From b7962ef7c3d8094b0991edd44d564e6b3cbf19cf Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Mon, 10 Jun 2024 10:21:24 +0200 Subject: [PATCH 01/16] CRD-based instrumentation, testing framework --- .gitignore | 11 + buildEnv/build.sh | 4 +- testWorkloads/dotnet/Makefile | 4 +- .../dotnet/MyFirstApp/d-myfirstapp.yaml | 5 +- webhook/Dockerfile | 24 + webhook/Makefile | 83 + .../ext.appd.com_clusterinstrumentations.yaml | 308 +++ .../ext.appd.com_globalinstrumentations.yaml | 308 +++ .../bases/ext.appd.com_instrumentations.yaml | 311 +++ .../ext.appd.com_opentelemetrycollectors.yaml | 2149 +++++++++++++++++ webhook/e2e-tests/dotnet/cm/pod-assert.yaml | 109 + webhook/e2e-tests/dotnet/cm/pod.yaml | 27 + .../dotnet/instr-otel/crd-otelcol.yaml | 48 + .../dotnet/instr-otel/instrumentation.yaml | 19 + webhook/e2e-tests/dotnet/instr-otel/pod.yaml | 27 + .../dotnet/instr/instrumentation.yaml | 18 + .../e2e-tests/dotnet/instr/pod-assert.yaml | 109 + webhook/e2e-tests/dotnet/instr/pod.yaml | 27 + .../e2e-tests/helmDefaultValues-template.yaml | 342 +++ webhook/e2e-tests/helmDefaultValues.yaml | 349 +++ webhook/e2e-tests/java/cm/pod-assert.yaml | 102 + webhook/e2e-tests/java/cm/pod.yaml | 25 + .../java/instr-otel/crd-otelcol.yaml | 48 + .../java/instr-otel/instrumentation.yaml | 20 + .../e2e-tests/java/instr-otel/pod-assert.yaml | 122 + webhook/e2e-tests/java/instr-otel/pod.yaml | 25 + .../e2e-tests/java/instr/instrumentation.yaml | 20 + webhook/e2e-tests/java/instr/pod-assert.yaml | 120 + webhook/e2e-tests/java/instr/pod.yaml | 25 + webhook/e2e-tests/secrets-sample.txt | 6 + webhook/examples/crd-cluster-instr.yaml | 18 + webhook/examples/crd-instr.yaml | 20 + webhook/examples/crd-otelcol.yaml | 48 + webhook/go.mod | 65 - webhook/go.sum | 553 ----- webhook/helm/Chart.yaml | 9 + webhook/helm/templates/_helpers.tpl | 14 + .../cm-webhook-instrumentor-config.yaml | 25 + .../templates/cr-webhook-instrumentor.yaml | 53 + .../templates/crb-webhook-instrumentor.yaml | 12 + .../templates/crd-instrumetation-config.yaml | 93 + .../templates/d-webhook-instrumentor.yaml | 50 + .../helm/templates/db-agent/d-db-agent.yaml | 47 + .../ext.appd.com_clusterinstrumentations.yaml | 308 +++ .../ext.appd.com_instrumentations.yaml | 311 +++ .../ext.appd.com_opentelemetrycollectors.yaml | 2149 +++++++++++++++++ .../otel/cm-otel-collector-config.yaml | 22 + .../otel/svc-d-otel-collector-service.yaml | 70 + .../templates/r-webhook-instrumentor.yaml | 26 + .../templates/rb-webhook-instrumentor.yaml | 12 + webhook/helm/templates/role.yaml | 19 + .../templates/sa-webhook-instrumentor.yaml | 5 + .../sec-and-mwhc-webhook-instrumentor.yaml | 140 ++ .../templates/svc-webhook-instrumentor.yaml | 33 + webhook/helm/values-sample-otel.yaml | 283 +++ webhook/helm/values-sample.yaml | 264 ++ webhook/instrumentTelescopeJava.go | 154 -- webhook/instrumentTelescopeNodeJS.go | 126 - webhook/license.txt | 13 + webhook/otelCollSidecar.go | 178 -- webhook/{ => pkg}/admission_controller.go | 4 +- webhook/{ => pkg}/configuration.go | 234 +- webhook/pkg/crdReconciler.go | 514 ++++ webhook/pkg/go.mod | 90 + webhook/pkg/go.sum | 247 ++ webhook/pkg/go.work | 6 + webhook/pkg/go.work.sum | 332 +++ webhook/{ => pkg}/instrument.go | 81 +- webhook/{ => pkg}/instrumentAppdApache.go | 8 +- webhook/{ => pkg}/instrumentAppdDotNet.go | 43 +- webhook/{ => pkg}/instrumentAppdJava.go | 28 +- webhook/{ => pkg}/instrumentAppdNodeJS.go | 11 +- webhook/{ => pkg}/instrumentOtelApache.go | 31 +- webhook/{ => pkg}/instrumentOtelDotNet.go | 16 +- webhook/{ => pkg}/instrumentOtelJava.go | 18 +- webhook/{ => pkg}/instrumentOtelNginx.go | 31 +- webhook/{ => pkg}/instrumentOtelNodeJS.go | 16 +- webhook/{ => pkg}/main.go | 103 +- webhook/{ => pkg}/match.go | 33 +- webhook/pkg/otelCollSidecar.go | 364 +++ webhook/pkg/t_driver_test.go | 1 + webhook/pkg/t_instrumentAppdJava_test.go | 112 + webhook/pkg/t_main_test.go | 125 + webhook/pkg/t_utils_test.go | 544 +++++ webhook/{ => pkg}/tracing.go | 0 webhook/pkg/v1alpha1/go.mod | 26 + webhook/pkg/v1alpha1/go.sum | 106 + webhook/pkg/v1alpha1/groupversion_info.go | 34 + webhook/pkg/v1alpha1/instrumentation_rule.go | 178 ++ webhook/pkg/v1alpha1/otel_collector.go | 133 + webhook/pkg/v1alpha1/zz_generated.deepcopy.go | 485 ++++ 91 files changed, 12560 insertions(+), 1309 deletions(-) create mode 100644 webhook/Dockerfile create mode 100644 webhook/Makefile create mode 100644 webhook/config/crd/bases/ext.appd.com_clusterinstrumentations.yaml create mode 100644 webhook/config/crd/bases/ext.appd.com_globalinstrumentations.yaml create mode 100644 webhook/config/crd/bases/ext.appd.com_instrumentations.yaml create mode 100644 webhook/config/crd/bases/ext.appd.com_opentelemetrycollectors.yaml create mode 100644 webhook/e2e-tests/dotnet/cm/pod-assert.yaml create mode 100644 webhook/e2e-tests/dotnet/cm/pod.yaml create mode 100644 webhook/e2e-tests/dotnet/instr-otel/crd-otelcol.yaml create mode 100644 webhook/e2e-tests/dotnet/instr-otel/instrumentation.yaml create mode 100644 webhook/e2e-tests/dotnet/instr-otel/pod.yaml create mode 100644 webhook/e2e-tests/dotnet/instr/instrumentation.yaml create mode 100644 webhook/e2e-tests/dotnet/instr/pod-assert.yaml create mode 100644 webhook/e2e-tests/dotnet/instr/pod.yaml create mode 100644 webhook/e2e-tests/helmDefaultValues-template.yaml create mode 100644 webhook/e2e-tests/helmDefaultValues.yaml create mode 100644 webhook/e2e-tests/java/cm/pod-assert.yaml create mode 100644 webhook/e2e-tests/java/cm/pod.yaml create mode 100644 webhook/e2e-tests/java/instr-otel/crd-otelcol.yaml create mode 100644 webhook/e2e-tests/java/instr-otel/instrumentation.yaml create mode 100644 webhook/e2e-tests/java/instr-otel/pod-assert.yaml create mode 100644 webhook/e2e-tests/java/instr-otel/pod.yaml create mode 100644 webhook/e2e-tests/java/instr/instrumentation.yaml create mode 100644 webhook/e2e-tests/java/instr/pod-assert.yaml create mode 100644 webhook/e2e-tests/java/instr/pod.yaml create mode 100644 webhook/e2e-tests/secrets-sample.txt create mode 100644 webhook/examples/crd-cluster-instr.yaml create mode 100644 webhook/examples/crd-instr.yaml create mode 100644 webhook/examples/crd-otelcol.yaml delete mode 100644 webhook/go.mod delete mode 100644 webhook/go.sum create mode 100644 webhook/helm/Chart.yaml create mode 100644 webhook/helm/templates/_helpers.tpl create mode 100644 webhook/helm/templates/cm-webhook-instrumentor-config.yaml create mode 100644 webhook/helm/templates/cr-webhook-instrumentor.yaml create mode 100644 webhook/helm/templates/crb-webhook-instrumentor.yaml create mode 100644 webhook/helm/templates/crd-instrumetation-config.yaml create mode 100644 webhook/helm/templates/d-webhook-instrumentor.yaml create mode 100644 webhook/helm/templates/db-agent/d-db-agent.yaml create mode 100644 webhook/helm/templates/ext.appd.com_clusterinstrumentations.yaml create mode 100644 webhook/helm/templates/ext.appd.com_instrumentations.yaml create mode 100644 webhook/helm/templates/ext.appd.com_opentelemetrycollectors.yaml create mode 100644 webhook/helm/templates/otel/cm-otel-collector-config.yaml create mode 100644 webhook/helm/templates/otel/svc-d-otel-collector-service.yaml create mode 100644 webhook/helm/templates/r-webhook-instrumentor.yaml create mode 100644 webhook/helm/templates/rb-webhook-instrumentor.yaml create mode 100644 webhook/helm/templates/role.yaml create mode 100644 webhook/helm/templates/sa-webhook-instrumentor.yaml create mode 100644 webhook/helm/templates/sec-and-mwhc-webhook-instrumentor.yaml create mode 100644 webhook/helm/templates/svc-webhook-instrumentor.yaml create mode 100644 webhook/helm/values-sample-otel.yaml create mode 100644 webhook/helm/values-sample.yaml delete mode 100644 webhook/instrumentTelescopeJava.go delete mode 100644 webhook/instrumentTelescopeNodeJS.go create mode 100644 webhook/license.txt delete mode 100644 webhook/otelCollSidecar.go rename webhook/{ => pkg}/admission_controller.go (99%) rename webhook/{ => pkg}/configuration.go (77%) create mode 100644 webhook/pkg/crdReconciler.go create mode 100644 webhook/pkg/go.mod create mode 100644 webhook/pkg/go.sum create mode 100644 webhook/pkg/go.work create mode 100644 webhook/pkg/go.work.sum rename webhook/{ => pkg}/instrument.go (84%) rename webhook/{ => pkg}/instrumentAppdApache.go (79%) rename webhook/{ => pkg}/instrumentAppdDotNet.go (67%) rename webhook/{ => pkg}/instrumentAppdJava.go (83%) rename webhook/{ => pkg}/instrumentAppdNodeJS.go (89%) rename webhook/{ => pkg}/instrumentOtelApache.go (86%) rename webhook/{ => pkg}/instrumentOtelDotNet.go (89%) rename webhook/{ => pkg}/instrumentOtelJava.go (83%) rename webhook/{ => pkg}/instrumentOtelNginx.go (85%) rename webhook/{ => pkg}/instrumentOtelNodeJS.go (83%) rename webhook/{ => pkg}/main.go (52%) rename webhook/{ => pkg}/match.go (72%) create mode 100644 webhook/pkg/otelCollSidecar.go create mode 100644 webhook/pkg/t_driver_test.go create mode 100644 webhook/pkg/t_instrumentAppdJava_test.go create mode 100644 webhook/pkg/t_main_test.go create mode 100644 webhook/pkg/t_utils_test.go rename webhook/{ => pkg}/tracing.go (100%) create mode 100644 webhook/pkg/v1alpha1/go.mod create mode 100644 webhook/pkg/v1alpha1/go.sum create mode 100644 webhook/pkg/v1alpha1/groupversion_info.go create mode 100644 webhook/pkg/v1alpha1/instrumentation_rule.go create mode 100644 webhook/pkg/v1alpha1/otel_collector.go create mode 100644 webhook/pkg/v1alpha1/zz_generated.deepcopy.go diff --git a/.gitignore b/.gitignore index 459a599..02bc342 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,14 @@ testWorkloads/nodejs/testserver/node_modules testWorkloads/customErrorPlugin/ testWorkloads/customErrorPlugin.zip testWorkloads/dotnet.zip +webhook/v1alpha1/bin/** +webhook/pkg/v1alpha1/bin/** +webhook/bin/** +webhook/env.sh +webhook/test.sh +webhook/examples/use-case-1-appd/** +webhook/e2e-tests/helmDefaultValues copy.yaml +webhook/e2e-tests/helmDefaultValuesTemp.yaml +webhook/e2e-tests/secrets.txt +webhook/e2e-tests/java/instr-otel/crd-otelcol_ori.yaml +webhook/kubeconfig diff --git a/buildEnv/build.sh b/buildEnv/build.sh index a92ea8f..06f72ec 100755 --- a/buildEnv/build.sh +++ b/buildEnv/build.sh @@ -2,7 +2,7 @@ cd .. -docker build -f buildEnv/Dockerfile . -t chrlic/appd-webhook-instrumentor:v1.0.6 +docker build -f buildEnv/Dockerfile . -t chrlic/appd-webhook-instrumentor:v1.0.6-crd -docker push chrlic/appd-webhook-instrumentor:v1.0.6 +docker push chrlic/appd-webhook-instrumentor:v1.0.6-crd diff --git a/testWorkloads/dotnet/Makefile b/testWorkloads/dotnet/Makefile index adcefee..116048b 100644 --- a/testWorkloads/dotnet/Makefile +++ b/testWorkloads/dotnet/Makefile @@ -3,9 +3,9 @@ images: docker push chrlic/sample-dotnet-app:latest deploy: - kubectl apply -f MyFirstApp/d-myfirstapp.yaml + kubectl -ndemo apply -f MyFirstApp/d-myfirstapp.yaml undeploy: - kubectl delete -f MyFirstApp/d-myfirstapp.yaml + kubectl -ndemo delete -f MyFirstApp/d-myfirstapp.yaml redeploy: undeploy deploy \ No newline at end of file diff --git a/testWorkloads/dotnet/MyFirstApp/d-myfirstapp.yaml b/testWorkloads/dotnet/MyFirstApp/d-myfirstapp.yaml index 0ac047c..ca2c42e 100644 --- a/testWorkloads/dotnet/MyFirstApp/d-myfirstapp.yaml +++ b/testWorkloads/dotnet/MyFirstApp/d-myfirstapp.yaml @@ -2,7 +2,6 @@ apiVersion: apps/v1 kind: Deployment metadata: - namespace: r name: myfirstapp spec: replicas: 1 @@ -17,8 +16,7 @@ spec: app: myfirstapp appdApp: MD-instr-wh appdInstr: do - # language: dotnetcore - language: uni + language: dotnetcore spec: containers: - name: myfirstapp @@ -47,7 +45,6 @@ spec: apiVersion: v1 kind: Service metadata: - namespace: r name: myfirstapp labels: run: myfirstapp diff --git a/webhook/Dockerfile b/webhook/Dockerfile new file mode 100644 index 0000000..174fdab --- /dev/null +++ b/webhook/Dockerfile @@ -0,0 +1,24 @@ +############################ +# STEP 1 build executable binary +############################ +FROM golang:1.22.1-alpine3.19 AS builder +# Install git. +# Git is required for fetching the dependencies. +RUN apk update && apk add --no-cache git +WORKDIR $GOPATH/src/webhook/ +COPY pkg . +# Fetch dependencies. +RUN go mod tidy +# Build the binary. +RUN GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o /go/bin/webhook + +############################ +# STEP 3 build a small image +############################ +FROM alpine:3.19 +# Copy our static executable. +COPY --from=builder /go/bin/webhook /go/bin/webhook + +EXPOSE 8443 + +CMD ["/go/bin/webhook"] \ No newline at end of file diff --git a/webhook/Makefile b/webhook/Makefile new file mode 100644 index 0000000..a55d290 --- /dev/null +++ b/webhook/Makefile @@ -0,0 +1,83 @@ +LOCALBIN ?= $(shell pwd)/bin +$(LOCALBIN): + mkdir -p $(LOCALBIN) + +CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen +CONTROLLER_TOOLS_VERSION ?= v0.14.0 +CRD_OPTIONS ?= "crd:generateEmbeddedObjectMeta=true" + +IMAGE_OWNER ?= chrlic +IMAGE_NAME ?= appd-webhook-instrumentor-ng +IMAGE_VERSION ?= 2.0.0 + +HELM_DEPLOYMENT_NAME ?= mwh +HELM_DEPLOYMENT_NAMESPACE ?= mwh +HELM_VALUES_FILE ?= values.yaml + +TEST_SECRETS = ../e2e-tests/secrets.txt +TEST_HELM_VALUES = ../e2e-tests/helmDefaultValues.yaml +TEST_HELM_VALUES_TEMP = ../e2e-tests/helmDefaultValuesTemp.yaml + +.PHONY: all +all: manifests api-docs + +.PHONY: controller-gen +controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. +$(CONTROLLER_GEN): $(LOCALBIN) + test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION) + +.PHONY: manifests +manifests: controller-gen + cd pkg && $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=appd-aac webhook paths="./..." output:crd:artifacts:config=../config/crd/bases + cd pkg && $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=appd-aac output:rbac:dir=../helm/templates paths="./..." output:crd:artifacts:config=../helm/templates object:headerFile=../license.txt + +.PHONY: images +images: + docker build . -t $(IMAGE_OWNER)/$(IMAGE_NAME):$(IMAGE_VERSION) + docker push $(IMAGE_OWNER)/$(IMAGE_NAME):$(IMAGE_VERSION) + +CRDOCBIN = $(shell pwd)/bin +CRDOC = $(shell pwd)/bin/crdoc +.PHONY: crdoc +crdoc: ## Download crdoc locally if necessary. + GOBIN=$(CRDOCBIN) go install fybrik.io/crdoc@latest + +HELM = "helm" +.PHONY: api-docs +api-docs: crdoc + @{ \ + set -e ;\ + TMP_DIR=$$(mktemp -d) ; \ + $(HELM) template test helm/. > $$TMP_DIR/crd-output.yaml;\ + $(CRDOC) --resources $$TMP_DIR/crd-output.yaml --output docs/api.md ;\ + } + +.PHONY: install +install: + cd helm && helm install --namespace $(HELM_DEPLOYMENT_NAMESPACE) $(HELM_DEPLOYMENT_NAME) . --values=$(HELM_VALUES_FILE) + +.PHONY: install-test +install-test: + cd helm && helm install --namespace $(HELM_DEPLOYMENT_NAMESPACE) $(HELM_DEPLOYMENT_NAME) . --values=$(TEST_HELM_VALUES_TEMP) + +.PHONY: remove +remove: + -cd helm && helm delete --namespace $(HELM_DEPLOYMENT_NAMESPACE) $(HELM_DEPLOYMENT_NAME) + +.PHONY: test +test: + cd pkg && TEST_SECRETS=$(TEST_SECRETS) TEST_HELM_VALUES=$(TEST_HELM_VALUES) TEST_HELM_VALUES_TEMP=$(TEST_HELM_VALUES_TEMP) go test *.go -v + +.PHONY: test-cleanup +test-cleanup: + -helm uninstall --namespace mwh mwh + -kubectl delete -f ./helm/templates/ext.appd.com_clusterinstrumentations.yaml + -kubectl delete -f ./helm/templates/ext.appd.com_instrumentations.yaml + -kubectl delete -f ./helm/templates/ext.appd.com_opentelemetrycollectors.yaml + -kubectl delete clusterrole webhook-instrumentor + -kubectl delete clusterrole appd-aac + -kubectl delete clusterrolebinding webhook-instrumentor + -kubectl delete MutatingWebhookConfiguration webhook-appd + +.PHONY: build-run +build-run: remove images install \ No newline at end of file diff --git a/webhook/config/crd/bases/ext.appd.com_clusterinstrumentations.yaml b/webhook/config/crd/bases/ext.appd.com_clusterinstrumentations.yaml new file mode 100644 index 0000000..5e3fa26 --- /dev/null +++ b/webhook/config/crd/bases/ext.appd.com_clusterinstrumentations.yaml @@ -0,0 +1,308 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: clusterinstrumentations.ext.appd.com +spec: + group: ext.appd.com + names: + kind: ClusterInstrumentation + listKind: ClusterInstrumentationList + plural: clusterinstrumentations + singular: clusterinstrumentation + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: Instrumentation defines how to inject agent into workload. + properties: + injectionRuleSet: + items: + properties: + applicationName: + type: string + applicationNameAnnotation: + type: string + applicationNameExpression: + type: string + applicationNameLabel: + type: string + applicationNameSource: + description: Source of AppDynamics application name + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + doNotInstrument: + type: boolean + env: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + image: + type: string + injectK8SOtelResourceAttrs: + type: boolean + javaCustomConfig: + type: string + javaEnvVar: + type: string + logLevel: + type: string + netvizPort: + type: string + openTelemetryCollector: + type: string + options: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + resourceReservation: + properties: + cpu: + description: CPU reservation value + type: string + memory: + description: Memory allocation reservation value + type: string + type: object + technology: + description: The programming language or solution to instrument + enum: + - java + - dotnetcore + - nodejs + - apache + - nginx + - java/appd + - dotnetcore/appd + - nodejs/appd + - apache/appd + - nginx/appd + - java/otel + - dotnetcore/otel + - nodejs/otel + - apache/otel + - nginx/otel + type: string + template: + type: string + tierName: + type: string + tierNameAnnotation: + type: string + tierNameExpression: + type: string + tierNameLabel: + type: string + tierNameSource: + description: Source of AppDynamics tier name + enum: + - auto + - manual + - label + - annotation + - namespace + type: string + usePodNameForNodeName: + type: boolean + type: object + type: array + injectionRules: + description: Injection rule specifies how the instrumentation should + be done + properties: + applicationName: + type: string + applicationNameAnnotation: + type: string + applicationNameExpression: + type: string + applicationNameLabel: + type: string + applicationNameSource: + description: Source of AppDynamics application name + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + doNotInstrument: + type: boolean + env: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + image: + type: string + injectK8SOtelResourceAttrs: + type: boolean + javaCustomConfig: + type: string + javaEnvVar: + type: string + logLevel: + type: string + netvizPort: + type: string + openTelemetryCollector: + type: string + options: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + resourceReservation: + properties: + cpu: + description: CPU reservation value + type: string + memory: + description: Memory allocation reservation value + type: string + type: object + technology: + description: The programming language or solution to instrument + enum: + - java + - dotnetcore + - nodejs + - apache + - nginx + - java/appd + - dotnetcore/appd + - nodejs/appd + - apache/appd + - nginx/appd + - java/otel + - dotnetcore/otel + - nodejs/otel + - apache/otel + - nginx/otel + type: string + template: + type: string + tierName: + type: string + tierNameAnnotation: + type: string + tierNameExpression: + type: string + tierNameLabel: + type: string + tierNameSource: + description: Source of AppDynamics tier name + enum: + - auto + - manual + - label + - annotation + - namespace + type: string + usePodNameForNodeName: + type: boolean + type: object + matchRules: + description: Match rule matches the workload for injection + properties: + annotations: + description: List of annotations and their regex values to match + items: + additionalProperties: + type: string + type: object + type: array + labels: + description: List of labels and their regex values to match + items: + additionalProperties: + type: string + type: object + type: array + namespaceRegex: + description: Regex by which to match namespace of the workload. + Used only for ClusterInstrumentation. + type: string + podNameRegex: + description: Regex to match names of pods + type: string + type: object + name: + type: string + priority: + default: 1 + description: Priority defines priority of this rule - 1 is lowest + type: integer + required: + - priority + type: object + status: + description: ClusterInstrumentationStatus defines status of the instrumentation. + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/webhook/config/crd/bases/ext.appd.com_globalinstrumentations.yaml b/webhook/config/crd/bases/ext.appd.com_globalinstrumentations.yaml new file mode 100644 index 0000000..5e79e46 --- /dev/null +++ b/webhook/config/crd/bases/ext.appd.com_globalinstrumentations.yaml @@ -0,0 +1,308 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: globalinstrumentations.ext.appd.com +spec: + group: ext.appd.com + names: + kind: GlobalInstrumentation + listKind: GlobalInstrumentationList + plural: globalinstrumentations + singular: globalinstrumentation + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: Instrumentation defines how to inject agent into workload. + properties: + injectionRuleSet: + items: + properties: + applicationName: + type: string + applicationNameAnnotation: + type: string + applicationNameExpression: + type: string + applicationNameLabel: + type: string + applicationNameSource: + description: Source of AppDynamics application name + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + doNotInstrument: + type: boolean + env: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + image: + type: string + injectK8SOtelResourceAttrs: + type: boolean + javaCustomConfig: + type: string + javaEnvVar: + type: string + logLevel: + type: string + netvizPort: + type: string + openTelemetryCollector: + type: string + options: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + resourceReservation: + properties: + cpu: + description: CPU reservation value + type: string + memory: + description: Memory allocation reservation value + type: string + type: object + technology: + description: The programming language or solution to instrument + enum: + - java + - dotnet + - nodejs + - apache + - nginx + - java/appd + - dotnet/appd + - nodejs/appd + - apache/appd + - nginx/appd + - java/otel + - dotnet/otel + - nodejs/otel + - apache/otel + - nginx/otel + type: string + template: + type: string + tierName: + type: string + tierNameAnnotation: + type: string + tierNameExpression: + type: string + tierNameLabel: + type: string + tierNameSource: + description: Source of AppDynamics tier name + enum: + - auto + - manual + - label + - annotation + - namespace + type: string + usePodNameForNodeName: + type: boolean + type: object + type: array + injectionRules: + description: Injection rule specifies how the instrumentation should + be done + properties: + applicationName: + type: string + applicationNameAnnotation: + type: string + applicationNameExpression: + type: string + applicationNameLabel: + type: string + applicationNameSource: + description: Source of AppDynamics application name + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + doNotInstrument: + type: boolean + env: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + image: + type: string + injectK8SOtelResourceAttrs: + type: boolean + javaCustomConfig: + type: string + javaEnvVar: + type: string + logLevel: + type: string + netvizPort: + type: string + openTelemetryCollector: + type: string + options: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + resourceReservation: + properties: + cpu: + description: CPU reservation value + type: string + memory: + description: Memory allocation reservation value + type: string + type: object + technology: + description: The programming language or solution to instrument + enum: + - java + - dotnet + - nodejs + - apache + - nginx + - java/appd + - dotnet/appd + - nodejs/appd + - apache/appd + - nginx/appd + - java/otel + - dotnet/otel + - nodejs/otel + - apache/otel + - nginx/otel + type: string + template: + type: string + tierName: + type: string + tierNameAnnotation: + type: string + tierNameExpression: + type: string + tierNameLabel: + type: string + tierNameSource: + description: Source of AppDynamics tier name + enum: + - auto + - manual + - label + - annotation + - namespace + type: string + usePodNameForNodeName: + type: boolean + type: object + matchRules: + description: Match rule matches the workload for injection + properties: + annotations: + description: List of annotations and their regex values to match + items: + additionalProperties: + type: string + type: object + type: array + labels: + description: List of labels and their regex values to match + items: + additionalProperties: + type: string + type: object + type: array + namespaceRegex: + description: Regex by which to match namespace of the workload. + Used only for GlobalInstrumentation. + type: string + podNameRegex: + description: Regex to match names of pods + type: string + type: object + name: + type: string + priority: + default: 1 + description: Priority defines priority of this rule - 1 is lowest + type: integer + required: + - priority + type: object + status: + description: GlobalInstrumentationStatus defines status of the instrumentation. + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/webhook/config/crd/bases/ext.appd.com_instrumentations.yaml b/webhook/config/crd/bases/ext.appd.com_instrumentations.yaml new file mode 100644 index 0000000..34dff7c --- /dev/null +++ b/webhook/config/crd/bases/ext.appd.com_instrumentations.yaml @@ -0,0 +1,311 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: instrumentations.ext.appd.com +spec: + group: ext.appd.com + names: + kind: Instrumentation + listKind: InstrumentationList + plural: instrumentations + shortNames: + - instr + - instrs + singular: instrumentation + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: Instrumentation defines how to inject agent into workload. + properties: + injectionRuleSet: + items: + properties: + applicationName: + type: string + applicationNameAnnotation: + type: string + applicationNameExpression: + type: string + applicationNameLabel: + type: string + applicationNameSource: + description: Source of AppDynamics application name + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + doNotInstrument: + type: boolean + env: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + image: + type: string + injectK8SOtelResourceAttrs: + type: boolean + javaCustomConfig: + type: string + javaEnvVar: + type: string + logLevel: + type: string + netvizPort: + type: string + openTelemetryCollector: + type: string + options: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + resourceReservation: + properties: + cpu: + description: CPU reservation value + type: string + memory: + description: Memory allocation reservation value + type: string + type: object + technology: + description: The programming language or solution to instrument + enum: + - java + - dotnetcore + - nodejs + - apache + - nginx + - java/appd + - dotnetcore/appd + - nodejs/appd + - apache/appd + - nginx/appd + - java/otel + - dotnetcore/otel + - nodejs/otel + - apache/otel + - nginx/otel + type: string + template: + type: string + tierName: + type: string + tierNameAnnotation: + type: string + tierNameExpression: + type: string + tierNameLabel: + type: string + tierNameSource: + description: Source of AppDynamics tier name + enum: + - auto + - manual + - label + - annotation + - namespace + type: string + usePodNameForNodeName: + type: boolean + type: object + type: array + injectionRules: + description: Injection rule specifies how the instrumentation should + be done + properties: + applicationName: + type: string + applicationNameAnnotation: + type: string + applicationNameExpression: + type: string + applicationNameLabel: + type: string + applicationNameSource: + description: Source of AppDynamics application name + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + doNotInstrument: + type: boolean + env: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + image: + type: string + injectK8SOtelResourceAttrs: + type: boolean + javaCustomConfig: + type: string + javaEnvVar: + type: string + logLevel: + type: string + netvizPort: + type: string + openTelemetryCollector: + type: string + options: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + resourceReservation: + properties: + cpu: + description: CPU reservation value + type: string + memory: + description: Memory allocation reservation value + type: string + type: object + technology: + description: The programming language or solution to instrument + enum: + - java + - dotnetcore + - nodejs + - apache + - nginx + - java/appd + - dotnetcore/appd + - nodejs/appd + - apache/appd + - nginx/appd + - java/otel + - dotnetcore/otel + - nodejs/otel + - apache/otel + - nginx/otel + type: string + template: + type: string + tierName: + type: string + tierNameAnnotation: + type: string + tierNameExpression: + type: string + tierNameLabel: + type: string + tierNameSource: + description: Source of AppDynamics tier name + enum: + - auto + - manual + - label + - annotation + - namespace + type: string + usePodNameForNodeName: + type: boolean + type: object + matchRules: + description: Match rule matches the workload for injection + properties: + annotations: + description: List of annotations and their regex values to match + items: + additionalProperties: + type: string + type: object + type: array + labels: + description: List of labels and their regex values to match + items: + additionalProperties: + type: string + type: object + type: array + namespaceRegex: + description: Regex by which to match namespace of the workload. + Used only for ClusterInstrumentation. + type: string + podNameRegex: + description: Regex to match names of pods + type: string + type: object + name: + type: string + priority: + default: 1 + description: Priority defines priority of this rule - 1 is lowest + type: integer + required: + - priority + type: object + status: + description: InstrumentationStatus defines status of the instrumentation. + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/webhook/config/crd/bases/ext.appd.com_opentelemetrycollectors.yaml b/webhook/config/crd/bases/ext.appd.com_opentelemetrycollectors.yaml new file mode 100644 index 0000000..1ee5eb7 --- /dev/null +++ b/webhook/config/crd/bases/ext.appd.com_opentelemetrycollectors.yaml @@ -0,0 +1,2149 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: opentelemetrycollectors.ext.appd.com +spec: + group: ext.appd.com + names: + kind: OpenTelemetryCollector + listKind: OpenTelemetryCollectorList + plural: opentelemetrycollectors + shortNames: + - otelcol + - otelcols + singular: opentelemetrycollector + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: Deployment Mode + jsonPath: .spec.mode + name: Mode + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: OpenTelemetryCollector is the Schema for the opentelemetrycollectors + API. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: OpenTelemetryCollectorSpec defines the desired state of OpenTelemetryCollector. + properties: + args: + additionalProperties: + type: string + description: Args is the set of arguments to pass to the main container's + binary. + type: object + config: + description: |- + Config is the raw JSON to be used as the collector's configuration. Refer to the OpenTelemetry Collector documentation for details. + The empty objects e.g. batch: should be written as batch: {} otherwise they won't work with kustomize or kubectl edit. + type: string + env: + description: Environment variables to set on the generated pods. + items: + description: EnvVar represents an environment variable present in + a Container. + properties: + name: + description: Name of the environment variable. Must be a C_IDENTIFIER. + type: string + value: + description: |- + Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in the container and + any service environment variables. If a variable cannot be resolved, + the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether the variable + exists or not. + Defaults to "". + type: string + valueFrom: + description: Source for the environment variable's value. Cannot + be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + optional: + description: Specify whether the ConfigMap or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: |- + Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, + spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. + properties: + apiVersion: + description: Version of the schema the FieldPath is + written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the specified + API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the exposed + resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in the pod's namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + optional: + description: Specify whether the Secret or its key must + be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + description: List of sources to populate environment variables on + the generated pods. + items: + description: EnvFromSource represents the source of a set of ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + optional: + description: Specify whether the ConfigMap must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend to each key in + the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + optional: + description: Specify whether the Secret must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + description: Image indicates the container image to use for the generated + pods. + type: string + imagePullPolicy: + description: ImagePullPolicy indicates the pull policy to be used + for retrieving the container image. + type: string + mode: + allOf: + - enum: + - deployment + - sidecar + - enum: + - deployment + - sidecar + - external + description: Mode represents how the collector should be deployed + (deployment or sidecar) + type: string + otlpEndpoint: + description: |- + OtlpEndpoint is the hostname of an OpenTelemetry collector running independently from the instrumentor tool. + Used only for Mode == ModeExternal + type: string + ports: + description: |- + Ports allows a set of ports to be exposed by the underlying v1.Service. By default, the operator + will attempt to infer the required ports by parsing the .Spec.Config property but this property can be + used to open additional ports that can't be inferred by the operator, like for custom receivers. + items: + description: ServicePort contains information on service's port. + properties: + appProtocol: + description: |- + The application protocol for this port. + This is used as a hint for implementations to offer richer behavior for protocols that they understand. + This field follows standard Kubernetes label syntax. + Valid values are either: + + + * Un-prefixed protocol names - reserved for IANA standard service names (as per + RFC-6335 and https://www.iana.org/assignments/service-names). + + + * Kubernetes-defined prefixed names: + * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- + * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 + * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 + + + * Other protocols should use implementation-defined prefixed names such as + mycompany.com/my-custom-protocol. + type: string + name: + description: |- + The name of this port within the service. This must be a DNS_LABEL. + All ports within a ServiceSpec must have unique names. When considering + the endpoints for a Service, this must match the 'name' field in the + EndpointPort. + Optional if only one ServicePort is defined on this service. + type: string + nodePort: + description: |- + The port on each node on which this service is exposed when type is + NodePort or LoadBalancer. Usually assigned by the system. If a value is + specified, in-range, and not in use it will be used, otherwise the + operation will fail. If not specified, a port will be allocated if this + Service requires one. If this field is specified when creating a + Service which does not need it, creation will fail. This field will be + wiped when updating a Service to no longer need it (e.g. changing type + from NodePort to ClusterIP). + More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + format: int32 + type: integer + port: + description: The port that will be exposed by this service. + format: int32 + type: integer + protocol: + default: TCP + description: |- + The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". + Default is TCP. + type: string + targetPort: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the pods targeted by the service. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. + If this is a string, it will be looked up as a named port in the + target Pod's container ports. If this is not specified, the value + of the 'port' field is used (an identity map). + This field is ignored for services with clusterIP=None, and should be + omitted or set equal to the 'port' field. + More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service + x-kubernetes-int-or-string: true + required: + - port + type: object + type: array + x-kubernetes-list-type: atomic + replicas: + description: Replicas is the number of pod instances for the underlying + replicaset. Set this if you are not using autoscaling. + format: int32 + type: integer + resources: + description: Resources to set on generated pods. + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + serviceAccount: + description: |- + ServiceAccount indicates the name of an existing service account to use with this instance. When set, + the operator will not automatically create a ServiceAccount. + type: string + volumeMounts: + description: VolumeMounts represents the mount points to use in the + underlying deployment(s). + items: + description: VolumeMount describes a mounting of a Volume within + a container. + properties: + mountPath: + description: |- + Path within the container at which the volume should be mounted. Must + not contain ':'. + type: string + mountPropagation: + description: |- + mountPropagation determines how mounts are propagated from the host + to container and the other way around. + When not set, MountPropagationNone is used. + This field is beta in 1.10. + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: |- + Mounted read-only if true, read-write otherwise (false or unspecified). + Defaults to false. + type: boolean + subPath: + description: |- + Path within the volume from which the container's volume should be mounted. + Defaults to "" (volume's root). + type: string + subPathExpr: + description: |- + Expanded path within the volume from which the container's volume should be mounted. + Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. + Defaults to "" (volume's root). + SubPathExpr and SubPath are mutually exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + x-kubernetes-list-type: atomic + volumes: + description: Volumes represents which volumes to use in the underlying + deployment(s). + items: + description: Volume represents a named volume in a pod that may + be accessed by any container in the pod. + properties: + awsElasticBlockStore: + description: |- + awsElasticBlockStore represents an AWS Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + properties: + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + TODO: how do we prevent errors in the filesystem from compromising the machine + type: string + partition: + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + format: int32 + type: integer + readOnly: + description: |- + readOnly value true will force the readOnly setting in VolumeMounts. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: boolean + volumeID: + description: |- + volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: string + required: + - volumeID + type: object + azureDisk: + description: azureDisk represents an Azure Data Disk mount on + the host and bind mount to the pod. + properties: + cachingMode: + description: 'cachingMode is the Host Caching mode: None, + Read Only, Read Write.' + type: string + diskName: + description: diskName is the Name of the data disk in the + blob storage + type: string + diskURI: + description: diskURI is the URI of data disk in the blob + storage + type: string + fsType: + description: |- + fsType is Filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + kind: + description: 'kind expected values are Shared: multiple + blob disks per storage account Dedicated: single blob + disk per storage account Managed: azure managed data + disk (only in managed availability set). defaults to shared' + type: string + readOnly: + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + description: azureFile represents an Azure File Service mount + on the host and bind mount to the pod. + properties: + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretName: + description: secretName is the name of secret that contains + Azure Storage Account Name and Key + type: string + shareName: + description: shareName is the azure share Name + type: string + required: + - secretName + - shareName + type: object + cephfs: + description: cephFS represents a Ceph FS mount on the host that + shares a pod's lifetime + properties: + monitors: + description: |- + monitors is Required: Monitors is a collection of Ceph monitors + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + items: + type: string + type: array + path: + description: 'path is Optional: Used as the mounted root, + rather than the full Ceph tree, default is /' + type: string + readOnly: + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: boolean + secretFile: + description: |- + secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: string + secretRef: + description: |- + secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + user: + description: |- + user is optional: User is the rados user name, default is admin + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: string + required: + - monitors + type: object + cinder: + description: |- + cinder represents a cinder volume attached and mounted on kubelets host machine. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: boolean + secretRef: + description: |- + secretRef is optional: points to a secret object containing parameters used to connect + to OpenStack. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + volumeID: + description: |- + volumeID used to identify the volume in cinder. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: string + required: + - volumeID + type: object + configMap: + description: configMap represents a configMap that should populate + this volume + properties: + defaultMode: + description: |- + defaultMode is optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + optional: + description: optional specify whether the ConfigMap or its + keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + csi: + description: csi (Container Storage Interface) represents ephemeral + storage that is handled by certain external CSI drivers (Beta + feature). + properties: + driver: + description: |- + driver is the name of the CSI driver that handles this volume. + Consult with your admin for the correct name as registered in the cluster. + type: string + fsType: + description: |- + fsType to mount. Ex. "ext4", "xfs", "ntfs". + If not provided, the empty value is passed to the associated CSI driver + which will determine the default filesystem to apply. + type: string + nodePublishSecretRef: + description: |- + nodePublishSecretRef is a reference to the secret object containing + sensitive information to pass to the CSI driver to complete the CSI + NodePublishVolume and NodeUnpublishVolume calls. + This field is optional, and may be empty if no secret is required. If the + secret object contains more than one secret, all secret references are passed. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + readOnly: + description: |- + readOnly specifies a read-only configuration for the volume. + Defaults to false (read/write). + type: boolean + volumeAttributes: + additionalProperties: + type: string + description: |- + volumeAttributes stores driver-specific properties that are passed to the CSI + driver. Consult your driver's documentation for supported values. + type: object + required: + - driver + type: object + downwardAPI: + description: downwardAPI represents downward API about the pod + that should populate this volume + properties: + defaultMode: + description: |- + Optional: mode bits to use on created files by default. Must be a + Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: Items is a list of downward API volume file + items: + description: DownwardAPIVolumeFile represents information + to create the file containing the pod field + properties: + fieldRef: + description: 'Required: Selects a field of the pod: + only annotations, labels, name and namespace are + supported.' + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the + specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: 'Required: Path is the relative path + name of the file to be created. Must not be absolute + or contain the ''..'' path. Must be utf-8 encoded. + The first item of the relative path must not start + with ''..''' + type: string + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the + exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + emptyDir: + description: |- + emptyDir represents a temporary directory that shares a pod's lifetime. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + properties: + medium: + description: |- + medium represents what type of storage medium should back this directory. + The default is "" which means to use the node's default medium. + Must be an empty string (default) or Memory. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + description: |- + sizeLimit is the total amount of local storage required for this EmptyDir volume. + The size limit is also applicable for memory medium. + The maximum usage on memory medium EmptyDir would be the minimum value between + the SizeLimit specified here and the sum of memory limits of all containers in a pod. + The default is nil which means that the limit is undefined. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + ephemeral: + description: |- + ephemeral represents a volume that is handled by a cluster storage driver. + The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, + and deleted when the pod is removed. + + + Use this if: + a) the volume is only needed while the pod runs, + b) features of normal volumes like restoring from snapshot or capacity + tracking are needed, + c) the storage driver is specified through a storage class, and + d) the storage driver supports dynamic volume provisioning through + a PersistentVolumeClaim (see EphemeralVolumeSource for more + information on the connection between this volume type + and PersistentVolumeClaim). + + + Use PersistentVolumeClaim or one of the vendor-specific + APIs for volumes that persist for longer than the lifecycle + of an individual pod. + + + Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to + be used that way - see the documentation of the driver for + more information. + + + A pod can use both types of ephemeral volumes and + persistent volumes at the same time. + properties: + volumeClaimTemplate: + description: |- + Will be used to create a stand-alone PVC to provision the volume. + The pod in which this EphemeralVolumeSource is embedded will be the + owner of the PVC, i.e. the PVC will be deleted together with the + pod. The name of the PVC will be `-` where + `` is the name from the `PodSpec.Volumes` array + entry. Pod validation will reject the pod if the concatenated name + is not valid for a PVC (for example, too long). + + + An existing PVC with that name that is not owned by the pod + will *not* be used for the pod to avoid using an unrelated + volume by mistake. Starting the pod is then blocked until + the unrelated PVC is removed. If such a pre-created PVC is + meant to be used by the pod, the PVC has to updated with an + owner reference to the pod once the pod exists. Normally + this should not be necessary, but it may be useful when + manually reconstructing a broken cluster. + + + This field is read-only and no changes will be made by Kubernetes + to the PVC after it has been created. + + + Required, must not be nil. + properties: + metadata: + description: |- + May contain labels and annotations that will be copied into the PVC + when creating it. No other fields are allowed and will be rejected during + validation. + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + spec: + description: |- + The specification for the PersistentVolumeClaim. The entire content is + copied unchanged into the PVC that gets created from this + template. The same fields as in a PersistentVolumeClaim + are also valid here. + properties: + accessModes: + description: |- + accessModes contains the desired access modes the volume should have. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 + items: + type: string + type: array + dataSource: + description: |- + dataSource field can be used to specify either: + * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller can support the specified data source, + it will create a new volume based on the contents of the specified data source. + When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, + and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not be copied to dataSource. + properties: + apiGroup: + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being + referenced + type: string + name: + description: Name is the name of resource being + referenced + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + description: |- + dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + volume is desired. This may be any object from a non-empty API group (non + core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed if the type of + the specified object matches some installed volume populator or dynamic + provisioner. + This field will replace the functionality of the dataSource field and as such + if both fields are non-empty, they must have the same value. For backwards + compatibility, when namespace isn't specified in dataSourceRef, + both fields (dataSource and dataSourceRef) will be set to the same + value automatically if one of them is empty and the other is non-empty. + When namespace is specified in dataSourceRef, + dataSource isn't set to the same value and must be empty. + There are three important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, dataSourceRef + allows any non-core object, as well as PersistentVolumeClaim objects. + * While dataSource ignores disallowed values (dropping them), dataSourceRef + preserves all values, and generates an error if a disallowed value is + specified. + * While dataSource only allows local objects, dataSourceRef allows objects + in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + properties: + apiGroup: + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being + referenced + type: string + name: + description: Name is the name of resource being + referenced + type: string + namespace: + description: |- + Namespace is the namespace of resource being referenced + Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + type: string + required: + - kind + - name + type: object + resources: + description: |- + resources represents the minimum resources the volume should have. + If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements + that are lower than previous value but must still be higher than capacity recorded in the + status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + selector: + description: selector is a label query over volumes + to consider for binding. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + description: |- + storageClassName is the name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 + type: string + volumeAttributesClassName: + description: |- + volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. + If specified, the CSI driver will create or update the volume with the attributes defined + in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, + it can be changed after the claim is created. An empty string value means that no VolumeAttributesClass + will be applied to the claim but it's not allowed to reset this field to empty string once it is set. + If unspecified and the PersistentVolumeClaim is unbound, the default VolumeAttributesClass + will be set by the persistentvolume controller if it exists. + If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be + set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource + exists. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass + (Alpha) Using this field requires the VolumeAttributesClass feature gate to be enabled. + type: string + volumeMode: + description: |- + volumeMode defines what type of volume is required by the claim. + Value of Filesystem is implied when not included in claim spec. + type: string + volumeName: + description: volumeName is the binding reference + to the PersistentVolume backing this claim. + type: string + type: object + required: + - spec + type: object + type: object + fc: + description: fc represents a Fibre Channel resource that is + attached to a kubelet's host machine and then exposed to the + pod. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + TODO: how do we prevent errors in the filesystem from compromising the machine + type: string + lun: + description: 'lun is Optional: FC target lun number' + format: int32 + type: integer + readOnly: + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + targetWWNs: + description: 'targetWWNs is Optional: FC target worldwide + names (WWNs)' + items: + type: string + type: array + wwids: + description: |- + wwids Optional: FC volume world wide identifiers (wwids) + Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. + items: + type: string + type: array + type: object + flexVolume: + description: |- + flexVolume represents a generic volume resource that is + provisioned/attached using an exec based plugin. + properties: + driver: + description: driver is the name of the driver to use for + this volume. + type: string + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + type: string + options: + additionalProperties: + type: string + description: 'options is Optional: this field holds extra + command options if any.' + type: object + readOnly: + description: |- + readOnly is Optional: defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef is Optional: secretRef is reference to the secret object containing + sensitive information to pass to the plugin scripts. This may be + empty if no secret object is specified. If the secret object + contains more than one secret, all secrets are passed to the plugin + scripts. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + required: + - driver + type: object + flocker: + description: flocker represents a Flocker volume attached to + a kubelet's host machine. This depends on the Flocker control + service being running + properties: + datasetName: + description: |- + datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker + should be considered as deprecated + type: string + datasetUUID: + description: datasetUUID is the UUID of the dataset. This + is unique identifier of a Flocker dataset + type: string + type: object + gcePersistentDisk: + description: |- + gcePersistentDisk represents a GCE Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + properties: + fsType: + description: |- + fsType is filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + TODO: how do we prevent errors in the filesystem from compromising the machine + type: string + partition: + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + format: int32 + type: integer + pdName: + description: |- + pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: string + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: boolean + required: + - pdName + type: object + gitRepo: + description: |- + gitRepo represents a git repository at a particular revision. + DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an + EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir + into the Pod's container. + properties: + directory: + description: |- + directory is the target directory name. + Must not contain or start with '..'. If '.' is supplied, the volume directory will be the + git repository. Otherwise, if specified, the volume will contain the git repository in + the subdirectory with the given name. + type: string + repository: + description: repository is the URL + type: string + revision: + description: revision is the commit hash for the specified + revision. + type: string + required: + - repository + type: object + glusterfs: + description: |- + glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/glusterfs/README.md + properties: + endpoints: + description: |- + endpoints is the endpoint name that details Glusterfs topology. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: string + path: + description: |- + path is the Glusterfs volume path. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: string + readOnly: + description: |- + readOnly here will force the Glusterfs volume to be mounted with read-only permissions. + Defaults to false. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: boolean + required: + - endpoints + - path + type: object + hostPath: + description: |- + hostPath represents a pre-existing file or directory on the host + machine that is directly exposed to the container. This is generally + used for system agents or other privileged things that are allowed + to see the host machine. Most containers will NOT need this. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + --- + TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not + mount host directories as read/write. + properties: + path: + description: |- + path of the directory on the host. + If the path is a symlink, it will follow the link to the real path. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + type: string + type: + description: |- + type for HostPath Volume + Defaults to "" + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + type: string + required: + - path + type: object + iscsi: + description: |- + iscsi represents an ISCSI Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://examples.k8s.io/volumes/iscsi/README.md + properties: + chapAuthDiscovery: + description: chapAuthDiscovery defines whether support iSCSI + Discovery CHAP authentication + type: boolean + chapAuthSession: + description: chapAuthSession defines whether support iSCSI + Session CHAP authentication + type: boolean + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi + TODO: how do we prevent errors in the filesystem from compromising the machine + type: string + initiatorName: + description: |- + initiatorName is the custom iSCSI Initiator Name. + If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface + : will be created for the connection. + type: string + iqn: + description: iqn is the target iSCSI Qualified Name. + type: string + iscsiInterface: + description: |- + iscsiInterface is the interface Name that uses an iSCSI transport. + Defaults to 'default' (tcp). + type: string + lun: + description: lun represents iSCSI Target Lun number. + format: int32 + type: integer + portals: + description: |- + portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). + items: + type: string + type: array + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + type: boolean + secretRef: + description: secretRef is the CHAP Secret for iSCSI target + and initiator authentication + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + targetPortal: + description: |- + targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + description: |- + name of the volume. + Must be a DNS_LABEL and unique within the pod. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + nfs: + description: |- + nfs represents an NFS mount on the host that shares a pod's lifetime + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + properties: + path: + description: |- + path that is exported by the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: string + readOnly: + description: |- + readOnly here will force the NFS export to be mounted with read-only permissions. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: boolean + server: + description: |- + server is the hostname or IP address of the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + description: |- + persistentVolumeClaimVolumeSource represents a reference to a + PersistentVolumeClaim in the same namespace. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + properties: + claimName: + description: |- + claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + type: string + readOnly: + description: |- + readOnly Will force the ReadOnly setting in VolumeMounts. + Default false. + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + description: photonPersistentDisk represents a PhotonController + persistent disk attached and mounted on kubelets host machine + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + pdID: + description: pdID is the ID that identifies Photon Controller + persistent disk + type: string + required: + - pdID + type: object + portworxVolume: + description: portworxVolume represents a portworx volume attached + and mounted on kubelets host machine + properties: + fsType: + description: |- + fSType represents the filesystem type to mount + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + volumeID: + description: volumeID uniquely identifies a Portworx volume + type: string + required: + - volumeID + type: object + projected: + description: projected items for all in one resources secrets, + configmaps, and downward API + properties: + defaultMode: + description: |- + defaultMode are the mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + sources: + description: sources is the list of volume projections + items: + description: Projection that may be projected along with + other supported volume types + properties: + clusterTrustBundle: + description: |- + ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field + of ClusterTrustBundle objects in an auto-updating file. + + + Alpha, gated by the ClusterTrustBundleProjection feature gate. + + + ClusterTrustBundle objects can either be selected by name, or by the + combination of signer name and a label selector. + + + Kubelet performs aggressive normalization of the PEM contents written + into the pod filesystem. Esoteric PEM features such as inter-block + comments and block headers are stripped. Certificates are deduplicated. + The ordering of certificates within the file is arbitrary, and Kubelet + may change the order over time. + properties: + labelSelector: + description: |- + Select all ClusterTrustBundles that match this label selector. Only has + effect if signerName is set. Mutually-exclusive with name. If unset, + interpreted as "match nothing". If set but empty, interpreted as "match + everything". + properties: + matchExpressions: + description: matchExpressions is a list of + label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + name: + description: |- + Select a single ClusterTrustBundle by object name. Mutually-exclusive + with signerName and labelSelector. + type: string + optional: + description: |- + If true, don't block pod startup if the referenced ClusterTrustBundle(s) + aren't available. If using name, then the named ClusterTrustBundle is + allowed not to exist. If using signerName, then the combination of + signerName and labelSelector is allowed to match zero + ClusterTrustBundles. + type: boolean + path: + description: Relative path from the volume root + to write the bundle. + type: string + signerName: + description: |- + Select all ClusterTrustBundles that match this signer name. + Mutually-exclusive with name. The contents of all selected + ClusterTrustBundles will be unified and deduplicated. + type: string + required: + - path + type: object + configMap: + description: configMap information about the configMap + data to project + properties: + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within + a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + optional: + description: optional specify whether the ConfigMap + or its keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + downwardAPI: + description: downwardAPI information about the downwardAPI + data to project + properties: + items: + description: Items is a list of DownwardAPIVolume + file + items: + description: DownwardAPIVolumeFile represents + information to create the file containing + the pod field + properties: + fieldRef: + description: 'Required: Selects a field + of the pod: only annotations, labels, + name and namespace are supported.' + properties: + apiVersion: + description: Version of the schema the + FieldPath is written in terms of, + defaults to "v1". + type: string + fieldPath: + description: Path of the field to select + in the specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: 'Required: Path is the relative + path name of the file to be created. Must + not be absolute or contain the ''..'' + path. Must be utf-8 encoded. The first + item of the relative path must not start + with ''..''' + type: string + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + properties: + containerName: + description: 'Container name: required + for volumes, optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format + of the exposed resources, defaults + to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to + select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + description: secret information about the secret data + to project + properties: + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within + a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + optional: + description: optional field specify whether the + Secret or its key must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + serviceAccountToken: + description: serviceAccountToken is information about + the serviceAccountToken data to project + properties: + audience: + description: |- + audience is the intended audience of the token. A recipient of a token + must identify itself with an identifier specified in the audience of the + token, and otherwise should reject the token. The audience defaults to the + identifier of the apiserver. + type: string + expirationSeconds: + description: |- + expirationSeconds is the requested duration of validity of the service + account token. As the token approaches expiration, the kubelet volume + plugin will proactively rotate the service account token. The kubelet will + start trying to rotate the token if the token is older than 80 percent of + its time to live or if the token is older than 24 hours.Defaults to 1 hour + and must be at least 10 minutes. + format: int64 + type: integer + path: + description: |- + path is the path relative to the mount point of the file to project the + token into. + type: string + required: + - path + type: object + type: object + type: array + type: object + quobyte: + description: quobyte represents a Quobyte mount on the host + that shares a pod's lifetime + properties: + group: + description: |- + group to map volume access to + Default is no group + type: string + readOnly: + description: |- + readOnly here will force the Quobyte volume to be mounted with read-only permissions. + Defaults to false. + type: boolean + registry: + description: |- + registry represents a single or multiple Quobyte Registry services + specified as a string as host:port pair (multiple entries are separated with commas) + which acts as the central registry for volumes + type: string + tenant: + description: |- + tenant owning the given Quobyte volume in the Backend + Used with dynamically provisioned Quobyte volumes, value is set by the plugin + type: string + user: + description: |- + user to map volume access to + Defaults to serivceaccount user + type: string + volume: + description: volume is a string that references an already + created Quobyte volume by name. + type: string + required: + - registry + - volume + type: object + rbd: + description: |- + rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/rbd/README.md + properties: + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd + TODO: how do we prevent errors in the filesystem from compromising the machine + type: string + image: + description: |- + image is the rados image name. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + keyring: + description: |- + keyring is the path to key ring for RBDUser. + Default is /etc/ceph/keyring. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + monitors: + description: |- + monitors is a collection of Ceph monitors. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + items: + type: string + type: array + pool: + description: |- + pool is the rados pool name. + Default is rbd. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: boolean + secretRef: + description: |- + secretRef is name of the authentication secret for RBDUser. If provided + overrides keyring. + Default is nil. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + user: + description: |- + user is the rados user name. + Default is admin. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + required: + - image + - monitors + type: object + scaleIO: + description: scaleIO represents a ScaleIO persistent volume + attached and mounted on Kubernetes nodes. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". + Default is "xfs". + type: string + gateway: + description: gateway is the host address of the ScaleIO + API Gateway. + type: string + protectionDomain: + description: protectionDomain is the name of the ScaleIO + Protection Domain for the configured storage. + type: string + readOnly: + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef references to the secret for ScaleIO user and other + sensitive information. If this is not provided, Login operation will fail. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + sslEnabled: + description: sslEnabled Flag enable/disable SSL communication + with Gateway, default false + type: boolean + storageMode: + description: |- + storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. + Default is ThinProvisioned. + type: string + storagePool: + description: storagePool is the ScaleIO Storage Pool associated + with the protection domain. + type: string + system: + description: system is the name of the storage system as + configured in ScaleIO. + type: string + volumeName: + description: |- + volumeName is the name of a volume already created in the ScaleIO system + that is associated with this volume source. + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + description: |- + secret represents a secret that should populate this volume. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + properties: + defaultMode: + description: |- + defaultMode is Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values + for mode bits. Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: |- + items If unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + optional: + description: optional field specify whether the Secret or + its keys must be defined + type: boolean + secretName: + description: |- + secretName is the name of the secret in the pod's namespace to use. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + type: string + type: object + storageos: + description: storageOS represents a StorageOS volume attached + and mounted on Kubernetes nodes. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef specifies the secret to use for obtaining the StorageOS API + credentials. If not specified, default values will be attempted. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + volumeName: + description: |- + volumeName is the human-readable name of the StorageOS volume. Volume + names are only unique within a namespace. + type: string + volumeNamespace: + description: |- + volumeNamespace specifies the scope of the volume within StorageOS. If no + namespace is specified then the Pod's namespace will be used. This allows the + Kubernetes name scoping to be mirrored within StorageOS for tighter integration. + Set VolumeName to any name to override the default behaviour. + Set to "default" if you are not using namespaces within StorageOS. + Namespaces that do not pre-exist within StorageOS will be created. + type: string + type: object + vsphereVolume: + description: vsphereVolume represents a vSphere volume attached + and mounted on kubelets host machine + properties: + fsType: + description: |- + fsType is filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + storagePolicyID: + description: storagePolicyID is the storage Policy Based + Management (SPBM) profile ID associated with the StoragePolicyName. + type: string + storagePolicyName: + description: storagePolicyName is the storage Policy Based + Management (SPBM) profile name. + type: string + volumePath: + description: volumePath is the path that identifies vSphere + volume vmdk + type: string + required: + - volumePath + type: object + required: + - name + type: object + type: array + x-kubernetes-list-type: atomic + required: + - config + type: object + status: + description: OpenTelemetryCollectorStatus defines the observed state of + OpenTelemetryCollector. + type: object + type: object + served: true + storage: true + subresources: + scale: + labelSelectorPath: .status.scale.selector + specReplicasPath: .spec.replicas + statusReplicasPath: .status.scale.replicas + status: {} diff --git a/webhook/e2e-tests/dotnet/cm/pod-assert.yaml b/webhook/e2e-tests/dotnet/cm/pod-assert.yaml new file mode 100644 index 0000000..bc79daa --- /dev/null +++ b/webhook/e2e-tests/dotnet/cm/pod-assert.yaml @@ -0,0 +1,109 @@ +apiVersion: v1 +kind: Pod +metadata: + annotations: + APPD_INSTRUMENTATION_VIA_RULE: dotnet + test: testval + labels: + app: myfirstapp + appdApp: MD-instr-wh + appdInstr: do + language: dotnetcore + name: dotnetapp +spec: + containers: + - env: + - name: APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY + value: "<>" + - name: APPDYNAMICS_CONTROLLER_HOST_NAME + value: "<>" + - name: APPDYNAMICS_CONTROLLER_PORT + value: "<>" + - name: APPDYNAMICS_CONTROLLER_SSL_ENABLED + value: "true" + - name: APPDYNAMICS_AGENT_ACCOUNT_NAME + value: "<>" + - name: LD_LIBRARY_PATH + value: /opt/appdynamics-dotnetcore + - name: CORECLR_PROFILER + value: '{57e1aa68-2229-41aa-9931-a6e93bbc64d8}' + - name: CORECLR_PROFILER_PATH + value: /opt/appdynamics-dotnetcore/libappdprofiler.so + - name: CORECLR_ENABLE_PROFILING + value: "1" + - name: APPDYNAMICS_AGENT_REUSE_NODE_NAME + value: "true" + - name: APPDYNAMICS_AGENT_APPLICATION_NAME + value: MD-instr-wh + - name: APPDYNAMICS_AGENT_TIER_NAME + value: dotnetapp + - name: APPDYNAMICS_AGENT_REUSE_NODE_NAME_PREFIX + value: dotnetapp + - name: APPDYNAMICS_NETVIZ_AGENT_HOST + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.hostIP + - name: APPDYNAMICS_NETVIZ_AGENT_PORT + value: "3892" + image: chrlic/sample-dotnet-app:latest + imagePullPolicy: Always + name: myfirstapp + ports: + - containerPort: 7032 + protocol: TCP + resources: + limits: + cpu: "1" + memory: 500Mi + requests: + cpu: 250m + memory: 100Mi + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: "~.*" + readOnly: true + - mountPath: /opt/appdynamics-dotnetcore + name: appd-agent-repo-dotnetcore + initContainers: + - command: + - cp + - -r + - /opt/appdynamics/. + - /opt/appdynamics-dotnetcore + image: appdynamics/dotnet-core-agent:latest + imagePullPolicy: Always + name: appd-agent-attach-dotnetcore + resources: + limits: + cpu: 200m + memory: 75M + requests: + cpu: 100m + memory: 50M + volumeMounts: + - mountPath: /opt/appdynamics-dotnetcore + name: appd-agent-repo-dotnetcore + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: "~.*" + readOnly: true + volumes: + - name: "~kube-api-access-.*" + projected: + defaultMode: 420 + sources: + - serviceAccountToken: + - configMap: + items: + - key: ca.crt + path: ca.crt + name: kube-root-ca.crt + - downwardAPI: + items: + - fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + path: namespace + - emptyDir: {} + name: appd-agent-repo-dotnetcore + diff --git a/webhook/e2e-tests/dotnet/cm/pod.yaml b/webhook/e2e-tests/dotnet/cm/pod.yaml new file mode 100644 index 0000000..69b5593 --- /dev/null +++ b/webhook/e2e-tests/dotnet/cm/pod.yaml @@ -0,0 +1,27 @@ + +apiVersion: v1 +kind: Pod +metadata: + name: dotnetapp + annotations: + test: testval + labels: + app: myfirstapp + appdApp: MD-instr-wh + appdInstr: do + language: dotnetcore +spec: + containers: + - name: myfirstapp + image: chrlic/sample-dotnet-app:latest + imagePullPolicy: Always + ports: + - containerPort: 7032 + env: + resources: + limits: + cpu: "1" + memory: 500Mi + requests: + cpu: 250m + memory: 100Mi diff --git a/webhook/e2e-tests/dotnet/instr-otel/crd-otelcol.yaml b/webhook/e2e-tests/dotnet/instr-otel/crd-otelcol.yaml new file mode 100644 index 0000000..d5d4221 --- /dev/null +++ b/webhook/e2e-tests/dotnet/instr-otel/crd-otelcol.yaml @@ -0,0 +1,48 @@ +apiVersion: ext.appd.com/v1alpha1 +kind: OpenTelemetryCollector +metadata: + name: test +spec: + replicas: 1 + image: otel/opentelemetry-collector-contrib:latest + imagePullPolicy: Always + mode: deployment + config: |- + receivers: + otlp: + protocols: + grpc: + http: + processors: + batch: + resource: + attributes: + - key: appdynamics.controller.account + action: upsert + value: "<>" + - key: appdynamics.controller.host + action: upsert + value: "<>" + - key: appdynamics.controller.port + action: upsert + value: <> + exporters: + logging: + loglevel: debug + # This part says that the opentelemetry collector will send data to OTIS pipeline for AppDynamicas CSaaS. + otlphttp: + tls: + insecure: true + endpoint: "<>" + headers: {"x-api-key": <>} + service: + pipelines: + traces: + receivers: [otlp] + processors: [batch, resource] + exporters: [logging, otlphttp] + telemetry: + logs: + level: "debug" + + diff --git a/webhook/e2e-tests/dotnet/instr-otel/instrumentation.yaml b/webhook/e2e-tests/dotnet/instr-otel/instrumentation.yaml new file mode 100644 index 0000000..d1c4c4f --- /dev/null +++ b/webhook/e2e-tests/dotnet/instr-otel/instrumentation.yaml @@ -0,0 +1,19 @@ +apiVersion: ext.appd.com/v1alpha1 +kind: Instrumentation +metadata: + name: dotnetcore-instrumentation +spec: + name: dotnetcore-instrumentation + priority: 2 + matchRules: + labels: + - language: dotnetcore + - instrument: crd + podNameRegex: .* + injectionRules: + technology: dotnetcore + image: appdynamics/dotnet-core-agent:latest + openTelemetryCollector: test + + + diff --git a/webhook/e2e-tests/dotnet/instr-otel/pod.yaml b/webhook/e2e-tests/dotnet/instr-otel/pod.yaml new file mode 100644 index 0000000..9523ef9 --- /dev/null +++ b/webhook/e2e-tests/dotnet/instr-otel/pod.yaml @@ -0,0 +1,27 @@ + +apiVersion: v1 +kind: Pod +metadata: + name: dotnetapp + annotations: + test: testval + labels: + app: myfirstapp + appdApp: MD-instr-wh + instrument: crd + language: dotnetcore +spec: + containers: + - name: myfirstapp + image: chrlic/sample-dotnet-app:latest + imagePullPolicy: Always + ports: + - containerPort: 7032 + env: + resources: + limits: + cpu: "1" + memory: 500Mi + requests: + cpu: 250m + memory: 100Mi diff --git a/webhook/e2e-tests/dotnet/instr/instrumentation.yaml b/webhook/e2e-tests/dotnet/instr/instrumentation.yaml new file mode 100644 index 0000000..a555cf1 --- /dev/null +++ b/webhook/e2e-tests/dotnet/instr/instrumentation.yaml @@ -0,0 +1,18 @@ +apiVersion: ext.appd.com/v1alpha1 +kind: Instrumentation +metadata: + name: dotnetcore-instrumentation +spec: + name: dotnetcore-instrumentation + priority: 2 + matchRules: + labels: + - language: dotnetcore + - instrument: crd + podNameRegex: .* + injectionRules: + technology: dotnetcore + image: appdynamics/dotnet-core-agent:latest + + + diff --git a/webhook/e2e-tests/dotnet/instr/pod-assert.yaml b/webhook/e2e-tests/dotnet/instr/pod-assert.yaml new file mode 100644 index 0000000..fa798c4 --- /dev/null +++ b/webhook/e2e-tests/dotnet/instr/pod-assert.yaml @@ -0,0 +1,109 @@ +apiVersion: v1 +kind: Pod +metadata: + annotations: + APPD_INSTRUMENTATION_VIA_RULE: demo/dotnetcore-instrumentation + test: testval + labels: + app: myfirstapp + appdApp: MD-instr-wh + instrument: crd + language: dotnetcore + name: dotnetapp +spec: + containers: + - env: + - name: APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY + value: "<>" + - name: APPDYNAMICS_CONTROLLER_HOST_NAME + value: "<>" + - name: APPDYNAMICS_CONTROLLER_PORT + value: "<>" + - name: APPDYNAMICS_CONTROLLER_SSL_ENABLED + value: "true" + - name: APPDYNAMICS_AGENT_ACCOUNT_NAME + value: "<>" + - name: LD_LIBRARY_PATH + value: /opt/appdynamics-dotnetcore + - name: CORECLR_PROFILER + value: '{57e1aa68-2229-41aa-9931-a6e93bbc64d8}' + - name: CORECLR_PROFILER_PATH + value: /opt/appdynamics-dotnetcore/libappdprofiler.so + - name: CORECLR_ENABLE_PROFILING + value: "1" + - name: APPDYNAMICS_AGENT_REUSE_NODE_NAME + value: "true" + - name: APPDYNAMICS_AGENT_APPLICATION_NAME + value: MD-instr-wh + - name: APPDYNAMICS_AGENT_TIER_NAME + value: dotnetapp + - name: APPDYNAMICS_AGENT_REUSE_NODE_NAME_PREFIX + value: dotnetapp + - name: APPDYNAMICS_NETVIZ_AGENT_HOST + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.hostIP + - name: APPDYNAMICS_NETVIZ_AGENT_PORT + value: "3892" + image: chrlic/sample-dotnet-app:latest + imagePullPolicy: Always + name: myfirstapp + ports: + - containerPort: 7032 + protocol: TCP + resources: + limits: + cpu: "1" + memory: 500Mi + requests: + cpu: 250m + memory: 100Mi + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: "~.*" + readOnly: true + - mountPath: /opt/appdynamics-dotnetcore + name: appd-agent-repo-dotnetcore + initContainers: + - command: + - cp + - -r + - /opt/appdynamics/. + - /opt/appdynamics-dotnetcore + image: appdynamics/dotnet-core-agent:latest + imagePullPolicy: Always + name: appd-agent-attach-dotnetcore + resources: + limits: + cpu: 200m + memory: 75M + requests: + cpu: 100m + memory: 50M + volumeMounts: + - mountPath: /opt/appdynamics-dotnetcore + name: appd-agent-repo-dotnetcore + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: "~.*" + readOnly: true + volumes: + - name: "~kube-api-access-.*" + projected: + defaultMode: 420 + sources: + - serviceAccountToken: + - configMap: + items: + - key: ca.crt + path: ca.crt + name: kube-root-ca.crt + - downwardAPI: + items: + - fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + path: namespace + - emptyDir: {} + name: appd-agent-repo-dotnetcore + diff --git a/webhook/e2e-tests/dotnet/instr/pod.yaml b/webhook/e2e-tests/dotnet/instr/pod.yaml new file mode 100644 index 0000000..9523ef9 --- /dev/null +++ b/webhook/e2e-tests/dotnet/instr/pod.yaml @@ -0,0 +1,27 @@ + +apiVersion: v1 +kind: Pod +metadata: + name: dotnetapp + annotations: + test: testval + labels: + app: myfirstapp + appdApp: MD-instr-wh + instrument: crd + language: dotnetcore +spec: + containers: + - name: myfirstapp + image: chrlic/sample-dotnet-app:latest + imagePullPolicy: Always + ports: + - containerPort: 7032 + env: + resources: + limits: + cpu: "1" + memory: 500Mi + requests: + cpu: 250m + memory: 100Mi diff --git a/webhook/e2e-tests/helmDefaultValues-template.yaml b/webhook/e2e-tests/helmDefaultValues-template.yaml new file mode 100644 index 0000000..1e4aa47 --- /dev/null +++ b/webhook/e2e-tests/helmDefaultValues-template.yaml @@ -0,0 +1,342 @@ + +serviceaccount: webhook-instrumentor +deploymentName: webhook-server +webhookName: webhook-appd +# namespacesEnabled is optional list of namespaces, where webhook would be applied. +# If missing, all namespaces will be enabled, except kubernetes system namespaces +# namespacesEnabled: +# - ns1 +# - ns2 +# +# namespacesDisabled is optional list of namespaces, where webhook would not be applied. +# If missing, all namespaces will be enabled, except kubernetes system namespaces +# (and namespace where the webook itself is running) +# namespacesDisabled: +# - ns3 +# +# enabledForPodsWithLabels is optional safety belt to try to instrument only pods +# having set labels to a specific values +# enabledForPodsWithLabels: +# - appdInstr +# +# number of replicas for webhook server +replicas: 1 +certValidityDays: 1024 +# failure policy can be Fail or Ignore. +# Ignore is safer - should the webhook fail or be unresponsive for timeoutSeconds, pod gets created unchanged +timeoutSeconds: 2 +failurePolicy: Ignore +debug: false + +# optional - certs information. If missing, certs will be generated dynamically, but that does +# not work with helm upgrade (except on OpenShift with service CA usage) +# certs: +# tlsCert: +# tlsKey: +# caCert: + +# optional - useServiceCAonOCP: true - if set, on OpenShift, Service CA certificates will be used +useServiceCAonOCP: true + +# service type and port for webhook server +service: + type: ClusterIP + port: 443 + +# image for pods running the webhook functionality +image: + image: docker.io/chrlic/appd-webhook-instrumentor-ng:2.0.0 + pullPolicy: Always + +# enables exceptions from instrumentation rules via namespaced CRD +useCrdConfig: true + +otelTracing: + endpoint: otel-collector.default.svc.cluster.local:4317 + serviceName: mwh + samplesPerMillion: "1000000" + logPayload: true + +# optional AppDynamics controller access information - required if +# AppDynamics native/hybrid agents are used +appdController: + host: .saas.appdynamics.com + port: "443" + isSecure: true + accountName: + accessKey: "" + # useProxy: true + # proxyHost: proxy.corm.com + # proxyPort: "8080" + otelEndpoint: https://.saas.appdynamics.com + otelHeaderKey: "" + +appdCloud: + +# optional OpenTelemetry parameters +# covers OTel Collector settings for AppDynamics cSaaS, AppDynamics Cloud, and Cisco Telescope +openTelemetryCollectors: + # collector name MUST be DNS friendly - only lowercase, numbers and "-" + deployment-hybrid-agent-default: + # mode - one of "sidecar", "deployment", "external" + mode: deployment + # replicas is only considered for OTel collector running as a deployment, otherwise ignored + replicas: 1 + image: + image: docker.io/otel/opentelemetry-collector-contrib:0.48.0 + imagePullPolicy: Always + initImage: docker.io/alpine:latest + config: > + receivers: + otlp: + protocols: + grpc: + http: + processors: + batch: + resource: + attributes: + - key: appdynamics.controller.account + action: upsert + value: "{{ .Values.appdController.accountName }}" + - key: appdynamics.controller.host + action: upsert + value: "{{ .Values.appdController.host }}" + - key: appdynamics.controller.port + action: upsert + value: {{ .Values.appdController.port }} + exporters: + logging: + loglevel: debug + # This part says that the opentelemetry collector will send data to OTIS pipeline for AppDynamicas CSaaS. + otlphttp: + tls: + insecure: true + endpoint: "{{ .Values.appdController.otelEndpoint }}" + headers: {"x-api-key": "{{ .Values.appdController.otelHeaderKey }}"} + service: + pipelines: + traces: + receivers: [otlp] + processors: [batch, resource] + exporters: [logging, otlphttp] + telemetry: + logs: + level: "debug" + sidecar-hybrid-agent-default: + # mode - one of "sidecar", "deployment", "external" + mode: sidecar + # replicas is only considered for OTel collector running as a deployment, otherwise ignored + replicas: 1 + image: + image: docker.io/otel/opentelemetry-collector-contrib:0.48.0 + imagePullPolicy: Always + initImage: docker.io/alpine:latest + config: > + receivers: + otlp: + protocols: + grpc: + http: + processors: + batch: + resource: + attributes: + - key: appdynamics.controller.account + action: upsert + value: "{{ .Values.appdController.accountName }}" + - key: appdynamics.controller.host + action: upsert + value: "{{ .Values.appdController.host }}" + - key: appdynamics.controller.port + action: upsert + value: {{ .Values.appdController.port }} + exporters: + logging: + loglevel: debug + # This part says that the opentelemetry collector will send data to OTIS pipeline for AppDynamicas CSaaS. + otlphttp: + tls: + insecure: true + endpoint: "{{ .Values.appdController.otelEndpoint }}" + headers: {"x-api-key": "{{ .Values.appdController.otelHeaderKey }}"} + service: + pipelines: + traces: + receivers: [otlp] + processors: [batch, resource] + exporters: [logging, otlphttp] + telemetry: + logs: + level: "debug" + external-hybrid-agent-default: + mode: external + collectorEndpoint: otel-collector.default.svc.cluster.local + +instrumentationTemplates: + - name: Java_Default + injectionRules: + # technology = java | dotnetcore | nodejs + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: JAVA_TOOL_OPTIONS + applicationNameSource: expression + applicationNameLabel: appdApp + applicationNameExpression: '{{index .Labels "appdApp"}}' + tierNameSource: auto + # usePodNameForNodeName: true + - name: Dotnet_Default + injectionRules: + technology: dotnetcore + image: appdynamics/dotnet-core-agent:22.5.1 + applicationNameSource: expression + applicationNameLabel: appdApp + applicationNameExpression: '{{index .Labels "appdApp"}}' + tierNameSource: auto + # usePodNameForNodeName: true + - name: Nodejs_Default + injectionRules: + technology: nodejs + image: appdynamics/nodejs-agent:22.5.0-16-stretch-slim + applicationNameSource: expression + applicationNameLabel: appdApp + applicationNameExpression: 'MD-{{if eq (index .NamespaceLabels "appd/type") "test"}}sat-{{index .NamespaceLabels "appd/name"}}_{{index .NamespaceLabels "appd/env"}}{{else}}sas-{{index .NamespaceLabels "appd/name"}}{{end}}' + tierNameSource: auto + # usePodNameForNodeName: true + - name: Java_Otel + injectionRules: + # technology = java | dotnetcore | nodejs + # provider = appd | otel | telescope - appd is default if missing + technology: java/otel + image: chrlic/opentelemetry-java-agent:latest + imagePullPolicy: Always + javaEnvVar: JAVA_TOOL_OPTIONS + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + - name: Dotnet_Otel + injectionRules: + technology: dotnetcore/otel + image: chrlic/opentelemetry-dotnet-agent:latest + imagePullPolicy: Always + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + - name: Nodejs_Otel + injectionRules: + technology: nodejs/otel + image: chrlic/opentelemetry-nodejs-agent:latest + imagePullPolicy: Always + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + - name: Apache_Otel + injectionRules: + technology: apache/otel + image: chrlic/opentelemetry-webserver-agent:latest + imagePullPolicy: Always + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + - name: Nginx_Otel + injectionRules: + technology: nginx/otel + image: chrlic/opentelemetry-webserver-agent:latest + imagePullPolicy: Always + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + +instrumentationRules: + - name: uni1 + matchRules: + namespaceRegex: .* + labels: + - language: uni + podNameRegex: .* + injectionRuleSet: + - template: Java_Default + - template: Dotnet_Default + - template: Nodejs_Default + - name: test1 + matchRules: + namespaceRegex: .* + labels: + - language: java + annotations: + - annot1: .* + podNameRegex: .* + injectionRules: + template: Java_Default + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: _JAVA_OPTIONS + - name: otel-test + matchRules: + namespaceRegex: .* + labels: + - otel: native + - language: java + annotations: + - annot1: .* + podNameRegex: .* + injectionRules: + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: _JAVA_OPTIONS + - name: java-otel-test + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: java + podNameRegex: .* + injectionRules: + template: Java_Default + javaEnvVar: _JAVA_OPTIONS + # optional otelNativeAgent: true -> assume native otel image use, no AppD native feed + openTelemetryCollector: sidecar-hybrid-agent-default + - name: dotnet1 + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: dotnetcore + podNameRegex: .* + injectionRules: + template: Dotnet_Otel + openTelemetryCollector: deployment-hybrid-agent-default + - name: nodejs1 + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: nodejs + podNameRegex: .* + injectionRules: + template: Nodejs_Otel + openTelemetryCollector: deployment-hybrid-agent-default + - name: apacheOtel + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: apache + podNameRegex: .* + injectionRules: + template: Apache_Otel + openTelemetryCollector: deployment-hybrid-agent-default + - name: apacheOtel + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: nginx + podNameRegex: .* + injectionRules: + template: Nginx_Otel + openTelemetryCollector: sidecar-hybrid-agent-default + + +flexMatch: | + Test-{{ .Namespace }} diff --git a/webhook/e2e-tests/helmDefaultValues.yaml b/webhook/e2e-tests/helmDefaultValues.yaml new file mode 100644 index 0000000..730ef73 --- /dev/null +++ b/webhook/e2e-tests/helmDefaultValues.yaml @@ -0,0 +1,349 @@ + +serviceaccount: webhook-instrumentor +deploymentName: webhook-server +webhookName: webhook-appd +# namespacesEnabled is optional list of namespaces, where webhook would be applied. +# If missing, all namespaces will be enabled, except kubernetes system namespaces +# namespacesEnabled: +# - ns1 +# - ns2 +# +# namespacesDisabled is optional list of namespaces, where webhook would not be applied. +# If missing, all namespaces will be enabled, except kubernetes system namespaces +# (and namespace where the webook itself is running) +# namespacesDisabled: +# - ns3 +# +# enabledForPodsWithLabels is optional safety belt to try to instrument only pods +# having set labels to a specific values +# enabledForPodsWithLabels: +# - appdInstr +# +# number of replicas for webhook server +replicas: 1 +certValidityDays: 1024 +# failure policy can be Fail or Ignore. +# Ignore is safer - should the webhook fail or be unresponsive for timeoutSeconds, pod gets created unchanged +timeoutSeconds: 2 +failurePolicy: Ignore +debug: false + +# optional - certs information. If missing, certs will be generated dynamically, but that does +# not work with helm upgrade (except on OpenShift with service CA usage) +# certs: +# tlsCert: +# tlsKey: +# caCert: + +# optional - useServiceCAonOCP: true - if set, on OpenShift, Service CA certificates will be used +useServiceCAonOCP: true + +# service type and port for webhook server +service: + type: ClusterIP + port: 443 + +# image for pods running the webhook functionality +image: + image: docker.io/chrlic/appd-webhook-instrumentor-ng:2.0.0 + pullPolicy: Always + +# enables exceptions from instrumentation rules via namespaced CRD +useCrdConfig: true + +otelTracing: + endpoint: otel-collector.default.svc.cluster.local:4317 + serviceName: mwh + samplesPerMillion: "1000000" + logPayload: true + +# optional AppDynamics controller access information - required if +# AppDynamics native/hybrid agents are used +appdController: + host: <> + port: "<>" + isSecure: true + accountName: <> + accessKey: "<>" + # useProxy: true + # proxyHost: proxy.corp.com + # proxyPort: "8080" + otelEndpoint: <> + otelHeaderKey: <> + +# optional OpenTelemetry parameters +# covers OTel Collector settings for AppDynamics cSaaS, AppDynamics Cloud, and Cisco Telescope +openTelemetryCollectors: + # collector name MUST be DNS friendly - only lowercase, numbers and "-" + deployment-hybrid-agent-default: + # mode - one of "sidecar", "deployment", "external" + mode: deployment + # replicas is only considered for OTel collector running as a deployment, otherwise ignored + replicas: 1 + image: + image: docker.io/otel/opentelemetry-collector-contrib:0.48.0 + imagePullPolicy: Always + initImage: docker.io/alpine:latest + config: > + receivers: + otlp: + protocols: + grpc: + http: + processors: + batch: + resource: + attributes: + - key: appdynamics.controller.account + action: upsert + value: "{{ .Values.appdController.accountName }}" + - key: appdynamics.controller.host + action: upsert + value: "{{ .Values.appdController.host }}" + - key: appdynamics.controller.port + action: upsert + value: {{ .Values.appdController.port }} + exporters: + logging: + loglevel: debug + # This part says that the opentelemetry collector will send data to OTIS pipeline for AppDynamicas CSaaS. + otlphttp: + tls: + insecure: true + endpoint: "{{ .Values.appdController.otelEndpoint }}" + headers: {"x-api-key": "{{ .Values.appdController.otelHeaderKey }}"} + service: + pipelines: + traces: + receivers: [otlp] + processors: [batch, resource] + exporters: [logging, otlphttp] + telemetry: + logs: + level: "debug" + sidecar-hybrid-agent-default: + # mode - one of "sidecar", "deployment", "external" + mode: sidecar + # replicas is only considered for OTel collector running as a deployment, otherwise ignored + replicas: 1 + image: + image: docker.io/otel/opentelemetry-collector-contrib:0.48.0 + imagePullPolicy: Always + initImage: docker.io/alpine:latest + config: > + receivers: + otlp: + protocols: + grpc: + http: + processors: + batch: + resource: + attributes: + - key: appdynamics.controller.account + action: upsert + value: "{{ .Values.appdController.accountName }}" + - key: appdynamics.controller.host + action: upsert + value: "{{ .Values.appdController.host }}" + - key: appdynamics.controller.port + action: upsert + value: {{ .Values.appdController.port }} + exporters: + logging: + loglevel: debug + # This part says that the opentelemetry collector will send data to OTIS pipeline for AppDynamicas CSaaS. + otlphttp: + tls: + insecure: true + endpoint: "{{ .Values.appdController.otelEndpoint }}" + headers: {"x-api-key": "{{ .Values.appdController.otelHeaderKey }}"} + service: + pipelines: + traces: + receivers: [otlp] + processors: [batch, resource] + exporters: [logging, otlphttp] + telemetry: + logs: + level: "debug" + external-hybrid-agent-default: + mode: external + collectorEndpoint: otel-collector.default.svc.cluster.local + +instrumentationTemplates: + - name: Java_Default + injectionRules: + # technology = java | dotnetcore | nodejs + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: JAVA_TOOL_OPTIONS + applicationNameSource: expression + applicationNameLabel: appdApp + applicationNameExpression: '{{index .Labels "appdApp"}}' + tierNameSource: auto + # usePodNameForNodeName: true + - name: Dotnet_Default + injectionRules: + technology: dotnetcore + image: appdynamics/dotnet-core-agent:latest + applicationNameSource: expression + applicationNameLabel: appdApp + applicationNameExpression: '{{index .Labels "appdApp"}}' + tierNameSource: auto + # usePodNameForNodeName: true + - name: Nodejs_Default + injectionRules: + technology: nodejs + image: appdynamics/nodejs-agent:22.5.0-16-stretch-slim + applicationNameSource: expression + applicationNameLabel: appdApp + applicationNameExpression: 'MD-{{if eq (index .NamespaceLabels "appd/type") "test"}}sat-{{index .NamespaceLabels "appd/name"}}_{{index .NamespaceLabels "appd/env"}}{{else}}sas-{{index .NamespaceLabels "appd/name"}}{{end}}' + tierNameSource: auto + # usePodNameForNodeName: true + - name: Java_Otel + injectionRules: + # technology = java | dotnetcore | nodejs + # provider = appd | otel | telescope - appd is default if missing + technology: java/otel + image: chrlic/opentelemetry-java-agent:latest + imagePullPolicy: Always + javaEnvVar: JAVA_TOOL_OPTIONS + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + - name: Dotnet_Otel + injectionRules: + technology: dotnetcore/otel + image: chrlic/opentelemetry-dotnet-agent:latest + imagePullPolicy: Always + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + - name: Nodejs_Otel + injectionRules: + technology: nodejs/otel + image: chrlic/opentelemetry-nodejs-agent:latest + imagePullPolicy: Always + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + - name: Apache_Otel + injectionRules: + technology: apache/otel + image: chrlic/opentelemetry-webserver-agent:latest + imagePullPolicy: Always + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + - name: Nginx_Otel + injectionRules: + technology: nginx/otel + image: chrlic/opentelemetry-webserver-agent:latest + imagePullPolicy: Always + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + +instrumentationRules: + - name: uni1 + matchRules: + namespaceRegex: .* + labels: + - language: uni + podNameRegex: .* + injectionRuleSet: + - template: Java_Default + - template: Dotnet_Default + - template: Nodejs_Default + - name: test1 + matchRules: + namespaceRegex: .* + labels: + - language: java + annotations: + - annot1: .* + podNameRegex: .* + injectionRules: + template: Java_Default + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: _JAVA_OPTIONS + - name: otel-test + matchRules: + namespaceRegex: .* + labels: + - otel: native + - language: java + annotations: + - annot1: .* + podNameRegex: .* + injectionRules: + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: _JAVA_OPTIONS + - name: java-otel-test + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: java + podNameRegex: .* + injectionRules: + template: Java_Default + javaEnvVar: _JAVA_OPTIONS + # optional otelNativeAgent: true -> assume native otel image use, no AppD native feed + openTelemetryCollector: sidecar-hybrid-agent-default + - name: dotnet + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: dotnetcore + podNameRegex: .* + injectionRules: + template: Dotnet_Default + - name: dotnet-otel + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: dotnetcore + podNameRegex: .* + injectionRules: + template: Dotnet_Otel + openTelemetryCollector: deployment-hybrid-agent-default + - name: nodejs1 + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: nodejs + podNameRegex: .* + injectionRules: + template: Nodejs_Otel + openTelemetryCollector: deployment-hybrid-agent-default + - name: apacheOtel + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: apache + podNameRegex: .* + injectionRules: + template: Apache_Otel + openTelemetryCollector: deployment-hybrid-agent-default + - name: apacheOtel + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: nginx + podNameRegex: .* + injectionRules: + template: Nginx_Otel + openTelemetryCollector: sidecar-hybrid-agent-default + + +flexMatch: | + Test-{{ .Namespace }} diff --git a/webhook/e2e-tests/java/cm/pod-assert.yaml b/webhook/e2e-tests/java/cm/pod-assert.yaml new file mode 100644 index 0000000..32a7588 --- /dev/null +++ b/webhook/e2e-tests/java/cm/pod-assert.yaml @@ -0,0 +1,102 @@ +apiVersion: v1 +kind: Pod +metadata: + annotations: + APPD_INSTRUMENTATION_VIA_RULE: test1 + annot1: my-annotation + labels: + app: vendors + appdApp: MD-Hybrid-App + language: java + otel: appd + name: javatest +spec: + containers: + - env: + - name: APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY + value: "<>" + - name: APPDYNAMICS_CONTROLLER_HOST_NAME + value: "<>" + - name: APPDYNAMICS_CONTROLLER_PORT + value: "<>" + - name: APPDYNAMICS_CONTROLLER_SSL_ENABLED + value: "true" + - name: APPDYNAMICS_AGENT_ACCOUNT_NAME + value: "<>" + - name: _JAVA_OPTIONS + value: ' -Dappdynamics.agent.accountAccessKey=$(APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY) + -Dappdynamics.agent.reuse.nodeName=true -Dappdynamics.socket.collection.bci.enable=true + -javaagent:/opt/appdynamics-java/javaagent.jar ' + - name: APPDYNAMICS_AGENT_APPLICATION_NAME + value: MD-Hybrid-App + - name: APPDYNAMICS_AGENT_TIER_NAME + value: javatest + - name: APPDYNAMICS_AGENT_REUSE_NODE_NAME_PREFIX + value: javatest + - name: APPDYNAMICS_NETVIZ_AGENT_HOST + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.hostIP + - name: APPDYNAMICS_NETVIZ_AGENT_PORT + value: "3892" + image: chrlic/echoapp:latest + imagePullPolicy: Always + name: vendors + ports: + - containerPort: 8181 + protocol: TCP + resources: + limits: + cpu: "1" + memory: 500Mi + requests: + cpu: 250m + memory: 100Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: ~kube-api-access-.* + readOnly: true + - mountPath: /opt/appdynamics-java + name: appd-agent-repo-java + initContainers: + - args: + - cp -ar /opt/appdynamics/. /opt/appdynamics-java + command: + - /bin/sh + - -c + image: appdynamics/java-agent:latest + name: appd-agent-attach-java + resources: + limits: + cpu: 200m + memory: 75M + requests: + cpu: 100m + memory: 50M + volumeMounts: + - mountPath: /opt/appdynamics-java + name: appd-agent-repo-java + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: ~kube-api-access-.* + readOnly: true + volumes: + - name: ~kube-api-access-.* + projected: + sources: + - serviceAccountToken: + - configMap: + items: + - key: ca.crt + path: ca.crt + name: kube-root-ca.crt + - downwardAPI: + items: + - fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + path: namespace + - emptyDir: {} + name: appd-agent-repo-java diff --git a/webhook/e2e-tests/java/cm/pod.yaml b/webhook/e2e-tests/java/cm/pod.yaml new file mode 100644 index 0000000..9a6f5d8 --- /dev/null +++ b/webhook/e2e-tests/java/cm/pod.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: Pod +metadata: + name: javatest + annotations: + annot1: my-annotation + labels: + app: vendors + appdApp: MD-Hybrid-App + otel: appd + language: java +spec: + containers: + - name: vendors + image: chrlic/echoapp:latest + imagePullPolicy: Always + ports: + - containerPort: 8181 + resources: + limits: + cpu: "1" + memory: 500Mi + requests: + cpu: 250m + memory: 100Mi \ No newline at end of file diff --git a/webhook/e2e-tests/java/instr-otel/crd-otelcol.yaml b/webhook/e2e-tests/java/instr-otel/crd-otelcol.yaml new file mode 100644 index 0000000..d5d4221 --- /dev/null +++ b/webhook/e2e-tests/java/instr-otel/crd-otelcol.yaml @@ -0,0 +1,48 @@ +apiVersion: ext.appd.com/v1alpha1 +kind: OpenTelemetryCollector +metadata: + name: test +spec: + replicas: 1 + image: otel/opentelemetry-collector-contrib:latest + imagePullPolicy: Always + mode: deployment + config: |- + receivers: + otlp: + protocols: + grpc: + http: + processors: + batch: + resource: + attributes: + - key: appdynamics.controller.account + action: upsert + value: "<>" + - key: appdynamics.controller.host + action: upsert + value: "<>" + - key: appdynamics.controller.port + action: upsert + value: <> + exporters: + logging: + loglevel: debug + # This part says that the opentelemetry collector will send data to OTIS pipeline for AppDynamicas CSaaS. + otlphttp: + tls: + insecure: true + endpoint: "<>" + headers: {"x-api-key": <>} + service: + pipelines: + traces: + receivers: [otlp] + processors: [batch, resource] + exporters: [logging, otlphttp] + telemetry: + logs: + level: "debug" + + diff --git a/webhook/e2e-tests/java/instr-otel/instrumentation.yaml b/webhook/e2e-tests/java/instr-otel/instrumentation.yaml new file mode 100644 index 0000000..f80aef8 --- /dev/null +++ b/webhook/e2e-tests/java/instr-otel/instrumentation.yaml @@ -0,0 +1,20 @@ +apiVersion: ext.appd.com/v1alpha1 +kind: Instrumentation +metadata: + name: java-instrumentation +spec: + name: java-instrumentation + priority: 2 + matchRules: + labels: + - language: java + - otel: appd + podNameRegex: .* + injectionRules: + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: _JAVA_OPTIONS + # technology java + openTelemetryCollector -> use AppD hybrid agent + openTelemetryCollector: test + + diff --git a/webhook/e2e-tests/java/instr-otel/pod-assert.yaml b/webhook/e2e-tests/java/instr-otel/pod-assert.yaml new file mode 100644 index 0000000..7168e7d --- /dev/null +++ b/webhook/e2e-tests/java/instr-otel/pod-assert.yaml @@ -0,0 +1,122 @@ +apiVersion: v1 +kind: Pod +metadata: + annotations: + APPD_INSTRUMENTATION_VIA_RULE: ~test-.*/java-instrumentation + annot1: my-annotation + labels: + app: vendors + appdApp: MD-Hybrid-App + language: java + otel: appd + name: javatest +spec: + containers: + - env: + - name: APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY + value: "<>" + - name: APPDYNAMICS_CONTROLLER_HOST_NAME + value: "<>" + - name: APPDYNAMICS_CONTROLLER_PORT + value: "<>" + - name: APPDYNAMICS_CONTROLLER_SSL_ENABLED + value: "true" + - name: APPDYNAMICS_AGENT_ACCOUNT_NAME + value: "<>" + - name: K8S_POD_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.podIP + - name: K8S_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: K8S_NAMESPACE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: OTEL_RESOURCE_ATTRIBUTES + value: k8s.pod.ip=$(K8S_POD_IP),k8s.pod.name=$(K8S_POD_NAME),k8s.namespace.name=$(K8S_NAMESPACE_NAME),k8s.container.name=vendors,k8s.container.restart_count=0 + - name: _JAVA_OPTIONS + value: '~ -Dappdynamics.agent.accountAccessKey=\$\(APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY\) + -Dappdynamics.agent.reuse.nodeName=true -Dappdynamics.socket.collection.bci.enable=true + -javaagent:/opt/appdynamics-java/javaagent.jar -Dappdynamics.opentelemetry.enabled=true + -Dotel.resource.attributes=service.name=javatest,service.namespace=test-.*,\$\(OTEL_RESOURCE_ATTRIBUTES\) + -Dotel.traces.exporter=otlp,logging -Dotel.exporter.otlp.traces.endpoint=http://otel-collector-test.test-.*.svc.cluster.local:4317 ' + - name: APPDYNAMICS_AGENT_APPLICATION_NAME + value: ~test-.* + - name: APPDYNAMICS_AGENT_TIER_NAME + value: javatest + - name: APPDYNAMICS_AGENT_REUSE_NODE_NAME_PREFIX + value: javatest + - name: APPDYNAMICS_NETVIZ_AGENT_HOST + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.hostIP + - name: APPDYNAMICS_NETVIZ_AGENT_PORT + value: "3892" + image: chrlic/echoapp:latest + imagePullPolicy: Always + name: vendors + ports: + - containerPort: 8181 + protocol: TCP + resources: + limits: + cpu: "1" + memory: 500Mi + requests: + cpu: 250m + memory: 100Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: ~kube-api-access-.* + readOnly: true + - mountPath: /opt/appdynamics-java + name: appd-agent-repo-java + initContainers: + - args: + - cp -ar /opt/appdynamics/. /opt/appdynamics-java + command: + - /bin/sh + - -c + image: appdynamics/java-agent:latest + name: appd-agent-attach-java + resources: + limits: + cpu: 200m + memory: 75M + requests: + cpu: 100m + memory: 50M + volumeMounts: + - mountPath: /opt/appdynamics-java + name: appd-agent-repo-java + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: ~kube-api-access-.* + readOnly: true + volumes: + - name: ~kube-api-access-.* + projected: + sources: + - serviceAccountToken: + path: token + - configMap: + items: + - key: ca.crt + path: ca.crt + name: kube-root-ca.crt + - downwardAPI: + items: + - fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + path: namespace + - emptyDir: {} + name: appd-agent-repo-java diff --git a/webhook/e2e-tests/java/instr-otel/pod.yaml b/webhook/e2e-tests/java/instr-otel/pod.yaml new file mode 100644 index 0000000..9a6f5d8 --- /dev/null +++ b/webhook/e2e-tests/java/instr-otel/pod.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: Pod +metadata: + name: javatest + annotations: + annot1: my-annotation + labels: + app: vendors + appdApp: MD-Hybrid-App + otel: appd + language: java +spec: + containers: + - name: vendors + image: chrlic/echoapp:latest + imagePullPolicy: Always + ports: + - containerPort: 8181 + resources: + limits: + cpu: "1" + memory: 500Mi + requests: + cpu: 250m + memory: 100Mi \ No newline at end of file diff --git a/webhook/e2e-tests/java/instr/instrumentation.yaml b/webhook/e2e-tests/java/instr/instrumentation.yaml new file mode 100644 index 0000000..a1ad331 --- /dev/null +++ b/webhook/e2e-tests/java/instr/instrumentation.yaml @@ -0,0 +1,20 @@ +apiVersion: ext.appd.com/v1alpha1 +kind: Instrumentation +metadata: + name: java-instrumentation +spec: + name: java-instrumentation + priority: 2 + matchRules: + labels: + - language: java + - otel: appd + podNameRegex: .* + injectionRules: + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: _JAVA_OPTIONS + # technology java + openTelemetryCollector -> use AppD hybrid agent + # openTelemetryCollector: test + + diff --git a/webhook/e2e-tests/java/instr/pod-assert.yaml b/webhook/e2e-tests/java/instr/pod-assert.yaml new file mode 100644 index 0000000..5c68bb3 --- /dev/null +++ b/webhook/e2e-tests/java/instr/pod-assert.yaml @@ -0,0 +1,120 @@ +apiVersion: v1 +kind: Pod +metadata: + annotations: + APPD_INSTRUMENTATION_VIA_RULE: ~test-.*/java-instrumentation + annot1: my-annotation + labels: + app: vendors + appdApp: MD-Hybrid-App + language: java + otel: appd + name: javatest +spec: + containers: + - env: + - name: APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY + value: "<>" + - name: APPDYNAMICS_CONTROLLER_HOST_NAME + value: "<>" + - name: APPDYNAMICS_CONTROLLER_PORT + value: "<>" + - name: APPDYNAMICS_CONTROLLER_SSL_ENABLED + value: "true" + - name: APPDYNAMICS_AGENT_ACCOUNT_NAME + value: "<>" + - name: K8S_POD_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.podIP + - name: K8S_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: K8S_NAMESPACE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: OTEL_RESOURCE_ATTRIBUTES + value: k8s.pod.ip=$(K8S_POD_IP),k8s.pod.name=$(K8S_POD_NAME),k8s.namespace.name=$(K8S_NAMESPACE_NAME),k8s.container.name=vendors,k8s.container.restart_count=0 + - name: _JAVA_OPTIONS + value: ' -Dappdynamics.agent.accountAccessKey=$(APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY) + -Dappdynamics.agent.reuse.nodeName=true -Dappdynamics.socket.collection.bci.enable=true + -javaagent:/opt/appdynamics-java/javaagent.jar ' + - name: APPDYNAMICS_AGENT_APPLICATION_NAME + value: ~test-.* + - name: APPDYNAMICS_AGENT_TIER_NAME + value: javatest + - name: APPDYNAMICS_AGENT_REUSE_NODE_NAME_PREFIX + value: javatest + - name: APPDYNAMICS_NETVIZ_AGENT_HOST + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.hostIP + - name: APPDYNAMICS_NETVIZ_AGENT_PORT + value: "3892" + image: chrlic/echoapp:latest + imagePullPolicy: Always + name: vendors + ports: + - containerPort: 8181 + protocol: TCP + resources: + limits: + cpu: "1" + memory: 500Mi + requests: + cpu: 250m + memory: 100Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: ~kube-api-access-.* + readOnly: true + - mountPath: /opt/appdynamics-java + name: appd-agent-repo-java + initContainers: + - args: + - cp -ar /opt/appdynamics/. /opt/appdynamics-java + command: + - /bin/sh + - -c + image: appdynamics/java-agent:latest + name: appd-agent-attach-java + resources: + limits: + cpu: 200m + memory: 75M + requests: + cpu: 100m + memory: 50M + volumeMounts: + - mountPath: /opt/appdynamics-java + name: appd-agent-repo-java + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: ~kube-api-access-.* + readOnly: true + volumes: + - name: ~kube-api-access-.* + projected: + sources: + - serviceAccountToken: + path: token + - configMap: + items: + - key: ca.crt + path: ca.crt + name: kube-root-ca.crt + - downwardAPI: + items: + - fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + path: namespace + - emptyDir: {} + name: appd-agent-repo-java diff --git a/webhook/e2e-tests/java/instr/pod.yaml b/webhook/e2e-tests/java/instr/pod.yaml new file mode 100644 index 0000000..9a6f5d8 --- /dev/null +++ b/webhook/e2e-tests/java/instr/pod.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: Pod +metadata: + name: javatest + annotations: + annot1: my-annotation + labels: + app: vendors + appdApp: MD-Hybrid-App + otel: appd + language: java +spec: + containers: + - name: vendors + image: chrlic/echoapp:latest + imagePullPolicy: Always + ports: + - containerPort: 8181 + resources: + limits: + cpu: "1" + memory: 500Mi + requests: + cpu: 250m + memory: 100Mi \ No newline at end of file diff --git a/webhook/e2e-tests/secrets-sample.txt b/webhook/e2e-tests/secrets-sample.txt new file mode 100644 index 0000000..9ae1247 --- /dev/null +++ b/webhook/e2e-tests/secrets-sample.txt @@ -0,0 +1,6 @@ +APPD_CONTROLLER=.saas.appdynamics.com +APPD_CONTROLLER_PORT=443 +APPD_ACCOUNT= +APPD_ACCESS_KEY= +APPD_OTEL_SERVICE=https://-sls-agent-api.saas.appdynamics.com +APPD_OTEL_AUTH_KEY="" \ No newline at end of file diff --git a/webhook/examples/crd-cluster-instr.yaml b/webhook/examples/crd-cluster-instr.yaml new file mode 100644 index 0000000..51e6d74 --- /dev/null +++ b/webhook/examples/crd-cluster-instr.yaml @@ -0,0 +1,18 @@ +apiVersion: ext.appd.com/v1alpha1 +kind: ClusterInstrumentation +metadata: + name: java-instrumentation +spec: + name: java-instrumentation + priority: 2 + matchRules: + labels: + - language: java + podNameRegex: .* + injectionRules: + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: _JAVA_OPTIONS + # technology java + openTelemetryCollector -> use AppD hybrid agent + openTelemetryCollector: cSaaS_Collector + diff --git a/webhook/examples/crd-instr.yaml b/webhook/examples/crd-instr.yaml new file mode 100644 index 0000000..f80aef8 --- /dev/null +++ b/webhook/examples/crd-instr.yaml @@ -0,0 +1,20 @@ +apiVersion: ext.appd.com/v1alpha1 +kind: Instrumentation +metadata: + name: java-instrumentation +spec: + name: java-instrumentation + priority: 2 + matchRules: + labels: + - language: java + - otel: appd + podNameRegex: .* + injectionRules: + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: _JAVA_OPTIONS + # technology java + openTelemetryCollector -> use AppD hybrid agent + openTelemetryCollector: test + + diff --git a/webhook/examples/crd-otelcol.yaml b/webhook/examples/crd-otelcol.yaml new file mode 100644 index 0000000..7e2588b --- /dev/null +++ b/webhook/examples/crd-otelcol.yaml @@ -0,0 +1,48 @@ +apiVersion: ext.appd.com/v1alpha1 +kind: OpenTelemetryCollector +metadata: + name: test +spec: + replicas: 1 + image: otel/opentelemetry-collector-contrib:latest + imagePullPolicy: Always + mode: deployment + config: |- + receivers: + otlp: + protocols: + grpc: + http: + processors: + batch: + resource: + attributes: + - key: appdynamics.controller.account + action: upsert + value: "ceer" + - key: appdynamics.controller.host + action: upsert + value: "ceer.saas.appdynamics.com" + - key: appdynamics.controller.port + action: upsert + value: 443 + exporters: + logging: + loglevel: debug + # This part says that the opentelemetry collector will send data to OTIS pipeline for AppDynamicas CSaaS. + otlphttp: + tls: + insecure: true + endpoint: "https://fra-sls-agent-api.saas.appdynamics.com" + headers: {"x-api-key": "***REMOVED***"} + service: + pipelines: + traces: + receivers: [otlp] + processors: [batch, resource] + exporters: [logging, otlphttp] + telemetry: + logs: + level: "debug" + + diff --git a/webhook/go.mod b/webhook/go.mod deleted file mode 100644 index 85da0b5..0000000 --- a/webhook/go.mod +++ /dev/null @@ -1,65 +0,0 @@ -module main - -go 1.19 - -require ( - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.4 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.1 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 - google.golang.org/grpc v1.56.3 - k8s.io/api v0.25.3 - k8s.io/apimachinery v0.25.3 - k8s.io/client-go v0.25.3 -) - -require ( - github.com/PuerkitoBio/purell v1.1.1 // indirect - github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect - github.com/cenkalti/backoff/v4 v4.1.3 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/emicklei/go-restful/v3 v3.8.0 // indirect - github.com/felixge/httpsnoop v1.0.3 // indirect - github.com/go-logr/logr v1.2.3 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-openapi/jsonpointer v0.19.5 // indirect - github.com/go-openapi/jsonreference v0.19.5 // indirect - github.com/go-openapi/swag v0.19.14 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/google/gnostic v0.5.7-v3refs // indirect - github.com/google/go-cmp v0.5.9 // indirect - github.com/google/gofuzz v1.1.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - github.com/imdario/mergo v0.3.6 // indirect - github.com/josharian/intern v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect - github.com/mailru/easyjson v0.7.6 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/spf13/pflag v1.0.5 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1 // indirect - go.opentelemetry.io/otel/metric v0.33.0 // indirect - go.opentelemetry.io/proto/otlp v0.19.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/oauth2 v0.7.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect - google.golang.org/protobuf v1.30.0 // indirect - gopkg.in/inf.v0 v0.9.1 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/klog/v2 v2.70.1 // indirect - k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect - k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect - sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect - sigs.k8s.io/yaml v1.2.0 // indirect -) diff --git a/webhook/go.sum b/webhook/go.sum deleted file mode 100644 index 8b91aaf..0000000 --- a/webhook/go.sum +++ /dev/null @@ -1,553 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= -github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= -github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/emicklei/go-restful/v3 v3.8.0 h1:eCZ8ulSerjdAiaNpF7GxXIE7ZCMo1moN1qX+S609eVw= -github.com/emicklei/go-restful/v3 v3.8.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= -github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonreference v0.19.5 h1:1WJP/wi4OjB4iV8KVbH73rQaoialJrqv8gitZLxGLtM= -github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng= -github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= -github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= -github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= -github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= -github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/onsi/ginkgo/v2 v2.1.6 h1:Fx2POJZfKRQcM1pH49qSZiYeu319wji004qX+GDovrU= -github.com/onsi/gomega v1.20.1 h1:PA/3qinGoukvymdIDV8pii6tiZgC8kbmJO6Z5+b002Q= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.4 h1:aUEBEdCa6iamGzg6fuYxDA8ThxvOG240mAvWDU+XLio= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.4/go.mod h1:l2MdsbKTocpPS5nQZscqTR9jd8u96VYZdcpF8Sye7mA= -go.opentelemetry.io/otel v1.11.1 h1:4WLLAmcfkmDk2ukNXJyq3/kiz/3UzCaYq6PskJsaou4= -go.opentelemetry.io/otel v1.11.1/go.mod h1:1nNhXBbWSD0nsL38H6btgnFN2k4i0sNLHNNMZMSbUGE= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 h1:X2GndnMCsUPh6CiY2a+frAbNsXaPLbB0soHRYhAZ5Ig= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1/go.mod h1:i8vjiSzbiUC7wOQplijSXMYUpNM93DtlS5CbUT+C6oQ= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1 h1:MEQNafcNCB0uQIti/oHgU7CZpUMYQ7qigBwMVKycHvc= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1/go.mod h1:19O5I2U5iys38SsmT2uDJja/300woyzE1KPIQxEUBUc= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.1 h1:LYyG/f1W/jzAix16jbksJfMQFpOH/Ma6T639pVPMgfI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.1/go.mod h1:QrRRQiY3kzAoYPNLP0W/Ikg0gR6V3LMc+ODSxr7yyvg= -go.opentelemetry.io/otel/metric v0.33.0 h1:xQAyl7uGEYvrLAiV/09iTJlp1pZnQ9Wl793qbVvED1E= -go.opentelemetry.io/otel/metric v0.33.0/go.mod h1:QlTYc+EnYNq/M2mNk1qDDMRLpqCOj2f/r5c7Fd5FYaI= -go.opentelemetry.io/otel/sdk v1.11.1 h1:F7KmQgoHljhUuJyA+9BiU+EkJfyX5nVVF4wyzWZpKxs= -go.opentelemetry.io/otel/sdk v1.11.1/go.mod h1:/l3FE4SupHJ12TduVjUkZtlfFqDCQJlOlithYrdktys= -go.opentelemetry.io/otel/trace v1.11.1 h1:ofxdnzsNrGBYXbP7t7zpUK281+go5rF7dvdIZXF8gdQ= -go.opentelemetry.io/otel/trace v1.11.1/go.mod h1:f/Q9G7vzk5u91PhbmKbg1Qn0rzH1LJ4vbPHFGkTPtOk= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= -golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44= -golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= -google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.25.3 h1:Q1v5UFfYe87vi5H7NU0p4RXC26PPMT8KOpr1TLQbCMQ= -k8s.io/api v0.25.3/go.mod h1:o42gKscFrEVjHdQnyRenACrMtbuJsVdP+WVjqejfzmI= -k8s.io/apimachinery v0.25.3 h1:7o9ium4uyUOM76t6aunP0nZuex7gDf8VGwkR5RcJnQc= -k8s.io/apimachinery v0.25.3/go.mod h1:jaF9C/iPNM1FuLl7Zuy5b9v+n35HGSh6AQ4HYRkCqwo= -k8s.io/client-go v0.25.3 h1:oB4Dyl8d6UbfDHD8Bv8evKylzs3BXzzufLiO27xuPs0= -k8s.io/client-go v0.25.3/go.mod h1:t39LPczAIMwycjcXkVc+CB+PZV69jQuNx4um5ORDjQA= -k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= -k8s.io/klog/v2 v2.70.1 h1:7aaoSdahviPmR+XkS7FyxlkkXs6tHISSG03RxleQAVQ= -k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 h1:MQ8BAZPZlWk3S9K4a9NCkIFQtZShWqoha7snGixVgEA= -k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU= -k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed h1:jAne/RjBTyawwAy0utX5eqigAwz/lQhTmy+Hr/Cpue4= -k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k= -sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= -sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= -sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= -sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= -sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= diff --git a/webhook/helm/Chart.yaml b/webhook/helm/Chart.yaml new file mode 100644 index 0000000..cc4d9e2 --- /dev/null +++ b/webhook/helm/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +name: webhook-instrumentor +version: 0.2.2 +description: Kubernetes Mutating Webhook for AppDynamics auto-instrumentation +icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png +maintainers: + - name: Martin Divis + email: mdivis@cisco.com +engine: gotpl \ No newline at end of file diff --git a/webhook/helm/templates/_helpers.tpl b/webhook/helm/templates/_helpers.tpl new file mode 100644 index 0000000..207c489 --- /dev/null +++ b/webhook/helm/templates/_helpers.tpl @@ -0,0 +1,14 @@ + +{{/* +Expand the name of the chart. +*/}} +{{- define "webhook-instrumentor.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "webhook-instrumentor.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/webhook/helm/templates/cm-webhook-instrumentor-config.yaml b/webhook/helm/templates/cm-webhook-instrumentor-config.yaml new file mode 100644 index 0000000..cd2b5e4 --- /dev/null +++ b/webhook/helm/templates/cm-webhook-instrumentor-config.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: webhook-instrumentor-config + namespace: {{ .Release.Namespace }} +data: + {{- if .Values.appdController }} + controller: | {{ printf "\n" }} + {{- toYaml .Values.appdController | indent 4 }} + {{- end }} + {{- if .Values.appdController }} + flexMatch: "{{ .Values.flexMatch }}" + {{- end }} + instrumentation: | {{ printf "\n" }} + {{- toYaml .Values.instrumentationRules | indent 4 }} + injectionTemplates: | {{ printf "\n" }} + {{- toYaml .Values.instrumentationTemplates | indent 4 }} + {{- if .Values.appdCloud }} + appdCloud: | {{ printf "\n" }} + {{- toYaml .Values.appdCloud | indent 4 }} + {{- end }} + {{- if .Values.telescope }} + telescope: | {{ printf "\n" }} + {{- toYaml .Values.telescope | indent 4 }} + {{- end }} diff --git a/webhook/helm/templates/cr-webhook-instrumentor.yaml b/webhook/helm/templates/cr-webhook-instrumentor.yaml new file mode 100644 index 0000000..5e7f041 --- /dev/null +++ b/webhook/helm/templates/cr-webhook-instrumentor.yaml @@ -0,0 +1,53 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ .Values.serviceaccount }} +rules: + - apiGroups: + - "" + resources: + - namespaces + - configmaps + # - secrets + - pods + verbs: + - get + - watch + - list + - apiGroups: + - "" + resources: + - services + verbs: + - get + - list + - watch + - create + - update + - apiGroups: + - apps + resources: + - deployments + - daemonsets + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - ext.appd.com + resources: + - clusterinstrumentations + - instrumentations + - opentelemetrycollectors + verbs: + - create + - delete + - get + - list + - patch + - update + - watch diff --git a/webhook/helm/templates/crb-webhook-instrumentor.yaml b/webhook/helm/templates/crb-webhook-instrumentor.yaml new file mode 100644 index 0000000..440f637 --- /dev/null +++ b/webhook/helm/templates/crb-webhook-instrumentor.yaml @@ -0,0 +1,12 @@ +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.serviceaccount }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceaccount }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.serviceaccount }} + apiGroup: rbac.authorization.k8s.io diff --git a/webhook/helm/templates/crd-instrumetation-config.yaml b/webhook/helm/templates/crd-instrumetation-config.yaml new file mode 100644 index 0000000..4155714 --- /dev/null +++ b/webhook/helm/templates/crd-instrumetation-config.yaml @@ -0,0 +1,93 @@ +{{ if and (.Values.useCrdConfig) (not ( .Capabilities.APIVersions.Has "ext.appd.com/v1/AppDynamicsInstrumentation")) }} +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + # name must match the spec fields below, and be in the form: . + name: appdynamicsinstrumentations.ext.appd.com +spec: + # group name to use for REST API: /apis// + group: ext.appd.com + # list of versions supported by this CustomResourceDefinition + versions: + - name: v1 + # Each version can be enabled/disabled by Served flag. + served: true + # One and only one version must be marked as the storage version. + storage: true + schema: + openAPIV3Schema: + type: object + properties: + spec: + type: object + properties: + exclude: + type: array + items: + type: object + properties: + api: + type: string + kind: + type: string + name: + type: string + nameRegex: + type: string + include: + type: array + items: + type: object + properties: + api: + type: string + kind: + type: string + name: + type: string + nameRegex: + type: string + # either Namespaced or Cluster + scope: Namespaced + names: + # plural name to be used in the URL: /apis/// + plural: appdynamicsinstrumentations + # singular name to be used as an alias on the CLI and for display + singular: appdynamicsinstrumentation + # kind is normally the CamelCased singular type. Your resource manifests use this. + kind: AppDynamicsInstrumentation + # shortNames allow shorter string to match your resource on the CLI + shortNames: + - adi + - adis + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ .Values.serviceaccount }}-crd + namespace: {{ .Release.Namespace }} +rules: + - apiGroups: + - "ext.appd.com" + resources: + - "*" + verbs: + - "*" + + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.serviceaccount }}-crd + namespace: {{ .Release.Namespace }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceaccount }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ .Values.serviceaccount }}-crd + apiGroup: rbac.authorization.k8s.io +{{ end }} \ No newline at end of file diff --git a/webhook/helm/templates/d-webhook-instrumentor.yaml b/webhook/helm/templates/d-webhook-instrumentor.yaml new file mode 100644 index 0000000..37d7e44 --- /dev/null +++ b/webhook/helm/templates/d-webhook-instrumentor.yaml @@ -0,0 +1,50 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.deploymentName }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.deploymentName }} +spec: + replicas: {{ .Values.replicas }} + selector: + matchLabels: + app: {{ .Values.deploymentName }} + template: + metadata: + labels: + app: {{ .Values.deploymentName }} + spec: + serviceAccountName: {{ .Values.serviceaccount }} + containers: + - name: {{ .Values.deploymentName }} + command: + - /go/bin/webhook + {{ if .Values.otelTracing }} + - --otel-tracing=true + - --otel-service-name={{ .Values.otelTracing.serviceName }} + - --otel-service-namespace={{ .Release.Namespace }} + - --otel-endpoint={{ .Values.otelTracing.endpoint }} + - --otel-samples-per-million={{ .Values.otelTracing.samplesPerMillion }} + - --otel-log-layload={{ .Values.otelTracing.logPayload }} + {{ end }} + image: {{ .Values.image.image }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: 8443 + name: webhook-api + resources: + limits: + cpu: "1" + memory: 1Gi + requests: + cpu: 250m + memory: 200Mi + volumeMounts: + - name: {{ template "webhook-instrumentor.name" . }}-certs + mountPath: /run/secrets/tls + readOnly: true + volumes: + - name: {{ template "webhook-instrumentor.name" . }}-certs + secret: + secretName: {{ template "webhook-instrumentor.name" . }}-certs diff --git a/webhook/helm/templates/db-agent/d-db-agent.yaml b/webhook/helm/templates/db-agent/d-db-agent.yaml new file mode 100644 index 0000000..4526e69 --- /dev/null +++ b/webhook/helm/templates/db-agent/d-db-agent.yaml @@ -0,0 +1,47 @@ +{{ range $key, $val := .Values.dbAgents }} +--- + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: db-agent-{{ $key }} + namespace: {{ $.Release.Namespace }} + labels: + app: db-agent-{{ $key }} +spec: + replicas: 1 + selector: + matchLabels: + app: db-agent-{{ $key }} + template: + metadata: + labels: + app: db-agent-{{ $key }} + spec: + serviceAccountName: {{ $.Values.serviceaccount }} + containers: + - name: db-agent-{{ $key }} + image: {{ $val.image.image }} + imagePullPolicy: {{ $val.image.imagePullPolicy }} + env: + - name: APPDYNAMICS_CONTROLLER_HOST_NAME + value: {{ $.Values.appdController.host }} + - name: APPDYNAMICS_CONTROLLER_PORT + value: "{{ $.Values.appdController.port }}" + - name: APPDYNAMICS_CONTROLLER_SSL_ENABLED + value: "{{ $.Values.appdController.isSecure }}" + - name: APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY + value: {{ $.Values.appdController.accessKey }} + - name: APPDYNAMICS_AGENT_ACCOUNT_NAME + value: {{ $.Values.appdController.accountName }} + - name: _JAVA_OPTIONS + value: -Ddbagent.name={{ $key }} + resources: + limits: + cpu: "1" + memory: 1Gi + requests: + cpu: 100m + memory: 200Mi + +{{ end }} \ No newline at end of file diff --git a/webhook/helm/templates/ext.appd.com_clusterinstrumentations.yaml b/webhook/helm/templates/ext.appd.com_clusterinstrumentations.yaml new file mode 100644 index 0000000..5e3fa26 --- /dev/null +++ b/webhook/helm/templates/ext.appd.com_clusterinstrumentations.yaml @@ -0,0 +1,308 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: clusterinstrumentations.ext.appd.com +spec: + group: ext.appd.com + names: + kind: ClusterInstrumentation + listKind: ClusterInstrumentationList + plural: clusterinstrumentations + singular: clusterinstrumentation + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: Instrumentation defines how to inject agent into workload. + properties: + injectionRuleSet: + items: + properties: + applicationName: + type: string + applicationNameAnnotation: + type: string + applicationNameExpression: + type: string + applicationNameLabel: + type: string + applicationNameSource: + description: Source of AppDynamics application name + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + doNotInstrument: + type: boolean + env: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + image: + type: string + injectK8SOtelResourceAttrs: + type: boolean + javaCustomConfig: + type: string + javaEnvVar: + type: string + logLevel: + type: string + netvizPort: + type: string + openTelemetryCollector: + type: string + options: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + resourceReservation: + properties: + cpu: + description: CPU reservation value + type: string + memory: + description: Memory allocation reservation value + type: string + type: object + technology: + description: The programming language or solution to instrument + enum: + - java + - dotnetcore + - nodejs + - apache + - nginx + - java/appd + - dotnetcore/appd + - nodejs/appd + - apache/appd + - nginx/appd + - java/otel + - dotnetcore/otel + - nodejs/otel + - apache/otel + - nginx/otel + type: string + template: + type: string + tierName: + type: string + tierNameAnnotation: + type: string + tierNameExpression: + type: string + tierNameLabel: + type: string + tierNameSource: + description: Source of AppDynamics tier name + enum: + - auto + - manual + - label + - annotation + - namespace + type: string + usePodNameForNodeName: + type: boolean + type: object + type: array + injectionRules: + description: Injection rule specifies how the instrumentation should + be done + properties: + applicationName: + type: string + applicationNameAnnotation: + type: string + applicationNameExpression: + type: string + applicationNameLabel: + type: string + applicationNameSource: + description: Source of AppDynamics application name + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + doNotInstrument: + type: boolean + env: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + image: + type: string + injectK8SOtelResourceAttrs: + type: boolean + javaCustomConfig: + type: string + javaEnvVar: + type: string + logLevel: + type: string + netvizPort: + type: string + openTelemetryCollector: + type: string + options: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + resourceReservation: + properties: + cpu: + description: CPU reservation value + type: string + memory: + description: Memory allocation reservation value + type: string + type: object + technology: + description: The programming language or solution to instrument + enum: + - java + - dotnetcore + - nodejs + - apache + - nginx + - java/appd + - dotnetcore/appd + - nodejs/appd + - apache/appd + - nginx/appd + - java/otel + - dotnetcore/otel + - nodejs/otel + - apache/otel + - nginx/otel + type: string + template: + type: string + tierName: + type: string + tierNameAnnotation: + type: string + tierNameExpression: + type: string + tierNameLabel: + type: string + tierNameSource: + description: Source of AppDynamics tier name + enum: + - auto + - manual + - label + - annotation + - namespace + type: string + usePodNameForNodeName: + type: boolean + type: object + matchRules: + description: Match rule matches the workload for injection + properties: + annotations: + description: List of annotations and their regex values to match + items: + additionalProperties: + type: string + type: object + type: array + labels: + description: List of labels and their regex values to match + items: + additionalProperties: + type: string + type: object + type: array + namespaceRegex: + description: Regex by which to match namespace of the workload. + Used only for ClusterInstrumentation. + type: string + podNameRegex: + description: Regex to match names of pods + type: string + type: object + name: + type: string + priority: + default: 1 + description: Priority defines priority of this rule - 1 is lowest + type: integer + required: + - priority + type: object + status: + description: ClusterInstrumentationStatus defines status of the instrumentation. + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/webhook/helm/templates/ext.appd.com_instrumentations.yaml b/webhook/helm/templates/ext.appd.com_instrumentations.yaml new file mode 100644 index 0000000..34dff7c --- /dev/null +++ b/webhook/helm/templates/ext.appd.com_instrumentations.yaml @@ -0,0 +1,311 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: instrumentations.ext.appd.com +spec: + group: ext.appd.com + names: + kind: Instrumentation + listKind: InstrumentationList + plural: instrumentations + shortNames: + - instr + - instrs + singular: instrumentation + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: Instrumentation defines how to inject agent into workload. + properties: + injectionRuleSet: + items: + properties: + applicationName: + type: string + applicationNameAnnotation: + type: string + applicationNameExpression: + type: string + applicationNameLabel: + type: string + applicationNameSource: + description: Source of AppDynamics application name + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + doNotInstrument: + type: boolean + env: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + image: + type: string + injectK8SOtelResourceAttrs: + type: boolean + javaCustomConfig: + type: string + javaEnvVar: + type: string + logLevel: + type: string + netvizPort: + type: string + openTelemetryCollector: + type: string + options: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + resourceReservation: + properties: + cpu: + description: CPU reservation value + type: string + memory: + description: Memory allocation reservation value + type: string + type: object + technology: + description: The programming language or solution to instrument + enum: + - java + - dotnetcore + - nodejs + - apache + - nginx + - java/appd + - dotnetcore/appd + - nodejs/appd + - apache/appd + - nginx/appd + - java/otel + - dotnetcore/otel + - nodejs/otel + - apache/otel + - nginx/otel + type: string + template: + type: string + tierName: + type: string + tierNameAnnotation: + type: string + tierNameExpression: + type: string + tierNameLabel: + type: string + tierNameSource: + description: Source of AppDynamics tier name + enum: + - auto + - manual + - label + - annotation + - namespace + type: string + usePodNameForNodeName: + type: boolean + type: object + type: array + injectionRules: + description: Injection rule specifies how the instrumentation should + be done + properties: + applicationName: + type: string + applicationNameAnnotation: + type: string + applicationNameExpression: + type: string + applicationNameLabel: + type: string + applicationNameSource: + description: Source of AppDynamics application name + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + doNotInstrument: + type: boolean + env: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + image: + type: string + injectK8SOtelResourceAttrs: + type: boolean + javaCustomConfig: + type: string + javaEnvVar: + type: string + logLevel: + type: string + netvizPort: + type: string + openTelemetryCollector: + type: string + options: + items: + properties: + name: + description: Variable name + type: string + value: + description: Variable value + type: string + type: object + type: array + resourceReservation: + properties: + cpu: + description: CPU reservation value + type: string + memory: + description: Memory allocation reservation value + type: string + type: object + technology: + description: The programming language or solution to instrument + enum: + - java + - dotnetcore + - nodejs + - apache + - nginx + - java/appd + - dotnetcore/appd + - nodejs/appd + - apache/appd + - nginx/appd + - java/otel + - dotnetcore/otel + - nodejs/otel + - apache/otel + - nginx/otel + type: string + template: + type: string + tierName: + type: string + tierNameAnnotation: + type: string + tierNameExpression: + type: string + tierNameLabel: + type: string + tierNameSource: + description: Source of AppDynamics tier name + enum: + - auto + - manual + - label + - annotation + - namespace + type: string + usePodNameForNodeName: + type: boolean + type: object + matchRules: + description: Match rule matches the workload for injection + properties: + annotations: + description: List of annotations and their regex values to match + items: + additionalProperties: + type: string + type: object + type: array + labels: + description: List of labels and their regex values to match + items: + additionalProperties: + type: string + type: object + type: array + namespaceRegex: + description: Regex by which to match namespace of the workload. + Used only for ClusterInstrumentation. + type: string + podNameRegex: + description: Regex to match names of pods + type: string + type: object + name: + type: string + priority: + default: 1 + description: Priority defines priority of this rule - 1 is lowest + type: integer + required: + - priority + type: object + status: + description: InstrumentationStatus defines status of the instrumentation. + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/webhook/helm/templates/ext.appd.com_opentelemetrycollectors.yaml b/webhook/helm/templates/ext.appd.com_opentelemetrycollectors.yaml new file mode 100644 index 0000000..1ee5eb7 --- /dev/null +++ b/webhook/helm/templates/ext.appd.com_opentelemetrycollectors.yaml @@ -0,0 +1,2149 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: opentelemetrycollectors.ext.appd.com +spec: + group: ext.appd.com + names: + kind: OpenTelemetryCollector + listKind: OpenTelemetryCollectorList + plural: opentelemetrycollectors + shortNames: + - otelcol + - otelcols + singular: opentelemetrycollector + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: Deployment Mode + jsonPath: .spec.mode + name: Mode + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: OpenTelemetryCollector is the Schema for the opentelemetrycollectors + API. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: OpenTelemetryCollectorSpec defines the desired state of OpenTelemetryCollector. + properties: + args: + additionalProperties: + type: string + description: Args is the set of arguments to pass to the main container's + binary. + type: object + config: + description: |- + Config is the raw JSON to be used as the collector's configuration. Refer to the OpenTelemetry Collector documentation for details. + The empty objects e.g. batch: should be written as batch: {} otherwise they won't work with kustomize or kubectl edit. + type: string + env: + description: Environment variables to set on the generated pods. + items: + description: EnvVar represents an environment variable present in + a Container. + properties: + name: + description: Name of the environment variable. Must be a C_IDENTIFIER. + type: string + value: + description: |- + Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in the container and + any service environment variables. If a variable cannot be resolved, + the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether the variable + exists or not. + Defaults to "". + type: string + valueFrom: + description: Source for the environment variable's value. Cannot + be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + optional: + description: Specify whether the ConfigMap or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: |- + Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, + spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. + properties: + apiVersion: + description: Version of the schema the FieldPath is + written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the specified + API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the exposed + resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in the pod's namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + optional: + description: Specify whether the Secret or its key must + be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + description: List of sources to populate environment variables on + the generated pods. + items: + description: EnvFromSource represents the source of a set of ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + optional: + description: Specify whether the ConfigMap must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend to each key in + the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + optional: + description: Specify whether the Secret must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + description: Image indicates the container image to use for the generated + pods. + type: string + imagePullPolicy: + description: ImagePullPolicy indicates the pull policy to be used + for retrieving the container image. + type: string + mode: + allOf: + - enum: + - deployment + - sidecar + - enum: + - deployment + - sidecar + - external + description: Mode represents how the collector should be deployed + (deployment or sidecar) + type: string + otlpEndpoint: + description: |- + OtlpEndpoint is the hostname of an OpenTelemetry collector running independently from the instrumentor tool. + Used only for Mode == ModeExternal + type: string + ports: + description: |- + Ports allows a set of ports to be exposed by the underlying v1.Service. By default, the operator + will attempt to infer the required ports by parsing the .Spec.Config property but this property can be + used to open additional ports that can't be inferred by the operator, like for custom receivers. + items: + description: ServicePort contains information on service's port. + properties: + appProtocol: + description: |- + The application protocol for this port. + This is used as a hint for implementations to offer richer behavior for protocols that they understand. + This field follows standard Kubernetes label syntax. + Valid values are either: + + + * Un-prefixed protocol names - reserved for IANA standard service names (as per + RFC-6335 and https://www.iana.org/assignments/service-names). + + + * Kubernetes-defined prefixed names: + * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- + * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 + * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 + + + * Other protocols should use implementation-defined prefixed names such as + mycompany.com/my-custom-protocol. + type: string + name: + description: |- + The name of this port within the service. This must be a DNS_LABEL. + All ports within a ServiceSpec must have unique names. When considering + the endpoints for a Service, this must match the 'name' field in the + EndpointPort. + Optional if only one ServicePort is defined on this service. + type: string + nodePort: + description: |- + The port on each node on which this service is exposed when type is + NodePort or LoadBalancer. Usually assigned by the system. If a value is + specified, in-range, and not in use it will be used, otherwise the + operation will fail. If not specified, a port will be allocated if this + Service requires one. If this field is specified when creating a + Service which does not need it, creation will fail. This field will be + wiped when updating a Service to no longer need it (e.g. changing type + from NodePort to ClusterIP). + More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + format: int32 + type: integer + port: + description: The port that will be exposed by this service. + format: int32 + type: integer + protocol: + default: TCP + description: |- + The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". + Default is TCP. + type: string + targetPort: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the pods targeted by the service. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. + If this is a string, it will be looked up as a named port in the + target Pod's container ports. If this is not specified, the value + of the 'port' field is used (an identity map). + This field is ignored for services with clusterIP=None, and should be + omitted or set equal to the 'port' field. + More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service + x-kubernetes-int-or-string: true + required: + - port + type: object + type: array + x-kubernetes-list-type: atomic + replicas: + description: Replicas is the number of pod instances for the underlying + replicaset. Set this if you are not using autoscaling. + format: int32 + type: integer + resources: + description: Resources to set on generated pods. + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + serviceAccount: + description: |- + ServiceAccount indicates the name of an existing service account to use with this instance. When set, + the operator will not automatically create a ServiceAccount. + type: string + volumeMounts: + description: VolumeMounts represents the mount points to use in the + underlying deployment(s). + items: + description: VolumeMount describes a mounting of a Volume within + a container. + properties: + mountPath: + description: |- + Path within the container at which the volume should be mounted. Must + not contain ':'. + type: string + mountPropagation: + description: |- + mountPropagation determines how mounts are propagated from the host + to container and the other way around. + When not set, MountPropagationNone is used. + This field is beta in 1.10. + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: |- + Mounted read-only if true, read-write otherwise (false or unspecified). + Defaults to false. + type: boolean + subPath: + description: |- + Path within the volume from which the container's volume should be mounted. + Defaults to "" (volume's root). + type: string + subPathExpr: + description: |- + Expanded path within the volume from which the container's volume should be mounted. + Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. + Defaults to "" (volume's root). + SubPathExpr and SubPath are mutually exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + x-kubernetes-list-type: atomic + volumes: + description: Volumes represents which volumes to use in the underlying + deployment(s). + items: + description: Volume represents a named volume in a pod that may + be accessed by any container in the pod. + properties: + awsElasticBlockStore: + description: |- + awsElasticBlockStore represents an AWS Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + properties: + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + TODO: how do we prevent errors in the filesystem from compromising the machine + type: string + partition: + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + format: int32 + type: integer + readOnly: + description: |- + readOnly value true will force the readOnly setting in VolumeMounts. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: boolean + volumeID: + description: |- + volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: string + required: + - volumeID + type: object + azureDisk: + description: azureDisk represents an Azure Data Disk mount on + the host and bind mount to the pod. + properties: + cachingMode: + description: 'cachingMode is the Host Caching mode: None, + Read Only, Read Write.' + type: string + diskName: + description: diskName is the Name of the data disk in the + blob storage + type: string + diskURI: + description: diskURI is the URI of data disk in the blob + storage + type: string + fsType: + description: |- + fsType is Filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + kind: + description: 'kind expected values are Shared: multiple + blob disks per storage account Dedicated: single blob + disk per storage account Managed: azure managed data + disk (only in managed availability set). defaults to shared' + type: string + readOnly: + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + description: azureFile represents an Azure File Service mount + on the host and bind mount to the pod. + properties: + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretName: + description: secretName is the name of secret that contains + Azure Storage Account Name and Key + type: string + shareName: + description: shareName is the azure share Name + type: string + required: + - secretName + - shareName + type: object + cephfs: + description: cephFS represents a Ceph FS mount on the host that + shares a pod's lifetime + properties: + monitors: + description: |- + monitors is Required: Monitors is a collection of Ceph monitors + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + items: + type: string + type: array + path: + description: 'path is Optional: Used as the mounted root, + rather than the full Ceph tree, default is /' + type: string + readOnly: + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: boolean + secretFile: + description: |- + secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: string + secretRef: + description: |- + secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + user: + description: |- + user is optional: User is the rados user name, default is admin + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: string + required: + - monitors + type: object + cinder: + description: |- + cinder represents a cinder volume attached and mounted on kubelets host machine. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: boolean + secretRef: + description: |- + secretRef is optional: points to a secret object containing parameters used to connect + to OpenStack. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + volumeID: + description: |- + volumeID used to identify the volume in cinder. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: string + required: + - volumeID + type: object + configMap: + description: configMap represents a configMap that should populate + this volume + properties: + defaultMode: + description: |- + defaultMode is optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + optional: + description: optional specify whether the ConfigMap or its + keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + csi: + description: csi (Container Storage Interface) represents ephemeral + storage that is handled by certain external CSI drivers (Beta + feature). + properties: + driver: + description: |- + driver is the name of the CSI driver that handles this volume. + Consult with your admin for the correct name as registered in the cluster. + type: string + fsType: + description: |- + fsType to mount. Ex. "ext4", "xfs", "ntfs". + If not provided, the empty value is passed to the associated CSI driver + which will determine the default filesystem to apply. + type: string + nodePublishSecretRef: + description: |- + nodePublishSecretRef is a reference to the secret object containing + sensitive information to pass to the CSI driver to complete the CSI + NodePublishVolume and NodeUnpublishVolume calls. + This field is optional, and may be empty if no secret is required. If the + secret object contains more than one secret, all secret references are passed. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + readOnly: + description: |- + readOnly specifies a read-only configuration for the volume. + Defaults to false (read/write). + type: boolean + volumeAttributes: + additionalProperties: + type: string + description: |- + volumeAttributes stores driver-specific properties that are passed to the CSI + driver. Consult your driver's documentation for supported values. + type: object + required: + - driver + type: object + downwardAPI: + description: downwardAPI represents downward API about the pod + that should populate this volume + properties: + defaultMode: + description: |- + Optional: mode bits to use on created files by default. Must be a + Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: Items is a list of downward API volume file + items: + description: DownwardAPIVolumeFile represents information + to create the file containing the pod field + properties: + fieldRef: + description: 'Required: Selects a field of the pod: + only annotations, labels, name and namespace are + supported.' + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the + specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: 'Required: Path is the relative path + name of the file to be created. Must not be absolute + or contain the ''..'' path. Must be utf-8 encoded. + The first item of the relative path must not start + with ''..''' + type: string + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the + exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + emptyDir: + description: |- + emptyDir represents a temporary directory that shares a pod's lifetime. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + properties: + medium: + description: |- + medium represents what type of storage medium should back this directory. + The default is "" which means to use the node's default medium. + Must be an empty string (default) or Memory. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + description: |- + sizeLimit is the total amount of local storage required for this EmptyDir volume. + The size limit is also applicable for memory medium. + The maximum usage on memory medium EmptyDir would be the minimum value between + the SizeLimit specified here and the sum of memory limits of all containers in a pod. + The default is nil which means that the limit is undefined. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + ephemeral: + description: |- + ephemeral represents a volume that is handled by a cluster storage driver. + The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, + and deleted when the pod is removed. + + + Use this if: + a) the volume is only needed while the pod runs, + b) features of normal volumes like restoring from snapshot or capacity + tracking are needed, + c) the storage driver is specified through a storage class, and + d) the storage driver supports dynamic volume provisioning through + a PersistentVolumeClaim (see EphemeralVolumeSource for more + information on the connection between this volume type + and PersistentVolumeClaim). + + + Use PersistentVolumeClaim or one of the vendor-specific + APIs for volumes that persist for longer than the lifecycle + of an individual pod. + + + Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to + be used that way - see the documentation of the driver for + more information. + + + A pod can use both types of ephemeral volumes and + persistent volumes at the same time. + properties: + volumeClaimTemplate: + description: |- + Will be used to create a stand-alone PVC to provision the volume. + The pod in which this EphemeralVolumeSource is embedded will be the + owner of the PVC, i.e. the PVC will be deleted together with the + pod. The name of the PVC will be `-` where + `` is the name from the `PodSpec.Volumes` array + entry. Pod validation will reject the pod if the concatenated name + is not valid for a PVC (for example, too long). + + + An existing PVC with that name that is not owned by the pod + will *not* be used for the pod to avoid using an unrelated + volume by mistake. Starting the pod is then blocked until + the unrelated PVC is removed. If such a pre-created PVC is + meant to be used by the pod, the PVC has to updated with an + owner reference to the pod once the pod exists. Normally + this should not be necessary, but it may be useful when + manually reconstructing a broken cluster. + + + This field is read-only and no changes will be made by Kubernetes + to the PVC after it has been created. + + + Required, must not be nil. + properties: + metadata: + description: |- + May contain labels and annotations that will be copied into the PVC + when creating it. No other fields are allowed and will be rejected during + validation. + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + spec: + description: |- + The specification for the PersistentVolumeClaim. The entire content is + copied unchanged into the PVC that gets created from this + template. The same fields as in a PersistentVolumeClaim + are also valid here. + properties: + accessModes: + description: |- + accessModes contains the desired access modes the volume should have. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 + items: + type: string + type: array + dataSource: + description: |- + dataSource field can be used to specify either: + * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller can support the specified data source, + it will create a new volume based on the contents of the specified data source. + When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, + and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not be copied to dataSource. + properties: + apiGroup: + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being + referenced + type: string + name: + description: Name is the name of resource being + referenced + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + description: |- + dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + volume is desired. This may be any object from a non-empty API group (non + core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed if the type of + the specified object matches some installed volume populator or dynamic + provisioner. + This field will replace the functionality of the dataSource field and as such + if both fields are non-empty, they must have the same value. For backwards + compatibility, when namespace isn't specified in dataSourceRef, + both fields (dataSource and dataSourceRef) will be set to the same + value automatically if one of them is empty and the other is non-empty. + When namespace is specified in dataSourceRef, + dataSource isn't set to the same value and must be empty. + There are three important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, dataSourceRef + allows any non-core object, as well as PersistentVolumeClaim objects. + * While dataSource ignores disallowed values (dropping them), dataSourceRef + preserves all values, and generates an error if a disallowed value is + specified. + * While dataSource only allows local objects, dataSourceRef allows objects + in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + properties: + apiGroup: + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being + referenced + type: string + name: + description: Name is the name of resource being + referenced + type: string + namespace: + description: |- + Namespace is the namespace of resource being referenced + Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + type: string + required: + - kind + - name + type: object + resources: + description: |- + resources represents the minimum resources the volume should have. + If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements + that are lower than previous value but must still be higher than capacity recorded in the + status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + selector: + description: selector is a label query over volumes + to consider for binding. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + description: |- + storageClassName is the name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 + type: string + volumeAttributesClassName: + description: |- + volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. + If specified, the CSI driver will create or update the volume with the attributes defined + in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, + it can be changed after the claim is created. An empty string value means that no VolumeAttributesClass + will be applied to the claim but it's not allowed to reset this field to empty string once it is set. + If unspecified and the PersistentVolumeClaim is unbound, the default VolumeAttributesClass + will be set by the persistentvolume controller if it exists. + If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be + set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource + exists. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass + (Alpha) Using this field requires the VolumeAttributesClass feature gate to be enabled. + type: string + volumeMode: + description: |- + volumeMode defines what type of volume is required by the claim. + Value of Filesystem is implied when not included in claim spec. + type: string + volumeName: + description: volumeName is the binding reference + to the PersistentVolume backing this claim. + type: string + type: object + required: + - spec + type: object + type: object + fc: + description: fc represents a Fibre Channel resource that is + attached to a kubelet's host machine and then exposed to the + pod. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + TODO: how do we prevent errors in the filesystem from compromising the machine + type: string + lun: + description: 'lun is Optional: FC target lun number' + format: int32 + type: integer + readOnly: + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + targetWWNs: + description: 'targetWWNs is Optional: FC target worldwide + names (WWNs)' + items: + type: string + type: array + wwids: + description: |- + wwids Optional: FC volume world wide identifiers (wwids) + Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. + items: + type: string + type: array + type: object + flexVolume: + description: |- + flexVolume represents a generic volume resource that is + provisioned/attached using an exec based plugin. + properties: + driver: + description: driver is the name of the driver to use for + this volume. + type: string + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + type: string + options: + additionalProperties: + type: string + description: 'options is Optional: this field holds extra + command options if any.' + type: object + readOnly: + description: |- + readOnly is Optional: defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef is Optional: secretRef is reference to the secret object containing + sensitive information to pass to the plugin scripts. This may be + empty if no secret object is specified. If the secret object + contains more than one secret, all secrets are passed to the plugin + scripts. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + required: + - driver + type: object + flocker: + description: flocker represents a Flocker volume attached to + a kubelet's host machine. This depends on the Flocker control + service being running + properties: + datasetName: + description: |- + datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker + should be considered as deprecated + type: string + datasetUUID: + description: datasetUUID is the UUID of the dataset. This + is unique identifier of a Flocker dataset + type: string + type: object + gcePersistentDisk: + description: |- + gcePersistentDisk represents a GCE Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + properties: + fsType: + description: |- + fsType is filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + TODO: how do we prevent errors in the filesystem from compromising the machine + type: string + partition: + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + format: int32 + type: integer + pdName: + description: |- + pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: string + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: boolean + required: + - pdName + type: object + gitRepo: + description: |- + gitRepo represents a git repository at a particular revision. + DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an + EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir + into the Pod's container. + properties: + directory: + description: |- + directory is the target directory name. + Must not contain or start with '..'. If '.' is supplied, the volume directory will be the + git repository. Otherwise, if specified, the volume will contain the git repository in + the subdirectory with the given name. + type: string + repository: + description: repository is the URL + type: string + revision: + description: revision is the commit hash for the specified + revision. + type: string + required: + - repository + type: object + glusterfs: + description: |- + glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/glusterfs/README.md + properties: + endpoints: + description: |- + endpoints is the endpoint name that details Glusterfs topology. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: string + path: + description: |- + path is the Glusterfs volume path. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: string + readOnly: + description: |- + readOnly here will force the Glusterfs volume to be mounted with read-only permissions. + Defaults to false. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: boolean + required: + - endpoints + - path + type: object + hostPath: + description: |- + hostPath represents a pre-existing file or directory on the host + machine that is directly exposed to the container. This is generally + used for system agents or other privileged things that are allowed + to see the host machine. Most containers will NOT need this. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + --- + TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not + mount host directories as read/write. + properties: + path: + description: |- + path of the directory on the host. + If the path is a symlink, it will follow the link to the real path. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + type: string + type: + description: |- + type for HostPath Volume + Defaults to "" + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + type: string + required: + - path + type: object + iscsi: + description: |- + iscsi represents an ISCSI Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://examples.k8s.io/volumes/iscsi/README.md + properties: + chapAuthDiscovery: + description: chapAuthDiscovery defines whether support iSCSI + Discovery CHAP authentication + type: boolean + chapAuthSession: + description: chapAuthSession defines whether support iSCSI + Session CHAP authentication + type: boolean + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi + TODO: how do we prevent errors in the filesystem from compromising the machine + type: string + initiatorName: + description: |- + initiatorName is the custom iSCSI Initiator Name. + If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface + : will be created for the connection. + type: string + iqn: + description: iqn is the target iSCSI Qualified Name. + type: string + iscsiInterface: + description: |- + iscsiInterface is the interface Name that uses an iSCSI transport. + Defaults to 'default' (tcp). + type: string + lun: + description: lun represents iSCSI Target Lun number. + format: int32 + type: integer + portals: + description: |- + portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). + items: + type: string + type: array + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + type: boolean + secretRef: + description: secretRef is the CHAP Secret for iSCSI target + and initiator authentication + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + targetPortal: + description: |- + targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + description: |- + name of the volume. + Must be a DNS_LABEL and unique within the pod. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + nfs: + description: |- + nfs represents an NFS mount on the host that shares a pod's lifetime + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + properties: + path: + description: |- + path that is exported by the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: string + readOnly: + description: |- + readOnly here will force the NFS export to be mounted with read-only permissions. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: boolean + server: + description: |- + server is the hostname or IP address of the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + description: |- + persistentVolumeClaimVolumeSource represents a reference to a + PersistentVolumeClaim in the same namespace. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + properties: + claimName: + description: |- + claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + type: string + readOnly: + description: |- + readOnly Will force the ReadOnly setting in VolumeMounts. + Default false. + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + description: photonPersistentDisk represents a PhotonController + persistent disk attached and mounted on kubelets host machine + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + pdID: + description: pdID is the ID that identifies Photon Controller + persistent disk + type: string + required: + - pdID + type: object + portworxVolume: + description: portworxVolume represents a portworx volume attached + and mounted on kubelets host machine + properties: + fsType: + description: |- + fSType represents the filesystem type to mount + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + volumeID: + description: volumeID uniquely identifies a Portworx volume + type: string + required: + - volumeID + type: object + projected: + description: projected items for all in one resources secrets, + configmaps, and downward API + properties: + defaultMode: + description: |- + defaultMode are the mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + sources: + description: sources is the list of volume projections + items: + description: Projection that may be projected along with + other supported volume types + properties: + clusterTrustBundle: + description: |- + ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field + of ClusterTrustBundle objects in an auto-updating file. + + + Alpha, gated by the ClusterTrustBundleProjection feature gate. + + + ClusterTrustBundle objects can either be selected by name, or by the + combination of signer name and a label selector. + + + Kubelet performs aggressive normalization of the PEM contents written + into the pod filesystem. Esoteric PEM features such as inter-block + comments and block headers are stripped. Certificates are deduplicated. + The ordering of certificates within the file is arbitrary, and Kubelet + may change the order over time. + properties: + labelSelector: + description: |- + Select all ClusterTrustBundles that match this label selector. Only has + effect if signerName is set. Mutually-exclusive with name. If unset, + interpreted as "match nothing". If set but empty, interpreted as "match + everything". + properties: + matchExpressions: + description: matchExpressions is a list of + label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + name: + description: |- + Select a single ClusterTrustBundle by object name. Mutually-exclusive + with signerName and labelSelector. + type: string + optional: + description: |- + If true, don't block pod startup if the referenced ClusterTrustBundle(s) + aren't available. If using name, then the named ClusterTrustBundle is + allowed not to exist. If using signerName, then the combination of + signerName and labelSelector is allowed to match zero + ClusterTrustBundles. + type: boolean + path: + description: Relative path from the volume root + to write the bundle. + type: string + signerName: + description: |- + Select all ClusterTrustBundles that match this signer name. + Mutually-exclusive with name. The contents of all selected + ClusterTrustBundles will be unified and deduplicated. + type: string + required: + - path + type: object + configMap: + description: configMap information about the configMap + data to project + properties: + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within + a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + optional: + description: optional specify whether the ConfigMap + or its keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + downwardAPI: + description: downwardAPI information about the downwardAPI + data to project + properties: + items: + description: Items is a list of DownwardAPIVolume + file + items: + description: DownwardAPIVolumeFile represents + information to create the file containing + the pod field + properties: + fieldRef: + description: 'Required: Selects a field + of the pod: only annotations, labels, + name and namespace are supported.' + properties: + apiVersion: + description: Version of the schema the + FieldPath is written in terms of, + defaults to "v1". + type: string + fieldPath: + description: Path of the field to select + in the specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: 'Required: Path is the relative + path name of the file to be created. Must + not be absolute or contain the ''..'' + path. Must be utf-8 encoded. The first + item of the relative path must not start + with ''..''' + type: string + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + properties: + containerName: + description: 'Container name: required + for volumes, optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format + of the exposed resources, defaults + to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to + select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + description: secret information about the secret data + to project + properties: + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within + a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + optional: + description: optional field specify whether the + Secret or its key must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + serviceAccountToken: + description: serviceAccountToken is information about + the serviceAccountToken data to project + properties: + audience: + description: |- + audience is the intended audience of the token. A recipient of a token + must identify itself with an identifier specified in the audience of the + token, and otherwise should reject the token. The audience defaults to the + identifier of the apiserver. + type: string + expirationSeconds: + description: |- + expirationSeconds is the requested duration of validity of the service + account token. As the token approaches expiration, the kubelet volume + plugin will proactively rotate the service account token. The kubelet will + start trying to rotate the token if the token is older than 80 percent of + its time to live or if the token is older than 24 hours.Defaults to 1 hour + and must be at least 10 minutes. + format: int64 + type: integer + path: + description: |- + path is the path relative to the mount point of the file to project the + token into. + type: string + required: + - path + type: object + type: object + type: array + type: object + quobyte: + description: quobyte represents a Quobyte mount on the host + that shares a pod's lifetime + properties: + group: + description: |- + group to map volume access to + Default is no group + type: string + readOnly: + description: |- + readOnly here will force the Quobyte volume to be mounted with read-only permissions. + Defaults to false. + type: boolean + registry: + description: |- + registry represents a single or multiple Quobyte Registry services + specified as a string as host:port pair (multiple entries are separated with commas) + which acts as the central registry for volumes + type: string + tenant: + description: |- + tenant owning the given Quobyte volume in the Backend + Used with dynamically provisioned Quobyte volumes, value is set by the plugin + type: string + user: + description: |- + user to map volume access to + Defaults to serivceaccount user + type: string + volume: + description: volume is a string that references an already + created Quobyte volume by name. + type: string + required: + - registry + - volume + type: object + rbd: + description: |- + rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/rbd/README.md + properties: + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd + TODO: how do we prevent errors in the filesystem from compromising the machine + type: string + image: + description: |- + image is the rados image name. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + keyring: + description: |- + keyring is the path to key ring for RBDUser. + Default is /etc/ceph/keyring. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + monitors: + description: |- + monitors is a collection of Ceph monitors. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + items: + type: string + type: array + pool: + description: |- + pool is the rados pool name. + Default is rbd. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: boolean + secretRef: + description: |- + secretRef is name of the authentication secret for RBDUser. If provided + overrides keyring. + Default is nil. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + user: + description: |- + user is the rados user name. + Default is admin. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + required: + - image + - monitors + type: object + scaleIO: + description: scaleIO represents a ScaleIO persistent volume + attached and mounted on Kubernetes nodes. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". + Default is "xfs". + type: string + gateway: + description: gateway is the host address of the ScaleIO + API Gateway. + type: string + protectionDomain: + description: protectionDomain is the name of the ScaleIO + Protection Domain for the configured storage. + type: string + readOnly: + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef references to the secret for ScaleIO user and other + sensitive information. If this is not provided, Login operation will fail. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + sslEnabled: + description: sslEnabled Flag enable/disable SSL communication + with Gateway, default false + type: boolean + storageMode: + description: |- + storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. + Default is ThinProvisioned. + type: string + storagePool: + description: storagePool is the ScaleIO Storage Pool associated + with the protection domain. + type: string + system: + description: system is the name of the storage system as + configured in ScaleIO. + type: string + volumeName: + description: |- + volumeName is the name of a volume already created in the ScaleIO system + that is associated with this volume source. + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + description: |- + secret represents a secret that should populate this volume. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + properties: + defaultMode: + description: |- + defaultMode is Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values + for mode bits. Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: |- + items If unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + optional: + description: optional field specify whether the Secret or + its keys must be defined + type: boolean + secretName: + description: |- + secretName is the name of the secret in the pod's namespace to use. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + type: string + type: object + storageos: + description: storageOS represents a StorageOS volume attached + and mounted on Kubernetes nodes. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef specifies the secret to use for obtaining the StorageOS API + credentials. If not specified, default values will be attempted. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + volumeName: + description: |- + volumeName is the human-readable name of the StorageOS volume. Volume + names are only unique within a namespace. + type: string + volumeNamespace: + description: |- + volumeNamespace specifies the scope of the volume within StorageOS. If no + namespace is specified then the Pod's namespace will be used. This allows the + Kubernetes name scoping to be mirrored within StorageOS for tighter integration. + Set VolumeName to any name to override the default behaviour. + Set to "default" if you are not using namespaces within StorageOS. + Namespaces that do not pre-exist within StorageOS will be created. + type: string + type: object + vsphereVolume: + description: vsphereVolume represents a vSphere volume attached + and mounted on kubelets host machine + properties: + fsType: + description: |- + fsType is filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + storagePolicyID: + description: storagePolicyID is the storage Policy Based + Management (SPBM) profile ID associated with the StoragePolicyName. + type: string + storagePolicyName: + description: storagePolicyName is the storage Policy Based + Management (SPBM) profile name. + type: string + volumePath: + description: volumePath is the path that identifies vSphere + volume vmdk + type: string + required: + - volumePath + type: object + required: + - name + type: object + type: array + x-kubernetes-list-type: atomic + required: + - config + type: object + status: + description: OpenTelemetryCollectorStatus defines the observed state of + OpenTelemetryCollector. + type: object + type: object + served: true + storage: true + subresources: + scale: + labelSelectorPath: .status.scale.selector + specReplicasPath: .spec.replicas + statusReplicasPath: .status.scale.replicas + status: {} diff --git a/webhook/helm/templates/otel/cm-otel-collector-config.yaml b/webhook/helm/templates/otel/cm-otel-collector-config.yaml new file mode 100644 index 0000000..84273d8 --- /dev/null +++ b/webhook/helm/templates/otel/cm-otel-collector-config.yaml @@ -0,0 +1,22 @@ +{{ if .Values.openTelemetryCollectors }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: otel-collector-config + namespace: {{ $.Release.Namespace }} +data: +{{ range $key, $val := .Values.openTelemetryCollectors }} + {{ $key }}.mode: {{ $val.mode }} + {{ if eq $val.mode "external" }} + {{ $key }}.serviceName: {{ $val.collectorEndpoint }} + {{ else }} + {{ $key }}.config: {{ (tpl (toYaml $val.config) (dict "Values" $.Values "Template" $.Template)) | indent 2 }} + {{ $key }}.image.image: {{ $val.image.image }} + {{ $key }}.image.imagePullPolicy: {{ $val.image.imagePullPolicy }} + {{ $key }}.image.initImage: {{ $val.image.initImage }} + {{ $key }}.serviceName: otel-coll-{{ $key }}.{{ $.Release.Namespace}}.svc.cluster.local + {{ end }} + +{{ end }} +{{ end }} \ No newline at end of file diff --git a/webhook/helm/templates/otel/svc-d-otel-collector-service.yaml b/webhook/helm/templates/otel/svc-d-otel-collector-service.yaml new file mode 100644 index 0000000..7cbfd2f --- /dev/null +++ b/webhook/helm/templates/otel/svc-d-otel-collector-service.yaml @@ -0,0 +1,70 @@ +{{ range $key, $val := .Values.openTelemetryCollectors }} +{{ if eq $val.mode "deployment" }} +--- +apiVersion: v1 +kind: Service +metadata: + name: otel-coll-{{ $key }} + namespace: {{ $.Release.Namespace }} +spec: + selector: + app: otel-coll-{{ $key }} + ports: + - port: 4317 + targetPort: otlp-grpc + name: otlp-grpc + - port: 4318 + targetPort: otlp-http + name: otlp-http + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: otel-coll-{{ $key }} + namespace: {{ $.Release.Namespace }} + labels: + app: otel-coll-{{ $key }} +spec: + replicas: {{ $val.replicas }} + selector: + matchLabels: + app: otel-coll-{{ $key }} + template: + metadata: + labels: + app: otel-coll-{{ $key }} + spec: + serviceAccountName: {{ $.Values.serviceaccount }} + containers: + - name: otel-coll-{{ $key }} + image: {{ $val.image.image }} + imagePullPolicy: {{ $val.image.imagePullPolicy }} + args: + - --config + - /conf/otel-collector-config.yaml + ports: + - containerPort: 4317 + name: otlp-grpc + - containerPort: 4318 + name: otlp-http + resources: + limits: + cpu: "1" + memory: 1Gi + requests: + cpu: 250m + memory: 200Mi + volumeMounts: + - name: otel-collector-config-vol + mountPath: /conf + volumes: + - configMap: + name: otel-collector-config + items: + - key: {{ $key }}.config + path: otel-collector-config.yaml + name: otel-collector-config-vol + +{{ end }} +{{ end }} \ No newline at end of file diff --git a/webhook/helm/templates/r-webhook-instrumentor.yaml b/webhook/helm/templates/r-webhook-instrumentor.yaml new file mode 100644 index 0000000..c34be09 --- /dev/null +++ b/webhook/helm/templates/r-webhook-instrumentor.yaml @@ -0,0 +1,26 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ .Values.serviceaccount }} + namespace: {{ .Release.Namespace }} +rules: + - apiGroups: + - "" + resources: + - configmaps + - secrets + verbs: + - "*" + - apiGroups: + - ext.appd.com + resources: + - globalinstrumentation + - instrumentation + verbs: + - create + - delete + - get + - list + - patch + - update + - watch diff --git a/webhook/helm/templates/rb-webhook-instrumentor.yaml b/webhook/helm/templates/rb-webhook-instrumentor.yaml new file mode 100644 index 0000000..7a40eed --- /dev/null +++ b/webhook/helm/templates/rb-webhook-instrumentor.yaml @@ -0,0 +1,12 @@ +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.serviceaccount }} + namespace: {{ .Release.Namespace }} +subjects: + - kind: ServiceAccount + name: {{ .Values.serviceaccount }} +roleRef: + kind: Role + name: {{ .Values.serviceaccount }} + apiGroup: rbac.authorization.k8s.io \ No newline at end of file diff --git a/webhook/helm/templates/role.yaml b/webhook/helm/templates/role.yaml new file mode 100644 index 0000000..0889ccd --- /dev/null +++ b/webhook/helm/templates/role.yaml @@ -0,0 +1,19 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: appd-aac +rules: +- apiGroups: + - ext.appd.com + resources: + - ClusterInstrumentation + - instrumentation + verbs: + - create + - delete + - get + - list + - patch + - update + - watch diff --git a/webhook/helm/templates/sa-webhook-instrumentor.yaml b/webhook/helm/templates/sa-webhook-instrumentor.yaml new file mode 100644 index 0000000..f1587d3 --- /dev/null +++ b/webhook/helm/templates/sa-webhook-instrumentor.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.serviceaccount }} + namespace: {{ .Release.Namespace }} diff --git a/webhook/helm/templates/sec-and-mwhc-webhook-instrumentor.yaml b/webhook/helm/templates/sec-and-mwhc-webhook-instrumentor.yaml new file mode 100644 index 0000000..166b7fc --- /dev/null +++ b/webhook/helm/templates/sec-and-mwhc-webhook-instrumentor.yaml @@ -0,0 +1,140 @@ + +{{- $ca := genCA "webhook-change-group-webhook-ca" (.Values.certValidityDays | int) -}} +{{- $altNames := list ( printf "%s.%s" (include "webhook-instrumentor.name" .) .Release.Namespace ) ( printf "%s.%s.svc" (include "webhook-instrumentor.name" .) .Release.Namespace ) -}} +{{- $cert := genSignedCert ( include "webhook-instrumentor.name" . ) nil $altNames (.Values.certValidityDays | int) $ca -}} + +--- +{{- if not ( and ( .Values.useServiceCAonOCP ) ( .Capabilities.APIVersions.Has "apps.openshift.io/v1/DeploymentConfig") )}} +apiVersion: v1 +kind: Secret +type: kubernetes.io/tls +metadata: + namespace: {{ .Release.Namespace }} + name: {{ template "webhook-instrumentor.name" . }}-certs + labels: + app: {{ template "webhook-instrumentor.name" . }} + chart: {{ template "webhook-instrumentor.chart" . }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + annotations: + # "helm.sh/hook": "pre-install" + # "helm.sh/hook-delete-policy": "before-hook-creation" +data: + {{- if not (hasKey .Values "certs") }} + tls.crt: {{ $cert.Cert | b64enc | quote }} + tls.key: {{ $cert.Key | b64enc | quote }} + ca.crt: {{ $ca.Cert | b64enc | quote }} + {{- else }} + tls.crt: {{ .Values.certs.tlsCert | quote }} + tls.key: {{ .Values.certs.tlsKey | quote }} + ca.crt: {{ .Values.certs.caCert | quote }} + {{- end }} +{{- end }} + +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: MutatingWebhookConfiguration +metadata: + {{- if and ( .Values.useServiceCAonOCP ) ( .Capabilities.APIVersions.Has "apps.openshift.io/v1/DeploymentConfig") }} + annotations: + service.beta.openshift.io/inject-cabundle: 'true' + {{- end }} + name: {{ .Values.webhookName }} +webhooks: + - name: {{ ( printf "%s.%s.svc" (include "webhook-instrumentor.name" .) .Release.Namespace ) }} + sideEffects: None + admissionReviewVersions: ["v1", "v1beta1"] + timeoutSeconds: {{ .Values.timeoutSeconds | int }} + failurePolicy: {{ .Values.failurePolicy }} + clientConfig: + service: + name: {{ ( include "webhook-instrumentor.name" . ) }} + namespace: {{ .Release.Namespace }} + path: "/mutate" + port: 7443 + {{ if not ( and ( .Values.useServiceCAonOCP ) ( .Capabilities.APIVersions.Has "apps.openshift.io/v1/DeploymentConfig") )}} + {{ if not (hasKey .Values "certs") }} + caBundle: {{ $ca.Cert | b64enc | quote }} + {{ else }} + caBundle: {{ .Values.certs.caCert | quote }} + {{ end }} + {{ end }} + {{- if .Values.enabledForPodsWithLabels }} + objectSelector: + matchExpressions: + {{ range $idx, $value := .Values.enabledForPodsWithLabels }} + - key: {{ $value }} + operator: Exists + {{ end }} + {{- end }} + namespaceSelector: + matchExpressions: + {{- if .Values.namespacesEnabled }} + - key: kubernetes.io/metadata.name + operator: In + values: [{{ range $index, $element := .Values.namespacesEnabled }}{{if $index}},{{end}}"{{$element}}"{{end}}] + {{- end }} + - key: kubernetes.io/metadata.name + operator: NotIn + values: [ {{ .Release.Namespace | quote }}{{ if .Values.namespacesDisabled }},{{ range $index, $element := .Values.namespacesDisabled }}{{if $index}},{{end}}"{{$element}}"{{end}}{{end}}] + rules: + # mutating webhook for pods - actual instrumentation + - operations: [ "CREATE" ] + apiGroups: [""] + apiVersions: ["v1"] + resources: ["pods"] + +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: ValidatingWebhookConfiguration +metadata: + {{- if and ( .Values.useServiceCAonOCP ) ( .Capabilities.APIVersions.Has "apps.openshift.io/v1/DeploymentConfig") }} + annotations: + service.beta.openshift.io/inject-cabundle: 'true' + {{- end }} + name: {{ .Values.webhookName }}-validate +webhooks: + - name: {{ ( printf "%s.%s.svc" (include "webhook-instrumentor.name" .) .Release.Namespace ) }} + sideEffects: NoneOnDryRun #instrumentation registration is a side effect!!! + admissionReviewVersions: ["v1", "v1beta1", "v1alpha1"] + timeoutSeconds: {{ .Values.timeoutSeconds | int }} + failurePolicy: {{ .Values.failurePolicy }} + clientConfig: + service: + name: {{ ( include "webhook-instrumentor.name" . ) }} + namespace: {{ .Release.Namespace }} + path: "/validate" + port: 7443 + {{ if not ( and ( .Values.useServiceCAonOCP ) ( .Capabilities.APIVersions.Has "apps.openshift.io/v1/DeploymentConfig") )}} + {{ if not (hasKey .Values "certs") }} + caBundle: {{ $ca.Cert | b64enc | quote }} + {{ else }} + caBundle: {{ .Values.certs.caCert | quote }} + {{ end }} + {{ end }} + namespaceSelector: + matchExpressions: + {{- if .Values.namespacesEnabled }} + - key: kubernetes.io/metadata.name + operator: In + values: [{{ range $index, $element := .Values.namespacesEnabled }}{{if $index}},{{end}}"{{$element}}"{{end}}] + {{- end }} + - key: kubernetes.io/metadata.name + operator: NotIn + values: [ {{ .Release.Namespace | quote }}{{ if .Values.namespacesDisabled }},{{ range $index, $element := .Values.namespacesDisabled }}{{if $index}},{{end}}"{{$element}}"{{end}}{{end}}] + rules: + # admission webhook for cluster-wide instrumentation + - operations: [ "CREATE" ] + apiGroups: ["ext.appd.com"] + apiVersions: ["v1alpha1"] + resources: ["clusterinstrumentations"] + # admission webhook for namespaced instrumentation + - operations: [ "CREATE" ] + apiGroups: ["ext.appd.com"] + apiVersions: ["v1alpha1"] + resources: ["instrumentations"] + # admission webhook for namespaced OpenTelemetry collector + - operations: [ "CREATE" ] + apiGroups: ["ext.appd.com"] + apiVersions: ["v1alpha1"] + resources: ["opentelemetrycollectors"] diff --git a/webhook/helm/templates/svc-webhook-instrumentor.yaml b/webhook/helm/templates/svc-webhook-instrumentor.yaml new file mode 100644 index 0000000..4d2e557 --- /dev/null +++ b/webhook/helm/templates/svc-webhook-instrumentor.yaml @@ -0,0 +1,33 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ ( include "webhook-instrumentor.name" . ) }} + namespace: {{ .Release.Namespace }} + {{- if and ( .Values.useServiceCAonOCP ) ( .Capabilities.APIVersions.Has "apps.openshift.io/v1/DeploymentConfig") }} + annotations: + service.beta.openshift.io/serving-cert-secret-name: {{ template "webhook-instrumentor.name" . }}-certs + {{- end }} +spec: + selector: + app: {{ .Values.deploymentName }} + ports: + - port: 7443 + targetPort: webhook-api + +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ ( include "webhook-instrumentor.name" . ) }}-ext + namespace: {{ .Release.Namespace }} + {{- if and ( .Values.useServiceCAonOCP ) ( .Capabilities.APIVersions.Has "apps.openshift.io/v1/DeploymentConfig") }} + annotations: + service.beta.openshift.io/serving-cert-secret-name: {{ template "webhook-instrumentor.name" . }}-certs + {{- end }} +spec: + selector: + app: {{ .Values.deploymentName }} + ports: + - port: 7443 + targetPort: webhook-api + type: LoadBalancer \ No newline at end of file diff --git a/webhook/helm/values-sample-otel.yaml b/webhook/helm/values-sample-otel.yaml new file mode 100644 index 0000000..b0b2d72 --- /dev/null +++ b/webhook/helm/values-sample-otel.yaml @@ -0,0 +1,283 @@ + +serviceaccount: webhook-instrumentor +deploymentName: webhook-server +webhookName: webhook-appd +# namespacesEnabled is optional list of namespaces, where webhook would be applied. +# If missing, all namespaces will be enabled, except kubernetes system namespaces +# namespacesEnabled: +# - ns1 +# - ns2 +# +# namespacesDisabled is optional list of namespaces, where webhook would not be applied. +# If missing, all namespaces will be enabled, except kubernetes system namespaces +# (and namespace where the webook itself is running) +# namespacesDisabled: +# - ns3 +# +# enabledForPodsWithLabels is optional safety belt to try to instrument only pods +# having set labels to a specific values +# enabledForPodsWithLabels: +# - appdInstr +# +# number of replicas for webhook server +replicas: 1 +certValidityDays: 1024 +# failure policy can be Fail or Ignore. +# Ignore is safer - should the webhook fail or be unresponsive for timeoutSeconds, pod gets created unchanged +timeoutSeconds: 2 +failurePolicy: Ignore + +# optional - certs information. If missing, certs will be generated dynamically, but that does +# not work with helm upgrade (except on OpenShift with service CA usage) +# certs: +# tlsCert: +# tlsKey: +# caCert: + +# optional - useServiceCAonOCP: true - if set, on OpenShift, Service CA certificates will be used +useServiceCAonOCP: true + +# service type and port for webhook server +service: + type: ClusterIP + port: 443 + +# image for pods running the webhook functionality +image: + image: docker.io/chrlic/appd-webhook-instrumentor:v1.0.3-exp + pullPolicy: Always + +# optional AppDynamics controller access information - required if +# AppDynamics native/hybrid agents are used +appdController: + host: .saas.appdynamics.com + port: "443" + isSecure: true + accountName: + accessKey: "" + # useProxy: true + # proxyHost: proxy.corm.com + # proxyPort: "8080" + otelEndpoint: https://fra-sls-agent-api.saas.appdynamics.com + otelHeaderKey: "" + +# appdCloud: +# clientID: +# clientSecret: +# appdTokenUrl: +# appdVanityUrl: + +# optional OpenTelemetry parameters +# covers OTel Collector settings for AppDynamics cSaaS, AppDynamics Cloud, and Cisco Telescope +openTelemetryCollectors: + # collector name MUST be DNS friendly - only lowercase, numbers and "-" + deployment-hybrid-agent-default: + # mode - one of "sidecar", "deployment", "external" + mode: deployment + # replicas is only considered for OTel collector running as a deployment, otherwise ignored + replicas: 1 + image: + image: docker.io/otel/opentelemetry-collector-contrib:0.48.0 + imagePullPolicy: Always + initImage: docker.io/alpine:latest + config: > + receivers: + otlp: + protocols: + grpc: + http: + processors: + batch: + resource: + attributes: + - key: appdynamics.controller.account + action: upsert + value: "{{ .Values.appdController.accountName }}" + - key: appdynamics.controller.host + action: upsert + value: "{{ .Values.appdController.host }}" + - key: appdynamics.controller.port + action: upsert + value: {{ .Values.appdController.port }} + exporters: + logging: + loglevel: debug + # This part says that the opentelemetry collector will send data to OTIS pipeline for AppDynamicas CSaaS. + otlphttp: + tls: + insecure: true + endpoint: "{{ .Values.appdController.otelEndpoint }}" + headers: {"x-api-key": "{{ .Values.appdController.otelHeaderKey }}"} + service: + pipelines: + traces: + receivers: [otlp] + processors: [batch, resource] + exporters: [logging, otlphttp, otlphttp/telescope] + telemetry: + logs: + level: "debug" + sidecar-hybrid-agent-default: + # mode - one of "sidecar", "deployment", "external" + mode: sidecar + # replicas is only considered for OTel collector running as a deployment, otherwise ignored + replicas: 1 + image: + image: docker.io/otel/opentelemetry-collector-contrib:0.48.0 + imagePullPolicy: Always + initImage: docker.io/alpine:latest + config: > + receivers: + otlp: + protocols: + grpc: + http: + processors: + batch: + resource: + attributes: + - key: appdynamics.controller.account + action: upsert + value: "{{ .Values.appdController.accountName }}" + - key: appdynamics.controller.host + action: upsert + value: "{{ .Values.appdController.host }}" + - key: appdynamics.controller.port + action: upsert + value: {{ .Values.appdController.port }} + exporters: + logging: + loglevel: debug + # This part says that the opentelemetry collector will send data to OTIS pipeline for AppDynamicas CSaaS. + otlphttp: + tls: + insecure: true + endpoint: "{{ .Values.appdController.otelEndpoint }}" + headers: {"x-api-key": "{{ .Values.appdController.otelHeaderKey }}"} + service: + pipelines: + traces: + receivers: [otlp] + processors: [batch, resource] + exporters: [logging, otlphttp] + telemetry: + logs: + level: "debug" + external-hybrid-agent-default: + mode: external + collectorEndpoint: otel-collector.default.svc.cluster.local + +instrumentationTemplates: + - name: Java_Default + injectionRules: + # technology = java | dotnetcore | nodejs + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: JAVA_TOOL_OPTIONS + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + - name: Dotnet_Default + injectionRules: + technology: dotnetcore + image: appdynamics/dotnet-core-agent:22.5.1 + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + - name: Nodejs_Default + injectionRules: + technology: nodejs + image: appdynamics/nodejs-agent:22.5.0-16-stretch-slim + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + - name: Java_Otel + injectionRules: + # technology = java | dotnetcore | nodejs + # provider = appd | otel | telescope - appd is default if missing + technology: java/otel + image: chrlic/opentelemetry-java-agent:latest + imagePullPolicy: Always + javaEnvVar: JAVA_TOOL_OPTIONS + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + - name: Java_Telescope + injectionRules: + # technology = java | dotnetcore | nodejs + # provider = appd | otel | telescope - appd is default if missing + technology: java/telescope + image: chrlic/telescope-java-agent:latest + imagePullPolicy: Always + javaEnvVar: JAVA_TOOL_OPTIONS + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + - name: Nodejs_Otel + injectionRules: + technology: nodejs/otel + image: chrlic/opentelemetry-nodejs-agent:latest + imagePullPolicy: Always + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + +instrumentationRules: + - name: test1 + matchRules: + namespaceRegex: .* + labels: + - language: java + annotations: + - annot1: .* + podNameRegex: .* + injectionRules: + template: Java_Default + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: _JAVA_OPTIONS + - name: otel-test + matchRules: + namespaceRegex: .* + labels: + - otel: native + - language: java + annotations: + - annot1: .* + podNameRegex: .* + injectionRules: + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: _JAVA_OPTIONS + - name: java-otel-test + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: java + podNameRegex: .* + injectionRules: + template: Java_Otel + javaEnvVar: _JAVA_OPTIONS + # optional otelNativeAgent: true -> assume native otel image use, no AppD native feed + openTelemetryCollector: deployment-hybrid-agent-default + - name: dotnet1 + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: dotnetcore + podNameRegex: .* + injectionRules: + template: Dotnet_Default + - name: nodejs1 + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: nodejs + podNameRegex: .* + injectionRules: + template: Nodejs_Otel + openTelemetryCollector: deployment-hybrid-agent-default + diff --git a/webhook/helm/values-sample.yaml b/webhook/helm/values-sample.yaml new file mode 100644 index 0000000..2d10cd4 --- /dev/null +++ b/webhook/helm/values-sample.yaml @@ -0,0 +1,264 @@ + +serviceaccount: webhook-instrumentor +deploymentName: webhook-server +webhookName: webhook-appd +# namespacesEnabled is optional list of namespaces, where webhook would be applied. +# If missing, all namespaces will be enabled, except kubernetes system namespaces +# namespacesEnabled: +# - ns1 +# - ns2 +# +# namespacesDisabled is optional list of namespaces, where webhook would not be applied. +# If missing, all namespaces will be enabled, except kubernetes system namespaces +# (and namespace where the webook itself is running) +# namespacesDisabled: +# - ns3 +# +# enabledForPodsWithLabels is optional safety belt to try to instrument only pods +# having set labels to a specific values +# enabledForPodsWithLabels: +# - appdInstr +# +# number of replicas for webhook server +replicas: 1 +certValidityDays: 1024 +# failure policy can be Fail or Ignore. +# Ignore is safer - should the webhook fail or be unresponsive for timeoutSeconds, pod gets created unchanged +timeoutSeconds: 2 +failurePolicy: Ignore + +# optional - certs information. If missing, certs will be generated dynamically, but that does +# not work with helm upgrade (except on OpenShift with service CA usage) +# certs: +# tlsCert: +# tlsKey: +# caCert: + +# optional - useServiceCAonOCP: true - if set, on OpenShift, Service CA certificates will be used +useServiceCAonOCP: true + +# service type and port for webhook server +service: + type: ClusterIP + port: 443 + +# image for pods running the webhook functionality +image: + image: docker.io/chrlic/appd-webhook-instrumentor:v1.0.3-exp + pullPolicy: Always + +# optional AppDynamics controller access information - required if +# AppDynamics native/hybrid agents are used +appdController: + host: .saas.appdynamics.com + port: "443" + isSecure: true + accountName: + accessKey: "xxxxxxxxxxx" + # useProxy: true + # proxyHost: proxy.corm.com + # proxyPort: "8080" + otelEndpoint: https://pdx-sls-agent-api.saas.appdynamics.com + otelHeaderKey: "xxx" + +appdCloud: + +telescope: + +# optional OpenTelemetry parameters +# covers OTel Collector settings for AppDynamics cSaaS, AppDynamics Cloud, and Cisco Telescope +openTelemetryCollectors: + # collector name must be DNS friendly - only lowercase, numbers and "-" + deployment-hybrid-agent-default: + # mode - one of "sidecar", "deployment", "external" + mode: deployment + # replicas is only considered for OTel collector running as a deployment, otherwise ignored + replicas: 1 + image: + image: docker.io/otel/opentelemetry-collector-contrib:0.53.0 + imagePullPolicy: Always + initImage: docker.io/alpine:latest + config: + receivers: + otlp: + protocols: + grpc: + http: + processors: + batch: + resource: + attributes: + - key: appdynamics.controller.account + action: upsert + value: "{{ .Values.appdController.accountName }}" + - key: appdynamics.controller.host + action: upsert + value: "{{ .Values.appdController.host }}" + - key: appdynamics.controller.port + action: upsert + value: "{{ .Values.appdController.port }}" + exporters: + logging: + loglevel: debug + jaeger: + endpoint: "jaeger.default.svc.cluster.local:14250" + tls: + insecure: true + # This part says that the opentelemetry collector will send data to OTIS pipeline for AppDynamicas CSaaS. + otlphttp: + tls: + insecure: true + endpoint: "{{ .Values.appdController.otelEndpoint }}" + headers: {"x-api-key": "{{ .Values.appdController.otelHeaderKey }}"} + service: + pipelines: + traces: + receivers: [otlp] + processors: [batch, resource] + exporters: [logging, otlphttp, jaeger] + telemetry: + logs: + level: "debug" + sidecar-hybrid-agent-default: + # mode - one of "sidecar", "deployment", "external" + mode: sidecar + # replicas is only considered for OTel collector running as a deployment, otherwise ignored + replicas: 1 + image: + image: docker.io/otel/opentelemetry-collector-contrib:0.53.0 + imagePullPolicy: Always + initImage: docker.io/alpine:latest + config: + receivers: + otlp: + protocols: + grpc: + http: + processors: + batch: + resource: + attributes: + - key: appdynamics.controller.account + action: upsert + value: "{{ .Values.appdController.accountName }}" + - key: appdynamics.controller.host + action: upsert + value: "{{ .Values.appdController.host }}" + - key: appdynamics.controller.port + action: upsert + value: "{{ .Values.appdController.port }}" + exporters: + logging: + loglevel: debug + jaeger: + endpoint: "jaeger.default.svc.cluster.local:14250" + tls: + insecure: true + # This part says that the opentelemetry collector will send data to OTIS pipeline for AppDynamicas CSaaS. + otlphttp: + tls: + insecure: true + endpoint: "{{ .Values.appdController.otelEndpoint }}" + headers: {"x-api-key": "{{ .Values.appdController.otelHeaderKey }}"} + service: + pipelines: + traces: + receivers: [otlp] + processors: [batch, resource] + exporters: [logging, otlphttp, jaeger] + telemetry: + logs: + level: "debug" + external-hybrid-agent-default: + mode: external + collectorEndpoint: otel-collector.default.svc.cluster.local + +instrumentationTemplates: + - name: Java_Default + injectionRules: + # technology = java | dotnetcore | nodejs + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: JAVA_TOOL_OPTIONS + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + # optional otelNativeAgent: true -> assume native otel image use, no AppD native feed + openTelemetryCollectors: deploymentHybridagentDefault + - name: Dotnet_Default + injectionRules: + technology: dotnetcore + image: appdynamics/dotnet-core-agent:22.5.1 + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + - name: Nodejs_Default + injectionRules: + technology: nodejs + image: appdynamics/nodejs-agent:22.5.0-16-stretch-slim + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + +instrumentationRules: + - name: test1 + matchRules: + namespaceRegex: .* + labels: + - matchLabel: test1 + - language: java + annotations: + - annot1: .* + podNameRegex: .* + injectionRules: + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: _JAVA_OPTIONS + # technology java + openTelemetryCollector -> use AppD hybrid agent + openTelemetryCollector: cSaaS_Collector + - name: otel-test + matchRules: + namespaceRegex: .* + labels: + - otel: native + - language: java + annotations: + - annot1: .* + podNameRegex: .* + injectionRules: + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: _JAVA_OPTIONS + # optional - technology java + openTelemetryCollector -> use AppD hybrid agent with OTel + openTelemetryCollector: cSaaS_Collector + - name: test2 + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: java + podNameRegex: .* + injectionRules: + template: Java_Default + technology: java + image: appdynamics/java-agent:latest + javaEnvVar: _JAVA_OPTIONS + - name: dotnet1 + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: dotnetcore + podNameRegex: .* + injectionRules: + template: Dotnet_Default + - name: nodejs1 + matchRules: + namespaceRegex: .* + labels: + - appdInstr: do + - language: nodejs + podNameRegex: .* + injectionRules: + template: Nodejs_Default + diff --git a/webhook/instrumentTelescopeJava.go b/webhook/instrumentTelescopeJava.go deleted file mode 100644 index 6f28ec8..0000000 --- a/webhook/instrumentTelescopeJava.go +++ /dev/null @@ -1,154 +0,0 @@ -/* -Copyright (c) 2019 Cisco Systems, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import ( - "fmt" - "log" - - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" -) - -func javaTelescopeInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { - patchOps := []patchOperation{} - - patchOps = append(patchOps, addTelescopeJavaEnvVar(pod, instrRule, 0)...) - patchOps = append(patchOps, addContainerEnvVar("OTEL_TRACES_EXPORTER", "otlp", 0)) - patchOps = append(patchOps, addContainerEnvVar("OTEL_METRICS_EXPORTER", "none", 0)) - patchOps = append(patchOps, addContainerEnvVar("OTEL_EXPORTER_OTLP_HEADERS", "", 0)) - patchOps = append(patchOps, addContainerEnvVar("OTEL_RESOURCE_ATTRIBUTES", - fmt.Sprintf("service.name=%s,service.namespace=%s", getTierName(pod, instrRule), getApplicationName(pod, instrRule)), 0)) - patchOps = append(patchOps, addContainerEnvVar("OTEL_SERVICE_NAME", getTierName(pod, instrRule), 0)) - patchOps = append(patchOps, addContainerEnvVar("CISCO_TOKEN", config.TelescopeConfig.Token, 0)) - - patchOps = append(patchOps, addSpecifiedContainerEnvVars(instrRule.InjectionRules.EnvVars, 0)...) - - patchOps = append(patchOps, addTelescopeJavaAgentVolumeMount(pod, instrRule, 0)...) - - patchOps = append(patchOps, addTelescopeJavaAgentInitContainer(pod, instrRule)...) - - patchOps = append(patchOps, addTelescopeJavaAgentVolume(pod, instrRule)...) - - if instrRule.InjectionRules.OpenTelemetryCollector != "" { - otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] - if !found { - log.Printf("Cannot find OTel collector definition %s\n", instrRule.InjectionRules.OpenTelemetryCollector) - } else { - // Telescope agent uses HTTP, not GRPC -> port 4318 and path /v1/traces - if otelCollConfig.Mode == "sidecar" { - patchOps = append(patchOps, addContainerEnvVar("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", "http://localhost:4318/v1/traces", 0)) - patchOps = append(patchOps, addOtelCollSidecar(pod, instrRule, 0)...) - } else if (otelCollConfig.Mode == "deployment") || (otelCollConfig.Mode == "external") { - patchOps = append(patchOps, addContainerEnvVar("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", fmt.Sprintf("http://%s:4318/v1/traces", otelCollConfig.ServiceName), 0)) - } - } - } - - return patchOps -} - -func addTelescopeJavaEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { - patchOps := []patchOperation{} - - patchOps = append(patchOps, patchOperation{ - Op: "add", - Path: fmt.Sprintf("/spec/containers/%d/env/-", containerIdx), - Value: corev1.EnvVar{ - Name: instrRules.InjectionRules.JavaEnvVar, - Value: getTelescopeJavaOptions(pod, instrRules), - }, - }) - - return patchOps -} - -func getTelescopeJavaOptions(pod corev1.Pod, instrRules *InstrumentationRule) string { - javaOpts := " " - - if config.ControllerConfig.UseProxy { - javaOpts += fmt.Sprintf("-Dappdynamics.http.proxyHost=%s ", config.ControllerConfig.ProxyHost) - javaOpts += fmt.Sprintf("-Dappdynamics.http.proxyPort=%s ", config.ControllerConfig.ProxyPort) - } - - javaOpts += "-javaagent:/opt/telescope-agent/cisco-telescope-javaagent.jar " - javaOpts += instrRules.InjectionRules.JavaCustomConfig + " " - - return javaOpts -} - -func addTelescopeJavaAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { - patchOps := []patchOperation{} - patchOps = append(patchOps, patchOperation{ - Op: "add", - Path: fmt.Sprintf("/spec/containers/%d/volumeMounts/-", containerIdx), - Value: corev1.VolumeMount{ - MountPath: "/opt/telescope-agent", //TODO - Name: "telescope-agent-repo-java", //TODO - }, - }) - return patchOps -} - -func addTelescopeJavaAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { - patchOps := []patchOperation{} - patchOps = append(patchOps, patchOperation{ - Op: "add", - Path: "/spec/volumes/-", - Value: corev1.Volume{ - Name: "telescope-agent-repo-java", //TODO - VolumeSource: corev1.VolumeSource{ - EmptyDir: &corev1.EmptyDirVolumeSource{}, - }, - }, - }) - return patchOps -} - -func addTelescopeJavaAgentInitContainer(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { - patchOps := []patchOperation{} - limCPU, _ := resource.ParseQuantity("200m") - limMem, _ := resource.ParseQuantity("75M") - reqCPU, _ := resource.ParseQuantity(instrRules.InjectionRules.ResourceReservation.CPU) - reqMem, _ := resource.ParseQuantity(instrRules.InjectionRules.ResourceReservation.Memory) - - patchOps = append(patchOps, patchOperation{ - Op: "add", - Path: "/spec/initContainers/-", - Value: corev1.Container{ - Name: "telescope-agent-attach-java", //TODO - Image: instrRules.InjectionRules.Image, - Command: []string{"cp", "-r", "/opt/telescope/.", "/opt/telescope-agent"}, - ImagePullPolicy: corev1.PullAlways, //TODO - Resources: corev1.ResourceRequirements{ - Limits: corev1.ResourceList{ - corev1.ResourceCPU: limCPU, - corev1.ResourceMemory: limMem, - }, - Requests: corev1.ResourceList{ - corev1.ResourceCPU: reqCPU, - corev1.ResourceMemory: reqMem, - }, - }, - VolumeMounts: []corev1.VolumeMount{{ - MountPath: "/opt/telescope-agent", //TODO - Name: "telescope-agent-repo-java", //TODO - }}, - }, - }) - return patchOps -} diff --git a/webhook/instrumentTelescopeNodeJS.go b/webhook/instrumentTelescopeNodeJS.go deleted file mode 100644 index 1eeb4c9..0000000 --- a/webhook/instrumentTelescopeNodeJS.go +++ /dev/null @@ -1,126 +0,0 @@ -/* -Copyright (c) 2019 Cisco Systems, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import ( - "fmt" - "log" - - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" -) - -func nodejsTelescopeInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { - patchOps := []patchOperation{} - - patchOps = append(patchOps, addTelescopeNodejsEnvVar(pod, instrRule, 0)...) - patchOps = append(patchOps, addContainerEnvVar("OTEL_SERVICE_NAMESPACE", getApplicationName(pod, instrRule), 0)) - patchOps = append(patchOps, addContainerEnvVar("OTEL_SERVICE_NAME", getTierName(pod, instrRule), 0)) - - patchOps = append(patchOps, addSpecifiedContainerEnvVars(instrRule.InjectionRules.EnvVars, 0)...) - - patchOps = append(patchOps, addTelescopeNodejsAgentVolumeMount(pod, instrRule, 0)...) - - patchOps = append(patchOps, addTelescopeNodejsAgentInitContainer(pod, instrRule)...) - - patchOps = append(patchOps, addTelescopeNodejsAgentVolume(pod, instrRule)...) - - if instrRule.InjectionRules.OpenTelemetryCollector != "" { - otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] - if !found { - log.Printf("Cannot find OTel collector definition %s\n", instrRule.InjectionRules.OpenTelemetryCollector) - } else { - if otelCollConfig.Mode == "sidecar" { - patchOps = append(patchOps, addContainerEnvVar("OTEL_EXPORTER_OTLP_ENDPOINT", "http://localhost:4318/v1/traces", 0)) - patchOps = append(patchOps, addOtelCollSidecar(pod, instrRule, 0)...) - } else if (otelCollConfig.Mode == "deployment") || (otelCollConfig.Mode == "external") { - patchOps = append(patchOps, addContainerEnvVar("OTEL_EXPORTER_OTLP_ENDPOINT", fmt.Sprintf("http://%s:4318/v1/traces", otelCollConfig.ServiceName), 0)) - } - } - } - return patchOps -} - -func addTelescopeNodejsEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { - patchOps := []patchOperation{} - - patchOps = append(patchOps, addContainerEnvVar("NODE_OPTIONS", "--require /opt/telescope-agent/shim.js", 0)) - - return patchOps -} - -func addTelescopeNodejsAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { - patchOps := []patchOperation{} - patchOps = append(patchOps, patchOperation{ - Op: "add", - Path: fmt.Sprintf("/spec/containers/%d/volumeMounts/-", containerIdx), - Value: corev1.VolumeMount{ - MountPath: "/opt/telescope-agent", //TODO - Name: "telescope-agent-repo-nodejs", //TODO - }, - }) - return patchOps -} - -func addTelescopeNodejsAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { - patchOps := []patchOperation{} - patchOps = append(patchOps, patchOperation{ - Op: "add", - Path: "/spec/volumes/-", - Value: corev1.Volume{ - Name: "telescope-agent-repo-nodejs", //TODO - VolumeSource: corev1.VolumeSource{ - EmptyDir: &corev1.EmptyDirVolumeSource{}, - }, - }, - }) - return patchOps -} - -func addTelescopeNodejsAgentInitContainer(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { - patchOps := []patchOperation{} - limCPU, _ := resource.ParseQuantity("200m") - limMem, _ := resource.ParseQuantity("75M") - reqCPU, _ := resource.ParseQuantity(instrRules.InjectionRules.ResourceReservation.CPU) - reqMem, _ := resource.ParseQuantity(instrRules.InjectionRules.ResourceReservation.Memory) - - patchOps = append(patchOps, patchOperation{ - Op: "add", - Path: "/spec/initContainers/-", - Value: corev1.Container{ - Name: "telescope-agent-attach-nodejs", //TODO - Image: instrRules.InjectionRules.Image, - Command: []string{"cp", "-r", "/opt/telescope/.", "/opt/telescope-agent"}, - ImagePullPolicy: corev1.PullAlways, //TODO - Resources: corev1.ResourceRequirements{ - Limits: corev1.ResourceList{ - corev1.ResourceCPU: limCPU, - corev1.ResourceMemory: limMem, - }, - Requests: corev1.ResourceList{ - corev1.ResourceCPU: reqCPU, - corev1.ResourceMemory: reqMem, - }, - }, - VolumeMounts: []corev1.VolumeMount{{ - MountPath: "/opt/telescope-agent", //TODO - Name: "telescope-agent-repo-nodejs", //TODO - }}, - }, - }) - return patchOps -} diff --git a/webhook/license.txt b/webhook/license.txt new file mode 100644 index 0000000..af4767b --- /dev/null +++ b/webhook/license.txt @@ -0,0 +1,13 @@ +// Copyright Cisco Systems +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. \ No newline at end of file diff --git a/webhook/otelCollSidecar.go b/webhook/otelCollSidecar.go deleted file mode 100644 index bb7e11c..0000000 --- a/webhook/otelCollSidecar.go +++ /dev/null @@ -1,178 +0,0 @@ -/* -Copyright (c) 2019 Cisco Systems, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import ( - "fmt" - "log" - "strings" - "sync" - - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" -) - -const OTEL_COLL_CONFIG_MAP_NAME = "otel-collector-config" - -type OtelCollConfig struct { - Config string - Mode string - Image string - ImagePullPolicy string - InitImage string - ServiceName string -} - -var otelCollsConfig = map[string]OtelCollConfig{} -var otelCollsConfigMutex = sync.Mutex{} - -func loadOtelConfig(cm map[string]string) { - otelCollsConfigMutex.Lock() - defer otelCollsConfigMutex.Unlock() - - for key, value := range cm { - keyElems := strings.Split(key, ".") - collectorName := keyElems[0] - itemKey := strings.Join(keyElems[1:], ".") - if _, found := otelCollsConfig[collectorName]; !found { - otelCollsConfig[collectorName] = OtelCollConfig{} - } - collectorConfig := otelCollsConfig[collectorName] - switch itemKey { - case "config": - collectorConfig.Config = value - case "mode": - collectorConfig.Mode = value - case "image.image": - collectorConfig.Image = value - case "image.imagePullPolicy": - collectorConfig.ImagePullPolicy = value - case "image.initImage": - collectorConfig.InitImage = value - case "serviceName": - collectorConfig.ServiceName = value - } - otelCollsConfig[collectorName] = collectorConfig - } -} - -func addOtelCollSidecar(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { - patchOps := []patchOperation{} - - if len(pod.Spec.Containers) > 0 { - // TODO - lookup the otel template for instrumentation rule - limCPU, _ := resource.ParseQuantity("1") - reqCPU, _ := resource.ParseQuantity("200m") - limMem, _ := resource.ParseQuantity("1Gi") - reqMem, _ := resource.ParseQuantity("200Mi") - - limCPUInit, _ := resource.ParseQuantity("300m") - reqCPUInit, _ := resource.ParseQuantity("50m") - limMemInit, _ := resource.ParseQuantity("200Mi") - reqMemInit, _ := resource.ParseQuantity("100Mi") - - otelCollConfig, err := getCollectorConfigsByName(instrRules.InjectionRules.OpenTelemetryCollector) - if err != nil { - log.Printf("Cannot find OTel collector definition %v\n", err) - return []patchOperation{} - } - - sidecar := corev1.Container{ - Name: "otel-coll-sidecar", - Image: otelCollConfig.Image, - Args: []string{"--config", "/conf/otel-collector-config.yaml"}, - ImagePullPolicy: corev1.PullPolicy(otelCollConfig.ImagePullPolicy), - Ports: []corev1.ContainerPort{{Name: "otlp-grpc", ContainerPort: 4317}, {Name: "otlp-http", ContainerPort: 4318}}, - Resources: corev1.ResourceRequirements{ - Limits: corev1.ResourceList{ - corev1.ResourceCPU: limCPU, - corev1.ResourceMemory: limMem, - }, - Requests: corev1.ResourceList{ - corev1.ResourceCPU: reqCPU, - corev1.ResourceMemory: reqMem, - }, - }, - VolumeMounts: []corev1.VolumeMount{{ - MountPath: "/conf", - Name: "otel-collector-config-vol", - }}, - } - - sidecarInit := corev1.Container{ - Name: "otel-coll-sidecar-init", - Image: otelCollConfig.InitImage, - Command: []string{"/bin/sh", "-c"}, - Args: []string{"echo \"$OTEL_COLL_CONFIG\" > /conf/otel-collector-config.yaml"}, - ImagePullPolicy: corev1.PullIfNotPresent, - Resources: corev1.ResourceRequirements{ - Limits: corev1.ResourceList{ - corev1.ResourceCPU: limCPUInit, - corev1.ResourceMemory: limMemInit, - }, - Requests: corev1.ResourceList{ - corev1.ResourceCPU: reqCPUInit, - corev1.ResourceMemory: reqMemInit, - }, - }, - VolumeMounts: []corev1.VolumeMount{{ - MountPath: "/conf", - Name: "otel-collector-config-vol", - }}, - Env: []corev1.EnvVar{{ - Name: "OTEL_COLL_CONFIG", - Value: otelCollConfig.Config, - }}, - } - - configVolume := corev1.Volume{ - Name: "otel-collector-config-vol", - VolumeSource: corev1.VolumeSource{ - EmptyDir: &corev1.EmptyDirVolumeSource{}, - }, - } - - patchOps = append(patchOps, patchOperation{ - Op: "add", - Path: "/spec/containers/-", - Value: sidecar, - }) - - patchOps = append(patchOps, patchOperation{ - Op: "add", - Path: "/spec/initContainers/-", - Value: sidecarInit, - }) - - patchOps = append(patchOps, patchOperation{ - Op: "add", - Path: "/spec/volumes/-", - Value: configVolume, - }) - } - - return patchOps -} - -func getCollectorConfigsByName(otelCollName string) (*OtelCollConfig, error) { - otelCollConfig, found := otelCollsConfig[otelCollName] - if !found { - return nil, fmt.Errorf("cannot find OTel collector definition %s", otelCollName) - } else { - return &otelCollConfig, nil - } -} diff --git a/webhook/admission_controller.go b/webhook/pkg/admission_controller.go similarity index 99% rename from webhook/admission_controller.go rename to webhook/pkg/admission_controller.go index 3d3286e..b3d19bd 100644 --- a/webhook/admission_controller.go +++ b/webhook/pkg/admission_controller.go @@ -20,7 +20,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "log" "net/http" @@ -65,7 +65,7 @@ func doServeAdmitFunc(w http.ResponseWriter, r *http.Request, admit admitFunc) ( return nil, fmt.Errorf("invalid method %s, only POST requests are allowed", r.Method) } - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) if err != nil { w.WriteHeader(http.StatusBadRequest) return nil, fmt.Errorf("could not read request body: %v", err) diff --git a/webhook/configuration.go b/webhook/pkg/configuration.go similarity index 77% rename from webhook/configuration.go rename to webhook/pkg/configuration.go index 362fa8e..b511c82 100644 --- a/webhook/configuration.go +++ b/webhook/pkg/configuration.go @@ -17,6 +17,7 @@ limitations under the License. package main import ( + "encoding/json" "flag" "fmt" "io/ioutil" @@ -25,9 +26,11 @@ import ( "os" "path/filepath" "regexp" + "slices" "sync" "text/template" "time" + "v1alpha1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -54,14 +57,17 @@ var ( ) type Config struct { - MyNamespace string - ConfigMapName string - ControllerConfig *ControllerConfig - AppdCloudConfig *AppdCloudConfig - TelescopeConfig *TelescopeConfig - InstrumentationConfig *InstrumentationConfig - FlexMatchTemplate *template.Template - mutex sync.Mutex + MyNamespace string + ConfigMapName string + ControllerConfig *ControllerConfig + AppdCloudConfig *AppdCloudConfig + TelescopeConfig *TelescopeConfig + InstrumentationConfig *InstrumentationConfig // This comes from the config map and is configured by Helm chart + InstrumentationClusterCrds *InstrumentationConfig // This comes from GlobalInstrumentation CRDs + InstrumentationNamespacedCrds map[string]*InstrumentationConfig // This comes from Instrumentation CRDs ans is namespace specific + FlexMatchTemplate *template.Template + CrdsDisabled bool // When set to true, namespaced Instrumentation is disabled + mutex sync.Mutex } type ControllerConfig struct { @@ -85,70 +91,15 @@ type ControllerConfig struct { type AppdCloudConfig struct { } +// TODO - Obsolete, should be cleaned out type TelescopeConfig struct { TracesEndpoint string `json:"traces_endpoint,omitempty" yaml:"traces_endpoint,omitempty"` Token string `json:"token,omitempty" yaml:"token,omitempty"` } -type MatchRules struct { - NamespaceRegex string `json:"namespaceRegex,omitempty" yaml:"namespaceRegex,omitempty"` - Labels *[]map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` - Annotations *[]map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` - PodNameRegex string `json:"podNameRegex,omitempty" yaml:"podNameRegex,omitempty"` -} - -type InjectionRules struct { - Template string `json:"template,omitempty" yaml:"template,omitempty"` - Technology string `json:"technology,omitempty" yaml:"technology,omitempty"` - Image string `json:"image,omitempty" yaml:"image,omitempty"` - JavaEnvVar string `json:"javaEnvVar,omitempty" yaml:"javaEnvVar,omitempty"` - JavaCustomConfig string `json:"javaCustomConfig,omitempty" yaml:"javaCustomConfig,omitempty"` - ApplicationNameSource string `json:"applicationNameSource,omitempty" yaml:"applicationNameSource,omitempty"` // manual,namespace,label,annotation,expression - ApplicationName string `json:"applicationName,omitempty" yaml:"applicationName,omitempty"` - ApplicationNameLabel string `json:"applicationNameLabel,omitempty" yaml:"applicationNameLabel,omitempty"` - ApplicationNameAnnotation string `json:"applicationNameAnnotation,omitempty" yaml:"applicationNameAnnotation,omitempty"` - ApplicationNameExpression string `json:"applicationNameExpression,omitempty" yaml:"applicationNameExpression,omitempty"` - TierNameSource string `json:"tierNameSource,omitempty" yaml:"tierNameSource,omitempty"` // auto,manual,namespace,label,annotation,expression - TierName string `json:"tierName,omitempty" yaml:"tierName,omitempty"` - TierNameLabel string `json:"tierNameLabel,omitempty" yaml:"tierNameLabel,omitempty"` - TierNameAnnotation string `json:"tierNameAnnotation,omitempty" yaml:"tierNameAnnotation,omitempty"` - TierNameExpression string `json:"tierNameExpression,omitempty" yaml:"tierNameExpression,omitempty"` - UsePodNameForNodeName *bool `json:"usePodNameForNodeName,omitempty" yaml:"usePodNameForNodeName,omitempty"` - DoNotInstrument *bool `json:"doNotInstrument,omitempty" yaml:"doNotInstrument,omitempty"` - ResourceReservation *ResourceReservation `json:"resourceReservation,omitempty" yaml:"resourceReservation,omitempty"` - LogLevel string `json:"logLevel,omitempty" yaml:"logLevel,omitempty"` - NetvizPort string `json:"netvizPort,omitempty" yaml:"netvizPort,omitempty"` - OpenTelemetryCollector string `json:"openTelemetryCollector,omitempty" yaml:"openTelemetryCollector,omitempty"` - EnvVars []NameValue `json:"env,omitempty" yaml:"env,omitempty"` - Options []NameValue `json:"options,omitempty" yaml:"options,omitempty"` - InjectK8SOtelResourceAttrs *bool `json:"injectK8SOtelResourceAttrs,omitempty" yaml:"injectK8SOtelResourceAttrs,omitempty"` -} - -type NameValue struct { - Name string `json:"name,omitempty" yaml:"name,omitempty"` - Value string `json:"value,omitempty" yaml:"value,omitempty"` -} - -type ResourceReservation struct { - CPU string `json:"cpu,omitempty" yaml:"cpu,omitempty"` - Memory string `json:"memory,omitempty" yaml:"memory,omitempty"` -} - -type InstrumentationConfig []InstrumentationRule +type InstrumentationConfig []v1alpha1.InstrumentationSpec -type InjectionTemplates []InjectionTemplate - -type InjectionTemplate struct { - Name string `json:"name,omitempty" yaml:"name,omitempty" ` - InjectionRules *InjectionRules `json:"injectionRules,omitempty" yaml:"injectionRules,omitempty" ` -} - -type InstrumentationRule struct { - Name string `json:"name,omitempty" yaml:"name,omitempty" ` - MatchRules *MatchRules `json:"matchRules,omitempty" yaml:"matchRules,omitempty"` - InjectionRules *InjectionRules `json:"injectionRules,omitempty" yaml:"injectionRules,omitempty"` - InjectionRuleSet []InjectionRules `json:"injectionRuleSet,omitempty" yaml:"injectionRuleSet,omitempty"` -} +type InjectionTemplates []v1alpha1.InjectionTemplate type groupResource struct { APIGroup string @@ -156,7 +107,10 @@ type groupResource struct { APIResource metav1.APIResource } -var config = Config{} +var config = Config{ + InstrumentationClusterCrds: &InstrumentationConfig{}, + InstrumentationNamespacedCrds: map[string]*InstrumentationConfig{}, +} func runConfigWatcher() { @@ -391,7 +345,7 @@ func applyInjectionRulesDefaults(instrumentationConfig *InstrumentationConfig) { } } -func injectionRuleDefaults(injRules *InjectionRules) *InjectionRules { +func injectionRuleDefaults(injRules *v1alpha1.InjectionRule) *v1alpha1.InjectionRule { injRules.ApplicationName = applyTemplateString(injRules.ApplicationName, "DEFAULT_APP_NAME") if injRules.DoNotInstrument == nil { falseValue := false @@ -409,7 +363,7 @@ func injectionRuleDefaults(injRules *InjectionRules) *InjectionRules { injRules.JavaEnvVar = applyTemplateString(injRules.JavaEnvVar, "JAVA_TOOL_OPTIONS") injRules.TierNameSource = applyTemplateString(injRules.TierNameSource, "auto") if injRules.ResourceReservation == nil { - injRules.ResourceReservation = &ResourceReservation{} + injRules.ResourceReservation = &v1alpha1.ResourceReservation{} } injRules.ResourceReservation.CPU = applyTemplateString(injRules.ResourceReservation.CPU, "100m") injRules.ResourceReservation.Memory = applyTemplateString(injRules.ResourceReservation.Memory, "50M") @@ -423,7 +377,7 @@ func injectionRuleDefaults(injRules *InjectionRules) *InjectionRules { func applyInjectionTemplates(injectionTemplates *InjectionTemplates, instrumentationConfig *InstrumentationConfig) bool { valid := true - injectionTemplateMap := map[string]*InjectionRules{} + injectionTemplateMap := map[string]*v1alpha1.InjectionRule{} for _, injTemplate := range *injectionTemplates { if injTemplate.Name == "" { @@ -461,7 +415,7 @@ func applyInjectionTemplates(injectionTemplates *InjectionTemplates, instrumenta return valid } -func injectionRuleTemplate(injRules *InjectionRules, injTempRules *InjectionRules) *InjectionRules { +func injectionRuleTemplate(injRules *v1alpha1.InjectionRule, injTempRules *v1alpha1.InjectionRule) *v1alpha1.InjectionRule { injRules.ApplicationName = applyTemplateString(injRules.ApplicationName, injTempRules.ApplicationName) injRules.ApplicationNameAnnotation = applyTemplateString(injRules.ApplicationNameAnnotation, injTempRules.ApplicationNameAnnotation) injRules.ApplicationNameExpression = applyTemplateString(injRules.ApplicationNameExpression, injTempRules.ApplicationNameExpression) @@ -480,7 +434,7 @@ func injectionRuleTemplate(injRules *InjectionRules, injTempRules *InjectionRule injRules.TierNameSource = applyTemplateString(injRules.TierNameSource, injTempRules.TierNameSource) injRules.UsePodNameForNodeName = applyTemplateBool(injRules.UsePodNameForNodeName, injTempRules.UsePodNameForNodeName, false) if injRules.ResourceReservation == nil && injTempRules.ResourceReservation != nil { - injRules.ResourceReservation = &ResourceReservation{} + injRules.ResourceReservation = &v1alpha1.ResourceReservation{} injRules.ResourceReservation.CPU = applyTemplateString(injRules.ResourceReservation.CPU, injTempRules.ResourceReservation.CPU) injRules.ResourceReservation.Memory = applyTemplateString(injRules.ResourceReservation.Memory, injTempRules.ResourceReservation.Memory) } @@ -493,8 +447,8 @@ func injectionRuleTemplate(injRules *InjectionRules, injTempRules *InjectionRule return injRules } -func mergeNameValues(specific []NameValue, templated []NameValue) []NameValue { - merged := []NameValue{} +func mergeNameValues(specific []v1alpha1.NameValue, templated []v1alpha1.NameValue) []v1alpha1.NameValue { + merged := []v1alpha1.NameValue{} temp := map[string]string{} for _, item := range templated { @@ -504,7 +458,7 @@ func mergeNameValues(specific []NameValue, templated []NameValue) []NameValue { temp[item.Name] = item.Value } for name, value := range temp { - merged = append(merged, NameValue{Name: name, Value: value}) + merged = append(merged, v1alpha1.NameValue{Name: name, Value: value}) } return merged @@ -683,3 +637,133 @@ func configHandler() http.Handler { } }) } + +func upsertCrdInstrumentation(namespace string, name string, instr v1alpha1.InstrumentationSpec) { + config.mutex.Lock() + defer config.mutex.Unlock() + + // Instrumentation rule name is always taken from the CRD name + // NamespaceRegex is set tu current namespace only + instr.Name = namespace + "/" + name + instr.MatchRules.NamespaceRegex = "^" + namespace + "$" + + ok := false + if _, ok = config.InstrumentationNamespacedCrds[namespace]; !ok { + config.InstrumentationNamespacedCrds[namespace] = &InstrumentationConfig{} + } + namespaceInstrs := config.InstrumentationNamespacedCrds[namespace] + + upsertInstrumentationSpecInConfig(namespaceInstrs, name, instr) +} + +func deleteCrdInstrumentation(namespace string, name string) { + config.mutex.Lock() + defer config.mutex.Unlock() + + ok := false + if _, ok = config.InstrumentationNamespacedCrds[namespace]; !ok { + config.InstrumentationNamespacedCrds[namespace] = &InstrumentationConfig{} + } + namespaceInstrs := config.InstrumentationNamespacedCrds[namespace] + + deleteInstrumentationSpecInConfig(namespaceInstrs, name) +} + +func upsertCrdClusterInstrumentation(name string, instr v1alpha1.InstrumentationSpec) { + config.mutex.Lock() + defer config.mutex.Unlock() + + // Instrumentation rule name is always taken from the CRD name + instr.Name = "*cluster*/" + name + + upsertInstrumentationSpecInConfig(config.InstrumentationClusterCrds, name, instr) +} + +func deleteCrdClusterInstrumentation(name string) { + config.mutex.Lock() + defer config.mutex.Unlock() + + deleteInstrumentationSpecInConfig(config.InstrumentationClusterCrds, name) +} + +func upsertInstrumentationSpecInConfig(specs *InstrumentationConfig, name string, instr v1alpha1.InstrumentationSpec) { + + found := false + for i, spec := range *specs { + if name == spec.Name { + (*specs)[i] = instr + found = true + break + } + } + if !found { + (*specs) = append((*specs), instr) + } + + slices.SortFunc((*specs), func(a, b v1alpha1.InstrumentationSpec) int { + if a.Priority > b.Priority { + return 1 + } else if a.Priority == b.Priority { + return 0 + } else { + return -1 + } + }) +} + +func deleteInstrumentationSpecInConfig(specs *InstrumentationConfig, name string) { + found := -1 + for i, spec := range *specs { + if name == spec.Name { + found = i + break + } + } + if found >= 0 { + (*specs) = append((*specs)[:found], (*specs)[found+1:]...) + } +} + +func instrumentationAsString() string { + otelCollsConfigStr, _ := json.MarshalIndent(otelCollsConfig, "", " ") + otelCollsConfigNamespacedStr, _ := json.MarshalIndent(otelCollsConfigNamespaced, "", " ") + instrumentationConfigStr, _ := json.MarshalIndent(config.InstrumentationConfig, "", " ") + instrumentationNamespacedStr, _ := json.MarshalIndent(config.InstrumentationNamespacedCrds, "", " ") + instrumentationClusterStr, _ := json.MarshalIndent(config.InstrumentationClusterCrds, "", " ") + + configStr := fmt.Sprintf(` + OpenTelemetry Collectors from config map + ======================================================================================== + %s + + OpenTelemetry Collectors namespaced + ======================================================================================== + %s + + Instrumentation Rules from config map + ======================================================================================== + %s + + Instrumentation Rules namespaced + ======================================================================================== + %s + + Instrumentation Rules cluster-wide + ======================================================================================== + %s + + `, + string(otelCollsConfigStr), + string(otelCollsConfigNamespacedStr), + string(instrumentationConfigStr), + string(instrumentationNamespacedStr), + string(instrumentationClusterStr), + ) + + return configStr +} + +func asJson(v any, header string) string { + str, _ := json.MarshalIndent(v, "", " ") + return string(str) +} diff --git a/webhook/pkg/crdReconciler.go b/webhook/pkg/crdReconciler.go new file mode 100644 index 0000000..b40d1b4 --- /dev/null +++ b/webhook/pkg/crdReconciler.go @@ -0,0 +1,514 @@ +package main + +import ( + "context" + "fmt" + "os" + "reflect" + "v1alpha1" + + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/intstr" + clientappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1" + clientcorev1 "k8s.io/client-go/kubernetes/typed/core/v1" + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" + "k8s.io/client-go/rest" + ctrl "sigs.k8s.io/controller-runtime" + clientk8s "sigs.k8s.io/controller-runtime/pkg/client" + configK8s "sigs.k8s.io/controller-runtime/pkg/client/config" + "sigs.k8s.io/controller-runtime/pkg/controller" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/manager/signals" + "sigs.k8s.io/controller-runtime/pkg/predicate" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + + sourceK8s "sigs.k8s.io/controller-runtime/pkg/source" +) + +func startCrdReconciler() { + entryLog := log.Log.WithName("instr-controller") + + // Setup a Manager + entryLog.Info("setting up manager") + mgr, err := manager.New(configK8s.GetConfigOrDie(), manager.Options{ + Scheme: scheme, + }) + + if err != nil { + entryLog.Error(err, "unable to set up overall controller manager") + os.Exit(1) + } + + // Setup a new controller to reconcile Instrumentation and ClusterInstrumentation + entryLog.Info("Setting up instr-controller") + instrController, err := controller.New("instr-controller", mgr, controller.Options{ + Reconciler: &reconcileInstrCrd{client: mgr.GetClient()}, + }) + if err != nil { + entryLog.Error(err, "unable to set up instr-controller") + os.Exit(1) + } + + entryLog.Info("Setting up ginstr-controller") + gInstrController, err := controller.New("ginstr-controller", mgr, controller.Options{ + Reconciler: &reconcileGInstrCrd{client: mgr.GetClient()}, + }) + if err != nil { + entryLog.Error(err, "unable to set up ginstr-controller") + os.Exit(1) + } + + entryLog.Info("Setting up otelcol-controller") + + reconciler := &reconcileOtelColCrd{client: mgr.GetClient()} + err = reconciler.SetupWithManager(mgr) + // otelcolController, err := controller.New("otelcol-controller", mgr, controller.Options{ + // Reconciler: reconciler, + // }) + if err != nil { + entryLog.Error(err, "unable to set up otelcol-controller") + os.Exit(1) + } + + entryLog.Info("Registering CRDs to controller") + + // Watch Instrumentation and ClusterInstrumentation + if err := instrController.Watch(sourceK8s.Kind(mgr.GetCache(), &v1alpha1.Instrumentation{}), &handler.EnqueueRequestForObject{}); err != nil { + entryLog.Error(err, "unable to watch Instrumentation") + os.Exit(1) + } + if err := gInstrController.Watch(sourceK8s.Kind(mgr.GetCache(), &v1alpha1.ClusterInstrumentation{}), &handler.EnqueueRequestForObject{}); err != nil { + entryLog.Error(err, "unable to watch ClusterInstrumentation") + os.Exit(1) + } + // Watch OpenTelemetry collector + // if err := otelcolController.Watch(sourceK8s.Kind(mgr.GetCache(), &v1alpha1.OpenTelemetryCollector{}), &handler.EnqueueRequestForObject{}); err != nil { + // entryLog.Error(err, "unable to watch OpenTelemetryCollector") + // os.Exit(1) + // } + entryLog.Info("starting manager") + if err := mgr.Start(signals.SetupSignalHandler()); err != nil { + entryLog.Error(err, "unable to run manager") + os.Exit(1) + } +} + +type reconcileInstrCrd struct { + client clientk8s.Client +} + +// Implement reconcile.Reconciler so the controller can reconcile objects +var _ reconcile.Reconciler = &reconcileInstrCrd{} + +func (r *reconcileInstrCrd) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) { + // set up a convenient log object so we don't have to type request over and over again + log := log.FromContext(ctx) + + // Fetch the Instrumentation from the cache + instr := &v1alpha1.Instrumentation{} + err := r.client.Get(ctx, request.NamespacedName, instr) + if errors.IsNotFound(err) { + log.Info("Deleting Instrumentation", "namespace", request.Namespace, "name", request.Name) + deleteCrdInstrumentation(request.Namespace, request.Name) + return reconcile.Result{}, nil + } + + if err != nil { + return reconcile.Result{}, fmt.Errorf("could not fetch Instrumentation: %+v", err) + } + + if !instr.DeletionTimestamp.IsZero() { + log.Info("Deleting Instrumentation", "data", *instr) + deleteCrdInstrumentation(request.Namespace, request.Name) + } else { + log.Info("Upserting Instrumentation", "data", *instr) + injectionRuleDefaults(instr.Spec.InjectionRules) + upsertCrdInstrumentation(request.Namespace, request.Name, instr.Spec) + // Set the label if it is missing + if instr.Annotations == nil { + instr.Annotations = map[string]string{} + } + instr.Annotations["processingStatus"] = "processed" + + err = r.client.Update(ctx, instr) + if err != nil { + return reconcile.Result{}, fmt.Errorf("could not write Instrumentation: %+v", err) + } + } + + return reconcile.Result{}, nil +} + +type reconcileGInstrCrd struct { + client clientk8s.Client +} + +// Implement reconcile.Reconciler so the controller can reconcile objects +var _ reconcile.Reconciler = &reconcileGInstrCrd{} + +func (r *reconcileGInstrCrd) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) { + // set up a convenient log object so we don't have to type request over and over again + log := log.FromContext(ctx) + + // Fetch the Instrumentation from the cache + instr := &v1alpha1.ClusterInstrumentation{} + err := r.client.Get(ctx, request.NamespacedName, instr) + if errors.IsNotFound(err) { + log.Info("Deleting ClusterInstrumentation", "name", request.Name) + deleteCrdClusterInstrumentation(request.Name) + return reconcile.Result{}, nil + } + + if err != nil { + return reconcile.Result{}, fmt.Errorf("could not fetch ClusterInstrumentation: %+v", err) + } + + if !instr.DeletionTimestamp.IsZero() { + log.Info("Deleting ClusterInstrumentation", "data", *instr) + deleteCrdClusterInstrumentation(request.Name) + } else { + log.Info("Upserting ClusterInstrumentation", "data", *instr) + injectionRuleDefaults(instr.Spec.InjectionRules) + upsertCrdClusterInstrumentation(request.Name, instr.Spec) + // Set the label if it is missing + if instr.Annotations == nil { + instr.Annotations = map[string]string{} + } + instr.Annotations["processingStatus"] = "processed" + + err = r.client.Update(ctx, instr) + if err != nil { + return reconcile.Result{}, fmt.Errorf("could not write ClusterInstrumentation: %+v", err) + } + } + + return reconcile.Result{}, nil +} + +type reconcileOtelColCrd struct { + client clientk8s.Client + Scheme *runtime.Scheme +} + +// Implement reconcile.Reconciler so the controller can reconcile objects +var _ reconcile.Reconciler = &reconcileOtelColCrd{} + +func (r *reconcileOtelColCrd) SetupWithManager(mgr manager.Manager) error { + return ctrl.NewControllerManagedBy(mgr). + For(&v1alpha1.OpenTelemetryCollector{}). + Owns(&appsv1.Deployment{}). + Owns(&corev1.Service{}). + WithEventFilter(predicate.Or( + predicate.GenerationChangedPredicate{}, + /*, predicate.LabelChangedPredicate{} */)). + Complete(r) +} + +func (r *reconcileOtelColCrd) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) { + // set up a convenient log object so we don't have to type request over and over again + log := log.FromContext(ctx) + + // Fetch the Instrumentation from the cache + otelcol := &v1alpha1.OpenTelemetryCollector{} + err := r.client.Get(ctx, request.NamespacedName, otelcol) + if errors.IsNotFound(err) { + log.Info("Deleting OpenTelemetryCollector", "name", request.Name) + r.deleteOtelCollector(ctx, request.Namespace, request.Name) + return reconcile.Result{}, nil + } + + if err != nil { + return reconcile.Result{}, fmt.Errorf("could not fetch OpenTelemetryCollector: %+v", err) + } + + if !otelcol.DeletionTimestamp.IsZero() { + log.Info("Deleting OpenTelemetryCollector", "data", *otelcol) + r.deleteOtelCollector(ctx, request.Namespace, request.Name) + } else { + log.Info("Upserting OpenTelemetryCollector", "data", *otelcol) + r.upsertOtelCollector(ctx, request.Namespace, request.Name, otelcol) + } + return reconcile.Result{}, nil +} + +func (r *reconcileOtelColCrd) deleteOtelCollector(ctx context.Context, namespace string, name string) error { + + unregisterNamespacedCollector(namespace, name) + return nil +} + +const ( + OTELCOL_APP_NAME = "otelcol" + OTELCOL_RESOURCE_PREFIX = "otel-collector-" + OTELCOL_CONFIG_INJECTOR = "config-injector" + OTELCOL_CONFIG_INJECTOR_IMAGE = "alpine:latest" +) + +func (r *reconcileOtelColCrd) upsertOtelCollector(ctx context.Context, namespace string, name string, otelcol *v1alpha1.OpenTelemetryCollector) error { + log := log.FromContext(ctx) + + name = OTELCOL_RESOURCE_PREFIX + name + + // if sidecar definition, which is only config as such, register it for later use + // when instrumented pods are instatiated + if otelcol.Spec.Mode == v1alpha1.ModeSidecar { + registerNamespacedSidecarCollector(namespace, otelcol) + return nil + } + + // if not sidecar definition, proceed to instantiate collector pods + config, err := rest.InClusterConfig() + if err != nil { + log.Error(err, "Error getting cluster config") + return err + } + + clientset, err := clientappsv1.NewForConfig(config) + if err != nil { + log.Error(err, "Error getting clientset") + return err + } + + deploymentClient := clientset.Deployments(namespace) + + create := false + presentDeployment, err := deploymentClient.Get(ctx, name, metav1.GetOptions{}) + if errors.IsNotFound(err) { + create = true + log.Info("OpenTelemetryCollector Deployment not present - creating", "namespace", namespace, "name", name) + } else if err == nil { + log.Info("OpenTelemetryCollector Deployment present - updating", "namespace", namespace, "name", name) + } else { + log.Error(err, "Error getting OpenTelemetryCollector Deployment", "namespace", namespace, "name", name) + return err + } + + // build the Deployment of OpenTelemetry Collector + + otelcolSelector := map[string]string{ + "ext.appd.com/instance": "appd-collector", + "ext.appd.com/name": name, + } + + // ownerReference := metav1.OwnerReference{ + // APIVersion: otelcol.APIVersion, + // Kind: otelcol.Kind, + // Name: otelcol.Name, + // UID: otelcol.UID, + // } + + limCPU, _ := resource.ParseQuantity("200m") + limMem, _ := resource.ParseQuantity("75M") + reqCPU, _ := resource.ParseQuantity("10m") + reqMem, _ := resource.ParseQuantity("50M") + + initScript := "echo \"" + otelcol.Spec.Config + "\" > /conf/otel-collector-config.yaml" + + if otelcol.Spec.Image == "" { + otelcol.Spec.Image = "otel/opentelemetry-collector-contrib:latest" + } + if otelcol.Spec.Replicas == nil { + otelcol.Spec.Replicas = int32Ptr(1) + } + + otelcolDeployment := &appsv1.Deployment{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + // OwnerReferences: []metav1.OwnerReference{ownerReference}, + }, + Spec: appsv1.DeploymentSpec{ + Replicas: int32Ptr(*otelcol.Spec.Replicas), + Selector: &metav1.LabelSelector{ + MatchLabels: otelcolSelector, + }, + Template: corev1.PodTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Labels: otelcolSelector, + }, + Spec: corev1.PodSpec{ + ServiceAccountName: otelcol.Spec.ServiceAccount, + Containers: []corev1.Container{ + { + Name: OTELCOL_APP_NAME, + Image: otelcol.Spec.Image, + ImagePullPolicy: otelcol.Spec.ImagePullPolicy, + Ports: []corev1.ContainerPort{ + { + Name: "grpc", + Protocol: corev1.ProtocolTCP, + ContainerPort: 4317, + }, + { + Name: "http", + Protocol: corev1.ProtocolTCP, + ContainerPort: 4318, + }, + }, + Resources: otelcol.Spec.Resources, + VolumeMounts: []corev1.VolumeMount{ + { + Name: "otelcol-config", + MountPath: "/conf", + }, + }, + Args: []string{"--config", "/conf/otel-collector-config.yaml"}, + }, + }, + InitContainers: []corev1.Container{ + { + Name: OTELCOL_CONFIG_INJECTOR, + Image: OTELCOL_CONFIG_INJECTOR_IMAGE, + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + corev1.ResourceCPU: limCPU, + corev1.ResourceMemory: limMem, + }, + Requests: corev1.ResourceList{ + corev1.ResourceCPU: reqCPU, + corev1.ResourceMemory: reqMem, + }, + }, + Command: []string{"/bin/sh", "-c"}, + Args: []string{initScript}, + VolumeMounts: append(otelcol.Spec.VolumeMounts, corev1.VolumeMount{ + Name: "otelcol-config", + MountPath: "/conf", + }, + ), + Env: otelcol.Spec.Env, + EnvFrom: otelcol.Spec.EnvFrom, + }, + }, + Volumes: append(otelcol.Spec.Volumes, + corev1.Volume{ + Name: "otelcol-config", + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + }, + ), + }, + }, + }, + } + + if err := controllerutil.SetControllerReference(otelcol, otelcolDeployment, scheme); err != nil { + log.Error(err, "Error setting up controller reference for deployment", "namespace", namespace, "name", name) + return err + } + + if create { + _, err = deploymentClient.Create(ctx, otelcolDeployment, metav1.CreateOptions{}) + if err != nil { + log.Error(err, "Error creating OpenTelemetryCollector Deployment", "namespace", namespace, "name", name) + } + } else { + desiredDeployment, err := deploymentClient.Update(ctx, otelcolDeployment, metav1.UpdateOptions{ + DryRun: []string{"All"}, + }) + if err != nil { + log.Error(err, "Error dry run updating OpenTelemetryCollector Deployment", "namespace", namespace, "name", name) + } + if reflect.DeepEqual(presentDeployment.Spec, desiredDeployment.Spec) { + log.Info("Deployment is not changed, skip update", "namespace", namespace, "name", name) + } else { + _, err := deploymentClient.Update(ctx, otelcolDeployment, metav1.UpdateOptions{}) + if err != nil { + log.Error(err, "Error updating OpenTelemetryCollector Deployment", "namespace", namespace, "name", name) + } + } + } + + // Create Service for the OpenTelemetry Collector created above + coreclientset, err := clientcorev1.NewForConfig(config) + if err != nil { + log.Error(err, "Error getting clientset") + return err + } + + serviceClient := coreclientset.Services(namespace) + + create = false + presentService, err := serviceClient.Get(ctx, name, metav1.GetOptions{}) + if errors.IsNotFound(err) { + create = true + log.Info("OpenTelemetryCollector Service not present - creating", "namespace", namespace, "name", name) + } else if err == nil { + log.Info("OpenTelemetryCollector Service present - updating", "namespace", namespace, "name", name) + } else { + log.Error(err, "Error getting OpenTelemetryCollector Service", "namespace", namespace, "name", name) + return err + } + + otelcolService := &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + // OwnerReferences: []metav1.OwnerReference{ownerReference}, + }, + Spec: corev1.ServiceSpec{ + Selector: otelcolSelector, + Ports: []corev1.ServicePort{ + { + Name: "grpc", + Protocol: corev1.ProtocolTCP, + Port: 4317, + TargetPort: intstr.IntOrString{Type: intstr.Int, IntVal: 4317}, + }, + { + Name: "http", + Protocol: corev1.ProtocolTCP, + Port: 4318, + TargetPort: intstr.IntOrString{Type: intstr.Int, IntVal: 4318}, + }, + }, + Type: corev1.ServiceTypeClusterIP, + }, + } + + if err := controllerutil.SetControllerReference(otelcol, otelcolService, scheme); err != nil { + log.Error(err, "Error setting up controller reference for service", "namespace", namespace, "name", name) + return err + } + + if create { + _, err = serviceClient.Create(ctx, otelcolService, metav1.CreateOptions{}) + if err != nil { + log.Error(err, "Error creating OpenTelemetryCollector Service", "namespace", namespace, "name", name) + } + } else { + desiredService, err := serviceClient.Update(ctx, otelcolService, metav1.UpdateOptions{ + DryRun: []string{"All"}, + }) + if err != nil { + log.Error(err, "Error dry run updating OpenTelemetryCollector Service", "namespace", namespace, "name", name) + } + if reflect.DeepEqual(presentService.Spec, desiredService.Spec) { + log.Info("Service is not changed, skip update", "namespace", namespace, "name", name) + } else { + _, err := serviceClient.Update(ctx, otelcolService, metav1.UpdateOptions{}) + if err != nil { + log.Error(err, "Error updating OpenTelemetryCollector Service", "namespace", namespace, "name", name) + } + } + } + + registerNamespacedStandaloneCollector(namespace, otelcol) + + return nil +} + +func int32Ptr(i int32) *int32 { + var v int32 + v = i + return &v +} diff --git a/webhook/pkg/go.mod b/webhook/pkg/go.mod new file mode 100644 index 0000000..11e50f9 --- /dev/null +++ b/webhook/pkg/go.mod @@ -0,0 +1,90 @@ +module main + +go 1.21 + +require ( + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 + google.golang.org/grpc v1.58.3 + k8s.io/api v0.29.0 + k8s.io/apimachinery v0.29.0 + k8s.io/client-go v0.29.0 + sigs.k8s.io/controller-runtime v0.17.2 +) + +require ( + github.com/gorilla/websocket v1.5.0 // indirect + github.com/moby/spdystream v0.2.0 // indirect + github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect +) + +require ( + github.com/beorn7/perks v1.0.1 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/emicklei/go-restful/v3 v3.11.0 // indirect + github.com/evanphx/json-patch/v5 v5.8.0 // indirect + github.com/felixge/httpsnoop v1.0.3 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-logr/zapr v1.3.0 // indirect + github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect + github.com/go-openapi/swag v0.22.3 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/gnostic-models v0.6.8 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/gofuzz v1.2.0 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/imdario/mergo v0.3.15 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/pkg/errors v0.9.1 + github.com/prometheus/client_golang v1.18.0 // indirect + github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/common v0.45.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/proto/otlp v1.0.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.26.0 // indirect + golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/oauth2 v0.12.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/term v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.3.0 // indirect + gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/protobuf v1.31.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/apiextensions-apiserver v0.29.0 // indirect + k8s.io/component-base v0.29.0 // indirect + k8s.io/klog/v2 v2.110.1 // indirect + k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect + k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect + sigs.k8s.io/e2e-framework v0.3.0 + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect +) diff --git a/webhook/pkg/go.sum b/webhook/pkg/go.sum new file mode 100644 index 0000000..0cc9b29 --- /dev/null +++ b/webhook/pkg/go.sum @@ -0,0 +1,247 @@ +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= +github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= +github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch/v5 v5.8.0 h1:lRj6N9Nci7MvzrXuX6HFzU8XjmhPiXPlsKEy1u0KQro= +github.com/evanphx/json-patch/v5 v5.8.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= +github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= +github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= +github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= +github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= +github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= +github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= +github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= +github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/onsi/ginkgo/v2 v2.14.0 h1:vSmGj2Z5YPb9JwCWT6z6ihcUvDhuXLc3sJiqd3jMKAY= +github.com/onsi/ginkgo/v2 v2.14.0/go.mod h1:JkUdW7JkN0V6rFvsHcJ478egV3XH9NxpD27Hal/PhZw= +github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= +github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/vladimirvivien/gexe v0.2.0 h1:nbdAQ6vbZ+ZNsolCgSVb9Fno60kzSuvtzVh6Ytqi/xY= +github.com/vladimirvivien/gexe v0.2.0/go.mod h1:LHQL00w/7gDUKIak24n801ABp8C+ni6eBht9vGVst8w= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 h1:KfYpVmrjI7JuToy5k8XV3nkapjWx48k4E4JOtVstzQI= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0/go.mod h1:SeQhzAEccGVZVEy7aH87Nh0km+utSpo1pTv6eMMop48= +go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= +go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 h1:Mne5On7VWdx7omSrSSZvM4Kw7cS7NQkOOmLcgscI51U= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0/go.mod h1:IPtUMKL4O3tH5y+iXVyAXqpAwMuzC1IrxVS81rummfE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 h1:3d+S281UTjM+AbF31XSOYn1qXn3BgIdWl8HNEpx08Jk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0/go.mod h1:0+KuTDyKL4gjKCF75pHOX4wuzYDUZYfAQdSu43o+Z2I= +go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= +go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= +go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= +go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= +go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= +go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= +go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= +golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= +gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= +google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= +google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e h1:z3vDksarJxsAKM5dmEGv0GHwE2hKJ096wZra71Vs4sw= +google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.29.0 h1:NiCdQMY1QOp1H8lfRyeEf8eOwV6+0xA6XEE44ohDX2A= +k8s.io/api v0.29.0/go.mod h1:sdVmXoz2Bo/cb77Pxi71IPTSErEW32xa4aXwKH7gfBA= +k8s.io/apiextensions-apiserver v0.29.0 h1:0VuspFG7Hj+SxyF/Z/2T0uFbI5gb5LRgEyUVE3Q4lV0= +k8s.io/apiextensions-apiserver v0.29.0/go.mod h1:TKmpy3bTS0mr9pylH0nOt/QzQRrW7/h7yLdRForMZwc= +k8s.io/apimachinery v0.29.0 h1:+ACVktwyicPz0oc6MTMLwa2Pw3ouLAfAon1wPLtG48o= +k8s.io/apimachinery v0.29.0/go.mod h1:eVBxQ/cwiJxH58eK/jd/vAk4mrxmVlnpBH5J2GbMeis= +k8s.io/client-go v0.29.0 h1:KmlDtFcrdUzOYrBhXHgKw5ycWzc3ryPX5mQe0SkG3y8= +k8s.io/client-go v0.29.0/go.mod h1:yLkXH4HKMAywcrD82KMSmfYg2DlE8mepPR4JGSo5n38= +k8s.io/component-base v0.29.0 h1:T7rjd5wvLnPBV1vC4zWd/iWRbV8Mdxs+nGaoaFzGw3s= +k8s.io/component-base v0.29.0/go.mod h1:sADonFTQ9Zc9yFLghpDpmNXEdHyQmFIGbiuZbqAXQ1M= +k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= +k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= +k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= +k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/controller-runtime v0.17.2 h1:FwHwD1CTUemg0pW2otk7/U5/i5m2ymzvOXdbeGOUvw0= +sigs.k8s.io/controller-runtime v0.17.2/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= +sigs.k8s.io/e2e-framework v0.3.0 h1:eqQALBtPCth8+ulTs6lcPK7ytV5rZSSHJzQHZph4O7U= +sigs.k8s.io/e2e-framework v0.3.0/go.mod h1:C+ef37/D90Dc7Xq1jQnNbJYscrUGpxrWog9bx2KIa+c= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/webhook/pkg/go.work b/webhook/pkg/go.work new file mode 100644 index 0000000..2610b4a --- /dev/null +++ b/webhook/pkg/go.work @@ -0,0 +1,6 @@ +go 1.21 + +use ( + ./ + ./v1alpha1 +) \ No newline at end of file diff --git a/webhook/pkg/go.work.sum b/webhook/pkg/go.work.sum new file mode 100644 index 0000000..4a86ad7 --- /dev/null +++ b/webhook/pkg/go.work.sum @@ -0,0 +1,332 @@ +cloud.google.com/go v0.110.2/go.mod h1:k04UEeEtb6ZBRTv3dZz4CeJC3jKGxyhl0sAiVVquxiw= +cloud.google.com/go v0.110.4/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= +cloud.google.com/go v0.110.6/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= +cloud.google.com/go/accessapproval v1.7.1/go.mod h1:JYczztsHRMK7NTXb6Xw+dwbs/WnOJxbo/2mTI+Kgg68= +cloud.google.com/go/accesscontextmanager v1.8.1/go.mod h1:JFJHfvuaTC+++1iL1coPiG1eu5D24db2wXCDWDjIrxo= +cloud.google.com/go/aiplatform v1.45.0/go.mod h1:Iu2Q7sC7QGhXUeOhAj/oCK9a+ULz1O4AotZiqjQ8MYA= +cloud.google.com/go/aiplatform v1.48.0/go.mod h1:Iu2Q7sC7QGhXUeOhAj/oCK9a+ULz1O4AotZiqjQ8MYA= +cloud.google.com/go/analytics v0.21.2/go.mod h1:U8dcUtmDmjrmUTnnnRnI4m6zKn/yaA5N9RlEkYFHpQo= +cloud.google.com/go/analytics v0.21.3/go.mod h1:U8dcUtmDmjrmUTnnnRnI4m6zKn/yaA5N9RlEkYFHpQo= +cloud.google.com/go/apigateway v1.6.1/go.mod h1:ufAS3wpbRjqfZrzpvLC2oh0MFlpRJm2E/ts25yyqmXA= +cloud.google.com/go/apigeeconnect v1.6.1/go.mod h1:C4awq7x0JpLtrlQCr8AzVIzAaYgngRqWf9S5Uhg+wWs= +cloud.google.com/go/apigeeregistry v0.7.1/go.mod h1:1XgyjZye4Mqtw7T9TsY4NW10U7BojBvG4RMD+vRDrIw= +cloud.google.com/go/appengine v1.8.1/go.mod h1:6NJXGLVhZCN9aQ/AEDvmfzKEfoYBlfB80/BHiKVputY= +cloud.google.com/go/area120 v0.8.1/go.mod h1:BVfZpGpB7KFVNxPiQBuHkX6Ed0rS51xIgmGyjrAfzsg= +cloud.google.com/go/artifactregistry v1.14.1/go.mod h1:nxVdG19jTaSTu7yA7+VbWL346r3rIdkZ142BSQqhn5E= +cloud.google.com/go/asset v1.14.1/go.mod h1:4bEJ3dnHCqWCDbWJ/6Vn7GVI9LerSi7Rfdi03hd+WTQ= +cloud.google.com/go/assuredworkloads v1.11.1/go.mod h1:+F04I52Pgn5nmPG36CWFtxmav6+7Q+c5QyJoL18Lry0= +cloud.google.com/go/automl v1.13.1/go.mod h1:1aowgAHWYZU27MybSCFiukPO7xnyawv7pt3zK4bheQE= +cloud.google.com/go/baremetalsolution v0.5.0/go.mod h1:dXGxEkmR9BMwxhzBhV0AioD0ULBmuLZI8CdwalUxuss= +cloud.google.com/go/baremetalsolution v1.1.1/go.mod h1:D1AV6xwOksJMV4OSlWHtWuFNZZYujJknMAP4Qa27QIA= +cloud.google.com/go/batch v0.7.0/go.mod h1:vLZN95s6teRUqRQ4s3RLDsH8PvboqBK+rn1oevL159g= +cloud.google.com/go/batch v1.3.1/go.mod h1:VguXeQKXIYaeeIYbuozUmBR13AfL4SJP7IltNPS+A4A= +cloud.google.com/go/beyondcorp v0.6.1/go.mod h1:YhxDWw946SCbmcWo3fAhw3V4XZMSpQ/VYfcKGAEU8/4= +cloud.google.com/go/beyondcorp v1.0.0/go.mod h1:YhxDWw946SCbmcWo3fAhw3V4XZMSpQ/VYfcKGAEU8/4= +cloud.google.com/go/bigquery v1.52.0/go.mod h1:3b/iXjRQGU4nKa87cXeg6/gogLjO8C6PmuM8i5Bi/u4= +cloud.google.com/go/bigquery v1.53.0/go.mod h1:3b/iXjRQGU4nKa87cXeg6/gogLjO8C6PmuM8i5Bi/u4= +cloud.google.com/go/billing v1.16.0/go.mod h1:y8vx09JSSJG02k5QxbycNRrN7FGZB6F3CAcgum7jvGA= +cloud.google.com/go/binaryauthorization v1.6.1/go.mod h1:TKt4pa8xhowwffiBmbrbcxijJRZED4zrqnwZ1lKH51U= +cloud.google.com/go/certificatemanager v1.7.1/go.mod h1:iW8J3nG6SaRYImIa+wXQ0g8IgoofDFRp5UMzaNk1UqI= +cloud.google.com/go/channel v1.16.0/go.mod h1:eN/q1PFSl5gyu0dYdmxNXscY/4Fi7ABmeHCJNf/oHmc= +cloud.google.com/go/cloudbuild v1.10.1/go.mod h1:lyJg7v97SUIPq4RC2sGsz/9tNczhyv2AjML/ci4ulzU= +cloud.google.com/go/cloudbuild v1.13.0/go.mod h1:lyJg7v97SUIPq4RC2sGsz/9tNczhyv2AjML/ci4ulzU= +cloud.google.com/go/clouddms v1.6.1/go.mod h1:Ygo1vL52Ov4TBZQquhz5fiw2CQ58gvu+PlS6PVXCpZI= +cloud.google.com/go/cloudtasks v1.11.1/go.mod h1:a9udmnou9KO2iulGscKR0qBYjreuX8oHwpmFsKspEvM= +cloud.google.com/go/cloudtasks v1.12.1/go.mod h1:a9udmnou9KO2iulGscKR0qBYjreuX8oHwpmFsKspEvM= +cloud.google.com/go/compute v1.19.3/go.mod h1:qxvISKp/gYnXkSAD1ppcSOveRAmzxicEv/JlizULFrI= +cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute v1.21.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/contactcenterinsights v1.9.1/go.mod h1:bsg/R7zGLYMVxFFzfh9ooLTruLRCG9fnzhH9KznHhbM= +cloud.google.com/go/contactcenterinsights v1.10.0/go.mod h1:bsg/R7zGLYMVxFFzfh9ooLTruLRCG9fnzhH9KznHhbM= +cloud.google.com/go/container v1.22.1/go.mod h1:lTNExE2R7f+DLbAN+rJiKTisauFCaoDq6NURZ83eVH4= +cloud.google.com/go/container v1.24.0/go.mod h1:lTNExE2R7f+DLbAN+rJiKTisauFCaoDq6NURZ83eVH4= +cloud.google.com/go/containeranalysis v0.10.1/go.mod h1:Ya2jiILITMY68ZLPaogjmOMNkwsDrWBSTyBubGXO7j0= +cloud.google.com/go/datacatalog v1.14.1/go.mod h1:d2CevwTG4yedZilwe+v3E3ZBDRMobQfSG/a6cCCN5R4= +cloud.google.com/go/datacatalog v1.16.0/go.mod h1:d2CevwTG4yedZilwe+v3E3ZBDRMobQfSG/a6cCCN5R4= +cloud.google.com/go/dataflow v0.9.1/go.mod h1:Wp7s32QjYuQDWqJPFFlnBKhkAtiFpMTdg00qGbnIHVw= +cloud.google.com/go/dataform v0.8.1/go.mod h1:3BhPSiw8xmppbgzeBbmDvmSWlwouuJkXsXsb8UBih9M= +cloud.google.com/go/datafusion v1.7.1/go.mod h1:KpoTBbFmoToDExJUso/fcCiguGDk7MEzOWXUsJo0wsI= +cloud.google.com/go/datalabeling v0.8.1/go.mod h1:XS62LBSVPbYR54GfYQsPXZjTW8UxCK2fkDciSrpRFdY= +cloud.google.com/go/dataplex v1.8.1/go.mod h1:7TyrDT6BCdI8/38Uvp0/ZxBslOslP2X2MPDucliyvSE= +cloud.google.com/go/dataplex v1.9.0/go.mod h1:7TyrDT6BCdI8/38Uvp0/ZxBslOslP2X2MPDucliyvSE= +cloud.google.com/go/dataproc v1.12.0/go.mod h1:zrF3aX0uV3ikkMz6z4uBbIKyhRITnxvr4i3IjKsKrw4= +cloud.google.com/go/dataproc/v2 v2.0.1/go.mod h1:7Ez3KRHdFGcfY7GcevBbvozX+zyWGcwLJvvAMwCaoZ4= +cloud.google.com/go/dataqna v0.8.1/go.mod h1:zxZM0Bl6liMePWsHA8RMGAfmTG34vJMapbHAxQ5+WA8= +cloud.google.com/go/datastore v1.12.1/go.mod h1:KjdB88W897MRITkvWWJrg2OUtrR5XVj1EoLgSp6/N70= +cloud.google.com/go/datastore v1.13.0/go.mod h1:KjdB88W897MRITkvWWJrg2OUtrR5XVj1EoLgSp6/N70= +cloud.google.com/go/datastream v1.9.1/go.mod h1:hqnmr8kdUBmrnk65k5wNRoHSCYksvpdZIcZIEl8h43Q= +cloud.google.com/go/datastream v1.10.0/go.mod h1:hqnmr8kdUBmrnk65k5wNRoHSCYksvpdZIcZIEl8h43Q= +cloud.google.com/go/deploy v1.11.0/go.mod h1:tKuSUV5pXbn67KiubiUNUejqLs4f5cxxiCNCeyl0F2g= +cloud.google.com/go/deploy v1.13.0/go.mod h1:tKuSUV5pXbn67KiubiUNUejqLs4f5cxxiCNCeyl0F2g= +cloud.google.com/go/dialogflow v1.38.0/go.mod h1:L7jnH+JL2mtmdChzAIcXQHXMvQkE3U4hTaNltEuxXn4= +cloud.google.com/go/dialogflow v1.40.0/go.mod h1:L7jnH+JL2mtmdChzAIcXQHXMvQkE3U4hTaNltEuxXn4= +cloud.google.com/go/dlp v1.10.1/go.mod h1:IM8BWz1iJd8njcNcG0+Kyd9OPnqnRNkDV8j42VT5KOI= +cloud.google.com/go/documentai v1.20.0/go.mod h1:yJkInoMcK0qNAEdRnqY/D5asy73tnPe88I1YTZT+a8E= +cloud.google.com/go/documentai v1.22.0/go.mod h1:yJkInoMcK0qNAEdRnqY/D5asy73tnPe88I1YTZT+a8E= +cloud.google.com/go/domains v0.9.1/go.mod h1:aOp1c0MbejQQ2Pjf1iJvnVyT+z6R6s8pX66KaCSDYfE= +cloud.google.com/go/edgecontainer v1.1.1/go.mod h1:O5bYcS//7MELQZs3+7mabRqoWQhXCzenBu0R8bz2rwk= +cloud.google.com/go/errorreporting v0.3.0/go.mod h1:xsP2yaAp+OAW4OIm60An2bbLpqIhKXdWR/tawvl7QzU= +cloud.google.com/go/essentialcontacts v1.6.2/go.mod h1:T2tB6tX+TRak7i88Fb2N9Ok3PvY3UNbUsMag9/BARh4= +cloud.google.com/go/eventarc v1.12.1/go.mod h1:mAFCW6lukH5+IZjkvrEss+jmt2kOdYlN8aMx3sRJiAI= +cloud.google.com/go/eventarc v1.13.0/go.mod h1:mAFCW6lukH5+IZjkvrEss+jmt2kOdYlN8aMx3sRJiAI= +cloud.google.com/go/filestore v1.7.1/go.mod h1:y10jsorq40JJnjR/lQ8AfFbbcGlw3g+Dp8oN7i7FjV4= +cloud.google.com/go/firestore v1.11.0/go.mod h1:b38dKhgzlmNNGTNZZwe7ZRFEuRab1Hay3/DBsIGKKy4= +cloud.google.com/go/functions v1.15.1/go.mod h1:P5yNWUTkyU+LvW/S9O6V+V423VZooALQlqoXdoPz5AE= +cloud.google.com/go/gkebackup v0.4.0/go.mod h1:byAyBGUwYGEEww7xsbnUTBHIYcOPy/PgUWUtOeRm9Vg= +cloud.google.com/go/gkebackup v1.3.0/go.mod h1:vUDOu++N0U5qs4IhG1pcOnD1Mac79xWy6GoBFlWCWBU= +cloud.google.com/go/gkeconnect v0.8.1/go.mod h1:KWiK1g9sDLZqhxB2xEuPV8V9NYzrqTUmQR9shJHpOZw= +cloud.google.com/go/gkehub v0.14.1/go.mod h1:VEXKIJZ2avzrbd7u+zeMtW00Y8ddk/4V9511C9CQGTY= +cloud.google.com/go/gkemulticloud v0.6.1/go.mod h1:kbZ3HKyTsiwqKX7Yw56+wUGwwNZViRnxWK2DVknXWfw= +cloud.google.com/go/gkemulticloud v1.0.0/go.mod h1:kbZ3HKyTsiwqKX7Yw56+wUGwwNZViRnxWK2DVknXWfw= +cloud.google.com/go/gsuiteaddons v1.6.1/go.mod h1:CodrdOqRZcLp5WOwejHWYBjZvfY0kOphkAKpF/3qdZY= +cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0= +cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= +cloud.google.com/go/iap v1.8.1/go.mod h1:sJCbeqg3mvWLqjZNsI6dfAtbbV1DL2Rl7e1mTyXYREQ= +cloud.google.com/go/ids v1.4.1/go.mod h1:np41ed8YMU8zOgv53MMMoCntLTn2lF+SUzlM+O3u/jw= +cloud.google.com/go/iot v1.7.1/go.mod h1:46Mgw7ev1k9KqK1ao0ayW9h0lI+3hxeanz+L1zmbbbk= +cloud.google.com/go/kms v1.12.1/go.mod h1:c9J991h5DTl+kg7gi3MYomh12YEENGrf48ee/N/2CDM= +cloud.google.com/go/kms v1.15.0/go.mod h1:c9J991h5DTl+kg7gi3MYomh12YEENGrf48ee/N/2CDM= +cloud.google.com/go/language v1.10.1/go.mod h1:CPp94nsdVNiQEt1CNjF5WkTcisLiHPyIbMhvR8H2AW0= +cloud.google.com/go/lifesciences v0.9.1/go.mod h1:hACAOd1fFbCGLr/+weUKRAJas82Y4vrL3O5326N//Wc= +cloud.google.com/go/logging v1.7.0/go.mod h1:3xjP2CjkM3ZkO73aj4ASA5wRPGGCRrPIAeNqVNkzY8M= +cloud.google.com/go/longrunning v0.5.0/go.mod h1:0JNuqRShmscVAhIACGtskSAWtqtOoPkwP0YF1oVEchc= +cloud.google.com/go/longrunning v0.5.1/go.mod h1:spvimkwdz6SPWKEt/XBij79E9fiTkHSQl/fRUUQJYJc= +cloud.google.com/go/managedidentities v1.6.1/go.mod h1:h/irGhTN2SkZ64F43tfGPMbHnypMbu4RB3yl8YcuEak= +cloud.google.com/go/maps v0.7.0/go.mod h1:3GnvVl3cqeSvgMcpRlQidXsPYuDGQ8naBis7MVzpXsY= +cloud.google.com/go/maps v1.4.0/go.mod h1:6mWTUv+WhnOwAgjVsSW2QPPECmW+s3PcRyOa9vgG/5s= +cloud.google.com/go/mediatranslation v0.8.1/go.mod h1:L/7hBdEYbYHQJhX2sldtTO5SZZ1C1vkapubj0T2aGig= +cloud.google.com/go/memcache v1.10.1/go.mod h1:47YRQIarv4I3QS5+hoETgKO40InqzLP6kpNLvyXuyaA= +cloud.google.com/go/metastore v1.11.1/go.mod h1:uZuSo80U3Wd4zi6C22ZZliOUJ3XeM/MlYi/z5OAOWRA= +cloud.google.com/go/metastore v1.12.0/go.mod h1:uZuSo80U3Wd4zi6C22ZZliOUJ3XeM/MlYi/z5OAOWRA= +cloud.google.com/go/monitoring v1.15.1/go.mod h1:lADlSAlFdbqQuwwpaImhsJXu1QSdd3ojypXrFSMr2rM= +cloud.google.com/go/networkconnectivity v1.12.1/go.mod h1:PelxSWYM7Sh9/guf8CFhi6vIqf19Ir/sbfZRUwXh92E= +cloud.google.com/go/networkmanagement v1.8.0/go.mod h1:Ho/BUGmtyEqrttTgWEe7m+8vDdK74ibQc+Be0q7Fof0= +cloud.google.com/go/networksecurity v0.9.1/go.mod h1:MCMdxOKQ30wsBI1eI659f9kEp4wuuAueoC9AJKSPWZQ= +cloud.google.com/go/notebooks v1.9.1/go.mod h1:zqG9/gk05JrzgBt4ghLzEepPHNwE5jgPcHZRKhlC1A8= +cloud.google.com/go/optimization v1.4.1/go.mod h1:j64vZQP7h9bO49m2rVaTVoNM0vEBEN5eKPUPbZyXOrk= +cloud.google.com/go/orchestration v1.8.1/go.mod h1:4sluRF3wgbYVRqz7zJ1/EUNc90TTprliq9477fGobD8= +cloud.google.com/go/orgpolicy v1.11.1/go.mod h1:8+E3jQcpZJQliP+zaFfayC2Pg5bmhuLK755wKhIIUCE= +cloud.google.com/go/osconfig v1.12.1/go.mod h1:4CjBxND0gswz2gfYRCUoUzCm9zCABp91EeTtWXyz0tE= +cloud.google.com/go/oslogin v1.10.1/go.mod h1:x692z7yAue5nE7CsSnoG0aaMbNoRJRXO4sn73R+ZqAs= +cloud.google.com/go/phishingprotection v0.8.1/go.mod h1:AxonW7GovcA8qdEk13NfHq9hNx5KPtfxXNeUxTDxB6I= +cloud.google.com/go/policytroubleshooter v1.7.1/go.mod h1:0NaT5v3Ag1M7U5r0GfDCpUFkWd9YqpubBWsQlhanRv0= +cloud.google.com/go/policytroubleshooter v1.8.0/go.mod h1:tmn5Ir5EToWe384EuboTcVQT7nTag2+DuH3uHmKd1HU= +cloud.google.com/go/privatecatalog v0.9.1/go.mod h1:0XlDXW2unJXdf9zFz968Hp35gl/bhF4twwpXZAW50JA= +cloud.google.com/go/pubsub v1.32.0/go.mod h1:f+w71I33OMyxf9VpMVcZbnG5KSUkCOUHYpFd5U1GdRc= +cloud.google.com/go/pubsub v1.33.0/go.mod h1:f+w71I33OMyxf9VpMVcZbnG5KSUkCOUHYpFd5U1GdRc= +cloud.google.com/go/pubsublite v1.8.1/go.mod h1:fOLdU4f5xldK4RGJrBMm+J7zMWNj/k4PxwEZXy39QS0= +cloud.google.com/go/recaptchaenterprise/v2 v2.7.2/go.mod h1:kR0KjsJS7Jt1YSyWFkseQ756D45kaYNTlDPPaRAvDBU= +cloud.google.com/go/recommendationengine v0.8.1/go.mod h1:MrZihWwtFYWDzE6Hz5nKcNz3gLizXVIDI/o3G1DLcrE= +cloud.google.com/go/recommender v1.10.1/go.mod h1:XFvrE4Suqn5Cq0Lf+mCP6oBHD/yRMA8XxP5sb7Q7gpA= +cloud.google.com/go/redis v1.13.1/go.mod h1:VP7DGLpE91M6bcsDdMuyCm2hIpB6Vp2hI090Mfd1tcg= +cloud.google.com/go/resourcemanager v1.9.1/go.mod h1:dVCuosgrh1tINZ/RwBufr8lULmWGOkPS8gL5gqyjdT8= +cloud.google.com/go/resourcesettings v1.6.1/go.mod h1:M7mk9PIZrC5Fgsu1kZJci6mpgN8o0IUzVx3eJU3y4Jw= +cloud.google.com/go/retail v1.14.1/go.mod h1:y3Wv3Vr2k54dLNIrCzenyKG8g8dhvhncT2NcNjb/6gE= +cloud.google.com/go/run v0.9.0/go.mod h1:Wwu+/vvg8Y+JUApMwEDfVfhetv30hCG4ZwDR/IXl2Qg= +cloud.google.com/go/run v1.2.0/go.mod h1:36V1IlDzQ0XxbQjUx6IYbw8H3TJnWvhii963WW3B/bo= +cloud.google.com/go/scheduler v1.10.1/go.mod h1:R63Ldltd47Bs4gnhQkmNDse5w8gBRrhObZ54PxgR2Oo= +cloud.google.com/go/secretmanager v1.11.1/go.mod h1:znq9JlXgTNdBeQk9TBW/FnR/W4uChEKGeqQWAJ8SXFw= +cloud.google.com/go/security v1.15.1/go.mod h1:MvTnnbsWnehoizHi09zoiZob0iCHVcL4AUBj76h9fXA= +cloud.google.com/go/securitycenter v1.23.0/go.mod h1:8pwQ4n+Y9WCWM278R8W3nF65QtY172h4S8aXyI9/hsQ= +cloud.google.com/go/servicedirectory v1.10.1/go.mod h1:Xv0YVH8s4pVOwfM/1eMTl0XJ6bzIOSLDt8f8eLaGOxQ= +cloud.google.com/go/servicedirectory v1.11.0/go.mod h1:Xv0YVH8s4pVOwfM/1eMTl0XJ6bzIOSLDt8f8eLaGOxQ= +cloud.google.com/go/shell v1.7.1/go.mod h1:u1RaM+huXFaTojTbW4g9P5emOrrmLE69KrxqQahKn4g= +cloud.google.com/go/spanner v1.47.0/go.mod h1:IXsJwVW2j4UKs0eYDqodab6HgGuA1bViSqW4uH9lfUI= +cloud.google.com/go/speech v1.17.1/go.mod h1:8rVNzU43tQvxDaGvqOhpDqgkJTFowBpDvCJ14kGlJYo= +cloud.google.com/go/speech v1.19.0/go.mod h1:8rVNzU43tQvxDaGvqOhpDqgkJTFowBpDvCJ14kGlJYo= +cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= +cloud.google.com/go/storagetransfer v1.10.0/go.mod h1:DM4sTlSmGiNczmV6iZyceIh2dbs+7z2Ayg6YAiQlYfA= +cloud.google.com/go/talent v1.6.2/go.mod h1:CbGvmKCG61mkdjcqTcLOkb2ZN1SrQI8MDyma2l7VD24= +cloud.google.com/go/texttospeech v1.7.1/go.mod h1:m7QfG5IXxeneGqTapXNxv2ItxP/FS0hCZBwXYqucgSk= +cloud.google.com/go/tpu v1.6.1/go.mod h1:sOdcHVIgDEEOKuqUoi6Fq53MKHJAtOwtz0GuKsWSH3E= +cloud.google.com/go/trace v1.10.1/go.mod h1:gbtL94KE5AJLH3y+WVpfWILmqgc6dXcqgNXdOPAQTYk= +cloud.google.com/go/translate v1.8.1/go.mod h1:d1ZH5aaOA0CNhWeXeC8ujd4tdCFw8XoNWRljklu5RHs= +cloud.google.com/go/translate v1.8.2/go.mod h1:d1ZH5aaOA0CNhWeXeC8ujd4tdCFw8XoNWRljklu5RHs= +cloud.google.com/go/video v1.17.1/go.mod h1:9qmqPqw/Ib2tLqaeHgtakU+l5TcJxCJbhFXM7UJjVzU= +cloud.google.com/go/video v1.19.0/go.mod h1:9qmqPqw/Ib2tLqaeHgtakU+l5TcJxCJbhFXM7UJjVzU= +cloud.google.com/go/videointelligence v1.11.1/go.mod h1:76xn/8InyQHarjTWsBR058SmlPCwQjgcvoW0aZykOvo= +cloud.google.com/go/vision/v2 v2.7.2/go.mod h1:jKa8oSYBWhYiXarHPvP4USxYANYUEdEsQrloLjrSwJU= +cloud.google.com/go/vmmigration v1.7.1/go.mod h1:WD+5z7a/IpZ5bKK//YmT9E047AD+rjycCAvyMxGJbro= +cloud.google.com/go/vmwareengine v0.4.1/go.mod h1:Px64x+BvjPZwWuc4HdmVhoygcXqEkGHXoa7uyfTgSI0= +cloud.google.com/go/vmwareengine v1.0.0/go.mod h1:Px64x+BvjPZwWuc4HdmVhoygcXqEkGHXoa7uyfTgSI0= +cloud.google.com/go/vpcaccess v1.7.1/go.mod h1:FogoD46/ZU+JUBX9D606X21EnxiszYi2tArQwLY4SXs= +cloud.google.com/go/webrisk v1.9.1/go.mod h1:4GCmXKcOa2BZcZPn6DCEvE7HypmEJcJkr4mtM+sqYPc= +cloud.google.com/go/websecurityscanner v1.6.1/go.mod h1:Njgaw3rttgRHXzwCB8kgCYqv5/rGpFCsBOvPbYgszpg= +cloud.google.com/go/workflows v1.11.1/go.mod h1:Z+t10G1wF7h8LgdY/EmRcQY8ptBD/nvofaL6FqlET6g= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= +github.com/alecthomas/kingpin/v2 v2.3.2/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= +github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= +github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/coreos/go-oidc v2.2.1+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= +github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.11.1/go.mod h1:uhMcXKCQMEJHiAb0w+YGefQLaTEw+YhGluxZkrTmD0g= +github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= +github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-openapi/jsonreference v0.20.1/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= +github.com/google/cel-go v0.17.7/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY= +github.com/google/gnostic v0.6.9/go.mod h1:Nm8234We1lq6iB9OmlgNv3nH91XLLVZHCDayfA3xq+E= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= +github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pquerna/cachecontrol v0.1.0/go.mod h1:NrUG3Z7Rdu85UNR3vm7SOsl1nFIeSiQnrHV5K9mBcUI= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75/go.mod h1:KO6IkyS8Y3j8OdNO85qEYBsRPuteD+YciPomcXdrMnk= +github.com/vladimirvivien/gexe v0.2.0/go.mod h1:LHQL00w/7gDUKIak24n801ABp8C+ni6eBht9vGVst8w= +github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/etcd/api/v3 v3.5.10/go.mod h1:TidfmT4Uycad3NM/o25fG3J07odo4GBB9hoxaodFCtI= +go.etcd.io/etcd/client/pkg/v3 v3.5.10/go.mod h1:DYivfIviIuQ8+/lCq4vcxuseg2P2XbHygkKwFo9fc8U= +go.etcd.io/etcd/client/v2 v2.305.10/go.mod h1:m3CKZi69HzilhVqtPDcjhSGp+kA1OmbNn0qamH80xjA= +go.etcd.io/etcd/client/v3 v3.5.10/go.mod h1:RVeBnDz2PUEZqTpgqwAtUd8nAPf5kjyFyND7P1VkOKc= +go.etcd.io/etcd/pkg/v3 v3.5.10/go.mod h1:TKTuCKKcF1zxmfKWDkfz5qqYaE3JncKKZPFf8c1nFUs= +go.etcd.io/etcd/raft/v3 v3.5.10/go.mod h1:odD6kr8XQXTy9oQnyMPBOr0TVe+gT0neQhElQ6jbGRc= +go.etcd.io/etcd/server/v3 v3.5.10/go.mod h1:gBplPHfs6YI0L+RpGkTQO7buDbHv5HJGG/Bst0/zIPo= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0/go.mod h1:5z+/ZWJQKXa9YT34fQNx5K8Hd1EoIhvtUygUQPqEOgQ= +go.opentelemetry.io/otel v1.18.0/go.mod h1:9lWqYO0Db579XzVuCKFNPDl4s73Voa+zEck3wHaAYQI= +go.opentelemetry.io/otel/metric v1.18.0/go.mod h1:nNSpsVDjWGfb7chbRLUNW+PBNdcSTHD4Uu5pfFMOI0k= +go.opentelemetry.io/otel/trace v1.18.0/go.mod h1:T2+SGJGuYZY3bjj5rgh/hN7KIrlpWC5nS8Mjvzckz+0= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= +google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:zqTuNwFlFRsw5zIts5VnzLQxSRqh+CGOTVMlYbY0Eyk= +google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= +google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:O9kGHb51iE/nOGvQaDUuadVYqovW56s5emA88lQnj6Y= +google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98/go.mod h1:S7mY02OqCJTD0E1OiQy1F72PWFB4bZJ87cAtLPYgDR0= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/api v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:mPBs5jNgx2GuQGvFwUvVKqtn6HsUw9nP64BedgvqEsQ= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:8mL13HKkDa+IuJ8yruA3ci0q+0vsUz4m//+ottjwS5o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= +gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +k8s.io/apiserver v0.29.0/go.mod h1:31n78PsRKPmfpee7/l9NYEv67u6hOL6AfcE761HapDM= +k8s.io/code-generator v0.29.0/go.mod h1:5bqIZoCxs2zTRKMWNYqyQWW/bajc+ah4rh0tMY8zdGA= +k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/kms v0.29.0/go.mod h1:mB0f9HLxRXeXUfHfn1A7rpwOlzXI1gIWu86z6buNoYA= +k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0/go.mod h1:VHVDI/KrK4fjnV61bE2g3sA7tiETLn8sooImelsCx3Y= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/webhook/instrument.go b/webhook/pkg/instrument.go similarity index 84% rename from webhook/instrument.go rename to webhook/pkg/instrument.go index 4bdee10..dfdd2d2 100644 --- a/webhook/instrument.go +++ b/webhook/pkg/instrument.go @@ -24,10 +24,10 @@ import ( "log" "strconv" "strings" + "v1alpha1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" ) type TemplateParams struct { @@ -38,9 +38,7 @@ type TemplateParams struct { Namespace string } -func instrument(pod corev1.Pod, instrRule *InstrumentationRule) ([]patchOperation, error) { - - getADIs(pod.GetNamespace()) +func instrument(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) ([]patchOperation, error) { patchOps := []patchOperation{} @@ -105,7 +103,7 @@ func instrument(pod corev1.Pod, instrRule *InstrumentationRule) ([]patchOperatio return patchOps, nil } -func applyInjectionRule(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { +func applyInjectionRule(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} _, provider := getTechnologyAndProvider(instrRule.InjectionRules.Technology) @@ -113,8 +111,6 @@ func applyInjectionRule(pod corev1.Pod, instrRule *InstrumentationRule) []patchO switch provider { case "appd": patchOps = append(patchOps, appdInstrumentation(pod, instrRule)...) - case "telescope": - patchOps = append(patchOps, telescopeInstrumentation(pod, instrRule)...) case "otel": patchOps = append(patchOps, otelInstrumentation(pod, instrRule)...) } @@ -122,7 +118,7 @@ func applyInjectionRule(pod corev1.Pod, instrRule *InstrumentationRule) []patchO return patchOps } -func appdInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { +func appdInstrumentation(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} @@ -150,31 +146,7 @@ func appdInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patch return patchOps } -func telescopeInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { - - patchOps := []patchOperation{} - - patchOps = append(patchOps, patchOperation{ - Op: "add", - Path: "/metadata/annotations/TELESCOPE_INSTRUMENTATION_VIA_RULE", - Value: string(instrRule.Name), - }) - - technology, _ := getTechnologyAndProvider(instrRule.InjectionRules.Technology) - - switch technology { - case "java": - patchOps = append(patchOps, javaTelescopeInstrumentation(pod, instrRule)...) - case "nodejs": - patchOps = append(patchOps, nodejsTelescopeInstrumentation(pod, instrRule)...) - default: - patchOps = append(patchOps, getInstrumentationStatusPatch("FAILED", "Technology for injection not specified or unknown")...) - } - - return patchOps -} - -func otelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { +func otelInstrumentation(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} @@ -204,7 +176,7 @@ func otelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patch return patchOps } -func getApplicationName(pod corev1.Pod, instrRule *InstrumentationRule) string { +func getApplicationName(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) string { appName := "" injRules := instrRule.InjectionRules switch injRules.ApplicationNameSource { @@ -264,7 +236,7 @@ func getApplicationName(pod corev1.Pod, instrRule *InstrumentationRule) string { return appName } -func getTierName(pod corev1.Pod, instrRule *InstrumentationRule) string { +func getTierName(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) string { tierName := "" injRules := instrRule.InjectionRules switch injRules.TierNameSource { @@ -325,7 +297,7 @@ func addContainerEnvVar(name string, value string, containerIdx int) patchOperat } } -func addSpecifiedContainerEnvVars(vars []NameValue, containerIdx int) []patchOperation { +func addSpecifiedContainerEnvVars(vars []v1alpha1.NameValue, containerIdx int) []patchOperation { patchOps := []patchOperation{} for _, envvar := range vars { @@ -341,9 +313,13 @@ func addSpecifiedContainerEnvVars(vars []NameValue, containerIdx int) []patchOpe return patchOps } -func addK8SOtelResourceAttrs(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addK8SOtelResourceAttrs(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int, envVarName string) []patchOperation { patchOps := []patchOperation{} + if envVarName == "" { + envVarName = "OTEL_RESOURCE_ATTRIBUTES" + } + preSetOtelResAttrs := "" podEnvs := pod.Spec.Containers[containerIdx].Env if podEnvs != nil { @@ -409,18 +385,18 @@ func addK8SOtelResourceAttrs(pod corev1.Pod, instrRules *InstrumentationRule, co Op: "add", Path: fmt.Sprintf("/spec/containers/%d/env/-", containerIdx), Value: corev1.EnvVar{ - Name: "OTEL_RESOURCE_ATTRIBUTES", + Name: envVarName, Value: otelResourceAttributes, }, }) } - log.Printf("OrelRsrs: %b, %v\n", *instrRules.InjectionRules.InjectK8SOtelResourceAttrs, patchOps) + log.Printf("OTelRsrs: %t, %v\n", *instrRules.InjectionRules.InjectK8SOtelResourceAttrs, patchOps) return patchOps } -func addNetvizEnvVars(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addNetvizEnvVars(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ @@ -473,12 +449,12 @@ func addControllerEnvVars(containerIdx int) []patchOperation { return patchOps } -func addTemplate(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addTemplate(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} return patchOps } -func reuseNodeNames(instrRules *InstrumentationRule) bool { +func reuseNodeNames(instrRules *v1alpha1.InstrumentationSpec) bool { if instrRules.InjectionRules.UsePodNameForNodeName != nil { if *instrRules.InjectionRules.UsePodNameForNodeName { return false @@ -535,24 +511,3 @@ func removeDupliciteEnvs(patchOps []patchOperation, containerIdx int) []patchOpe return newPatchOps } - -func getADIs(namespace string) error { - adiGVR := schema.GroupVersionResource{ - Group: "ext.appd.com", - Version: "v1", - Resource: "appdynamicsinstrumentations", - } - adis, err := client.Resource(adiGVR).Namespace(namespace).List(context.TODO(), metav1.ListOptions{}) - if err != nil { - log.Printf("Cannot get ADIs in namespace %s - %v\n", namespace, err) - return err - } - - for _, adi := range adis.Items { - log.Printf("ADI - %s - %v\n", adi.GetName(), adi) - spec := adi.UnstructuredContent()["spec"].(map[string]interface{}) - log.Printf("ADI Spec: \nexclude: %v\ninclude: %v\n", spec["exclude"], spec["include"]) - } - - return err -} diff --git a/webhook/instrumentAppdApache.go b/webhook/pkg/instrumentAppdApache.go similarity index 79% rename from webhook/instrumentAppdApache.go rename to webhook/pkg/instrumentAppdApache.go index 9889df9..a4c1b22 100644 --- a/webhook/instrumentAppdApache.go +++ b/webhook/pkg/instrumentAppdApache.go @@ -16,9 +16,13 @@ limitations under the License. package main -import corev1 "k8s.io/api/core/v1" +import ( + "v1alpha1" -func apacheAppdInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { + corev1 "k8s.io/api/core/v1" +) + +func apacheAppdInstrumentation(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} return patchOps diff --git a/webhook/instrumentAppdDotNet.go b/webhook/pkg/instrumentAppdDotNet.go similarity index 67% rename from webhook/instrumentAppdDotNet.go rename to webhook/pkg/instrumentAppdDotNet.go index 14cf656..964fc3f 100644 --- a/webhook/instrumentAppdDotNet.go +++ b/webhook/pkg/instrumentAppdDotNet.go @@ -18,16 +18,19 @@ package main import ( "fmt" + "log" + "v1alpha1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" ) -func dotnetAppdInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { +func dotnetAppdInstrumentation(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, addControllerEnvVars(0)...) patchOps = append(patchOps, addDotnetEnvVar(pod, instrRule, 0)...) + patchOps = append(patchOps, addDotnetOtelEnvVar(pod, instrRule, 0)...) patchOps = append(patchOps, addContainerEnvVar("APPDYNAMICS_AGENT_APPLICATION_NAME", getApplicationName(pod, instrRule), 0)) patchOps = append(patchOps, addContainerEnvVar("APPDYNAMICS_AGENT_TIER_NAME", getTierName(pod, instrRule), 0)) if reuseNodeNames(instrRule) { @@ -47,7 +50,7 @@ func dotnetAppdInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) [ return patchOps } -func addDotnetEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addDotnetEnvVar(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, addContainerEnvVar("LD_LIBRARY_PATH", "/opt/appdynamics-dotnetcore", 0)) @@ -87,7 +90,37 @@ func addDotnetEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, containerI return patchOps } -func addDotnetAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addDotnetOtelEnvVar(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { + patchOps := []patchOperation{} + if instrRule.InjectionRules.OpenTelemetryCollector != "" { + otelCollConfig, _, err := getCollectorConfigsByName(pod.GetNamespace(), instrRule.InjectionRules.OpenTelemetryCollector) + // otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] + if err != nil { + log.Printf("Cannot find OTel collector definition %s\n", instrRule.InjectionRules.OpenTelemetryCollector) + } else { + + patchOps = append(patchOps, addContainerEnvVar("APPDYNAMICS_OPENTELEMETRY_ENABLED", "true", containerIdx)) + patchOps = append(patchOps, addContainerEnvVar("OTEL_TRACES_EXPORTER", "otlp", containerIdx)) + otelRsrcAttrs := "" + if *instrRule.InjectionRules.InjectK8SOtelResourceAttrs { + patchOps = append(patchOps, addK8SOtelResourceAttrs(pod, instrRule, containerIdx, "OTEL_RESOURCE_ATTRIBUTES_K8S")...) + otelRsrcAttrs = ",$(OTEL_RESOURCE_ATTRIBUTES_K8S)" + } + resourceAttributes := fmt.Sprintf("service.name=%s,service.namespace=%s%s", getTierName(pod, instrRule), getApplicationName(pod, instrRule), otelRsrcAttrs) + patchOps = append(patchOps, addContainerEnvVar("OTEL_RESOURCE_ATTRIBUTES", resourceAttributes, containerIdx)) + if otelCollConfig.Mode == "sidecar" { + patchOps = append(patchOps, addContainerEnvVar("OTEL_EXPORTER_OTLP_ENDPOINT", "http://localhost:4318", containerIdx)) + patchOps = append(patchOps, addOtelCollSidecar(pod, instrRule, containerIdx)...) + } else if (otelCollConfig.Mode == "deployment") || (otelCollConfig.Mode == "external") { + patchOps = append(patchOps, addContainerEnvVar("OTEL_EXPORTER_OTLP_ENDPOINT", fmt.Sprintf("http://%s:4318", otelCollConfig.ServiceName), containerIdx)) + } + } + } + + return patchOps +} + +func addDotnetAgentVolumeMount(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -100,7 +133,7 @@ func addDotnetAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRule, return patchOps } -func addDotnetAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addDotnetAgentVolume(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -115,7 +148,7 @@ func addDotnetAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) []pat return patchOps } -func addDotnetAgentInitContainer(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addDotnetAgentInitContainer(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} limCPU, _ := resource.ParseQuantity("200m") limMem, _ := resource.ParseQuantity("75M") diff --git a/webhook/instrumentAppdJava.go b/webhook/pkg/instrumentAppdJava.go similarity index 83% rename from webhook/instrumentAppdJava.go rename to webhook/pkg/instrumentAppdJava.go index 2548ee2..67d27b4 100644 --- a/webhook/instrumentAppdJava.go +++ b/webhook/pkg/instrumentAppdJava.go @@ -19,12 +19,13 @@ package main import ( "fmt" "log" + "v1alpha1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" ) -func javaAppdInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { +func javaAppdInstrumentation(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, addControllerEnvVars(0)...) @@ -46,8 +47,9 @@ func javaAppdInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []p patchOps = append(patchOps, addJavaAgentVolume(pod, instrRule)...) if instrRule.InjectionRules.OpenTelemetryCollector != "" { - otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] - if !found { + otelCollConfig, _, err := getCollectorConfigsByName(pod.GetNamespace(), instrRule.InjectionRules.OpenTelemetryCollector) + // otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] + if err != nil { log.Printf("Cannot find OTel collector definition %s\n", instrRule.InjectionRules.OpenTelemetryCollector) } else { if otelCollConfig.Mode == "sidecar" { @@ -59,10 +61,13 @@ func javaAppdInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []p return patchOps } -func addJavaEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addJavaEnvVar(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} - patchOps = append(patchOps, addK8SOtelResourceAttrs(pod, instrRules, containerIdx)...) + // fmt.Println(asJson(instrRules, "INSTRUMENTATION RULES")) + // time.Sleep(1 * time.Second) + + patchOps = append(patchOps, addK8SOtelResourceAttrs(pod, instrRules, containerIdx, "OTEL_RESOURCE_ATTRIBUTES")...) patchOps = append(patchOps, patchOperation{ Op: "add", @@ -92,7 +97,7 @@ func addJavaEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx return patchOps } -func getJavaOptions(pod corev1.Pod, instrRules *InstrumentationRule) string { +func getJavaOptions(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) string { javaOpts := " " if config.ControllerConfig.UseProxy { @@ -110,8 +115,9 @@ func getJavaOptions(pod corev1.Pod, instrRules *InstrumentationRule) string { // OpenTelemetry Java Options for AppD hybrid agent if instrRules.InjectionRules.OpenTelemetryCollector != "" { - otelCollConfig, found := otelCollsConfig[instrRules.InjectionRules.OpenTelemetryCollector] - if !found { + otelCollConfig, _, err := getCollectorConfigsByName(pod.GetNamespace(), instrRules.InjectionRules.OpenTelemetryCollector) + // otelCollConfig, found := otelCollsConfig[instrRules.InjectionRules.OpenTelemetryCollector] + if err != nil { log.Printf("Cannot find OTel collector definition %s\n", instrRules.InjectionRules.OpenTelemetryCollector) } else { javaOpts += "-Dappdynamics.opentelemetry.enabled=true " @@ -132,7 +138,7 @@ func getJavaOptions(pod corev1.Pod, instrRules *InstrumentationRule) string { return javaOpts } -func addJavaAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addJavaAgentVolumeMount(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -145,7 +151,7 @@ func addJavaAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRule, co return patchOps } -func addJavaAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addJavaAgentVolume(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -160,7 +166,7 @@ func addJavaAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) []patch return patchOps } -func addJavaAgentInitContainer(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addJavaAgentInitContainer(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} limCPU, _ := resource.ParseQuantity("200m") limMem, _ := resource.ParseQuantity("75M") diff --git a/webhook/instrumentAppdNodeJS.go b/webhook/pkg/instrumentAppdNodeJS.go similarity index 89% rename from webhook/instrumentAppdNodeJS.go rename to webhook/pkg/instrumentAppdNodeJS.go index 60837bb..c0c4970 100644 --- a/webhook/instrumentAppdNodeJS.go +++ b/webhook/pkg/instrumentAppdNodeJS.go @@ -18,12 +18,13 @@ package main import ( "fmt" + "v1alpha1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" ) -func nodejsAppdInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { +func nodejsAppdInstrumentation(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, addControllerEnvVars(0)...) @@ -50,7 +51,7 @@ func nodejsAppdInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) [ return patchOps } -func addNodejsEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addNodejsEnvVar(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, addContainerEnvVar("NODE_OPTIONS", "--require /opt/appdynamics-nodejs/shim.js", 0)) @@ -88,7 +89,7 @@ func addNodejsEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, containerI return patchOps } -func addNodejsAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addNodejsAgentVolumeMount(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -101,7 +102,7 @@ func addNodejsAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRule, return patchOps } -func addNodejsAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addNodejsAgentVolume(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -116,7 +117,7 @@ func addNodejsAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) []pat return patchOps } -func addNodejsAgentInitContainer(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addNodejsAgentInitContainer(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} limCPU, _ := resource.ParseQuantity("200m") limMem, _ := resource.ParseQuantity("75M") diff --git a/webhook/instrumentOtelApache.go b/webhook/pkg/instrumentOtelApache.go similarity index 86% rename from webhook/instrumentOtelApache.go rename to webhook/pkg/instrumentOtelApache.go index 58ae538..82c8f6f 100644 --- a/webhook/instrumentOtelApache.go +++ b/webhook/pkg/instrumentOtelApache.go @@ -20,6 +20,7 @@ import ( "fmt" "log" "strings" + "v1alpha1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" @@ -29,7 +30,7 @@ const OTEL_WEBSERVER_DIR = "/opt/opentelemetry-webserver" const OTEL_WEBSERVER_AGENT_DIR = OTEL_WEBSERVER_DIR + "/agent" const OTEL_WEBSERVER_CONFIG_DIR = OTEL_WEBSERVER_DIR + "/source-conf" -func apacheOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { +func apacheOtelInstrumentation(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} containerId := 0 @@ -46,8 +47,9 @@ func apacheOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) [ patchOps = append(patchOps, addOtelApacheSourceConfVolume(pod, instrRule)...) if instrRule.InjectionRules.OpenTelemetryCollector != "" { - otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] - if !found { + otelCollConfig, _, err := getCollectorConfigsByName(pod.GetNamespace(), instrRule.InjectionRules.OpenTelemetryCollector) + // otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] + if err != nil { log.Printf("Cannot find OTel collector definition %s\n", instrRule.InjectionRules.OpenTelemetryCollector) } else { if otelCollConfig.Mode == "sidecar" { @@ -61,15 +63,15 @@ func apacheOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) [ return patchOps } -func addOtelApacheEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addOtelApacheEnvVar(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} - patchOps = append(patchOps, addK8SOtelResourceAttrs(pod, instrRules, containerIdx)...) + patchOps = append(patchOps, addK8SOtelResourceAttrs(pod, instrRules, containerIdx, "OTEL_RESOURCE_ATTRIBUTES")...) return patchOps } -func addOtelApacheAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addOtelApacheAgentVolumeMount(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} // directory with modified Apache conf directory patchOps = append(patchOps, patchOperation{ @@ -92,7 +94,7 @@ func addOtelApacheAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRu return patchOps } -func addOtelApacheAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addOtelApacheAgentVolume(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -107,7 +109,7 @@ func addOtelApacheAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) [ return patchOps } -func addOtelApacheSourceConfVolume(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addOtelApacheSourceConfVolume(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -122,7 +124,7 @@ func addOtelApacheSourceConfVolume(pod corev1.Pod, instrRules *InstrumentationRu return patchOps } -func addOtelApacheAgentInitContainer(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addOtelApacheAgentInitContainer(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} limCPU, _ := resource.ParseQuantity("200m") limMem, _ := resource.ParseQuantity("75M") @@ -176,7 +178,7 @@ func addOtelApacheAgentInitContainer(pod corev1.Pod, instrRules *Instrumentation return patchOps } -func getApacheOtelConfig(pod corev1.Pod, instrRules *InstrumentationRule) string { +func getApacheOtelConfig(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) string { template := ` LoadFile %[1]s/sdk_lib/lib/libopentelemetry_common.so LoadFile %[1]s/sdk_lib/lib/libopentelemetry_resources.so @@ -225,8 +227,9 @@ ApacheModuleTraceAsError ON collectorEndpoint := "" if instrRules.InjectionRules.OpenTelemetryCollector != "" { - otelCollConfig, found := otelCollsConfig[instrRules.InjectionRules.OpenTelemetryCollector] - if !found { + otelCollConfig, _, err := getCollectorConfigsByName(pod.GetNamespace(), instrRules.InjectionRules.OpenTelemetryCollector) + // otelCollConfig, found := otelCollsConfig[instrRules.InjectionRules.OpenTelemetryCollector] + if err != nil { log.Printf("Cannot find OTel collector definition %s\n", instrRules.InjectionRules.OpenTelemetryCollector) } else { if otelCollConfig.Mode == "sidecar" { @@ -247,7 +250,7 @@ ApacheModuleTraceAsError ON pod.GetName()+pod.GetGenerateName()+"a") } -func addApacheApplicationContainerCloneAsInit(pod corev1.Pod, instrRules *InstrumentationRule, containerId int) []patchOperation { +func addApacheApplicationContainerCloneAsInit(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerId int) []patchOperation { patchOps := []patchOperation{} limCPU, _ := resource.ParseQuantity("200m") limMem, _ := resource.ParseQuantity("75M") @@ -283,7 +286,7 @@ func addApacheApplicationContainerCloneAsInit(pod corev1.Pod, instrRules *Instru return patchOps } -func dropApachePassedConfig(pod corev1.Pod, instrRules *InstrumentationRule, containerId int) []patchOperation { +func dropApachePassedConfig(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerId int) []patchOperation { patchOps := []patchOperation{} for idx, volume := range pod.Spec.Containers[containerId].VolumeMounts { diff --git a/webhook/instrumentOtelDotNet.go b/webhook/pkg/instrumentOtelDotNet.go similarity index 89% rename from webhook/instrumentOtelDotNet.go rename to webhook/pkg/instrumentOtelDotNet.go index 739e3a9..5e07596 100644 --- a/webhook/instrumentOtelDotNet.go +++ b/webhook/pkg/instrumentOtelDotNet.go @@ -19,12 +19,13 @@ package main import ( "fmt" "log" + "v1alpha1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" ) -func dotnetOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { +func dotnetOtelInstrumentation(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} // patchOps = append(patchOps, addControllerEnvVars(0)...) @@ -38,8 +39,9 @@ func dotnetOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) [ patchOps = append(patchOps, addContainerEnvVar("OTEL_TRACES_EXPORTER", "otlp", 0)) if instrRule.InjectionRules.OpenTelemetryCollector != "" { - otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] - if !found { + otelCollConfig, _, err := getCollectorConfigsByName(pod.GetNamespace(), instrRule.InjectionRules.OpenTelemetryCollector) + // otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] + if err != nil { log.Printf("Cannot find OTel collector definition %s\n", instrRule.InjectionRules.OpenTelemetryCollector) } else { if otelCollConfig.Mode == "sidecar" { @@ -62,7 +64,7 @@ func dotnetOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) [ return patchOps } -func addOtelDotnetEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addOtelDotnetEnvVar(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} /* * COR_ENABLE_PROFILING=1 @@ -99,7 +101,7 @@ func addOtelDotnetEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, contai return patchOps } -func addOtelDotnetAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addOtelDotnetAgentVolumeMount(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -112,7 +114,7 @@ func addOtelDotnetAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRu return patchOps } -func addOtelDotnetAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addOtelDotnetAgentVolume(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -127,7 +129,7 @@ func addOtelDotnetAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) [ return patchOps } -func addOtelDotnetAgentInitContainer(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addOtelDotnetAgentInitContainer(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} limCPU, _ := resource.ParseQuantity("200m") limMem, _ := resource.ParseQuantity("75M") diff --git a/webhook/instrumentOtelJava.go b/webhook/pkg/instrumentOtelJava.go similarity index 83% rename from webhook/instrumentOtelJava.go rename to webhook/pkg/instrumentOtelJava.go index 2c4b6fc..2b2eea7 100644 --- a/webhook/instrumentOtelJava.go +++ b/webhook/pkg/instrumentOtelJava.go @@ -19,12 +19,13 @@ package main import ( "fmt" "log" + "v1alpha1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" ) -func javaOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { +func javaOtelInstrumentation(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, addOtelJavaEnvVar(pod, instrRule, 0)...) @@ -42,8 +43,9 @@ func javaOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []p patchOps = append(patchOps, addOtelJavaAgentVolume(pod, instrRule)...) if instrRule.InjectionRules.OpenTelemetryCollector != "" { - otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] - if !found { + otelCollConfig, _, err := getCollectorConfigsByName(pod.GetNamespace(), instrRule.InjectionRules.OpenTelemetryCollector) + // otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] + if err != nil { log.Printf("Cannot find OTel collector definition %s\n", instrRule.InjectionRules.OpenTelemetryCollector) } else { if otelCollConfig.Mode == "sidecar" { @@ -58,7 +60,7 @@ func javaOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []p return patchOps } -func addOtelJavaEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addOtelJavaEnvVar(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ @@ -73,7 +75,7 @@ func addOtelJavaEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, containe return patchOps } -func getOtelJavaOptions(pod corev1.Pod, instrRules *InstrumentationRule) string { +func getOtelJavaOptions(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) string { javaOpts := " " if config.ControllerConfig.UseProxy { @@ -87,7 +89,7 @@ func getOtelJavaOptions(pod corev1.Pod, instrRules *InstrumentationRule) string return javaOpts } -func addOtelJavaAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addOtelJavaAgentVolumeMount(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -100,7 +102,7 @@ func addOtelJavaAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRule return patchOps } -func addOtelJavaAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addOtelJavaAgentVolume(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -115,7 +117,7 @@ func addOtelJavaAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) []p return patchOps } -func addOtelJavaAgentInitContainer(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addOtelJavaAgentInitContainer(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} limCPU, _ := resource.ParseQuantity("200m") limMem, _ := resource.ParseQuantity("75M") diff --git a/webhook/instrumentOtelNginx.go b/webhook/pkg/instrumentOtelNginx.go similarity index 85% rename from webhook/instrumentOtelNginx.go rename to webhook/pkg/instrumentOtelNginx.go index dae847d..f97921a 100644 --- a/webhook/instrumentOtelNginx.go +++ b/webhook/pkg/instrumentOtelNginx.go @@ -20,12 +20,13 @@ import ( "fmt" "log" "strings" + "v1alpha1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" ) -func nginxOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { +func nginxOtelInstrumentation(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} containerId := 0 @@ -42,8 +43,9 @@ func nginxOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) [] patchOps = append(patchOps, addOtelNginxSourceConfVolume(pod, instrRule)...) if instrRule.InjectionRules.OpenTelemetryCollector != "" { - otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] - if !found { + otelCollConfig, _, err := getCollectorConfigsByName(pod.GetNamespace(), instrRule.InjectionRules.OpenTelemetryCollector) + // otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] + if err != nil { log.Printf("Cannot find OTel collector definition %s\n", instrRule.InjectionRules.OpenTelemetryCollector) } else { if otelCollConfig.Mode == "sidecar" { @@ -57,7 +59,7 @@ func nginxOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) [] return patchOps } -func addOtelNginxEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addOtelNginxEnvVar(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ @@ -69,12 +71,12 @@ func addOtelNginxEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, contain }, }) - patchOps = append(patchOps, addK8SOtelResourceAttrs(pod, instrRules, containerIdx)...) + patchOps = append(patchOps, addK8SOtelResourceAttrs(pod, instrRules, containerIdx, "OTEL_RESOURCE_ATTRIBUTES")...) return patchOps } -func addOtelNginxAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addOtelNginxAgentVolumeMount(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} // directory with modified Apache conf directory patchOps = append(patchOps, patchOperation{ @@ -97,7 +99,7 @@ func addOtelNginxAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRul return patchOps } -func addOtelNginxAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addOtelNginxAgentVolume(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -112,7 +114,7 @@ func addOtelNginxAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) [] return patchOps } -func addOtelNginxSourceConfVolume(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addOtelNginxSourceConfVolume(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -127,7 +129,7 @@ func addOtelNginxSourceConfVolume(pod corev1.Pod, instrRules *InstrumentationRul return patchOps } -func addOtelNginxAgentInitContainer(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addOtelNginxAgentInitContainer(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} limCPU, _ := resource.ParseQuantity("200m") limMem, _ := resource.ParseQuantity("75M") @@ -184,7 +186,7 @@ func addOtelNginxAgentInitContainer(pod corev1.Pod, instrRules *InstrumentationR return patchOps } -func getNginxOtelConfig(pod corev1.Pod, instrRules *InstrumentationRule) string { +func getNginxOtelConfig(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) string { template := ` NginxModuleEnabled ON; NginxModuleOtelSpanExporter otlp; @@ -201,8 +203,9 @@ NginxModuleTraceAsError ON; } collectorEndpoint := "" if instrRules.InjectionRules.OpenTelemetryCollector != "" { - otelCollConfig, found := otelCollsConfig[instrRules.InjectionRules.OpenTelemetryCollector] - if !found { + otelCollConfig, _, err := getCollectorConfigsByName(pod.GetNamespace(), instrRules.InjectionRules.OpenTelemetryCollector) + // otelCollConfig, found := otelCollsConfig[instrRules.InjectionRules.OpenTelemetryCollector] + if err != nil { log.Printf("Cannot find OTel collector definition %s\n", instrRules.InjectionRules.OpenTelemetryCollector) } else { if otelCollConfig.Mode == "sidecar" { @@ -222,7 +225,7 @@ NginxModuleTraceAsError ON; pod.GetName()+pod.GetGenerateName()+"a") } -func addNginxApplicationContainerCloneAsInit(pod corev1.Pod, instrRules *InstrumentationRule, containerId int) []patchOperation { +func addNginxApplicationContainerCloneAsInit(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerId int) []patchOperation { patchOps := []patchOperation{} limCPU, _ := resource.ParseQuantity("200m") limMem, _ := resource.ParseQuantity("75M") @@ -260,7 +263,7 @@ func addNginxApplicationContainerCloneAsInit(pod corev1.Pod, instrRules *Instrum return patchOps } -func dropNginxPassedConfig(pod corev1.Pod, instrRules *InstrumentationRule, containerId int) []patchOperation { +func dropNginxPassedConfig(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerId int) []patchOperation { patchOps := []patchOperation{} for idx, volume := range pod.Spec.Containers[containerId].VolumeMounts { diff --git a/webhook/instrumentOtelNodeJS.go b/webhook/pkg/instrumentOtelNodeJS.go similarity index 83% rename from webhook/instrumentOtelNodeJS.go rename to webhook/pkg/instrumentOtelNodeJS.go index ebba5e5..6eaf6f3 100644 --- a/webhook/instrumentOtelNodeJS.go +++ b/webhook/pkg/instrumentOtelNodeJS.go @@ -19,12 +19,13 @@ package main import ( "fmt" "log" + "v1alpha1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" ) -func nodejsOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) []patchOperation { +func nodejsOtelInstrumentation(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, addOtelNodejsEnvVar(pod, instrRule, 0)...) @@ -40,8 +41,9 @@ func nodejsOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) [ patchOps = append(patchOps, addOtelNodejsAgentVolume(pod, instrRule)...) if instrRule.InjectionRules.OpenTelemetryCollector != "" { - otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] - if !found { + otelCollConfig, _, err := getCollectorConfigsByName(pod.GetNamespace(), instrRule.InjectionRules.OpenTelemetryCollector) + // otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] + if err != nil { log.Printf("Cannot find OTel collector definition %s\n", instrRule.InjectionRules.OpenTelemetryCollector) } else { if otelCollConfig.Mode == "sidecar" { @@ -55,7 +57,7 @@ func nodejsOtelInstrumentation(pod corev1.Pod, instrRule *InstrumentationRule) [ return patchOps } -func addOtelNodejsEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addOtelNodejsEnvVar(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, addContainerEnvVar("NODE_OPTIONS", "--require /opt/opentelemetry-agent/shim.js", 0)) @@ -63,7 +65,7 @@ func addOtelNodejsEnvVar(pod corev1.Pod, instrRules *InstrumentationRule, contai return patchOps } -func addOtelNodejsAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRule, containerIdx int) []patchOperation { +func addOtelNodejsAgentVolumeMount(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -76,7 +78,7 @@ func addOtelNodejsAgentVolumeMount(pod corev1.Pod, instrRules *InstrumentationRu return patchOps } -func addOtelNodejsAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addOtelNodejsAgentVolume(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} patchOps = append(patchOps, patchOperation{ Op: "add", @@ -91,7 +93,7 @@ func addOtelNodejsAgentVolume(pod corev1.Pod, instrRules *InstrumentationRule) [ return patchOps } -func addOtelNodejsAgentInitContainer(pod corev1.Pod, instrRules *InstrumentationRule) []patchOperation { +func addOtelNodejsAgentInitContainer(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { patchOps := []patchOperation{} limCPU, _ := resource.ParseQuantity("200m") limMem, _ := resource.ParseQuantity("75M") diff --git a/webhook/main.go b/webhook/pkg/main.go similarity index 52% rename from webhook/main.go rename to webhook/pkg/main.go index c238479..845a0b0 100644 --- a/webhook/main.go +++ b/webhook/pkg/main.go @@ -19,15 +19,31 @@ package main import ( "flag" "fmt" - "log" "net/http" "path/filepath" + v1alpha1 "v1alpha1" admission "k8s.io/api/admission/v1beta1" + appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/log/zap" ) +var ( + scheme *runtime.Scheme = runtime.NewScheme() +) + +func init() { + log.SetLogger(zap.New()) + v1alpha1.AddToScheme(scheme) + corev1.AddToScheme(scheme) + appsv1.AddToScheme(scheme) + +} + func (s OtelConfig) String() string { return fmt.Sprintf("Trace: %t, Endpoint: %s, Samples/M %d, LogPayload: %t, ServiceName: %s, ServiceNamespace: %s", s.Trace, s.Endpoint, s.SamplesPerMillion, s.LogPayload, s.ServiceName, s.ServiceNamespace) @@ -40,15 +56,80 @@ const ( ) var ( - podResource = metav1.GroupVersionResource{Version: "v1", Resource: "pods"} + podResource = metav1.GroupVersionResource{Version: "v1", Resource: "pods"} + nsInstrResource = metav1.GroupVersionResource{Version: "v1alpha1", Resource: "instrumentations", Group: "ext.appd.com"} + globalInstrResource = metav1.GroupVersionResource{Version: "v1alpha1", Resource: "clusterinstrumentations", Group: "ext.appd.com"} + otelCollResource = metav1.GroupVersionResource{Version: "v1alpha1", Resource: "opentelemetrycollectors", Group: "ext.appd.com"} ) +func handleInstrumentationCRDs(req *admission.AdmissionRequest) ([]patchOperation, error) { + if req.DryRun != nil { + if *req.DryRun { + return []patchOperation{}, nil + } + } + + if req.Resource == nsInstrResource { + log.Log.Info("Validating and registering namespaced instrumentation", "namespace", req.Namespace, "name", req.Name) + // Parse the Instrumentation object. + raw := req.Object.Raw + instr := v1alpha1.Instrumentation{} + if _, _, err := universalDeserializer.Decode(raw, nil, &instr); err != nil { + return nil, fmt.Errorf("could not deserialize Instrumentation object: %v", err) + } + + injectionRuleDefaults(instr.Spec.InjectionRules) + upsertCrdInstrumentation(req.Namespace, instr.Name, instr.Spec) + + } else if req.Resource == globalInstrResource { + log.Log.Info("Validating and registering cluster-wide instrumentation", "name", req.Name) + // Parse the GlobalInstrumentation object. + raw := req.Object.Raw + instr := v1alpha1.ClusterInstrumentation{} + if _, _, err := universalDeserializer.Decode(raw, nil, &instr); err != nil { + return nil, fmt.Errorf("could not deserialize ClusterInstrumentation object: %v", err) + } + + injectionRuleDefaults(instr.Spec.InjectionRules) + upsertCrdClusterInstrumentation(instr.Name, instr.Spec) + + } else if req.Resource == otelCollResource { + log.Log.Info("Validating and registering OpenTelemetry collector", "namespace", req.Namespace, "name", req.Name) + // Parse the OpenTelemetryCollector object. + raw := req.Object.Raw + otelcol := v1alpha1.OpenTelemetryCollector{} + if _, _, err := universalDeserializer.Decode(raw, nil, &otelcol); err != nil { + return nil, fmt.Errorf("could not deserialize OpenTelemetryCollector object: %v", err) + } + + // if sidecar definition, which is only config as such, register it for later use + // when instrumented pods are instatiated + if otelcol.Spec.Mode == v1alpha1.ModeSidecar { + registerNamespacedSidecarCollector(req.Namespace, &otelcol) + } else { + // now it get's tricky - we'll leave collector instantiation for controller reconciler and just register + // the definition for immediate pod use + registerNamespacedStandaloneCollector(req.Namespace, &otelcol) + } + + } + + // TODO - for each type, reconciler should be added to check if in say 10 seconds, resource was really persisted + // and if not, removed from instrumentation rules + + return []patchOperation{}, nil +} + func applyAppdInstrumentation(req *admission.AdmissionRequest) ([]patchOperation, error) { // This handler should only get called on Pod objects as per the MutatingWebhookConfiguration in the YAML file. // However, if (for whatever reason) this gets invoked on an object of a different kind, issue a log message but // let the object request pass through otherwise. + + // fmt.Println(instrumentationAsString()) + // time.Sleep(1 * time.Second) + if req.Resource != podResource { - log.Printf("expect resource to be %s", podResource) + log.Log.Info("expect resource to be", "pod", podResource) return nil, nil } @@ -73,14 +154,14 @@ func applyAppdInstrumentation(req *admission.AdmissionRequest) ([]patchOperation return nil, fmt.Errorf("instrumentor configuration not read from configmap") } - log.Printf("Checking instrumentation for pod: %s", pod.Name) + log.Log.Info("Checking instrumentation for", "pod", pod.Name) instrumentationRule := getInstrumentationRule(pod) if instrumentationRule == nil { // pod not eligible for AppDynamics instrumentation return []patchOperation{}, nil } - log.Printf("Found instrumentation rule: %s", instrumentationRule.Name) + log.Log.Info("Found instrumentation rule", "rule", instrumentationRule.Name) config.mutex.Lock() defer config.mutex.Unlock() @@ -114,10 +195,10 @@ func main() { } if otelConfig.Trace { - log.Printf("Using otel tracing: %s\n", otelConfig) + log.Log.Info("Using otel tracing", "tracing", otelConfig) shutdown, err := initOtelTracing() if err != nil { - log.Printf("Error initializing OTEL tracing: %v\n", err) + log.Log.Info("Error initializing OTEL tracing", "error", err) } else { defer shutdown() } @@ -132,11 +213,14 @@ func main() { keyPath := filepath.Join(tlsDir, tlsKeyFile) tracer := getTracer("webhook-tracer") - log.Printf("Otel Tracer: %v\n", tracer) + log.Log.Info("Otel Tracer", "tracer", tracer) + + go startCrdReconciler() mux := http.NewServeMux() mux.Handle("/mutate", otelHandler(admitFuncHandler(applyAppdInstrumentation), "/mutate")) + mux.Handle("/validate", otelHandler(admitFuncHandler(handleInstrumentationCRDs), "/validate")) mux.Handle("/api/config", otelHandler(configHandler(), "/api/config")) server := &http.Server{ // We listen on port 8443 such that we do not need root privileges or extra capabilities for this server. @@ -144,5 +228,6 @@ func main() { Addr: ":8443", Handler: mux, } - log.Fatal(server.ListenAndServeTLS(certPath, keyPath)) + err := server.ListenAndServeTLS(certPath, keyPath) + log.Log.Error(err, "never should get here") } diff --git a/webhook/match.go b/webhook/pkg/match.go similarity index 72% rename from webhook/match.go rename to webhook/pkg/match.go index 86a7c79..a774505 100644 --- a/webhook/match.go +++ b/webhook/pkg/match.go @@ -22,6 +22,7 @@ import ( "log" "regexp" "text/template" + "v1alpha1" corev1 "k8s.io/api/core/v1" ) @@ -39,7 +40,7 @@ func getFlexMatch(pod corev1.Pod, flexMatchTmpl *template.Template) string { return res.String() } -func isMatch(pod corev1.Pod, rules MatchRules) bool { +func isMatch(pod corev1.Pod, rules v1alpha1.MatchRule) bool { if rules.NamespaceRegex != "" { match, _ := regexp.MatchString(rules.NamespaceRegex, pod.GetNamespace()) @@ -89,7 +90,7 @@ func isMatch(pod corev1.Pod, rules MatchRules) bool { return true } -func getInstrumentationRule(pod corev1.Pod) *InstrumentationRule { +func getInstrumentationRule(pod corev1.Pod) *v1alpha1.InstrumentationSpec { config.mutex.Lock() defer config.mutex.Unlock() @@ -100,8 +101,34 @@ func getInstrumentationRule(pod corev1.Pod) *InstrumentationRule { getFlexMatch(pod, config.FlexMatchTemplate) } + log.Default().Printf("Matching started\n") + + // First check if pod matches any namespaced Instrumentation - based rule + if !config.CrdsDisabled { + log.Default().Printf("Checking namespaced rules\n") + if instrConfig, ok := config.InstrumentationNamespacedCrds[pod.GetNamespace()]; ok { + for _, rule := range *instrConfig { + log.Default().Printf("Checking namespaced rule: %s\n", rule.Name) + if isMatch(pod, *rule.MatchRules) { + return &rule + } + } + } + } + + log.Default().Printf("Checking global rules\n") + + for _, rule := range *config.InstrumentationClusterCrds { + log.Default().Printf("Checking cluster-wide rule: %s\n", rule.Name) + if isMatch(pod, *rule.MatchRules) { + return &rule + } + } + + log.Default().Printf("Checking config map rules\n") + for _, rule := range *config.InstrumentationConfig { - fmt.Printf("Checking rule: %s\n", rule.Name) + log.Default().Printf("Checking config map rule: %s\n", rule.Name) if isMatch(pod, *rule.MatchRules) { return &rule } diff --git a/webhook/pkg/otelCollSidecar.go b/webhook/pkg/otelCollSidecar.go new file mode 100644 index 0000000..aee63b4 --- /dev/null +++ b/webhook/pkg/otelCollSidecar.go @@ -0,0 +1,364 @@ +/* +Copyright (c) 2019 Cisco Systems, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "fmt" + "log" + "strings" + "sync" + "v1alpha1" + + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" +) + +const OTEL_COLL_CONFIG_MAP_NAME = "otel-collector-config" +const DEFAULT_OTEL_COLLECTOR_IMAGE = "otel/opentelemetry-collector-contrib:latest" + +type OtelCollConfig struct { + Config string + Mode string + Image string + ImagePullPolicy string + InitImage string + ServiceName string + OtelColSpec v1alpha1.OpenTelemetryCollectorSpec +} + +var otelCollsConfig = map[string]OtelCollConfig{} +var otelCollsConfigNamespaced = map[string]map[string]OtelCollConfig{} +var otelCollsConfigMutex = sync.Mutex{} + +func loadOtelConfig(cm map[string]string) { + otelCollsConfigMutex.Lock() + defer otelCollsConfigMutex.Unlock() + + for key, value := range cm { + keyElems := strings.Split(key, ".") + collectorName := keyElems[0] + itemKey := strings.Join(keyElems[1:], ".") + if _, found := otelCollsConfig[collectorName]; !found { + otelCollsConfig[collectorName] = OtelCollConfig{} + } + collectorConfig := otelCollsConfig[collectorName] + switch itemKey { + case "config": + collectorConfig.Config = value + case "mode": + collectorConfig.Mode = value + case "image.image": + collectorConfig.Image = value + case "image.imagePullPolicy": + collectorConfig.ImagePullPolicy = value + case "image.initImage": + collectorConfig.InitImage = value + case "serviceName": + collectorConfig.ServiceName = value + } + otelCollsConfig[collectorName] = collectorConfig + } +} + +func addOtelCollSidecar(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { + patchOps := []patchOperation{} + + if len(pod.Spec.Containers) > 0 { + // TODO - lookup the otel template for instrumentation rule + limCPU, _ := resource.ParseQuantity("1") + reqCPU, _ := resource.ParseQuantity("200m") + limMem, _ := resource.ParseQuantity("1Gi") + reqMem, _ := resource.ParseQuantity("200Mi") + + limCPUInit, _ := resource.ParseQuantity("300m") + reqCPUInit, _ := resource.ParseQuantity("50m") + limMemInit, _ := resource.ParseQuantity("200Mi") + reqMemInit, _ := resource.ParseQuantity("100Mi") + + otelCollConfig, namespaced, err := getCollectorConfigsByName(pod.GetNamespace(), instrRules.InjectionRules.OpenTelemetryCollector) + if err != nil { + log.Printf("Cannot find OTel collector definition %v\n", err) + return []patchOperation{} + } + + if namespaced { + patchOps = append(patchOps, addOtelCollSidecarNamespaced(pod, instrRules, containerIdx)...) + return patchOps + } + + // else use the configmap based configuration, for the time being, less sophisticated + sidecar := corev1.Container{ + Name: "otel-coll-sidecar", + Image: otelCollConfig.Image, + Args: []string{"--config", "/conf/otel-collector-config.yaml"}, + ImagePullPolicy: corev1.PullPolicy(otelCollConfig.ImagePullPolicy), + Ports: []corev1.ContainerPort{{Name: "otlp-grpc", ContainerPort: 4317}, {Name: "otlp-http", ContainerPort: 4318}}, + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + corev1.ResourceCPU: limCPU, + corev1.ResourceMemory: limMem, + }, + Requests: corev1.ResourceList{ + corev1.ResourceCPU: reqCPU, + corev1.ResourceMemory: reqMem, + }, + }, + VolumeMounts: []corev1.VolumeMount{{ + MountPath: "/conf", + Name: "otel-collector-config-vol", + }}, + } + + sidecarInit := corev1.Container{ + Name: "otel-coll-sidecar-init", + Image: otelCollConfig.InitImage, + Command: []string{"/bin/sh", "-c"}, + Args: []string{"echo \"$OTEL_COLL_CONFIG\" > /conf/otel-collector-config.yaml"}, + ImagePullPolicy: corev1.PullIfNotPresent, + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + corev1.ResourceCPU: limCPUInit, + corev1.ResourceMemory: limMemInit, + }, + Requests: corev1.ResourceList{ + corev1.ResourceCPU: reqCPUInit, + corev1.ResourceMemory: reqMemInit, + }, + }, + VolumeMounts: []corev1.VolumeMount{{ + MountPath: "/conf", + Name: "otel-collector-config-vol", + }}, + Env: []corev1.EnvVar{{ + Name: "OTEL_COLL_CONFIG", + Value: otelCollConfig.Config, + }}, + } + + configVolume := corev1.Volume{ + Name: "otel-collector-config-vol", + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + } + + patchOps = append(patchOps, patchOperation{ + Op: "add", + Path: "/spec/containers/-", + Value: sidecar, + }) + + patchOps = append(patchOps, patchOperation{ + Op: "add", + Path: "/spec/initContainers/-", + Value: sidecarInit, + }) + + patchOps = append(patchOps, patchOperation{ + Op: "add", + Path: "/spec/volumes/-", + Value: configVolume, + }) + } + + return patchOps +} + +func getCollectorConfigsByName(namespace string, otelCollName string) (*OtelCollConfig, bool, error) { + // first check, if there's a match in namespaced collectors + otelCollsInNamespace, found := otelCollsConfigNamespaced[namespace] + if found { + otelCollConfig, found := otelCollsInNamespace[otelCollName] + if found { + return &otelCollConfig, true, nil + } + } + + // if not, search the collectors provided by the instrumentor + otelCollConfig, found := otelCollsConfig[otelCollName] + if !found { + return nil, false, fmt.Errorf("cannot find OTel collector definition %s", otelCollName) + } else { + return &otelCollConfig, false, nil + } +} + +func addOtelCollSidecarNamespaced(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { + patchOps := []patchOperation{} + + otelCollConfig, namespaced, err := getCollectorConfigsByName(pod.GetNamespace(), instrRules.InjectionRules.OpenTelemetryCollector) + if err != nil || !namespaced { + log.Printf("Cannot find namespaced (%t) OTel collector definition %v\n", namespaced, err) + return []patchOperation{} + } + + // here we rely on CRD-based otel col spec. In future, this should be changed for config map-based + // otel col as well + otelCollSpec := otelCollConfig.OtelColSpec + + if otelCollSpec.Mode != v1alpha1.ModeSidecar { + log.Printf("Sidecar OTEL collector has invalid mode %s\n", otelCollSpec.Mode) + return []patchOperation{} + + } + + if otelCollSpec.Image == "" { + otelCollSpec.Image = DEFAULT_OTEL_COLLECTOR_IMAGE + } + + limCPUInit, _ := resource.ParseQuantity("200m") + limMemInit, _ := resource.ParseQuantity("75M") + reqCPUInit, _ := resource.ParseQuantity("10m") + reqMemInit, _ := resource.ParseQuantity("50M") + + sidecar := corev1.Container{ + Name: "otel-coll-sidecar", + Image: otelCollSpec.Image, + Args: []string{"--config", "/conf/otel-collector-config.yaml"}, + ImagePullPolicy: corev1.PullPolicy(otelCollSpec.ImagePullPolicy), + Ports: []corev1.ContainerPort{ + {Name: "otlp-grpc", ContainerPort: 4317}, + {Name: "otlp-http", ContainerPort: 4318}, + }, + Resources: otelCollSpec.Resources, + VolumeMounts: append(otelCollSpec.VolumeMounts, corev1.VolumeMount{ + MountPath: "/conf", + Name: "otel-collector-config-vol", + }), + Env: otelCollSpec.Env, + EnvFrom: otelCollSpec.EnvFrom, + } + + sidecarInit := corev1.Container{ + Name: "otel-coll-sidecar-init", + Image: OTELCOL_CONFIG_INJECTOR_IMAGE, + Command: []string{"/bin/sh", "-c"}, + Args: []string{"echo \"$OTEL_COLL_CONFIG\" > /conf/otel-collector-config.yaml"}, + ImagePullPolicy: corev1.PullIfNotPresent, + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + corev1.ResourceCPU: limCPUInit, + corev1.ResourceMemory: limMemInit, + }, + Requests: corev1.ResourceList{ + corev1.ResourceCPU: reqCPUInit, + corev1.ResourceMemory: reqMemInit, + }, + }, + VolumeMounts: []corev1.VolumeMount{{ + MountPath: "/conf", + Name: "otel-collector-config-vol", + }}, + Env: []corev1.EnvVar{{ + Name: "OTEL_COLL_CONFIG", + Value: otelCollSpec.Config, + }}, + } + + configVolume := corev1.Volume{ + Name: "otel-collector-config-vol", + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + } + + patchOps = append(patchOps, patchOperation{ + Op: "add", + Path: "/spec/containers/-", + Value: sidecar, + }) + + patchOps = append(patchOps, patchOperation{ + Op: "add", + Path: "/spec/initContainers/-", + Value: sidecarInit, + }) + + patchOps = append(patchOps, patchOperation{ + Op: "add", + Path: "/spec/volumes/-", + Value: configVolume, + }) + + for _, vol := range otelCollSpec.Volumes { + patchOps = append(patchOps, patchOperation{ + Op: "add", + Path: "/spec/volumes/-", + Value: vol, + }) + } + + return patchOps +} + +func registerNamespacedSidecarCollector(namespace string, collector *v1alpha1.OpenTelemetryCollector) { + collectors := map[string]OtelCollConfig{} + found := false + if collectors, found = otelCollsConfigNamespaced[namespace]; !found { + collectors = map[string]OtelCollConfig{} + otelCollsConfigNamespaced[namespace] = collectors + } + + name := collector.GetName() + newCollectorConfig := OtelCollConfig{ + Image: collector.Spec.Image, + ImagePullPolicy: string(collector.Spec.ImagePullPolicy), + Mode: string(collector.Spec.Mode), + InitImage: OTELCOL_CONFIG_INJECTOR_IMAGE, + ServiceName: "", + Config: collector.Spec.Config, + OtelColSpec: collector.Spec, + } + + collectors[name] = newCollectorConfig + otelCollsConfigNamespaced[namespace] = collectors +} + +func unregisterNamespacedCollector(namespace string, name string) { + if collectors, found := otelCollsConfigNamespaced[namespace]; found { + delete(collectors, name) + otelCollsConfigNamespaced[namespace] = collectors + } +} + +func registerNamespacedStandaloneCollector(namespace string, collector *v1alpha1.OpenTelemetryCollector) { + collectors := map[string]OtelCollConfig{} + found := false + if collectors, found = otelCollsConfigNamespaced[namespace]; !found { + collectors = map[string]OtelCollConfig{} + otelCollsConfigNamespaced[namespace] = collectors + } + + serviceName := OTELCOL_RESOURCE_PREFIX + collector.GetName() + "." + namespace + ".svc.cluster.local" + if collector.Spec.Mode == v1alpha1.ModeExternal { + serviceName = collector.Spec.OtlpEndpoint + } + + name := collector.GetName() + newCollectorConfig := OtelCollConfig{ + Image: collector.Spec.Image, + ImagePullPolicy: string(collector.Spec.ImagePullPolicy), + Mode: string(collector.Spec.Mode), + InitImage: OTELCOL_CONFIG_INJECTOR_IMAGE, + ServiceName: serviceName, + Config: collector.Spec.Config, + OtelColSpec: collector.Spec, + } + + collectors[name] = newCollectorConfig + otelCollsConfigNamespaced[namespace] = collectors +} diff --git a/webhook/pkg/t_driver_test.go b/webhook/pkg/t_driver_test.go new file mode 100644 index 0000000..06ab7d0 --- /dev/null +++ b/webhook/pkg/t_driver_test.go @@ -0,0 +1 @@ +package main diff --git a/webhook/pkg/t_instrumentAppdJava_test.go b/webhook/pkg/t_instrumentAppdJava_test.go new file mode 100644 index 0000000..4c41e1a --- /dev/null +++ b/webhook/pkg/t_instrumentAppdJava_test.go @@ -0,0 +1,112 @@ +package main + +import ( + "context" + "testing" + + "sigs.k8s.io/e2e-framework/pkg/envconf" + "sigs.k8s.io/e2e-framework/pkg/features" +) + +func TestInstrumentJavaInstr(t *testing.T) { + f := features.New("Java AppD Instrumentation via CRD"). + Assess("setup instrumentation", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context { + instrFilename := "../e2e-tests/java/instr/instrumentation.yaml" + err := testenv.deployInstrumentation(ctx, t, cfg, instrFilename, 00) + if err != nil { + t.Error(err, "cannot deploy instrumentation per file: "+instrFilename) + t.FailNow() + } + + podFilename := "../e2e-tests/java/instr/pod.yaml" + podAssertFilename := "../e2e-tests/java/instr/pod-assert.yaml" + + eq, err, diffs := testenv.deployAndAssertPod(ctx, t, cfg, podFilename, podAssertFilename) + if err != nil { + t.Error(err, "cannot deploy and assert pod per file: "+podFilename) + t.FailNow() + } + + if !eq { + t.Error(err, "assert failed for: "+podFilename) + t.Error(err, testenv.formatDiffs(diffs)) + if testenv.getEnv("TEST_WAIT_ON_FAIL", "") != "" { + testenv.wait() + } + t.FailNow() + } + + return ctx + }) + + testenv.env.Test(t, f.Feature()) +} + +func TestInstrumentJavaInstrOtel(t *testing.T) { + f := features.New("Java AppD Instrumentation via CRD with Opentelemetry Collector"). + Assess("setup instrumentation", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context { + otelFilename := "../e2e-tests/java/instr-otel/crd-otelcol.yaml" + err := testenv.deployOtelCol(ctx, t, cfg, otelFilename, 0) + if err != nil { + t.Error(err, "cannot deploy opentelemetry collector per file: "+otelFilename) + t.FailNow() + } + + instrFilename := "../e2e-tests/java/instr-otel/instrumentation.yaml" + err = testenv.deployInstrumentation(ctx, t, cfg, instrFilename, 00) + if err != nil { + t.Error(err, "cannot deploy instrumentation per file: "+instrFilename) + t.FailNow() + } + + podFilename := "../e2e-tests/java/instr-otel/pod.yaml" + podAssertFilename := "../e2e-tests/java/instr-otel/pod-assert.yaml" + + eq, err, diffs := testenv.deployAndAssertPod(ctx, t, cfg, podFilename, podAssertFilename) + if err != nil { + t.Error(err, "cannot deploy and assert pod per file: "+podFilename) + t.FailNow() + } + + if !eq { + t.Error(err, "assert failed for: "+podFilename) + t.Error(err, testenv.formatDiffs(diffs)) + if testenv.getEnv("TEST_WAIT_ON_FAIL", "") != "" { + testenv.wait() + } + t.FailNow() + } + + return ctx + }) + + testenv.env.Test(t, f.Feature()) +} + +func TestInstrumentJavaConfigMap(t *testing.T) { + f := features.New("Java AppD Instrumentation via ConfigMap"). + Assess("setup instrumentation", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context { + + podFilename := "../e2e-tests/java/cm/pod.yaml" + podAssertFilename := "../e2e-tests/java/cm/pod-assert.yaml" + + eq, err, diffs := testenv.deployAndAssertPod(ctx, t, cfg, podFilename, podAssertFilename) + if err != nil { + t.Error(err, "cannot deploy and assert pod per file: "+podFilename) + t.FailNow() + } + + if !eq { + t.Error(err, "assert failed for: "+podFilename) + t.Error(err, testenv.formatDiffs(diffs)) + if testenv.getEnv("TEST_WAIT_ON_FAIL", "") != "" { + testenv.wait() + } + t.FailNow() + } + + return ctx + }) + + testenv.env.Test(t, f.Feature()) +} diff --git a/webhook/pkg/t_main_test.go b/webhook/pkg/t_main_test.go new file mode 100644 index 0000000..4f36195 --- /dev/null +++ b/webhook/pkg/t_main_test.go @@ -0,0 +1,125 @@ +package main + +import ( + "context" + "fmt" + "log" + "os" + "strings" + "testing" + "time" + "v1alpha1" + + // "k8s.io/apimachinery/pkg/runtime" + + v1 "k8s.io/api/core/v1" + sch "k8s.io/client-go/kubernetes/scheme" + "sigs.k8s.io/e2e-framework/pkg/env" + "sigs.k8s.io/e2e-framework/pkg/envconf" + "sigs.k8s.io/e2e-framework/pkg/features" +) + +const BASE_TEST_DIRECTORY = "../e2e-tests" +const WAIT_SEC_AFTER_HELM = 10 + +type TestFrame struct { + env env.Environment + namespace string + secrets map[string]string + replacer *strings.Replacer +} + +var testenv TestFrame + +var ignoredComapredFields = map[string]bool{ + "metadata.creationTimestamp": true, +} + +func TestMain(m *testing.M) { + testenv.env = env.New() + testenv.env.Setup( + // Setup func: install the instrumentation Helm chart + func(ctx context.Context, cfg *envconf.Config) (context.Context, error) { + log.Default().Print("starting") + + secretsFile := testenv.getEnv("TEST_SECRETS", "secrets.txt") + + err := testenv.loadSecrets(secretsFile) + if err != nil { + log.Default().Printf("Secrets file %s not loaded: %v", secretsFile, err) + } + + helmValuesTemplate := testenv.getEnv("TEST_HELM_VALUES", "helmDefaultValues.yaml") + helmValuesTemplateTemp := testenv.getEnv("TEST_HELM_VALUES_TEMP", "helmDefaultValuesTemp.yaml") + + err = testenv.applySecretsToFile(helmValuesTemplate, helmValuesTemplateTemp) + if err != nil { + log.Default().Printf("Helm values file %s not created: %v", secretsFile, err) + os.Exit(2) + } + + helmCmd := []string{"install", "--namespace", "mwh", "mwh", "../helm", "--values=" + helmValuesTemplateTemp} + stdout, stderr, err := testenv.runOsCommand("helm", helmCmd) + if err != nil { + log.Default().Printf("%s", string(stderr)) + log.Default().Fatalf("Error while installing Helm chart: %v", err) + os.Exit(2) + } + log.Default().Printf("Helm returns: \n%s", string(stdout)) + + testenv.registerResources() + + time.Sleep(WAIT_SEC_AFTER_HELM * time.Second) + + return ctx, nil + }, + ).Finish( + // Teardown func: + func(ctx context.Context, cfg *envconf.Config) (context.Context, error) { + log.Default().Print("finishing") + helmCmd := []string{"delete", "--namespace", "mwh", "mwh"} + stdout, stderr, err := testenv.runOsCommand("helm", helmCmd) + if err != nil { + log.Default().Printf("%s", string(stderr)) + log.Default().Fatalf("Error while removing Helm chart: %v", err) + os.Exit(2) + } + log.Default().Printf("Helm returns: \n%s", string(stdout)) + + helmValuesTemplateTemp := testenv.getEnv("TEST_HELM_VALUES_TEMP", "helmDefaultValuesTemp.yaml") + + if false { + os.Remove(helmValuesTemplateTemp) + } + + return ctx, nil + }, + ).BeforeEachFeature( + func(ctx context.Context, cfg *envconf.Config, t *testing.T, feature features.Feature) (context.Context, error) { + ns := envconf.RandomName("test", 10) + ctx = context.WithValue(ctx, testenv.getNamespaceKey(t), ns) + + t.Logf("Creating NS %v for test %v feature %s", ns, t.Name(), feature.Name()) + nsObj := v1.Namespace{} + nsObj.Name = ns + return ctx, cfg.Client().Resources().Create(ctx, &nsObj) + }, + ).AfterEachFeature( + func(ctx context.Context, cfg *envconf.Config, t *testing.T, feature features.Feature) (context.Context, error) { + ns := fmt.Sprint(ctx.Value(testenv.getNamespaceKey(t))) + t.Logf("Deleting NS %v for test %v feature %s", ns, t.Name(), feature.Name()) + + nsObj := v1.Namespace{} + nsObj.Name = ns + err := cfg.Client().Resources().Delete(ctx, &nsObj) + testenv.deleteAppDAppAfterTest(ns) + return ctx, err + }, + ) + + os.Exit(testenv.env.Run(m)) +} + +func (t *TestFrame) registerResources() { + v1alpha1.AddToScheme(sch.Scheme) +} diff --git a/webhook/pkg/t_utils_test.go b/webhook/pkg/t_utils_test.go new file mode 100644 index 0000000..1a7e44f --- /dev/null +++ b/webhook/pkg/t_utils_test.go @@ -0,0 +1,544 @@ +package main + +import ( + "bufio" + "bytes" + "context" + "crypto/tls" + "encoding/json" + "fmt" + "io" + "log" + "net/http" + "os" + "os/exec" + "reflect" + "regexp" + "strconv" + "strings" + "testing" + "time" + "v1alpha1" + + "github.com/pkg/errors" + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" + sch "k8s.io/client-go/kubernetes/scheme" + "sigs.k8s.io/e2e-framework/klient/wait" + "sigs.k8s.io/e2e-framework/klient/wait/conditions" + "sigs.k8s.io/e2e-framework/pkg/envconf" +) + +const SLEEP_SECONDS_ON_FAIL = 300 + +func (t *TestFrame) runOsCommand(command string, args []string) ([]byte, []byte, error) { + cmd := exec.Command(command, args...) + var stderr bytes.Buffer + cmd.Stderr = &stderr + stdoutBytes, err := cmd.Output() + stderrBytes := stderr.Bytes() + return stdoutBytes, stderrBytes, err +} + +// ref: https://github.com/kubernetes/client-go/issues/193#issuecomment-363318588 +func (t *TestFrame) parseK8sYaml(yamlDefinitions []byte) ([]runtime.Object, error) { + + yamlDefinitionsString := string(yamlDefinitions[:]) + objectYamlDefinitions := strings.Split(yamlDefinitionsString, "---") + retVal := make([]runtime.Object, 0, len(objectYamlDefinitions)) + for _, f := range objectYamlDefinitions { + if f == "\n" || f == "" { + // ignore empty cases + continue + } + + decode := sch.Codecs.UniversalDeserializer().Decode + obj, _, err := decode([]byte(f), nil, nil) + + if err != nil { + log.Println(fmt.Sprintf("Error while decoding YAML object. Err was: %s", err)) + continue + } + + retVal = append(retVal, obj) + + } + return retVal, nil +} + +func (t *TestFrame) loadObjectsFile(filename string) ([]runtime.Object, error) { + + content, err := t.loadFile(filename) + if err != nil { + return []runtime.Object{}, err + } + + // replace secrets if any + doctoredContentStr := t.applySecretsToString(string(content)) + + log.Default().Printf("read file %s", string(doctoredContentStr)) + + resourceObjects, err := t.parseK8sYaml([]byte(doctoredContentStr)) + + return resourceObjects, err +} + +func (t *TestFrame) loadSecrets(filename string) error { + + file, err := os.Open(filename) + if err != nil { + return err + } + defer file.Close() + + scanner := bufio.NewScanner(file) + + for scanner.Scan() { + line := scanner.Text() + if strings.HasPrefix(line, "#") { + continue + } + secretName, secretValue, found := strings.Cut(line, "=") + if !found { + continue + } + t.addSecret(secretName, secretValue) + } + + return nil +} + +func (t *TestFrame) addSecret(name string, value string) { + if t.secrets == nil { + t.secrets = map[string]string{} + } + t.secrets[name] = value + replacerConfig := []string{} + for n, v := range t.secrets { + replacerConfig = append(replacerConfig, "<<"+n+">>") + replacerConfig = append(replacerConfig, v) + } + t.replacer = strings.NewReplacer(replacerConfig...) +} + +func (t *TestFrame) getSecret(name string) string { + val, ok := t.secrets[name] + if !ok { + return "N/A" + } + return val +} + +func (t *TestFrame) applySecretsToFile(inFilename string, outFilename string) error { + inFile, err := os.Open(inFilename) + if err != nil { + return err + } + defer inFile.Close() + + outFile, err := os.Create(outFilename) + if err != nil { + return err + } + defer outFile.Close() + + scanner := bufio.NewScanner(inFile) + for scanner.Scan() { + line := scanner.Text() + outLine := t.applySecretsToString(line) + "\n" + outFile.WriteString(outLine) + } + return nil +} + +func (t *TestFrame) applySecretsToString(in string) string { + return t.replacer.Replace(in) +} + +func (t *TestFrame) loadFile(filename string) ([]byte, error) { + retVal := []byte{} + + file, err := os.Open(filename) + if err != nil { + return retVal, err + } + defer file.Close() + + // Get the file size + stat, err := file.Stat() + if err != nil { + return retVal, err + } + + // Read the file into a byte slice + retVal = make([]byte, stat.Size()) + _, err = bufio.NewReader(file).Read(retVal) + if err != nil && err != io.EOF { + return retVal, err + } + + return retVal, nil +} + +func (t *TestFrame) traverseObject(obj any) { + objMap, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj) + if err != nil { + log.Default().Printf("error traversing object %v - err: %v", obj, err) + return + } + t.traverseUnstructured(objMap) +} + +func (t *TestFrame) traverseUnstructured(obj map[string]any) { + visitFn := func(key string, value interface{}) { + // fmt.Printf("Key: %s, Value: %v\n", key, value) + } + + t.traverseUnstructuredInternal(obj, visitFn) +} + +func (t *TestFrame) traverseUnstructuredInternal(data map[string]any, fn func(key string, value interface{})) { + + // Recursive traversal function + var traverseMap func(m map[string]interface{}, path []string) + traverseMap = func(m map[string]interface{}, path []string) { + for key, value := range m { + currentPath := append(path, key) + if value == nil { + fn(strings.Join(currentPath, "."), value) + } else { + switch reflect.TypeOf(value).Kind() { + case reflect.Map: + traverseMap(value.(map[string]interface{}), currentPath) + case reflect.Slice: + for i, item := range value.([]interface{}) { + traverseMap(map[string]interface{}{strconv.Itoa(i): item}, currentPath) + } + default: + fn(strings.Join(currentPath, "."), value) + } + } + } + } + + traverseMap(data, []string{}) +} + +func (t *TestFrame) compareObjects(real any, obj any) (bool, []string) { + objMap, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj) + if err != nil { + log.Default().Printf("error traversing object %v - err: %v", obj, err) + return false, []string{} + } + realMap, err := runtime.DefaultUnstructuredConverter.ToUnstructured(real) + if err != nil { + log.Default().Printf("error traversing object %v - err: %v", obj, err) + return false, []string{} + } + eq, diffs := t.compareUnstructured(realMap, objMap) + return eq, diffs +} + +func (t *TestFrame) compareUnstructured(real, obj map[string]any) (bool, []string) { + visitFn := func(key string, rValue, value interface{}) []string { + // fmt.Printf("Key: %s, Value: %v = %v\n", key, rValue, value) + if reflect.TypeOf(value).Kind() == reflect.String && reflect.TypeOf(rValue).Kind() == reflect.String { + valueStr := value.(string) + if len(value.(string)) > 0 { + if valueStr[0] == '~' { + regexStr := valueStr[1:] + match, err := regexp.MatchString(regexStr, rValue.(string)) + if err != nil { + return []string{ + fmt.Sprintf("values for key %s regex to check invalid - %v", key, value), + } + } + if !match { + return []string{ + fmt.Sprintf("values for key %s don't regex match - real \n%v\n != expected \n%v", key, rValue, value), + } + } + } + return []string{} + } + } + if rValue != value { + return []string{ + fmt.Sprintf("values for key %s don't match - real \n%v\n != expected \n%v", key, rValue, value), + } + } + return []string{} + } + + diffs := t.compareUnstructuredInternal(real, obj, visitFn) + eq := len(diffs) == 0 + return eq, diffs +} + +func (t *TestFrame) compareUnstructuredInternal(real, data map[string]any, fn func(key string, rValue, value interface{}) []string) []string { + + // Recursive traversal function + var traverseMap func(r, m map[string]interface{}, path []string) []string + traverseMap = func(r, m map[string]interface{}, path []string) []string { + diffs := []string{} + for key, value := range m { + currentPath := append(path, key) + if _, found := ignoredComapredFields[strings.Join(currentPath, ".")]; found { + continue + } + rValue, ok := r[key] + if !ok { + diffs = append(diffs, fmt.Sprintf("real is missing key %v, desired value is %v", strings.Join(currentPath, "."), value)) + continue + } + if value == nil { + diffs = append(diffs, fn(strings.Join(currentPath, "."), rValue, value)...) + } else { + switch reflect.TypeOf(value).Kind() { + case reflect.Map: + if reflect.TypeOf(rValue).Kind() != reflect.Map { + diffs = append(diffs, fmt.Sprintf("real is wrong type at key %v, desired type is map", strings.Join(currentPath, "."))) + continue + } + diffs = append(diffs, traverseMap(rValue.(map[string]interface{}), value.(map[string]interface{}), currentPath)...) + case reflect.Slice: + if reflect.TypeOf(rValue).Kind() != reflect.Slice { + diffs = append(diffs, fmt.Sprintf("real is wrong type at key %v, desired type is slice", strings.Join(currentPath, "."))) + continue + } + for i, item := range value.([]interface{}) { + if i >= len(rValue.([]interface{})) { + diffs = append(diffs, fmt.Sprintf("real slice at key %v shorter than desired %d != %d", + strings.Join(currentPath, "."), len(rValue.([]interface{})), len(value.([]interface{})))) + continue + } + rItem := rValue.([]interface{})[i] + diffs = append(diffs, + traverseMap( + map[string]interface{}{strconv.Itoa(i): rItem}, + map[string]interface{}{strconv.Itoa(i): item}, + currentPath, + )...) + } + default: + diffs = append(diffs, fn(strings.Join(currentPath, "."), rValue, value)...) + } + } + } + return diffs + } + + diffs := traverseMap(real, data, []string{}) + return diffs +} + +func (t *TestFrame) convertObjToUnstructured(obj any) (*unstructured.Unstructured, error) { + objUnstr := &unstructured.Unstructured{} + + objJson, err := json.Marshal(obj) + if err != nil { + return nil, errors.Wrapf(err, "cannot parse object") + } + + err = json.Unmarshal(objJson, objUnstr) + if err != nil { + return nil, errors.Wrapf(err, "cannot unmarshal object to unstructured") + } + + return objUnstr, nil +} + +func (t *TestFrame) getNamespaceKey(test *testing.T) string { + // When we pass test.Name() from inside an `assess` step, the name is in the form TestName/Features/Assess + if strings.Contains(test.Name(), "/") { + return strings.Split(test.Name(), "/")[0] + } + + // When pass test.Name() from inside a `testenv.BeforeEachFeature` function, the name is just TestName + return test.Name() +} + +func (t *TestFrame) fullFilename(filename string) string { + return BASE_TEST_DIRECTORY + "/" + filename +} + +func (t *TestFrame) deployInstrumentation(ctx context.Context, test *testing.T, cfg *envconf.Config, filename string, delay int) error { + client, err := cfg.NewClient() + if err != nil { + test.Error(err, "cannot get k8s client") + test.FailNow() + } + + ns := ctx.Value(testenv.getNamespaceKey(test)).(string) + + resourceFile := t.fullFilename(filename) + objs, err := testenv.loadObjectsFile(resourceFile) + if err != nil { + test.Error(err, "cannot read instrumentation resource definition file", resourceFile) + test.FailNow() + } + + obj := objs[0].(*v1alpha1.Instrumentation) + obj.SetNamespace(ns) + + if err := client.Resources(ns).Create(ctx, obj); err != nil { + test.Error(err, "failed when creating instrumentation") + test.FailNow() + } + + time.Sleep(time.Duration(time.Duration(delay) * time.Second)) + + return nil +} + +func (t *TestFrame) deployOtelCol(ctx context.Context, test *testing.T, cfg *envconf.Config, filename string, delay int) error { + client, err := cfg.NewClient() + if err != nil { + test.Error(err, "cannot get k8s client") + test.FailNow() + } + + ns := ctx.Value(testenv.getNamespaceKey(test)).(string) + + resourceFile := t.fullFilename(filename) + objs, err := testenv.loadObjectsFile(resourceFile) + if err != nil { + test.Error(err, "cannot read otelcol resource definition file", resourceFile) + test.FailNow() + } + + obj := objs[0].(*v1alpha1.OpenTelemetryCollector) + obj.SetNamespace(ns) + + if err := client.Resources(ns).Create(ctx, obj); err != nil { + test.Error(err, "failed when creating otelcol") + test.FailNow() + } + + time.Sleep(time.Duration(time.Duration(delay) * time.Second)) + + return nil +} + +func (t *TestFrame) deployAndAssertPod(ctx context.Context, test *testing.T, cfg *envconf.Config, filenamePodToDeploy, filenamePodToAssert string) (bool, error, []string) { + client, err := cfg.NewClient() + if err != nil { + test.Error(err, "cannot get k8s client") + test.FailNow() + } + + ns := ctx.Value(testenv.getNamespaceKey(test)).(string) + + resourceFile := t.fullFilename(filenamePodToDeploy) + objs, err := testenv.loadObjectsFile(resourceFile) + if err != nil { + test.Error(err, "cannot read pod resource definition file", resourceFile) + test.FailNow() + } + + obj := objs[0].(*v1.Pod) + obj.SetNamespace(ns) + kind := obj.Kind + apiVersion := obj.APIVersion + + if err := client.Resources(ns).Create(ctx, obj); err != nil { + test.Error(err, "failed when creating pod") + test.FailNow() + } + + err = wait.For(conditions.New(client.Resources()).PodConditionMatch(obj, v1.PodReady, v1.ConditionTrue), wait.WithTimeout(time.Minute*5)) + if err != nil { + test.Error(err, "failed when waiting for pod") + test.FailNow() + } + + eobj := &v1.Pod{} + + if err := client.Resources(ns).Get(ctx, obj.Name, ns, eobj); err != nil { + test.Error(err, "failed when reading pod") + test.FailNow() + } + eobj.Kind = kind + eobj.APIVersion = apiVersion + + assertFile := t.fullFilename(filenamePodToAssert) + assertObj, err := testenv.loadObjectsFile(assertFile) + if err != nil { + test.Error(err, "cannot read pod assertion definition file", assertFile) + test.FailNow() + } + + eq, diffs := testenv.compareObjects(eobj, assertObj[0]) + test.Logf("objects are equal: %t, %s", eq, diffs) + + return eq, nil, diffs +} + +func (t *TestFrame) formatDiffs(diffs []string) string { + out := "" + for _, d := range diffs { + out = out + d + "\n" + } + return out +} + +func (t *TestFrame) wait() { + time.Sleep(SLEEP_SECONDS_ON_FAIL * time.Second) +} + +func (t *TestFrame) getEnv(env string, defVal string) string { + val := defVal + envVal := os.Getenv(env) + if envVal != "" { + val = envVal + } + return val +} + +func (t *TestFrame) deleteAppDAppAfterTest(name string) { + return + + // TODO - unfinished job here + + tr := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } + client := &http.Client{Transport: tr} + + protocol := "https" + if t.getSecret("APPD_CONTROLLER_SECURE") == "false" { + protocol = "http" + } + + req, err := http.NewRequest("DELETE", protocol+"://"+t.getSecret("APPD_CONTROLLER")+ + ":"+t.getSecret("APPD_CONTROLLER_PORT")+"/bucket/sample", nil) + if err != nil { + fmt.Println(err) + return + } + req.SetBasicAuth("singularity-agent@"+t.getSecret("APPD_ACCOUNT"), t.getSecret("APPD_ACCESS_KEY")) + + // Fetch Request + resp, err := client.Do(req) + if err != nil { + fmt.Println(err) + return + } + defer resp.Body.Close() + + // Read Response Body + respBody, err := io.ReadAll(resp.Body) + if err != nil { + fmt.Println(err) + return + } + + // Display Results + fmt.Println("response Status : ", resp.Status) + fmt.Println("response Headers : ", resp.Header) + fmt.Println("response Body : ", string(respBody)) + + // TIER_ID=`wget --user singularity-agent@${APPDYNAMICS_CONTROLLER_ACCOUNT_NAME} --password ${APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY} https://${APPDYNAMICS_CONTROLLER_HOST_NAME}:${APPDYNAMICS_CONTROLLER_PORT}/controller/rest/applications/${APPDYNAMICS_AGENT_APPLICATION_NAME}/tiers/${APPDYNAMICS_AGENT_TIER_NAME}?output=json -O -| grep -o '"id".*' | cut -d ":" -f 2 | sed 's/^[ \t,]*//;s/[ \t,]*$//'` + +} diff --git a/webhook/tracing.go b/webhook/pkg/tracing.go similarity index 100% rename from webhook/tracing.go rename to webhook/pkg/tracing.go diff --git a/webhook/pkg/v1alpha1/go.mod b/webhook/pkg/v1alpha1/go.mod new file mode 100644 index 0000000..501fe7b --- /dev/null +++ b/webhook/pkg/v1alpha1/go.mod @@ -0,0 +1,26 @@ +module v1alpha1 + +go 1.21 + +require ( + k8s.io/api v0.29.0 + k8s.io/apimachinery v0.29.3 + sigs.k8s.io/controller-runtime v0.17.2 +) + +require ( + github.com/go-logr/logr v1.4.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/gofuzz v1.2.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/text v0.14.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + k8s.io/klog/v2 v2.110.1 // indirect + k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect +) diff --git a/webhook/pkg/v1alpha1/go.sum b/webhook/pkg/v1alpha1/go.sum new file mode 100644 index 0000000..858d882 --- /dev/null +++ b/webhook/pkg/v1alpha1/go.sum @@ -0,0 +1,106 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/onsi/ginkgo/v2 v2.14.0 h1:vSmGj2Z5YPb9JwCWT6z6ihcUvDhuXLc3sJiqd3jMKAY= +github.com/onsi/ginkgo/v2 v2.14.0/go.mod h1:JkUdW7JkN0V6rFvsHcJ478egV3XH9NxpD27Hal/PhZw= +github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= +github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.29.0 h1:NiCdQMY1QOp1H8lfRyeEf8eOwV6+0xA6XEE44ohDX2A= +k8s.io/api v0.29.0/go.mod h1:sdVmXoz2Bo/cb77Pxi71IPTSErEW32xa4aXwKH7gfBA= +k8s.io/apimachinery v0.29.3 h1:2tbx+5L7RNvqJjn7RIuIKu9XTsIZ9Z5wX2G22XAa5EU= +k8s.io/apimachinery v0.29.3/go.mod h1:hx/S4V2PNW4OMg3WizRrHutyB5la0iCUbZym+W0EQIU= +k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= +k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/controller-runtime v0.17.2 h1:FwHwD1CTUemg0pW2otk7/U5/i5m2ymzvOXdbeGOUvw0= +sigs.k8s.io/controller-runtime v0.17.2/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/webhook/pkg/v1alpha1/groupversion_info.go b/webhook/pkg/v1alpha1/groupversion_info.go new file mode 100644 index 0000000..9dd8088 --- /dev/null +++ b/webhook/pkg/v1alpha1/groupversion_info.go @@ -0,0 +1,34 @@ +// Copyright Cisco Systems +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package v1alpha1 contains API Schema definitions for the core v1alpha1 API group. +// +kubebuilder:object:generate=true +// +groupName=ext.appd.com +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects. + GroupVersion = schema.GroupVersion{Group: "ext.appd.com", Version: "v1alpha1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme. + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/webhook/pkg/v1alpha1/instrumentation_rule.go b/webhook/pkg/v1alpha1/instrumentation_rule.go new file mode 100644 index 0000000..ddb6d80 --- /dev/null +++ b/webhook/pkg/v1alpha1/instrumentation_rule.go @@ -0,0 +1,178 @@ +// Copyright Cisco Systems +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +kubebuilder:validation:Required +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// MatchRule specifies criteria by which to match workload for instrumentation +type MatchRule struct { + // Regex by which to match namespace of the workload. Used only for ClusterInstrumentation. + // +optional + NamespaceRegex string `json:"namespaceRegex,omitempty" yaml:"namespaceRegex,omitempty"` + + // List of labels and their regex values to match + // +optional + Labels *[]map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + + // List of annotations and their regex values to match + // +optional + Annotations *[]map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + + // Regex to match names of pods + // +optional + PodNameRegex string `json:"podNameRegex,omitempty" yaml:"podNameRegex,omitempty"` +} + +type InjectionRule struct { + Template string `json:"template,omitempty" yaml:"template,omitempty"` + + // The programming language or solution to instrument + // +kubebuilder:validation:Enum=java;dotnetcore;nodejs;apache;nginx;java/appd;dotnetcore/appd;nodejs/appd;apache/appd;nginx/appd;java/otel;dotnetcore/otel;nodejs/otel;apache/otel;nginx/otel; + Technology string `json:"technology,omitempty" yaml:"technology,omitempty"` + Image string `json:"image,omitempty" yaml:"image,omitempty"` + JavaEnvVar string `json:"javaEnvVar,omitempty" yaml:"javaEnvVar,omitempty"` + JavaCustomConfig string `json:"javaCustomConfig,omitempty" yaml:"javaCustomConfig,omitempty"` + + // Source of AppDynamics application name + // +kubebuilder:validation:Enum=manual;label;annotation;namespace;namespaceLabel;namespaceAnnotation;expression + ApplicationNameSource string `json:"applicationNameSource,omitempty" yaml:"applicationNameSource,omitempty"` // manual,namespace,label,annotation,expression + ApplicationName string `json:"applicationName,omitempty" yaml:"applicationName,omitempty"` + ApplicationNameLabel string `json:"applicationNameLabel,omitempty" yaml:"applicationNameLabel,omitempty"` + ApplicationNameAnnotation string `json:"applicationNameAnnotation,omitempty" yaml:"applicationNameAnnotation,omitempty"` + ApplicationNameExpression string `json:"applicationNameExpression,omitempty" yaml:"applicationNameExpression,omitempty"` + + // Source of AppDynamics tier name + // +kubebuilder:validation:Enum=auto;manual;label;annotation;namespace + TierNameSource string `json:"tierNameSource,omitempty" yaml:"tierNameSource,omitempty"` // auto,manual,namespace,label,annotation,expression + TierName string `json:"tierName,omitempty" yaml:"tierName,omitempty"` + TierNameLabel string `json:"tierNameLabel,omitempty" yaml:"tierNameLabel,omitempty"` + TierNameAnnotation string `json:"tierNameAnnotation,omitempty" yaml:"tierNameAnnotation,omitempty"` + TierNameExpression string `json:"tierNameExpression,omitempty" yaml:"tierNameExpression,omitempty"` + UsePodNameForNodeName *bool `json:"usePodNameForNodeName,omitempty" yaml:"usePodNameForNodeName,omitempty"` + DoNotInstrument *bool `json:"doNotInstrument,omitempty" yaml:"doNotInstrument,omitempty"` + ResourceReservation *ResourceReservation `json:"resourceReservation,omitempty" yaml:"resourceReservation,omitempty"` + LogLevel string `json:"logLevel,omitempty" yaml:"logLevel,omitempty"` + NetvizPort string `json:"netvizPort,omitempty" yaml:"netvizPort,omitempty"` + OpenTelemetryCollector string `json:"openTelemetryCollector,omitempty" yaml:"openTelemetryCollector,omitempty"` + EnvVars []NameValue `json:"env,omitempty" yaml:"env,omitempty"` + Options []NameValue `json:"options,omitempty" yaml:"options,omitempty"` + InjectK8SOtelResourceAttrs *bool `json:"injectK8SOtelResourceAttrs,omitempty" yaml:"injectK8SOtelResourceAttrs,omitempty"` +} + +type NameValue struct { + // Variable name + // +mandatory + Name string `json:"name,omitempty" yaml:"name,omitempty"` + // Variable value + // +mandatory + Value string `json:"value,omitempty" yaml:"value,omitempty"` +} + +type ResourceReservation struct { + // CPU reservation value + // +mandatory + CPU string `json:"cpu,omitempty" yaml:"cpu,omitempty"` + // Memory allocation reservation value + // +mandatory + Memory string `json:"memory,omitempty" yaml:"memory,omitempty"` +} + +// Instrumentation defines how to inject agent into workload. +type InstrumentationSpec struct { + Name string `json:"name,omitempty" yaml:"name,omitempty"` + // Match rule matches the workload for injection + // +mandatory + MatchRules *MatchRule `json:"matchRules,omitempty" yaml:"matchRules,omitempty"` + + // Injection rule specifies how the instrumentation should be done + // +mandatory + InjectionRules *InjectionRule `json:"injectionRules,omitempty" yaml:"injectionRules,omitempty"` + + // Priority defines priority of this rule - 1 is lowest + // +kubebuilder:default=1 + Priority int `json:"priority" yaml:"priority"` + + InjectionRuleSet []InjectionRule `json:"injectionRuleSet,omitempty" yaml:"injectionRuleSet,omitempty"` +} + +type InjectionTemplate struct { + Name string `json:"name,omitempty" yaml:"name,omitempty" ` + InjectionRules *InjectionRule `json:"injectionRules,omitempty" yaml:"injectionRules,omitempty" ` +} + +func init() { + SchemeBuilder.Register( + &Instrumentation{}, + &ClusterInstrumentation{}, + &InstrumentationList{}, + &ClusterInstrumentationList{}, + ) +} + +// InstrumentationStatus defines status of the instrumentation. +type InstrumentationStatus struct { +} + +// ClusterInstrumentationStatus defines status of the instrumentation. +type ClusterInstrumentationStatus struct { +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:shortName=instr;instrs +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +// +operator-sdk:csv:customresourcedefinitions:displayName="AppDynamics Instrumentation Rule" +// +operator-sdk:csv:customresourcedefinitions:resources={{Instrumentation,v1alpha/ext.appd.com}} + +type Instrumentation struct { + Status InstrumentationStatus `json:"status,omitempty"` + metav1.TypeMeta `json:",inline"` + Spec InstrumentationSpec `json:"spec,omitempty"` + metav1.ObjectMeta `json:"metadata,omitempty"` +} + +// InstrumentationList contains a list of Instrumentation. +// +kubebuilder:object:root=true +type InstrumentationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Instrumentation `json:"items"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:shortName=clinstr;clinstrs +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +// +operator-sdk:csv:customresourcedefinitions:displayName="AppDynamics Cluster Instrumentation Rule" +// +operator-sdk:csv:customresourcedefinitions:resources={{ClusterInstrumentation,v1alpha/ext.appd.com}} + +type ClusterInstrumentation struct { + Status ClusterInstrumentationStatus `json:"status,omitempty"` + metav1.TypeMeta `json:",inline"` + Spec InstrumentationSpec `json:"spec,omitempty"` + metav1.ObjectMeta `json:"metadata,omitempty"` +} + +// InstrumentationList contains a list of Instrumentation. +// +kubebuilder:object:root=true +type ClusterInstrumentationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterInstrumentation `json:"items"` +} diff --git a/webhook/pkg/v1alpha1/otel_collector.go b/webhook/pkg/v1alpha1/otel_collector.go new file mode 100644 index 0000000..e6ee8c7 --- /dev/null +++ b/webhook/pkg/v1alpha1/otel_collector.go @@ -0,0 +1,133 @@ +// Copyright Cisco Systems +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +kubebuilder:validation:Required +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func init() { + SchemeBuilder.Register(&OpenTelemetryCollector{}, &OpenTelemetryCollectorList{}) +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:shortName=otelcol;otelcols +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.scale.replicas,selectorpath=.status.scale.selector +// +kubebuilder:printcolumn:name="Mode",type="string",JSONPath=".spec.mode",description="Deployment Mode" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +// +operator-sdk:csv:customresourcedefinitions:displayName="OpenTelemetry Collector" +// This annotation provides a hint for OLM which resources are managed by OpenTelemetryCollector kind. +// It's not mandatory to list all resources. +// +operator-sdk:csv:customresourcedefinitions:resources={{Pod,v1},{Deployment,apps/v1},{DaemonSets,apps/v1},{StatefulSets,apps/v1},{ConfigMaps,v1},{Service,v1}} + +// OpenTelemetryCollector is the Schema for the opentelemetrycollectors API. +type OpenTelemetryCollector struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec OpenTelemetryCollectorSpec `json:"spec,omitempty"` + Status OpenTelemetryCollectorStatus `json:"status,omitempty"` +} + +func (*OpenTelemetryCollector) Hub() {} + +//+kubebuilder:object:root=true + +// OpenTelemetryCollectorList contains a list of OpenTelemetryCollector. +type OpenTelemetryCollectorList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []OpenTelemetryCollector `json:"items"` +} + +// OpenTelemetryCollectorStatus defines the observed state of OpenTelemetryCollector. +type OpenTelemetryCollectorStatus struct { +} + +// OpenTelemetryCollectorSpec defines the desired state of OpenTelemetryCollector. +type OpenTelemetryCollectorSpec struct { + // Resources to set on generated pods. + // +optional + Resources v1.ResourceRequirements `json:"resources,omitempty"` + // Args is the set of arguments to pass to the main container's binary. + // +optional + Args map[string]string `json:"args,omitempty"` + // Replicas is the number of pod instances for the underlying replicaset. Set this if you are not using autoscaling. + // +optional + Replicas *int32 `json:"replicas,omitempty"` + // ServiceAccount indicates the name of an existing service account to use with this instance. When set, + // the operator will not automatically create a ServiceAccount. + // +optional + ServiceAccount string `json:"serviceAccount,omitempty"` + // Image indicates the container image to use for the generated pods. + // +optional + Image string `json:"image,omitempty"` + // ImagePullPolicy indicates the pull policy to be used for retrieving the container image. + // +optional + ImagePullPolicy v1.PullPolicy `json:"imagePullPolicy,omitempty"` + // VolumeMounts represents the mount points to use in the underlying deployment(s). + // +optional + // +listType=atomic + VolumeMounts []v1.VolumeMount `json:"volumeMounts,omitempty"` + // Ports allows a set of ports to be exposed by the underlying v1.Service. By default, the operator + // will attempt to infer the required ports by parsing the .Spec.Config property but this property can be + // used to open additional ports that can't be inferred by the operator, like for custom receivers. + // +optional + // +listType=atomic + Ports []v1.ServicePort `json:"ports,omitempty"` + // Environment variables to set on the generated pods. + // +optional + Env []v1.EnvVar `json:"env,omitempty"` + // List of sources to populate environment variables on the generated pods. + // +optional + EnvFrom []v1.EnvFromSource `json:"envFrom,omitempty"` + // Volumes represents which volumes to use in the underlying deployment(s). + // +optional + // +listType=atomic + Volumes []v1.Volume `json:"volumes,omitempty"` + // Mode represents how the collector should be deployed (deployment or sidecar) + // +optional + // +kubebuilder:validation:Enum=deployment;sidecar;external + Mode Mode `json:"mode,omitempty"` + // Config is the raw JSON to be used as the collector's configuration. Refer to the OpenTelemetry Collector documentation for details. + // The empty objects e.g. batch: should be written as batch: {} otherwise they won't work with kustomize or kubectl edit. + // +required + Config string `json:"config"` + // OtlpEndpoint is the hostname of an OpenTelemetry collector running independently from the instrumentor tool. + // Used only for Mode == ModeExternal + // +optional + OtlpEndpoint string `json:"otlpEndpoint,omitempty"` +} + +type ( + // Mode represents how the collector should be deployed (deployment vs. sidecar) + // +kubebuilder:validation:Enum=deployment;sidecar + Mode string +) + +const ( + // ModeDeployment specifies that the collector should be deployed as a Kubernetes Deployment. + ModeDeployment Mode = "deployment" + + // ModeSidecar specifies that the collector should be deployed as a sidecar to pods. + ModeSidecar Mode = "sidecar" + + // ModeExternal specifies that the collector already exists independently at a given address. + ModeExternal Mode = "external" +) diff --git a/webhook/pkg/v1alpha1/zz_generated.deepcopy.go b/webhook/pkg/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000..69b65ba --- /dev/null +++ b/webhook/pkg/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,485 @@ +//go:build !ignore_autogenerated + +// Copyright Cisco Systems +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterInstrumentation) DeepCopyInto(out *ClusterInstrumentation) { + *out = *in + out.Status = in.Status + out.TypeMeta = in.TypeMeta + in.Spec.DeepCopyInto(&out.Spec) + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterInstrumentation. +func (in *ClusterInstrumentation) DeepCopy() *ClusterInstrumentation { + if in == nil { + return nil + } + out := new(ClusterInstrumentation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterInstrumentation) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterInstrumentationList) DeepCopyInto(out *ClusterInstrumentationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterInstrumentation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterInstrumentationList. +func (in *ClusterInstrumentationList) DeepCopy() *ClusterInstrumentationList { + if in == nil { + return nil + } + out := new(ClusterInstrumentationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterInstrumentationList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterInstrumentationStatus) DeepCopyInto(out *ClusterInstrumentationStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterInstrumentationStatus. +func (in *ClusterInstrumentationStatus) DeepCopy() *ClusterInstrumentationStatus { + if in == nil { + return nil + } + out := new(ClusterInstrumentationStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InjectionRule) DeepCopyInto(out *InjectionRule) { + *out = *in + if in.UsePodNameForNodeName != nil { + in, out := &in.UsePodNameForNodeName, &out.UsePodNameForNodeName + *out = new(bool) + **out = **in + } + if in.DoNotInstrument != nil { + in, out := &in.DoNotInstrument, &out.DoNotInstrument + *out = new(bool) + **out = **in + } + if in.ResourceReservation != nil { + in, out := &in.ResourceReservation, &out.ResourceReservation + *out = new(ResourceReservation) + **out = **in + } + if in.EnvVars != nil { + in, out := &in.EnvVars, &out.EnvVars + *out = make([]NameValue, len(*in)) + copy(*out, *in) + } + if in.Options != nil { + in, out := &in.Options, &out.Options + *out = make([]NameValue, len(*in)) + copy(*out, *in) + } + if in.InjectK8SOtelResourceAttrs != nil { + in, out := &in.InjectK8SOtelResourceAttrs, &out.InjectK8SOtelResourceAttrs + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InjectionRule. +func (in *InjectionRule) DeepCopy() *InjectionRule { + if in == nil { + return nil + } + out := new(InjectionRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InjectionTemplate) DeepCopyInto(out *InjectionTemplate) { + *out = *in + if in.InjectionRules != nil { + in, out := &in.InjectionRules, &out.InjectionRules + *out = new(InjectionRule) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InjectionTemplate. +func (in *InjectionTemplate) DeepCopy() *InjectionTemplate { + if in == nil { + return nil + } + out := new(InjectionTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Instrumentation) DeepCopyInto(out *Instrumentation) { + *out = *in + out.Status = in.Status + out.TypeMeta = in.TypeMeta + in.Spec.DeepCopyInto(&out.Spec) + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Instrumentation. +func (in *Instrumentation) DeepCopy() *Instrumentation { + if in == nil { + return nil + } + out := new(Instrumentation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Instrumentation) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstrumentationList) DeepCopyInto(out *InstrumentationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Instrumentation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstrumentationList. +func (in *InstrumentationList) DeepCopy() *InstrumentationList { + if in == nil { + return nil + } + out := new(InstrumentationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstrumentationList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstrumentationSpec) DeepCopyInto(out *InstrumentationSpec) { + *out = *in + if in.MatchRules != nil { + in, out := &in.MatchRules, &out.MatchRules + *out = new(MatchRule) + (*in).DeepCopyInto(*out) + } + if in.InjectionRules != nil { + in, out := &in.InjectionRules, &out.InjectionRules + *out = new(InjectionRule) + (*in).DeepCopyInto(*out) + } + if in.InjectionRuleSet != nil { + in, out := &in.InjectionRuleSet, &out.InjectionRuleSet + *out = make([]InjectionRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstrumentationSpec. +func (in *InstrumentationSpec) DeepCopy() *InstrumentationSpec { + if in == nil { + return nil + } + out := new(InstrumentationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstrumentationStatus) DeepCopyInto(out *InstrumentationStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstrumentationStatus. +func (in *InstrumentationStatus) DeepCopy() *InstrumentationStatus { + if in == nil { + return nil + } + out := new(InstrumentationStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MatchRule) DeepCopyInto(out *MatchRule) { + *out = *in + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = new([]map[string]string) + if **in != nil { + in, out := *in, *out + *out = make([]map[string]string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + } + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = new([]map[string]string) + if **in != nil { + in, out := *in, *out + *out = make([]map[string]string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MatchRule. +func (in *MatchRule) DeepCopy() *MatchRule { + if in == nil { + return nil + } + out := new(MatchRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NameValue) DeepCopyInto(out *NameValue) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NameValue. +func (in *NameValue) DeepCopy() *NameValue { + if in == nil { + return nil + } + out := new(NameValue) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenTelemetryCollector) DeepCopyInto(out *OpenTelemetryCollector) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenTelemetryCollector. +func (in *OpenTelemetryCollector) DeepCopy() *OpenTelemetryCollector { + if in == nil { + return nil + } + out := new(OpenTelemetryCollector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OpenTelemetryCollector) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenTelemetryCollectorList) DeepCopyInto(out *OpenTelemetryCollectorList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OpenTelemetryCollector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenTelemetryCollectorList. +func (in *OpenTelemetryCollectorList) DeepCopy() *OpenTelemetryCollectorList { + if in == nil { + return nil + } + out := new(OpenTelemetryCollectorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OpenTelemetryCollectorList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenTelemetryCollectorSpec) DeepCopyInto(out *OpenTelemetryCollectorSpec) { + *out = *in + in.Resources.DeepCopyInto(&out.Resources) + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + if in.VolumeMounts != nil { + in, out := &in.VolumeMounts, &out.VolumeMounts + *out = make([]v1.VolumeMount, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Ports != nil { + in, out := &in.Ports, &out.Ports + *out = make([]v1.ServicePort, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Env != nil { + in, out := &in.Env, &out.Env + *out = make([]v1.EnvVar, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.EnvFrom != nil { + in, out := &in.EnvFrom, &out.EnvFrom + *out = make([]v1.EnvFromSource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Volumes != nil { + in, out := &in.Volumes, &out.Volumes + *out = make([]v1.Volume, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenTelemetryCollectorSpec. +func (in *OpenTelemetryCollectorSpec) DeepCopy() *OpenTelemetryCollectorSpec { + if in == nil { + return nil + } + out := new(OpenTelemetryCollectorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenTelemetryCollectorStatus) DeepCopyInto(out *OpenTelemetryCollectorStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenTelemetryCollectorStatus. +func (in *OpenTelemetryCollectorStatus) DeepCopy() *OpenTelemetryCollectorStatus { + if in == nil { + return nil + } + out := new(OpenTelemetryCollectorStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceReservation) DeepCopyInto(out *ResourceReservation) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceReservation. +func (in *ResourceReservation) DeepCopy() *ResourceReservation { + if in == nil { + return nil + } + out := new(ResourceReservation) + in.DeepCopyInto(out) + return out +} From 54a35541a9bfd4971d436b798c6a7ea36b4cbc17 Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Mon, 10 Jun 2024 14:11:30 +0200 Subject: [PATCH 02/16] readme --- README.md | 128 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 116 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 23a0093..f83b353 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # AppDynamics K8S Webhook Instrumentor -This project provides K8S mutating webhook, which, by pre-set rules, auto-instruments pods at their creation time with AppDynamics or OpenTelemetry agents. +This project provides a auto-instrumentation tool primarily for AppDynamics agents running in Kubernetes cluster, but provides also easy instrumentation by OpenTelemetry agents and other supported agents. Under the hood, it uses K8S mutating webhook, which, by pre-set rules, auto-instruments pods at their creation time with AppDynamics or other supported agents. ## Why? @@ -22,14 +22,14 @@ This project supports both AppDynamics hybrid agents and OpenTelemetry agents in ## Supported Agents -| Language | AppDynamics Native | AppDynamics Hybrid | OpenTelemetry | -| ----------- | ------------------ | ----------------------- | ----------------------- | -| Java | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| .NET (Core) | :white_check_mark: | :thinking: | :building_construction: | -| Node.js | :white_check_mark: | :building_construction: | :white_check_mark: | -| Apache | :thinking: | :x: | :microscope: | -| Nginx | :x: | :x: | :microscope: | -| Go | :x: | :x: | :thinking: | +| Agent Type / Language | AppDynamics Native | AppDynamics Hybrid | OpenTelemetry | Splunk | +| --------------------- | ------------------ | ----------------------- | ----------------------- | ----------------------- | +| Java | :white_check_mark: | :white_check_mark: | :white_check_mark: | :building_construction: | +| .NET (Core) | :white_check_mark: | :thinking: | :white_check_mark: | :x: | +| Node.js | :white_check_mark: | :building_construction: | :white_check_mark: | :building_construction: | +| Apache | :thinking: | :x: | :white_check_mark: | :x: | +| Nginx | :x: | :x: | :white_check_mark: | :x: | +| Go | :x: | :x: | :thinking: | :x: | |Icon |Support level | |------------------------|------------------------| @@ -62,15 +62,119 @@ helm repo update helm install --namespace= mwh/webhook-instrumentor --values= ``` +(For `values.yaml` file, see **How to configure?** section) + to upgrade after values change: - on OpenShift, you can use `helm upgrade` - on Kubernetes, use `helm delete ` `helm install ...` commands for the time being ## How to configure? -If using helm, modify values.yaml for helm chart parameters - -See `values-sample.yaml` for inspiration and this [Blog Post]() to get started. +Before deploying via Helm chart, modify values.yaml for helm chart parameters + +See `values-sample.yaml` in `webhook/helm` directory for inspiration and this [Blog Post]() to get started. + +The Helm chart always deploys the mutating webhook processes, set's up necessary security for the instrumentation to work. + +Instrumentation rules and OpenTelemetry collectors in use can be defined in tow ways: +- as part of `values.yaml` file for Helm chart +- via custom resource definitions (CRDs) +- by combination of both + +### Using CRDs for Instrumentation rule definition + +There are two custom resources definitions created by the Helm chart enabling to define application instrumentation rules: +- API `ext.appd.com/v1alpha1` resource `Instrumentation` - namespaced resource, which defines instrumentation rules +- API `ext.appd.com/v1alpha1` resource `ClusterInstrumentation` - cluster-wide resource, which defines instrumentation rules + +Syntax and options for instrumentation rules are common across `values.yaml`, `Instrumentation`, and `ClusterInstrumentation` and the rule is applied by first match of the `matchRules` defined in individual rules. The order of evaluation is following: +- Rules defined by `Instrumentation` definitions in the same namespace, as the instrumented pod. Each rule can have `.spec.priority` defined (default = 1), higher priorities are evaluated first. Order of rules with the same priority is not deterministic. +- Rules defined by `ClusterInstrumentation` definitions. Those rules are shared for all pods and namespaces, unless the namespace is excluded. Each rule can have `.spec.priority` defined (default = 1), higher priorities are evaluated first. Order of rules with the same priority is not deterministic. +- Rules defined by the `values.yaml` file for Helm chart. Those rules are evaluated in the order they are present in the file. Unlike rules defined by CRDs, rules can use templates to simplify the definitions. + +Example: + +~~~ +apiVersion: ext.appd.com/v1alpha1 +kind: Instrumentation +metadata: + name: java-instrumentation +spec: + name: java-instrumentation + priority: 2 + matchRules: + # must match both labels and their values. + # values defined here are regexes! + labels: + - language: java + - otel: appd + podNameRegex: .* + injectionRules: + technology: java # defines the agent type to use + image: appdynamics/java-agent:latest + javaEnvVar: _JAVA_OPTIONS + openTelemetryCollector: test # enables OpenTelemetry and defines the collector to use +~~~ + +### Using CRDs for OpenTelemetry collector definition + +When using OpenTelemetry, collector generally has to be deployed somewhere, usually on the same K8S cluster. This tool enables to provision 3 `.spec.mode` of collectors: +- `deployment` - collector running as `Deployment` with a `Service` published for application to send the signals to. This is managed by this tool. +- `sidecar` - collector running as a sidecar in the same pod as application itself. This is injected into the pod by this tool +- `external` - collector running independently of this tool, not managed by this tool - it's expected you setup this collector another way yourselves. It can even run anywhere like on different cluster, VM, or in the cloud. + +When using resource `ext.appd.com/v1alpha1` - `OpenTelemetryCollector`, and `deployment` mode, this tool will spin up a collector in the same namespace where this resource definition is created. When you delete the `OpenTelementryCollector` resource, collector will be also deleted. + +Example: + +~~~ +apiVersion: ext.appd.com/v1alpha1 +kind: OpenTelemetryCollector +metadata: + name: test +spec: + replicas: 1 + image: otel/opentelemetry-collector-contrib:latest + imagePullPolicy: Always + mode: deployment + config: |- + receivers: + otlp: + protocols: + grpc: + http: + processors: + batch: + resource: + attributes: + - key: appdynamics.controller.account + action: upsert + value: "<>" + - key: appdynamics.controller.host + action: upsert + value: "<>" + - key: appdynamics.controller.port + action: upsert + value: <> + exporters: + logging: + loglevel: debug + # This part says that the opentelemetry collector will send data to OTIS pipeline for AppDynamicas CSaaS. + otlphttp: + tls: + insecure: true + endpoint: "<>" + headers: {"x-api-key": <>} + service: + pipelines: + traces: + receivers: [otlp] + processors: [batch, resource] + exporters: [logging, otlphttp] + telemetry: + logs: + level: "debug" +~~~ More examples and documentation is coming soon. From 7d18732d4b9e945d9ee3f9ef666aa8c83dd930f2 Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Mon, 10 Jun 2024 16:42:00 +0200 Subject: [PATCH 03/16] otelcol spec adjustment --- webhook/examples/crd-otelcol.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webhook/examples/crd-otelcol.yaml b/webhook/examples/crd-otelcol.yaml index 7e2588b..c08273d 100644 --- a/webhook/examples/crd-otelcol.yaml +++ b/webhook/examples/crd-otelcol.yaml @@ -33,8 +33,8 @@ spec: otlphttp: tls: insecure: true - endpoint: "https://fra-sls-agent-api.saas.appdynamics.com" - headers: {"x-api-key": "***REMOVED***"} + endpoint: "https://<>-sls-agent-api.saas.appdynamics.com" + headers: {"x-api-key": "<>"} service: pipelines: traces: From cb4baf46434afe00f4c0d62340bb1bf6f3c996e9 Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Wed, 19 Jun 2024 11:53:21 +0200 Subject: [PATCH 04/16] Splunk preps --- images/Makefile | 10 ++ images/splunk/java/Dockerfile | 7 + images/splunk/java/notes.txt | 44 +++++ images/splunk/java/version.txt | 1 + images/splunk/nodejs/Dockerfile | 10 ++ images/splunk/nodejs/notes.txt | 55 +++++++ images/splunk/nodejs/shim.js | 1 + .../ext.appd.com_clusterinstrumentations.yaml | 60 +++++++ .../bases/ext.appd.com_instrumentations.yaml | 60 +++++++ .../ext.appd.com_clusterinstrumentations.yaml | 60 +++++++ .../ext.appd.com_instrumentations.yaml | 60 +++++++ webhook/pkg/configuration.go | 30 +++- webhook/pkg/crdReconciler.go | 8 +- webhook/pkg/instrument.go | 121 +++++++++++++- webhook/pkg/instrumentSplunkJava.go | 152 ++++++++++++++++++ webhook/pkg/v1alpha1/instrumentation_rule.go | 15 ++ webhook/pkg/v1alpha1/zz_generated.deepcopy.go | 35 ++++ 17 files changed, 718 insertions(+), 11 deletions(-) create mode 100644 images/Makefile create mode 100644 images/splunk/java/Dockerfile create mode 100644 images/splunk/java/notes.txt create mode 100644 images/splunk/java/version.txt create mode 100644 images/splunk/nodejs/Dockerfile create mode 100644 images/splunk/nodejs/notes.txt create mode 100644 images/splunk/nodejs/shim.js create mode 100644 webhook/pkg/instrumentSplunkJava.go diff --git a/images/Makefile b/images/Makefile new file mode 100644 index 0000000..bc10e0b --- /dev/null +++ b/images/Makefile @@ -0,0 +1,10 @@ +IMAGE_REPO=chrlic + +.PHONY: images +images: splunk-java-image + +.PHONY: splunk-java-image +splunk-java-image: + $(eval JAVA_VERSION := $(shell cat splunk/java/version.txt)) + cd splunk/java && docker build . -t $(IMAGE_REPO)/splunk-java-agent:$(JAVA_VERSION) --build-arg="version=$(JAVA_VERSION)" + docker push $(IMAGE_REPO)/splunk-java-agent:$(JAVA_VERSION) \ No newline at end of file diff --git a/images/splunk/java/Dockerfile b/images/splunk/java/Dockerfile new file mode 100644 index 0000000..c2e02e6 --- /dev/null +++ b/images/splunk/java/Dockerfile @@ -0,0 +1,7 @@ +FROM busybox + +ARG version + +ADD https://github.com/signalfx/splunk-otel-java/releases/download/v$version/splunk-otel-javaagent.jar /opt/splunk/splunk-otel-javaagent.jar + +RUN chmod -R go+r /opt/splunk/splunk-otel-javaagent.jar \ No newline at end of file diff --git a/images/splunk/java/notes.txt b/images/splunk/java/notes.txt new file mode 100644 index 0000000..d78cd62 --- /dev/null +++ b/images/splunk/java/notes.txt @@ -0,0 +1,44 @@ +// always on profiling +java -javaagent:./splunk-otel-javaagent.jar \ +-Dsplunk.profiler.enabled=true \ +-Dsplunk.profiler.memory.enabled=true \ +-Dotel.exporter.otlp.endpoint=http(s)://collector:4317 \ +-Dsplunk.metrics.endpoint=http(s)://collector:9943 +-jar .jar + +or +export SPLUNK_PROFILER_MEMORY_ENABLED=true + +// metrics collection +java -javaagent:./splunk-otel-javaagent.jar \ +-Dsplunk.metrics.enabled=true \ +-jar .jar + +or +export SPLUNK_METRICS_ENDPOINT='true' + + +// deployment + +apiVersion: apps/v1 +kind: Deployment +spec: +selector: + matchLabels: + app: your-application +template: + spec: + containers: + - name: myapp + env: + - name: SPLUNK_OTEL_AGENT + valueFrom: + fieldRef: + fieldPath: status.hostIP + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: "http://$(SPLUNK_OTEL_AGENT):4317" + - name: OTEL_SERVICE_NAME + value: "" + - name: OTEL_RESOURCE_ATTRIBUTES + value: "deployment.environment=" + \ No newline at end of file diff --git a/images/splunk/java/version.txt b/images/splunk/java/version.txt new file mode 100644 index 0000000..925bfd9 --- /dev/null +++ b/images/splunk/java/version.txt @@ -0,0 +1 @@ +1.32.1 \ No newline at end of file diff --git a/images/splunk/nodejs/Dockerfile b/images/splunk/nodejs/Dockerfile new file mode 100644 index 0000000..bd01422 --- /dev/null +++ b/images/splunk/nodejs/Dockerfile @@ -0,0 +1,10 @@ +FROM node:current-alpine + +COPY ./shim.js /opt/splunk/shim.js + +WORKDIR /opt/splunk + +RUN npm install @splunk/otel + + + diff --git a/images/splunk/nodejs/notes.txt b/images/splunk/nodejs/notes.txt new file mode 100644 index 0000000..1c18375 --- /dev/null +++ b/images/splunk/nodejs/notes.txt @@ -0,0 +1,55 @@ +export NODE_OPTIONS: '--require /opt/splunk/shim.js' + + +export OTEL_SERVICE_NAME= +export OTEL_EXPORTER_OTLP_ENDPOINT=: +export OTEL_RESOURCE_ATTRIBUTES='deployment.environment=,service.version=' + + +node -r @splunk/otel/instrument + +// always on profiling +SPLUNK_PROFILER_ENABLED=true +SPLUNK_PROFILER_MEMORY_ENABLED=true + +start({ + serviceName: '', + endpoint: 'collectorhost:port', + profiling: { // Activates CPU profiling + memoryProfilingEnabled: true, // Activates Memory profiling + } +}); + +// metrics collection +export SPLUNK_METRICS_ENABLED='true' + +// override host name +export OTEL_RESOURCE_ATTRIBUTES=host.name= + +// deployment +apiVersion: apps/v1 +kind: Deployment +spec: +selector: + matchLabels: + app: your-application +template: + spec: + containers: + - name: myapp + image: your-app-image + env: + - name: SPLUNK_OTEL_AGENT + valueFrom: + fieldRef: + fieldPath: status.hostIP + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: "http://$(SPLUNK_OTEL_AGENT):4317" + - name: OTEL_SERVICE_NAME + value: "" + - name: OTEL_RESOURCE_ATTRIBUTES + value: "deployment.environment=" + command: + - node + - -r @splunk/otel/instrument + - .js \ No newline at end of file diff --git a/images/splunk/nodejs/shim.js b/images/splunk/nodejs/shim.js new file mode 100644 index 0000000..6316a83 --- /dev/null +++ b/images/splunk/nodejs/shim.js @@ -0,0 +1 @@ +require("@splunk/otel/instrument") \ No newline at end of file diff --git a/webhook/config/crd/bases/ext.appd.com_clusterinstrumentations.yaml b/webhook/config/crd/bases/ext.appd.com_clusterinstrumentations.yaml index 5e3fa26..4c696e5 100644 --- a/webhook/config/crd/bases/ext.appd.com_clusterinstrumentations.yaml +++ b/webhook/config/crd/bases/ext.appd.com_clusterinstrumentations.yaml @@ -111,6 +111,36 @@ spec: description: Memory allocation reservation value type: string type: object + splunkConfig: + properties: + deploymentEnvironmentName: + type: string + deploymentEnvironmentNameAnnotation: + type: string + deploymentEnvironmentNameExpression: + type: string + deploymentEnvironmentNameLabel: + type: string + deploymentEnvironmentNameSource: + description: Source of deployment.environment + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + k8sClusterName: + type: string + splunkMemoryProfiler: + type: boolean + splunkMetricsEnabled: + type: boolean + splunkProfilerAlwaysOn: + type: boolean + type: object technology: description: The programming language or solution to instrument enum: @@ -223,6 +253,36 @@ spec: description: Memory allocation reservation value type: string type: object + splunkConfig: + properties: + deploymentEnvironmentName: + type: string + deploymentEnvironmentNameAnnotation: + type: string + deploymentEnvironmentNameExpression: + type: string + deploymentEnvironmentNameLabel: + type: string + deploymentEnvironmentNameSource: + description: Source of deployment.environment + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + k8sClusterName: + type: string + splunkMemoryProfiler: + type: boolean + splunkMetricsEnabled: + type: boolean + splunkProfilerAlwaysOn: + type: boolean + type: object technology: description: The programming language or solution to instrument enum: diff --git a/webhook/config/crd/bases/ext.appd.com_instrumentations.yaml b/webhook/config/crd/bases/ext.appd.com_instrumentations.yaml index 34dff7c..e02dee9 100644 --- a/webhook/config/crd/bases/ext.appd.com_instrumentations.yaml +++ b/webhook/config/crd/bases/ext.appd.com_instrumentations.yaml @@ -114,6 +114,36 @@ spec: description: Memory allocation reservation value type: string type: object + splunkConfig: + properties: + deploymentEnvironmentName: + type: string + deploymentEnvironmentNameAnnotation: + type: string + deploymentEnvironmentNameExpression: + type: string + deploymentEnvironmentNameLabel: + type: string + deploymentEnvironmentNameSource: + description: Source of deployment.environment + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + k8sClusterName: + type: string + splunkMemoryProfiler: + type: boolean + splunkMetricsEnabled: + type: boolean + splunkProfilerAlwaysOn: + type: boolean + type: object technology: description: The programming language or solution to instrument enum: @@ -226,6 +256,36 @@ spec: description: Memory allocation reservation value type: string type: object + splunkConfig: + properties: + deploymentEnvironmentName: + type: string + deploymentEnvironmentNameAnnotation: + type: string + deploymentEnvironmentNameExpression: + type: string + deploymentEnvironmentNameLabel: + type: string + deploymentEnvironmentNameSource: + description: Source of deployment.environment + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + k8sClusterName: + type: string + splunkMemoryProfiler: + type: boolean + splunkMetricsEnabled: + type: boolean + splunkProfilerAlwaysOn: + type: boolean + type: object technology: description: The programming language or solution to instrument enum: diff --git a/webhook/helm/templates/ext.appd.com_clusterinstrumentations.yaml b/webhook/helm/templates/ext.appd.com_clusterinstrumentations.yaml index 5e3fa26..4c696e5 100644 --- a/webhook/helm/templates/ext.appd.com_clusterinstrumentations.yaml +++ b/webhook/helm/templates/ext.appd.com_clusterinstrumentations.yaml @@ -111,6 +111,36 @@ spec: description: Memory allocation reservation value type: string type: object + splunkConfig: + properties: + deploymentEnvironmentName: + type: string + deploymentEnvironmentNameAnnotation: + type: string + deploymentEnvironmentNameExpression: + type: string + deploymentEnvironmentNameLabel: + type: string + deploymentEnvironmentNameSource: + description: Source of deployment.environment + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + k8sClusterName: + type: string + splunkMemoryProfiler: + type: boolean + splunkMetricsEnabled: + type: boolean + splunkProfilerAlwaysOn: + type: boolean + type: object technology: description: The programming language or solution to instrument enum: @@ -223,6 +253,36 @@ spec: description: Memory allocation reservation value type: string type: object + splunkConfig: + properties: + deploymentEnvironmentName: + type: string + deploymentEnvironmentNameAnnotation: + type: string + deploymentEnvironmentNameExpression: + type: string + deploymentEnvironmentNameLabel: + type: string + deploymentEnvironmentNameSource: + description: Source of deployment.environment + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + k8sClusterName: + type: string + splunkMemoryProfiler: + type: boolean + splunkMetricsEnabled: + type: boolean + splunkProfilerAlwaysOn: + type: boolean + type: object technology: description: The programming language or solution to instrument enum: diff --git a/webhook/helm/templates/ext.appd.com_instrumentations.yaml b/webhook/helm/templates/ext.appd.com_instrumentations.yaml index 34dff7c..e02dee9 100644 --- a/webhook/helm/templates/ext.appd.com_instrumentations.yaml +++ b/webhook/helm/templates/ext.appd.com_instrumentations.yaml @@ -114,6 +114,36 @@ spec: description: Memory allocation reservation value type: string type: object + splunkConfig: + properties: + deploymentEnvironmentName: + type: string + deploymentEnvironmentNameAnnotation: + type: string + deploymentEnvironmentNameExpression: + type: string + deploymentEnvironmentNameLabel: + type: string + deploymentEnvironmentNameSource: + description: Source of deployment.environment + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + k8sClusterName: + type: string + splunkMemoryProfiler: + type: boolean + splunkMetricsEnabled: + type: boolean + splunkProfilerAlwaysOn: + type: boolean + type: object technology: description: The programming language or solution to instrument enum: @@ -226,6 +256,36 @@ spec: description: Memory allocation reservation value type: string type: object + splunkConfig: + properties: + deploymentEnvironmentName: + type: string + deploymentEnvironmentNameAnnotation: + type: string + deploymentEnvironmentNameExpression: + type: string + deploymentEnvironmentNameLabel: + type: string + deploymentEnvironmentNameSource: + description: Source of deployment.environment + enum: + - manual + - label + - annotation + - namespace + - namespaceLabel + - namespaceAnnotation + - expression + type: string + k8sClusterName: + type: string + splunkMemoryProfiler: + type: boolean + splunkMetricsEnabled: + type: boolean + splunkProfilerAlwaysOn: + type: boolean + type: object technology: description: The programming language or solution to instrument enum: diff --git a/webhook/pkg/configuration.go b/webhook/pkg/configuration.go index b511c82..31122f0 100644 --- a/webhook/pkg/configuration.go +++ b/webhook/pkg/configuration.go @@ -20,7 +20,6 @@ import ( "encoding/json" "flag" "fmt" - "io/ioutil" "log" "net/http" "os" @@ -443,6 +442,19 @@ func injectionRuleTemplate(injRules *v1alpha1.InjectionRule, injTempRules *v1alp injRules.EnvVars = mergeNameValues(injRules.EnvVars, injTempRules.EnvVars) injRules.Options = mergeNameValues(injRules.Options, injTempRules.Options) injRules.InjectK8SOtelResourceAttrs = applyTemplateBool(injRules.InjectK8SOtelResourceAttrs, injTempRules.InjectK8SOtelResourceAttrs, false) + if injRules.SplunkConfig == nil && injTempRules.SplunkConfig != nil { + injRules.SplunkConfig = &v1alpha1.SplunkConfig{} + injRules.SplunkConfig.SplunkProfilerAlwaysOn = applyTemplateBool(injRules.SplunkConfig.SplunkProfilerAlwaysOn, injTempRules.SplunkConfig.SplunkProfilerAlwaysOn, false) + injRules.SplunkConfig.SplunkMemoryProfiler = applyTemplateBool(injRules.SplunkConfig.SplunkMemoryProfiler, injTempRules.SplunkConfig.SplunkMemoryProfiler, false) + injRules.SplunkConfig.SplunkMetricsEnabled = applyTemplateBool(injRules.SplunkConfig.SplunkMetricsEnabled, injTempRules.SplunkConfig.SplunkMetricsEnabled, false) + injRules.SplunkConfig.DeploymentEnvironmentName = applyTemplateString(injRules.SplunkConfig.DeploymentEnvironmentName, injTempRules.SplunkConfig.DeploymentEnvironmentName) + injRules.SplunkConfig.DeploymentEnvironmentNameSource = applyTemplateString(injRules.SplunkConfig.DeploymentEnvironmentNameSource, injTempRules.SplunkConfig.DeploymentEnvironmentNameSource) + injRules.SplunkConfig.DeploymentEnvironmentNameSource = applyTemplateString(injRules.SplunkConfig.DeploymentEnvironmentNameSource, "namespace") + injRules.SplunkConfig.DeploymentEnvironmentNameLabel = applyTemplateString(injRules.SplunkConfig.DeploymentEnvironmentNameLabel, injTempRules.SplunkConfig.DeploymentEnvironmentNameLabel) + injRules.SplunkConfig.DeploymentEnvironmentNameAnnotation = applyTemplateString(injRules.SplunkConfig.DeploymentEnvironmentNameAnnotation, injTempRules.SplunkConfig.DeploymentEnvironmentNameAnnotation) + injRules.SplunkConfig.DeploymentEnvironmentNameExpression = applyTemplateString(injRules.SplunkConfig.DeploymentEnvironmentNameExpression, injTempRules.SplunkConfig.DeploymentEnvironmentNameExpression) + injRules.SplunkConfig.K8SClusterName = applyTemplateString(injRules.SplunkConfig.K8SClusterName, injTempRules.SplunkConfig.K8SClusterName) + } /// return injRules } @@ -566,7 +578,7 @@ func runsOnOpenShift() bool { } func getMyNamespace() string { - namespaceBytes, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace") + namespaceBytes, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace") namespace := string(namespaceBytes) if err != nil { log.Printf("Cannot read namespace from serviceaccount directory: %v\n", err) @@ -630,6 +642,8 @@ func configHandler() http.Handler { switch r.Method { case "GET": log.Printf("Config GET called\n") + buff := []byte(instrumentationAsString()) + w.Write(buff) case "POST": log.Printf("Config POST called\n") default: @@ -653,7 +667,7 @@ func upsertCrdInstrumentation(namespace string, name string, instr v1alpha1.Inst } namespaceInstrs := config.InstrumentationNamespacedCrds[namespace] - upsertInstrumentationSpecInConfig(namespaceInstrs, name, instr) + upsertInstrumentationSpecInConfig(namespaceInstrs, namespace+"/"+name, instr) } func deleteCrdInstrumentation(namespace string, name string) { @@ -666,7 +680,7 @@ func deleteCrdInstrumentation(namespace string, name string) { } namespaceInstrs := config.InstrumentationNamespacedCrds[namespace] - deleteInstrumentationSpecInConfig(namespaceInstrs, name) + deleteInstrumentationSpecInConfig(namespaceInstrs, namespace+"/"+name) } func upsertCrdClusterInstrumentation(name string, instr v1alpha1.InstrumentationSpec) { @@ -676,18 +690,20 @@ func upsertCrdClusterInstrumentation(name string, instr v1alpha1.Instrumentation // Instrumentation rule name is always taken from the CRD name instr.Name = "*cluster*/" + name - upsertInstrumentationSpecInConfig(config.InstrumentationClusterCrds, name, instr) + upsertInstrumentationSpecInConfig(config.InstrumentationClusterCrds, "*cluster*/"+name, instr) } func deleteCrdClusterInstrumentation(name string) { config.mutex.Lock() defer config.mutex.Unlock() - deleteInstrumentationSpecInConfig(config.InstrumentationClusterCrds, name) + deleteInstrumentationSpecInConfig(config.InstrumentationClusterCrds, "*cluster*/"+name) } func upsertInstrumentationSpecInConfig(specs *InstrumentationConfig, name string, instr v1alpha1.InstrumentationSpec) { + log.Default().Printf("Upserting %s, %s", name, instr.Name) + found := false for i, spec := range *specs { if name == spec.Name { @@ -696,6 +712,8 @@ func upsertInstrumentationSpecInConfig(specs *InstrumentationConfig, name string break } } + log.Default().Printf("Upserting %s, %s, %t", name, instr.Name, found) + if !found { (*specs) = append((*specs), instr) } diff --git a/webhook/pkg/crdReconciler.go b/webhook/pkg/crdReconciler.go index b40d1b4..0f900f7 100644 --- a/webhook/pkg/crdReconciler.go +++ b/webhook/pkg/crdReconciler.go @@ -127,11 +127,11 @@ func (r *reconcileInstrCrd) Reconcile(ctx context.Context, request reconcile.Req if !instr.DeletionTimestamp.IsZero() { log.Info("Deleting Instrumentation", "data", *instr) - deleteCrdInstrumentation(request.Namespace, request.Name) + deleteCrdInstrumentation(request.Namespace, instr.Name) } else { log.Info("Upserting Instrumentation", "data", *instr) injectionRuleDefaults(instr.Spec.InjectionRules) - upsertCrdInstrumentation(request.Namespace, request.Name, instr.Spec) + upsertCrdInstrumentation(request.Namespace, instr.Name, instr.Spec) // Set the label if it is missing if instr.Annotations == nil { instr.Annotations = map[string]string{} @@ -173,11 +173,11 @@ func (r *reconcileGInstrCrd) Reconcile(ctx context.Context, request reconcile.Re if !instr.DeletionTimestamp.IsZero() { log.Info("Deleting ClusterInstrumentation", "data", *instr) - deleteCrdClusterInstrumentation(request.Name) + deleteCrdClusterInstrumentation(instr.Name) } else { log.Info("Upserting ClusterInstrumentation", "data", *instr) injectionRuleDefaults(instr.Spec.InjectionRules) - upsertCrdClusterInstrumentation(request.Name, instr.Spec) + upsertCrdClusterInstrumentation(instr.Name, instr.Spec) // Set the label if it is missing if instr.Annotations == nil { instr.Annotations = map[string]string{} diff --git a/webhook/pkg/instrument.go b/webhook/pkg/instrument.go index dfdd2d2..66fa32b 100644 --- a/webhook/pkg/instrument.go +++ b/webhook/pkg/instrument.go @@ -113,6 +113,8 @@ func applyInjectionRule(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) patchOps = append(patchOps, appdInstrumentation(pod, instrRule)...) case "otel": patchOps = append(patchOps, otelInstrumentation(pod, instrRule)...) + case "splunk": + patchOps = append(patchOps, splunkInstrumentation(pod, instrRule)...) } return patchOps @@ -176,6 +178,32 @@ func otelInstrumentation(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec return patchOps } +func splunkInstrumentation(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) []patchOperation { + + patchOps := []patchOperation{} + + patchOps = append(patchOps, patchOperation{ + Op: "add", + Path: "/metadata/annotations/SPLUNK_INSTRUMENTATION_VIA_RULE", + Value: string(instrRule.Name), + }) + + technology, _ := getTechnologyAndProvider(instrRule.InjectionRules.Technology) + + switch technology { + case "java": + patchOps = append(patchOps, javaSplunkInstrumentation(pod, instrRule)...) + case "dotnetcore": + // patchOps = append(patchOps, dotnetSplunkInstrumentation(pod, instrRule)...) + case "nodejs": + // patchOps = append(patchOps, nodejsSplunkInstrumentation(pod, instrRule)...) + default: + patchOps = append(patchOps, getInstrumentationStatusPatch("FAILED", "Technology for injection not specified or unknown")...) + } + + return patchOps +} + func getApplicationName(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) string { appName := "" injRules := instrRule.InjectionRules @@ -267,6 +295,79 @@ func getTierName(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) string return tierName } +func getSplunkDeploymentEnvironment(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) string { + dEnvName := "" + injRules := instrRule.InjectionRules.SplunkConfig + switch injRules.DeploymentEnvironmentNameSource { + case "manual": + dEnvName = injRules.DeploymentEnvironmentName + case "label": + dEnvName = pod.GetLabels()[injRules.DeploymentEnvironmentNameLabel] + case "annotation": + dEnvName = pod.GetAnnotations()[injRules.DeploymentEnvironmentNameAnnotation] + case "namespace": + dEnvName = pod.GetNamespace() + case "namespaceLabel": + nsName := pod.GetNamespace() + ns, err := clientset.CoreV1().Namespaces().Get(context.Background(), nsName, metav1.GetOptions{}) + if err != nil { + log.Printf("Cannot read namespace %s: %v\n", nsName, err) + dEnvName = nsName + } else { + dEnvName = ns.GetLabels()[injRules.DeploymentEnvironmentNameLabel] + } + case "namespaceAnnotation": + nsName := pod.GetNamespace() + ns, err := clientset.CoreV1().Namespaces().Get(context.Background(), nsName, metav1.GetOptions{}) + if err != nil { + log.Printf("Cannot read namespace %s: %v\n", nsName, err) + dEnvName = nsName + } else { + dEnvName = ns.GetAnnotations()[injRules.DeploymentEnvironmentNameAnnotation] + } + case "expression": + tmpl, err := template.New("expr").Parse(injRules.DeploymentEnvironmentNameExpression) + if err != nil { + log.Printf("Cannot parse deployment environment name expression %s: %v\n", injRules.DeploymentEnvironmentNameExpression, err) + dEnvName = "DEFAULT_DEPLOYMENT_ENVIRONMENT" + } else { + nsName := pod.GetNamespace() + ns, err := clientset.CoreV1().Namespaces().Get(context.Background(), nsName, metav1.GetOptions{}) + if err != nil { + log.Printf("Cannot read namespace %s: %v\n", nsName, err) + dEnvName = nsName + } else { + params := TemplateParams{ + Labels: pod.GetLabels(), + Annotations: pod.GetAnnotations(), + NamespaceLabels: ns.GetLabels(), + NamespaceAnnotations: ns.GetAnnotations(), + Namespace: pod.GetNamespace(), + } + var nameBytes bytes.Buffer + tmpl.Execute(&nameBytes, params) + dEnvName = nameBytes.String() + } + } + default: + dEnvName = "DEFAULT_DEPLOYMENT_ENVIRONMENT" + } + return dEnvName +} + +func getSplunkClusterName(_ corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) string { + clusterName := "" + injRules := instrRule.InjectionRules.SplunkConfig + + clusterName = injRules.K8SClusterName + + if clusterName == "" { + clusterName = "DEFAULT_K8S_CLUSTER" + } + + return clusterName +} + func getInstrumentationStatusPatch(status string, reason string) []patchOperation { patchOps := []patchOperation{} @@ -358,6 +459,19 @@ func addK8SOtelResourceAttrs(pod corev1.Pod, instrRules *v1alpha1.Instrumentatio }, }) + patchOps = append(patchOps, patchOperation{ + Op: "add", + Path: fmt.Sprintf("/spec/containers/%d/env/-", containerIdx), + Value: corev1.EnvVar{ + Name: "K8S_POD_UID", + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + FieldPath: "metadata.uid", + }, + }, + }, + }) + patchOps = append(patchOps, patchOperation{ Op: "add", Path: fmt.Sprintf("/spec/containers/%d/env/-", containerIdx), @@ -372,10 +486,15 @@ func addK8SOtelResourceAttrs(pod corev1.Pod, instrRules *v1alpha1.Instrumentatio }) containerName := pod.Spec.Containers[containerIdx].Name - otelResourceAttributes := "k8s.pod.ip=$(K8S_POD_IP),k8s.pod.name=$(K8S_POD_NAME),k8s.namespace.name=$(K8S_NAMESPACE_NAME)" + otelResourceAttributes := "k8s.pod.ip=$(K8S_POD_IP),k8s.pod.name=$(K8S_POD_NAME),k8s.pod.uid=$(K8S_POD_UID),k8s.namespace.name=$(K8S_NAMESPACE_NAME)" otelResourceAttributes = otelResourceAttributes + ",k8s.container.name=" + containerName // TODO - think about getting right number of restarts otelResourceAttributes = otelResourceAttributes + ",k8s.container.restart_count=0" + if instrRules.InjectionRules.SplunkConfig != nil { + otelResourceAttributes = otelResourceAttributes + + ",deployment.environment=" + getSplunkDeploymentEnvironment(pod, instrRules) + + ",k8s.cluster.name=" + getSplunkClusterName(pod, instrRules) + } if preSetOtelResAttrs != "" { otelResourceAttributes = preSetOtelResAttrs + "," + otelResourceAttributes diff --git a/webhook/pkg/instrumentSplunkJava.go b/webhook/pkg/instrumentSplunkJava.go new file mode 100644 index 0000000..02901a0 --- /dev/null +++ b/webhook/pkg/instrumentSplunkJava.go @@ -0,0 +1,152 @@ +/* +Copyright (c) 2019 Cisco Systems, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "fmt" + "log" + "v1alpha1" + + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" +) + +func javaSplunkInstrumentation(pod corev1.Pod, instrRule *v1alpha1.InstrumentationSpec) []patchOperation { + patchOps := []patchOperation{} + + patchOps = append(patchOps, addOtelJavaEnvVar(pod, instrRule, 0)...) + patchOps = append(patchOps, addContainerEnvVar("OTEL_TRACES_EXPORTER", "otlp", 0)) + patchOps = append(patchOps, addContainerEnvVar("OTEL_RESOURCE_ATTRIBUTES", + fmt.Sprintf("service.name=%s,service.namespace=%s", getTierName(pod, instrRule), getApplicationName(pod, instrRule)), 0)) + patchOps = append(patchOps, addContainerEnvVar("OTEL_SERVICE_NAME", getTierName(pod, instrRule), 0)) + + patchOps = append(patchOps, addSpecifiedContainerEnvVars(instrRule.InjectionRules.EnvVars, 0)...) + + patchOps = append(patchOps, addOtelJavaAgentVolumeMount(pod, instrRule, 0)...) + + patchOps = append(patchOps, addOtelJavaAgentInitContainer(pod, instrRule)...) + + patchOps = append(patchOps, addOtelJavaAgentVolume(pod, instrRule)...) + + if instrRule.InjectionRules.OpenTelemetryCollector != "" { + otelCollConfig, _, err := getCollectorConfigsByName(pod.GetNamespace(), instrRule.InjectionRules.OpenTelemetryCollector) + // otelCollConfig, found := otelCollsConfig[instrRule.InjectionRules.OpenTelemetryCollector] + if err != nil { + log.Printf("Cannot find OTel collector definition %s\n", instrRule.InjectionRules.OpenTelemetryCollector) + } else { + if otelCollConfig.Mode == "sidecar" { + patchOps = append(patchOps, addContainerEnvVar("OTEL_EXPORTER_OTLP_ENDPOINT", "http://localhost:4317", 0)) + patchOps = append(patchOps, addOtelCollSidecar(pod, instrRule, 0)...) + } else if (otelCollConfig.Mode == "deployment") || (otelCollConfig.Mode == "external") { + patchOps = append(patchOps, addContainerEnvVar("OTEL_EXPORTER_OTLP_ENDPOINT", fmt.Sprintf("http://%s:4317", otelCollConfig.ServiceName), 0)) + } + } + } + + return patchOps +} + +func addSplunkJavaEnvVar(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { + patchOps := []patchOperation{} + + patchOps = append(patchOps, patchOperation{ + Op: "add", + Path: fmt.Sprintf("/spec/containers/%d/env/-", containerIdx), + Value: corev1.EnvVar{ + Name: instrRules.InjectionRules.JavaEnvVar, + Value: getOtelJavaOptions(pod, instrRules), + }, + }) + + return patchOps +} + +func getSplunkJavaOptions(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) string { + javaOpts := " " + + if config.ControllerConfig.UseProxy { + javaOpts += fmt.Sprintf("-Dappdynamics.http.proxyHost=%s ", config.ControllerConfig.ProxyHost) + javaOpts += fmt.Sprintf("-Dappdynamics.http.proxyPort=%s ", config.ControllerConfig.ProxyPort) + } + + javaOpts += "-javaagent:/opt/splunk-agent/splunk-otel-javaagent.jar " + javaOpts += instrRules.InjectionRules.JavaCustomConfig + " " + + return javaOpts +} + +func addSplunkJavaAgentVolumeMount(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec, containerIdx int) []patchOperation { + patchOps := []patchOperation{} + patchOps = append(patchOps, patchOperation{ + Op: "add", + Path: fmt.Sprintf("/spec/containers/%d/volumeMounts/-", containerIdx), + Value: corev1.VolumeMount{ + MountPath: "/opt/splunk-agent", //TODO + Name: "splunk-agent-repo-java", //TODO + }, + }) + return patchOps +} + +func addSplunkJavaAgentVolume(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { + patchOps := []patchOperation{} + patchOps = append(patchOps, patchOperation{ + Op: "add", + Path: "/spec/volumes/-", + Value: corev1.Volume{ + Name: "splunk-agent-repo-java", //TODO + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + }, + }) + return patchOps +} + +func addSplunkJavaAgentInitContainer(pod corev1.Pod, instrRules *v1alpha1.InstrumentationSpec) []patchOperation { + patchOps := []patchOperation{} + limCPU, _ := resource.ParseQuantity("200m") + limMem, _ := resource.ParseQuantity("75M") + reqCPU, _ := resource.ParseQuantity(instrRules.InjectionRules.ResourceReservation.CPU) + reqMem, _ := resource.ParseQuantity(instrRules.InjectionRules.ResourceReservation.Memory) + + patchOps = append(patchOps, patchOperation{ + Op: "add", + Path: "/spec/initContainers/-", + Value: corev1.Container{ + Name: "splunk-agent-attach-java", //TODO + Image: instrRules.InjectionRules.Image, + Command: []string{"cp", "-r", "/opt/splunk/.", "/opt/splunk-agent"}, + ImagePullPolicy: corev1.PullAlways, //TODO + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + corev1.ResourceCPU: limCPU, + corev1.ResourceMemory: limMem, + }, + Requests: corev1.ResourceList{ + corev1.ResourceCPU: reqCPU, + corev1.ResourceMemory: reqMem, + }, + }, + VolumeMounts: []corev1.VolumeMount{{ + MountPath: "/opt/splunk-agent", //TODO + Name: "splunk-agent-repo-java", //TODO + }}, + }, + }) + return patchOps +} diff --git a/webhook/pkg/v1alpha1/instrumentation_rule.go b/webhook/pkg/v1alpha1/instrumentation_rule.go index ddb6d80..7a7fd9b 100644 --- a/webhook/pkg/v1alpha1/instrumentation_rule.go +++ b/webhook/pkg/v1alpha1/instrumentation_rule.go @@ -72,6 +72,21 @@ type InjectionRule struct { EnvVars []NameValue `json:"env,omitempty" yaml:"env,omitempty"` Options []NameValue `json:"options,omitempty" yaml:"options,omitempty"` InjectK8SOtelResourceAttrs *bool `json:"injectK8SOtelResourceAttrs,omitempty" yaml:"injectK8SOtelResourceAttrs,omitempty"` + SplunkConfig *SplunkConfig `json:"splunkConfig,omitempty" yaml:"splunkConfig,omitempty"` +} + +type SplunkConfig struct { + SplunkProfilerAlwaysOn *bool `json:"splunkProfilerAlwaysOn,omitempty" yaml:"splunkProfilerAlwaysOn,omitempty"` + SplunkMemoryProfiler *bool `json:"splunkMemoryProfiler,omitempty" yaml:"splunkMemoryProfiler,omitempty"` + SplunkMetricsEnabled *bool `json:"splunkMetricsEnabled,omitempty" yaml:"splunkMetricsEnabled,omitempty"` + // Source of deployment.environment + // +kubebuilder:validation:Enum=manual;label;annotation;namespace;namespaceLabel;namespaceAnnotation;expression + DeploymentEnvironmentNameSource string `json:"deploymentEnvironmentNameSource,omitempty" yaml:"deploymentEnvironmentNameSource,omitempty"` + DeploymentEnvironmentName string `json:"deploymentEnvironmentName,omitempty" yaml:"deploymentEnvironmentName,omitempty"` + DeploymentEnvironmentNameLabel string `json:"deploymentEnvironmentNameLabel,omitempty" yaml:"deploymentEnvironmentNameLabel,omitempty"` + DeploymentEnvironmentNameAnnotation string `json:"deploymentEnvironmentNameAnnotation,omitempty" yaml:"deploymentEnvironmentNameAnnotation,omitempty"` + DeploymentEnvironmentNameExpression string `json:"deploymentEnvironmentNameExpression,omitempty" yaml:"deploymentEnvironmentNameExpression,omitempty"` + K8SClusterName string `json:"k8sClusterName,omitempty" yaml:"k8sClusterName,omitempty"` } type NameValue struct { diff --git a/webhook/pkg/v1alpha1/zz_generated.deepcopy.go b/webhook/pkg/v1alpha1/zz_generated.deepcopy.go index 69b65ba..236569a 100644 --- a/webhook/pkg/v1alpha1/zz_generated.deepcopy.go +++ b/webhook/pkg/v1alpha1/zz_generated.deepcopy.go @@ -130,6 +130,11 @@ func (in *InjectionRule) DeepCopyInto(out *InjectionRule) { *out = new(bool) **out = **in } + if in.SplunkConfig != nil { + in, out := &in.SplunkConfig, &out.SplunkConfig + *out = new(SplunkConfig) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InjectionRule. @@ -483,3 +488,33 @@ func (in *ResourceReservation) DeepCopy() *ResourceReservation { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SplunkConfig) DeepCopyInto(out *SplunkConfig) { + *out = *in + if in.SplunkProfilerAlwaysOn != nil { + in, out := &in.SplunkProfilerAlwaysOn, &out.SplunkProfilerAlwaysOn + *out = new(bool) + **out = **in + } + if in.SplunkMemoryProfiler != nil { + in, out := &in.SplunkMemoryProfiler, &out.SplunkMemoryProfiler + *out = new(bool) + **out = **in + } + if in.SplunkMetricsEnabled != nil { + in, out := &in.SplunkMetricsEnabled, &out.SplunkMetricsEnabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SplunkConfig. +func (in *SplunkConfig) DeepCopy() *SplunkConfig { + if in == nil { + return nil + } + out := new(SplunkConfig) + in.DeepCopyInto(out) + return out +} From 34e61d9e187f299adae386ba8610628269e1dc9b Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Wed, 19 Jun 2024 11:55:45 +0200 Subject: [PATCH 05/16] Merging branch 'crd' - NG instrumentor --- webhook/pkg/go.work.sum | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webhook/pkg/go.work.sum b/webhook/pkg/go.work.sum index 4a86ad7..5221a31 100644 --- a/webhook/pkg/go.work.sum +++ b/webhook/pkg/go.work.sum @@ -37,6 +37,7 @@ cloud.google.com/go/compute v1.19.3/go.mod h1:qxvISKp/gYnXkSAD1ppcSOveRAmzxicEv/ cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute v1.21.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/contactcenterinsights v1.9.1/go.mod h1:bsg/R7zGLYMVxFFzfh9ooLTruLRCG9fnzhH9KznHhbM= cloud.google.com/go/contactcenterinsights v1.10.0/go.mod h1:bsg/R7zGLYMVxFFzfh9ooLTruLRCG9fnzhH9KznHhbM= @@ -162,7 +163,6 @@ github.com/alecthomas/kingpin/v2 v2.3.2/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HR github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= @@ -191,6 +191,7 @@ github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= github.com/google/cel-go v0.17.7/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY= +github.com/google/gnostic v0.6.9 h1:ZK/5VhkoX835RikCHpSUJV9a+S3e1zLh59YnyWeBW+0= github.com/google/gnostic v0.6.9/go.mod h1:Nm8234We1lq6iB9OmlgNv3nH91XLLVZHCDayfA3xq+E= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= @@ -229,7 +230,6 @@ github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRM github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75/go.mod h1:KO6IkyS8Y3j8OdNO85qEYBsRPuteD+YciPomcXdrMnk= -github.com/vladimirvivien/gexe v0.2.0/go.mod h1:LHQL00w/7gDUKIak24n801ABp8C+ni6eBht9vGVst8w= github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= From 0230e9a9c79685f52ede227ae1cc23f155303a5b Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Wed, 19 Jun 2024 13:49:31 +0200 Subject: [PATCH 06/16] e2e test asserts fixes --- webhook/e2e-tests/java/instr-otel/pod-assert.yaml | 5 +++++ webhook/e2e-tests/java/instr/pod-assert.yaml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/webhook/e2e-tests/java/instr-otel/pod-assert.yaml b/webhook/e2e-tests/java/instr-otel/pod-assert.yaml index 7168e7d..1d01c89 100644 --- a/webhook/e2e-tests/java/instr-otel/pod-assert.yaml +++ b/webhook/e2e-tests/java/instr-otel/pod-assert.yaml @@ -33,6 +33,11 @@ spec: fieldRef: apiVersion: v1 fieldPath: metadata.name + - name: K8S_POD_UID + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.uid - name: K8S_NAMESPACE_NAME valueFrom: fieldRef: diff --git a/webhook/e2e-tests/java/instr/pod-assert.yaml b/webhook/e2e-tests/java/instr/pod-assert.yaml index 5c68bb3..dab923c 100644 --- a/webhook/e2e-tests/java/instr/pod-assert.yaml +++ b/webhook/e2e-tests/java/instr/pod-assert.yaml @@ -33,6 +33,11 @@ spec: fieldRef: apiVersion: v1 fieldPath: metadata.name + - name: K8S_POD_UID + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.uid - name: K8S_NAMESPACE_NAME valueFrom: fieldRef: From 35bd4fc17999916bcca110ef84ed6d999b1e3a23 Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Fri, 21 Jun 2024 11:21:24 +0200 Subject: [PATCH 07/16] workflow for helm publishing fixed --- .github/workflows/helm-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/helm-release.yml b/.github/workflows/helm-release.yml index a4d66c6..d7bd931 100644 --- a/.github/workflows/helm-release.yml +++ b/.github/workflows/helm-release.yml @@ -35,7 +35,7 @@ jobs: - name: Run chart-releaser uses: helm/chart-releaser-action@v1.5.0 with: - charts_dir: buildEnv/helm + charts_dir: webhook/helm env: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 38f3f6db340d9beec2dceeb2ec58ae2d0d7c8f8e Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Fri, 21 Jun 2024 11:27:22 +0200 Subject: [PATCH 08/16] typos fixed --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f83b353..6d10e52 100644 --- a/README.md +++ b/README.md @@ -4,21 +4,21 @@ This project provides a auto-instrumentation tool primarily for AppDynamics agen ## Why? -### Why different autoinstrumentation for AppDynamics? +### Why different auto-instrumentation for AppDynamics? -AppDynamics offers autoinstrumentation functionality via Cluster Agent and it's configuration. Cluster Agent uses a strategy of +AppDynamics offers auto-instrumentation functionality via Cluster Agent and it's configuration. Cluster Agent uses a strategy of modifying Deployments, DeploymentConfigs (on OpenShift), and StatefulSets when those match pre-set criteria, when pod specifications are modified so, that agent for supported languages is automatically injected into application container. Kubernetes control plane then creates appropriate number of already instrumented pods. -While this approach offers a few benefits, among all ability to reverse instrumentation changes in inprobable case of issues introduced by an agent, there are also a few drawbacks, especially when using modern popular CD tooling such as Argo CD. In some cases, Cluster Agent is unable to detect changes in deployment specification made by those tools, which results in application not being instrumented, in other cases, like when using Argo CD, Cluster Agent and CD deployment tool end up in endless cycle of back and forth modifications of deployment specification, resulting in undesired number of application restarts and inconsistent monitoring. +While this approach offers a few benefits, among all ability to reverse instrumentation changes in improbable case of issues introduced by an agent, there are also a few drawbacks, especially when using modern popular CD tooling such as Argo CD. In some cases, Cluster Agent is unable to detect changes in deployment specification made by those tools, which results in application not being instrumented, in other cases, like when using Argo CD, Cluster Agent and CD deployment tool end up in endless cycle of back and forth modifications of deployment specification, resulting in undesired number of application restarts and inconsistent monitoring. This project brings a method of agent injection directly to pod specification upon their instantiation wia mutating webhook, avoiding most of the corner cases mentioned above (the only significant being for example Argo CD deploying Pod directly and not via ReplicaSet specification or Deployment/StatefulSet etc.). ### Other use cases made possible -With OpenTelemetry support in AppDynamics SaaS, it can be assumed users will want the same level of ease of agent installation as in case of traditional AppDynamics agents. While there is an official OpenTelemetry autoistrumentation functionality available at https://github.com/open-telemetry/opentelemetry-operator for official OpenTelemetry agents, AppDynamics offers also hybrid agent functionality in AppDynamics agents where agents emit both native and OpenTelemetry telemetry data. +With OpenTelemetry support in AppDynamics SaaS, it can be assumed users will want the same level of ease of agent installation as in case of traditional AppDynamics agents. While there is an official OpenTelemetry auto-instrumentation functionality available at https://github.com/open-telemetry/opentelemetry-operator for official OpenTelemetry agents, AppDynamics offers also hybrid agent functionality in AppDynamics agents where agents emit both native and OpenTelemetry telemetry data. -This project supports both AppDynamics hybrid agents and OpenTelemetry agents in several ways including ability to create OpenTelemetry collectors with speciified custom configuration. +This project supports both AppDynamics hybrid agents and OpenTelemetry agents in several ways including ability to create OpenTelemetry collectors with specified custom configuration. ## Supported Agents @@ -123,7 +123,7 @@ When using OpenTelemetry, collector generally has to be deployed somewhere, usua - `sidecar` - collector running as a sidecar in the same pod as application itself. This is injected into the pod by this tool - `external` - collector running independently of this tool, not managed by this tool - it's expected you setup this collector another way yourselves. It can even run anywhere like on different cluster, VM, or in the cloud. -When using resource `ext.appd.com/v1alpha1` - `OpenTelemetryCollector`, and `deployment` mode, this tool will spin up a collector in the same namespace where this resource definition is created. When you delete the `OpenTelementryCollector` resource, collector will be also deleted. +When using resource `ext.appd.com/v1alpha1` - `OpenTelemetryCollector`, and `deployment` mode, this tool will spin up a collector in the same namespace where this resource definition is created. When you delete the `OpenTelemetryCollector` resource, collector will be also deleted. Example: From 8c8d3e40c0c82195dd9d6ccdc98bef9fbb8a0870 Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Fri, 21 Jun 2024 11:32:45 +0200 Subject: [PATCH 09/16] reelase action upgraded to node 20 --- .github/workflows/helm-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/helm-release.yml b/.github/workflows/helm-release.yml index d7bd931..6f9d05d 100644 --- a/.github/workflows/helm-release.yml +++ b/.github/workflows/helm-release.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 env: @@ -28,12 +28,12 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install Helm - uses: azure/setup-helm@v3 + uses: azure/setup-helm@v4.2.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.5.0 + uses: helm/chart-releaser-action@v1.6.0 with: charts_dir: webhook/helm env: From ac732ee33b89a5e7df8b59f2d822dc5b08ae12c8 Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Fri, 21 Jun 2024 11:38:04 +0200 Subject: [PATCH 10/16] helm char moved to specific dir --- webhook/Makefile | 8 ++++---- webhook/helm/{ => instrumentor}/Chart.yaml | 0 webhook/helm/{ => instrumentor}/templates/_helpers.tpl | 0 .../templates/cm-webhook-instrumentor-config.yaml | 0 .../templates/cr-webhook-instrumentor.yaml | 0 .../templates/crb-webhook-instrumentor.yaml | 0 .../templates/crd-instrumetation-config.yaml | 0 .../templates/d-webhook-instrumentor.yaml | 0 .../{ => instrumentor}/templates/db-agent/d-db-agent.yaml | 0 .../templates/ext.appd.com_clusterinstrumentations.yaml | 0 .../templates/ext.appd.com_instrumentations.yaml | 0 .../templates/ext.appd.com_opentelemetrycollectors.yaml | 0 .../templates/otel/cm-otel-collector-config.yaml | 0 .../templates/otel/svc-d-otel-collector-service.yaml | 0 .../templates/r-webhook-instrumentor.yaml | 0 .../templates/rb-webhook-instrumentor.yaml | 0 webhook/helm/{ => instrumentor}/templates/role.yaml | 0 .../templates/sa-webhook-instrumentor.yaml | 0 .../templates/sec-and-mwhc-webhook-instrumentor.yaml | 0 .../templates/svc-webhook-instrumentor.yaml | 0 webhook/helm/{ => instrumentor}/values-sample-otel.yaml | 0 webhook/helm/{ => instrumentor}/values-sample.yaml | 0 22 files changed, 4 insertions(+), 4 deletions(-) rename webhook/helm/{ => instrumentor}/Chart.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/_helpers.tpl (100%) rename webhook/helm/{ => instrumentor}/templates/cm-webhook-instrumentor-config.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/cr-webhook-instrumentor.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/crb-webhook-instrumentor.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/crd-instrumetation-config.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/d-webhook-instrumentor.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/db-agent/d-db-agent.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/ext.appd.com_clusterinstrumentations.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/ext.appd.com_instrumentations.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/ext.appd.com_opentelemetrycollectors.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/otel/cm-otel-collector-config.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/otel/svc-d-otel-collector-service.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/r-webhook-instrumentor.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/rb-webhook-instrumentor.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/role.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/sa-webhook-instrumentor.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/sec-and-mwhc-webhook-instrumentor.yaml (100%) rename webhook/helm/{ => instrumentor}/templates/svc-webhook-instrumentor.yaml (100%) rename webhook/helm/{ => instrumentor}/values-sample-otel.yaml (100%) rename webhook/helm/{ => instrumentor}/values-sample.yaml (100%) diff --git a/webhook/Makefile b/webhook/Makefile index a55d290..6ea5b8f 100644 --- a/webhook/Makefile +++ b/webhook/Makefile @@ -29,7 +29,7 @@ $(CONTROLLER_GEN): $(LOCALBIN) .PHONY: manifests manifests: controller-gen cd pkg && $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=appd-aac webhook paths="./..." output:crd:artifacts:config=../config/crd/bases - cd pkg && $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=appd-aac output:rbac:dir=../helm/templates paths="./..." output:crd:artifacts:config=../helm/templates object:headerFile=../license.txt + cd pkg && $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=appd-aac output:rbac:dir=../helm/instrumentor/templates paths="./..." output:crd:artifacts:config=../helm/instrumentor/templates object:headerFile=../license.txt .PHONY: images images: @@ -71,9 +71,9 @@ test: .PHONY: test-cleanup test-cleanup: -helm uninstall --namespace mwh mwh - -kubectl delete -f ./helm/templates/ext.appd.com_clusterinstrumentations.yaml - -kubectl delete -f ./helm/templates/ext.appd.com_instrumentations.yaml - -kubectl delete -f ./helm/templates/ext.appd.com_opentelemetrycollectors.yaml + -kubectl delete -f ./helm/instrumentor/templates/ext.appd.com_clusterinstrumentations.yaml + -kubectl delete -f ./helm/instrumentor/templates/ext.appd.com_instrumentations.yaml + -kubectl delete -f ./helm/instrumentor/templates/ext.appd.com_opentelemetrycollectors.yaml -kubectl delete clusterrole webhook-instrumentor -kubectl delete clusterrole appd-aac -kubectl delete clusterrolebinding webhook-instrumentor diff --git a/webhook/helm/Chart.yaml b/webhook/helm/instrumentor/Chart.yaml similarity index 100% rename from webhook/helm/Chart.yaml rename to webhook/helm/instrumentor/Chart.yaml diff --git a/webhook/helm/templates/_helpers.tpl b/webhook/helm/instrumentor/templates/_helpers.tpl similarity index 100% rename from webhook/helm/templates/_helpers.tpl rename to webhook/helm/instrumentor/templates/_helpers.tpl diff --git a/webhook/helm/templates/cm-webhook-instrumentor-config.yaml b/webhook/helm/instrumentor/templates/cm-webhook-instrumentor-config.yaml similarity index 100% rename from webhook/helm/templates/cm-webhook-instrumentor-config.yaml rename to webhook/helm/instrumentor/templates/cm-webhook-instrumentor-config.yaml diff --git a/webhook/helm/templates/cr-webhook-instrumentor.yaml b/webhook/helm/instrumentor/templates/cr-webhook-instrumentor.yaml similarity index 100% rename from webhook/helm/templates/cr-webhook-instrumentor.yaml rename to webhook/helm/instrumentor/templates/cr-webhook-instrumentor.yaml diff --git a/webhook/helm/templates/crb-webhook-instrumentor.yaml b/webhook/helm/instrumentor/templates/crb-webhook-instrumentor.yaml similarity index 100% rename from webhook/helm/templates/crb-webhook-instrumentor.yaml rename to webhook/helm/instrumentor/templates/crb-webhook-instrumentor.yaml diff --git a/webhook/helm/templates/crd-instrumetation-config.yaml b/webhook/helm/instrumentor/templates/crd-instrumetation-config.yaml similarity index 100% rename from webhook/helm/templates/crd-instrumetation-config.yaml rename to webhook/helm/instrumentor/templates/crd-instrumetation-config.yaml diff --git a/webhook/helm/templates/d-webhook-instrumentor.yaml b/webhook/helm/instrumentor/templates/d-webhook-instrumentor.yaml similarity index 100% rename from webhook/helm/templates/d-webhook-instrumentor.yaml rename to webhook/helm/instrumentor/templates/d-webhook-instrumentor.yaml diff --git a/webhook/helm/templates/db-agent/d-db-agent.yaml b/webhook/helm/instrumentor/templates/db-agent/d-db-agent.yaml similarity index 100% rename from webhook/helm/templates/db-agent/d-db-agent.yaml rename to webhook/helm/instrumentor/templates/db-agent/d-db-agent.yaml diff --git a/webhook/helm/templates/ext.appd.com_clusterinstrumentations.yaml b/webhook/helm/instrumentor/templates/ext.appd.com_clusterinstrumentations.yaml similarity index 100% rename from webhook/helm/templates/ext.appd.com_clusterinstrumentations.yaml rename to webhook/helm/instrumentor/templates/ext.appd.com_clusterinstrumentations.yaml diff --git a/webhook/helm/templates/ext.appd.com_instrumentations.yaml b/webhook/helm/instrumentor/templates/ext.appd.com_instrumentations.yaml similarity index 100% rename from webhook/helm/templates/ext.appd.com_instrumentations.yaml rename to webhook/helm/instrumentor/templates/ext.appd.com_instrumentations.yaml diff --git a/webhook/helm/templates/ext.appd.com_opentelemetrycollectors.yaml b/webhook/helm/instrumentor/templates/ext.appd.com_opentelemetrycollectors.yaml similarity index 100% rename from webhook/helm/templates/ext.appd.com_opentelemetrycollectors.yaml rename to webhook/helm/instrumentor/templates/ext.appd.com_opentelemetrycollectors.yaml diff --git a/webhook/helm/templates/otel/cm-otel-collector-config.yaml b/webhook/helm/instrumentor/templates/otel/cm-otel-collector-config.yaml similarity index 100% rename from webhook/helm/templates/otel/cm-otel-collector-config.yaml rename to webhook/helm/instrumentor/templates/otel/cm-otel-collector-config.yaml diff --git a/webhook/helm/templates/otel/svc-d-otel-collector-service.yaml b/webhook/helm/instrumentor/templates/otel/svc-d-otel-collector-service.yaml similarity index 100% rename from webhook/helm/templates/otel/svc-d-otel-collector-service.yaml rename to webhook/helm/instrumentor/templates/otel/svc-d-otel-collector-service.yaml diff --git a/webhook/helm/templates/r-webhook-instrumentor.yaml b/webhook/helm/instrumentor/templates/r-webhook-instrumentor.yaml similarity index 100% rename from webhook/helm/templates/r-webhook-instrumentor.yaml rename to webhook/helm/instrumentor/templates/r-webhook-instrumentor.yaml diff --git a/webhook/helm/templates/rb-webhook-instrumentor.yaml b/webhook/helm/instrumentor/templates/rb-webhook-instrumentor.yaml similarity index 100% rename from webhook/helm/templates/rb-webhook-instrumentor.yaml rename to webhook/helm/instrumentor/templates/rb-webhook-instrumentor.yaml diff --git a/webhook/helm/templates/role.yaml b/webhook/helm/instrumentor/templates/role.yaml similarity index 100% rename from webhook/helm/templates/role.yaml rename to webhook/helm/instrumentor/templates/role.yaml diff --git a/webhook/helm/templates/sa-webhook-instrumentor.yaml b/webhook/helm/instrumentor/templates/sa-webhook-instrumentor.yaml similarity index 100% rename from webhook/helm/templates/sa-webhook-instrumentor.yaml rename to webhook/helm/instrumentor/templates/sa-webhook-instrumentor.yaml diff --git a/webhook/helm/templates/sec-and-mwhc-webhook-instrumentor.yaml b/webhook/helm/instrumentor/templates/sec-and-mwhc-webhook-instrumentor.yaml similarity index 100% rename from webhook/helm/templates/sec-and-mwhc-webhook-instrumentor.yaml rename to webhook/helm/instrumentor/templates/sec-and-mwhc-webhook-instrumentor.yaml diff --git a/webhook/helm/templates/svc-webhook-instrumentor.yaml b/webhook/helm/instrumentor/templates/svc-webhook-instrumentor.yaml similarity index 100% rename from webhook/helm/templates/svc-webhook-instrumentor.yaml rename to webhook/helm/instrumentor/templates/svc-webhook-instrumentor.yaml diff --git a/webhook/helm/values-sample-otel.yaml b/webhook/helm/instrumentor/values-sample-otel.yaml similarity index 100% rename from webhook/helm/values-sample-otel.yaml rename to webhook/helm/instrumentor/values-sample-otel.yaml diff --git a/webhook/helm/values-sample.yaml b/webhook/helm/instrumentor/values-sample.yaml similarity index 100% rename from webhook/helm/values-sample.yaml rename to webhook/helm/instrumentor/values-sample.yaml From 50be5b907f35ba154a6cb8ed1d49cac17355e3e3 Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Fri, 21 Jun 2024 11:40:11 +0200 Subject: [PATCH 11/16] bump heml char version to 0.3.0 --- webhook/helm/instrumentor/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webhook/helm/instrumentor/Chart.yaml b/webhook/helm/instrumentor/Chart.yaml index cc4d9e2..f2032b7 100644 --- a/webhook/helm/instrumentor/Chart.yaml +++ b/webhook/helm/instrumentor/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: webhook-instrumentor -version: 0.2.2 +version: 0.3.0 description: Kubernetes Mutating Webhook for AppDynamics auto-instrumentation icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png maintainers: From 8495351c4aef1e728faa427a8a0620c0ba4eb8a3 Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Wed, 26 Jun 2024 09:42:53 +0200 Subject: [PATCH 12/16] helm chart path consistency --- webhook/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webhook/Makefile b/webhook/Makefile index 6ea5b8f..877b6d9 100644 --- a/webhook/Makefile +++ b/webhook/Makefile @@ -54,15 +54,15 @@ api-docs: crdoc .PHONY: install install: - cd helm && helm install --namespace $(HELM_DEPLOYMENT_NAMESPACE) $(HELM_DEPLOYMENT_NAME) . --values=$(HELM_VALUES_FILE) + helm install --namespace $(HELM_DEPLOYMENT_NAMESPACE) $(HELM_DEPLOYMENT_NAME) ./helm/instrumentor --values=$(HELM_VALUES_FILE) .PHONY: install-test install-test: - cd helm && helm install --namespace $(HELM_DEPLOYMENT_NAMESPACE) $(HELM_DEPLOYMENT_NAME) . --values=$(TEST_HELM_VALUES_TEMP) + helm install --namespace $(HELM_DEPLOYMENT_NAMESPACE) $(HELM_DEPLOYMENT_NAME) ./helm/instrumentor --values=$(TEST_HELM_VALUES_TEMP) .PHONY: remove remove: - -cd helm && helm delete --namespace $(HELM_DEPLOYMENT_NAMESPACE) $(HELM_DEPLOYMENT_NAME) + -helm delete --namespace $(HELM_DEPLOYMENT_NAMESPACE) $(HELM_DEPLOYMENT_NAME) .PHONY: test test: From e86da2a1d3eeee5df1d602743142c0eef8e5db41 Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Wed, 26 Jun 2024 15:02:40 +0200 Subject: [PATCH 13/16] Hybrid mode with Splunk readme --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/README.md b/README.md index 6d10e52..5b88d10 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,49 @@ spec: level: "debug" ~~~ +## Using AppDynamics agents in Hybrid mode with Splunk Observability Cloud (aka O11y) + +The tool can ensure injection attributes specific to Splunk Observability Cloud into OpenTelemetry trace data, which is needed to data ingestion to work correctly and to correlate to container infrastructure telemetry. + +The Instrumentation and ClusterInstrumentation resources can include definition of where to take the deployment environment and Kubernetes cluster names from. + +For example like this: +~~~ +apiVersion: ext.appd.com/v1alpha1 +kind: Instrumentation +metadata: + name: java-instrumentation +spec: + name: java-instrumentation + priority: 2 + matchRules: + labels: + - language: java + - otel: appd + podNameRegex: .* + injectionRules: + technology: java + image: appdynamics/java-agent:latest + # imagePullPolicy: Always + applicationNameSource: label + applicationNameLabel: appdApp + tierNameSource: auto + javaEnvVar: _JAVA_OPTIONS + javaCustomConfig: "-Dappdynamics.low.entropy=false" + # technology java + openTelemetryCollector -> use AppD hybrid agent + openTelemetryCollector: appd-splunk-traces + splunkConfig: + deploymentEnvironmentNameSource: label + deploymentEnvironmentNameLabel: appdApp + k8sClusterName: md-cluster +~~~ + +where `splunkConfig` section defines the rules. + +As in case of AppDynamics application name, deployment environment value can be taken from label, annotation, namespace, namespace label or annotation, or via custom expression. + +For Kubernetes cluster name, it's a string constant. + More examples and documentation is coming soon. ## DB Agent support From 73163d4a552d35dc94572cd17ff115373b124a1c Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Wed, 26 Jun 2024 15:03:34 +0200 Subject: [PATCH 14/16] addition of otel native note --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5b88d10..3d3fd8b 100644 --- a/README.md +++ b/README.md @@ -219,6 +219,8 @@ As in case of AppDynamics application name, deployment environment value can be For Kubernetes cluster name, it's a string constant. +The section `splunkConfig` can be used with OpenTelemetry native agents, too. + More examples and documentation is coming soon. ## DB Agent support From 4b9cf2b567240f9fa4f74ba5c0b9ffb6a02e387c Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Thu, 27 Jun 2024 14:05:37 +0200 Subject: [PATCH 15/16] compliance fix --- webhook/examples/crd-otelcol.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webhook/examples/crd-otelcol.yaml b/webhook/examples/crd-otelcol.yaml index c08273d..7e2588b 100644 --- a/webhook/examples/crd-otelcol.yaml +++ b/webhook/examples/crd-otelcol.yaml @@ -33,8 +33,8 @@ spec: otlphttp: tls: insecure: true - endpoint: "https://<>-sls-agent-api.saas.appdynamics.com" - headers: {"x-api-key": "<>"} + endpoint: "https://fra-sls-agent-api.saas.appdynamics.com" + headers: {"x-api-key": "***REMOVED***"} service: pipelines: traces: From 1d20260c34870216fa3ef4b93514834e18fe1c47 Mon Sep 17 00:00:00 2001 From: Martin Divis Date: Thu, 27 Jun 2024 14:08:06 +0200 Subject: [PATCH 16/16] compliance fix --- webhook/examples/crd-otelcol.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webhook/examples/crd-otelcol.yaml b/webhook/examples/crd-otelcol.yaml index 7e2588b..be3850f 100644 --- a/webhook/examples/crd-otelcol.yaml +++ b/webhook/examples/crd-otelcol.yaml @@ -33,8 +33,8 @@ spec: otlphttp: tls: insecure: true - endpoint: "https://fra-sls-agent-api.saas.appdynamics.com" - headers: {"x-api-key": "***REMOVED***"} + endpoint: "https://-sls-agent-api.saas.appdynamics.com" + headers: {"x-api-key": ""} service: pipelines: traces: