Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: operator v2 (for Hubble control plane) #444

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ ALL_ARCH.windows = amd64
ENABLE_TLS ?= true
CERT_DIR := $(REPO_ROOT)/.certs

CERT_FILES := tls.crt:tls-client-cert-file \
tls.key:tls-client-key-file \
ca.crt:tls-ca-cert-files

# TAG is OS and platform agonstic, which can be used for binary version and image manifest tag,
# while RETINA_PLATFORM_TAG is platform specific, which can be used for image built for specific platforms.
RETINA_PLATFORM_TAG ?= $(TAG)-$(subst /,-,$(PLATFORM))
Expand Down Expand Up @@ -525,7 +529,8 @@ quick-deploy-hubble:
$(MAKE) helm-uninstall || true
$(MAKE) helm-install-without-tls HELM_IMAGE_TAG=$(TAG)-linux-amd64


.PHONY: simplify-dashboards
simplify-dashboards:
cd deploy/legacy/graphana/dashboards && go test . -tags=dashboard,simplifydashboard -v && cd $(REPO_ROOT)
cd deploy/legacy/grafana/dashboards && go test . -tags=dashboard,simplifydashboard -v && cd $(REPO_ROOT)

3 changes: 3 additions & 0 deletions deploy/hubble/grafana/dashboards/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# DAshboards

Dashboards here are a copy of dashboards in the Dashboard [https://msazure.visualstudio.com/One/_git/Azure-Observability-ECG-Grafana-DashboardAuthoring?path=/Azure%20Dashboards/Managed%20Prometheus/Network-Observability] Authoring Repo.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ spec:
image: {{ .Values.operator.repository }}:{{ .Values.operator.tag }}
imagePullPolicy: {{ .Values.operator.pullPolicy }}
name: retina-operator
{{- if .Values.operator.container.command }}
command:
{{- range .Values.operator.container.command }}
- {{ . }}
{{- end }}
{{- end }}
{{- if .Values.operator.container.args}}
args:
{{- range $.Values.operator.container.args}}
- {{ . | quote }}
{{- end}}
{{- end}}
env:
# this env var is used by retina OSS telemetry and zap
- name: POD_NAME
Expand Down
10 changes: 9 additions & 1 deletion deploy/hubble/manifests/controller/helm/retina/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ operator:
leaderElection: true
identityGCInterval: 15m # cilium default
endpointGCInterval: 5m # cilium default
container:
command:
- "/retina-operator"
args:
- "manage-cilium-crds"
- "--config-dir"
- "/retina"

agent:
leaderElection: false
Expand All @@ -32,7 +39,8 @@ agent:
init:
enabled: true
name: retina-agent-init
repository: acndev.azurecr.io/retina-agent-init
repository: ghcr.io/microsoft/retina/retina-init

tag: "latest"
pullPolicy: Always
container:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,20 @@ spec:
securityContext:
runAsNonRoot: true
containers:
- command:
- /retina-operator
image: {{ .Values.operator.repository }}:{{ .Values.operator.tag }}
- image: {{ .Values.operator.repository }}:{{ .Values.operator.tag }}
name: retina-operator
{{- if .Values.operator.container.command }}
command:
{{- range .Values.operator.container.command }}
- {{ . }}
{{- end }}
{{- end }}
{{- if .Values.operator.container.args}}
args:
{{- range $.Values.operator.container.args}}
- {{ . | quote }}
{{- end}}
{{- end}}
volumeMounts:
- name: retina-operator-config
mountPath: /retina/
Expand Down
6 changes: 6 additions & 0 deletions deploy/legacy/manifests/controller/helm/retina/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ operator:
requests:
cpu: 10m
memory: 128Mi
container:
command:
- "/retina-operator"
args:
- "--config"
- "/retina/operator-config.yaml"

image:
repository: ghcr.io/microsoft/retina/retina-agent
Expand Down
30 changes: 30 additions & 0 deletions get-certs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

set -euo pipefail
set -x

# Directory where certificates will be stored
CERT_DIR="$(pwd)/.certs"
mkdir -p "$CERT_DIR"

declare -A CERT_FILES=(
["tls.crt"]="tls-client-cert-file"
["tls.key"]="tls-client-key-file"
["ca.crt"]="tls-ca-cert-files"
)

for FILE in "${!CERT_FILES[@]}"; do
KEY="${CERT_FILES[$FILE]}"
JSONPATH="{.data['${FILE//./\\.}']}"

# Retrieve the secret and decode it
kubectl get secret hubble-relay-client-certs -n kube-system \
-o jsonpath="${JSONPATH}" | \
base64 -d > "$CERT_DIR/$FILE"

# Set the appropriate hubble CLI config
hubble config set "$KEY" "$CERT_DIR/$FILE"
done

hubble config set tls true
hubble config set tls-server-name instance.hubble-relay.cilium.io
64 changes: 64 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ module github.com/microsoft/retina
go 1.22.3

require (
github.com/go-chi/chi/v5 v5.1.0
github.com/go-chi/chi/v5 v5.1.0
github.com/google/uuid v1.6.0
github.com/prometheus/client_golang v1.19.1
github.com/spf13/cobra v1.8.1
go.uber.org/zap v1.27.0
go.uber.org/zap v1.27.0
k8s.io/client-go v0.30.1
)

Expand Down Expand Up @@ -37,6 +39,10 @@ require (
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.13 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.13 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.3 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.13 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.13 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.13 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3 // indirect
Expand All @@ -47,13 +53,25 @@ require (
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.30.1 // indirect
github.com/aws/smithy-go v1.20.3 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.13 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.15 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.15 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.13 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.22.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.30.1 // indirect
github.com/aws/smithy-go v1.20.3 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
github.com/cilium/dns v1.1.51-0.20231120140355-729345173dc3 // indirect
github.com/cilium/lumberjack/v2 v2.3.0 // indirect
github.com/cilium/stream v0.0.0-20240226091623-f979d32855f8 // indirect
github.com/cilium/dns v1.1.51-0.20231120140355-729345173dc3 // indirect
github.com/cilium/lumberjack/v2 v2.3.0 // indirect
github.com/cilium/stream v0.0.0-20240226091623-f979d32855f8 // indirect
github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa // indirect
github.com/containerd/cgroups/v3 v3.0.2 // indirect
github.com/containerd/containerd v1.7.14 // indirect
Expand All @@ -64,6 +82,7 @@ require (
github.com/containerd/ttrpc v1.2.3 // indirect
github.com/containerd/typeurl/v2 v2.1.1 // indirect
github.com/containernetworking/cni v1.1.2 // indirect
github.com/containernetworking/cni v1.1.2 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
Expand All @@ -80,13 +99,15 @@ require (
github.com/emicklei/go-restful/v3 v3.11.2 // indirect
github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/analysis v0.23.0 // indirect
github.com/go-openapi/errors v0.22.0 // indirect
Expand All @@ -98,6 +119,16 @@ require (
github.com/go-openapi/strfmt v0.23.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-openapi/validate v0.24.0 // indirect
github.com/go-openapi/analysis v0.23.0 // indirect
github.com/go-openapi/errors v0.22.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/loads v0.22.0 // indirect
github.com/go-openapi/runtime v0.28.0 // indirect
github.com/go-openapi/spec v0.21.0 // indirect
github.com/go-openapi/strfmt v0.23.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-openapi/validate v0.24.0 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
Expand All @@ -108,8 +139,10 @@ require (
github.com/google/btree v1.1.2 // indirect
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/google/gops v0.3.27 // indirect
github.com/google/gops v0.3.27 // indirect
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
github.com/google/renameio/v2 v2.0.0 // indirect
github.com/google/renameio/v2 v2.0.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
Expand All @@ -121,6 +154,7 @@ require (
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect
github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
Expand All @@ -141,6 +175,7 @@ require (
github.com/lib/pq v1.10.9 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mackerelio/go-osstat v0.2.4 // indirect
github.com/mackerelio/go-osstat v0.2.4 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
Expand Down Expand Up @@ -177,6 +212,7 @@ require (
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/rubenv/sql-migrate v1.5.2 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
Expand All @@ -188,21 +224,29 @@ require (
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spiffe/go-spiffe/v2 v2.1.7 // indirect
github.com/spiffe/spire-api-sdk v1.9.1 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
github.com/tidwall/gjson v1.17.1 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
github.com/tidwall/gjson v1.17.1 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
github.com/vishvananda/netns v0.0.4 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
github.com/zeebo/errs v1.3.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.12 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.12 // indirect
go.etcd.io/etcd/client/v3 v3.5.12 // indirect
go.mongodb.org/mongo-driver v1.14.0 // indirect
go.mongodb.org/mongo-driver v1.14.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.starlark.net v0.0.0-20230814145427-12f4cb8177e4 // indirect
Expand All @@ -217,6 +261,7 @@ require (
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
google.golang.org/grpc v1.62.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand All @@ -231,6 +276,7 @@ require (
require (
github.com/go-chi/chi v4.1.2+incompatible
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0
Expand All @@ -244,8 +290,10 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.7.0
golang.org/x/sys v0.22.0
golang.org/x/sys v0.22.0
golang.org/x/term v0.21.0 // indirect
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand All @@ -265,10 +313,12 @@ require (
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.12.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.8.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard v1.2.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.11.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v5 v5.2.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v5 v5.2.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2
github.com/Microsoft/hcsshim v0.12.0-rc.3
Expand All @@ -277,15 +327,22 @@ require (
github.com/aws/aws-sdk-go-v2/config v1.27.24
github.com/aws/aws-sdk-go-v2/credentials v1.17.24
github.com/aws/aws-sdk-go-v2/service/s3 v1.58.0
github.com/aws/aws-sdk-go-v2 v1.30.1
github.com/aws/aws-sdk-go-v2/config v1.27.24
github.com/aws/aws-sdk-go-v2/credentials v1.17.24
github.com/aws/aws-sdk-go-v2/service/s3 v1.58.0
github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5
github.com/cilium/cilium v1.16.0-pre.1.0.20240403152809-b9853ecbcaeb
github.com/cilium/cilium v1.16.0-pre.1.0.20240403152809-b9853ecbcaeb
github.com/cilium/ebpf v0.15.0
github.com/cilium/proxy v0.0.0-20231031145409-f19708f3d018
github.com/cilium/proxy v0.0.0-20231031145409-f19708f3d018
github.com/cilium/workerpool v1.2.0
github.com/florianl/go-tc v0.4.3
github.com/go-logr/zapr v1.3.0
github.com/google/gopacket v1.1.19
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/inspektor-gadget/inspektor-gadget v0.27.0
github.com/jellydator/ttlcache/v3 v3.1.1
github.com/jsternberg/zap-logfmt v1.3.0
Expand All @@ -296,15 +353,22 @@ require (
github.com/prometheus/client_model v0.6.1
github.com/prometheus/common v0.55.0
github.com/safchain/ethtool v0.4.1
github.com/prometheus/common v0.55.0
github.com/safchain/ethtool v0.4.1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/viper v1.19.0
github.com/vishvananda/netlink v1.2.1-beta.2.0.20240524165444-4d4ba1473f21
go.etcd.io/etcd v3.3.27+incompatible
go.opentelemetry.io/otel v1.28.0
go.opentelemetry.io/otel/metric v1.28.0
go.opentelemetry.io/otel/trace v1.28.0
go.etcd.io/etcd v3.3.27+incompatible
go.opentelemetry.io/otel v1.28.0
go.opentelemetry.io/otel/metric v1.28.0
go.opentelemetry.io/otel/trace v1.28.0
go.uber.org/mock v0.4.0
golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81
golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gotest.tools v2.2.0+incompatible
gotest.tools/v3 v3.5.1
Expand Down
Loading
Loading