Skip to content

Commit

Permalink
chore: rename dash0Backend Helm setting to dash0Export
Browse files Browse the repository at this point in the history
  • Loading branch information
basti1302 committed Sep 19, 2024
1 parent 6b81a9a commit 4ef4140
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 52 deletions.
30 changes: 15 additions & 15 deletions helm-chart/dash0-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ Now you can install the operator into your cluster via Helm with the following c
helm install \
--namespace dash0-system \
--create-namespace \
--set operator.dash0Backend.enabled=true \
--set operator.dash0Backend.endpoint=REPLACE THIS WITH YOUR DASH0 INGRESS ENDPOINT \
--set operator.dash0Backend.token=REPLACE THIS WITH YOUR DASH0 AUTH TOKEN \
--set operator.dash0Export.enabled=true \
--set operator.dash0Export.endpoint=REPLACE THIS WITH YOUR DASH0 INGRESS ENDPOINT \
--set operator.dash0Export.token=REPLACE THIS WITH YOUR DASH0 AUTH TOKEN \
dash0-operator \
dash0-operator/dash0-operator
```
Expand All @@ -74,10 +74,10 @@ Instead of providing the auth token directly, you can also use a secret referenc
helm install \
--namespace dash0-system \
--create-namespace \
--set operator.dash0Backend.enabled=true \
--set operator.dash0Backend.endpoint=REPLACE THIS WITH YOUR DASH0 INGRESS ENDPOINT \
--set operator.dash0Backend.secretRef.name=REPLACE THIS WITH THE NAME OF AN EXISTING KUBERNETES SECRET \
--set operator.dash0Backend.secretRef.key=REPLACE THIS WITH THE PROPERTY KEY IN THAT SECRET \
--set operator.dash0Export.enabled=true \
--set operator.dash0Export.endpoint=REPLACE THIS WITH YOUR DASH0 INGRESS ENDPOINT \
--set operator.dash0Export.secretRef.name=REPLACE THIS WITH THE NAME OF AN EXISTING KUBERNETES SECRET \
--set operator.dash0Export.secretRef.key=REPLACE THIS WITH THE PROPERTY KEY IN THAT SECRET \
dash0-operator \
dash0-operator/dash0-operator
```
Expand All @@ -98,7 +98,7 @@ helm install \

However, you will need to create a Dash0 operator configuration resource later that provides the backend connection
settings.
That is, providing `--set operator.dash0Backend.enabled=true` and the other backend-related settings when running
That is, providing `--set operator.dash0Export.enabled=true` and the other backend-related settings when running
`helm install` is simply a shortcut to deploy the Dash0 operator configuration resource automatically at startup.

On its own, the operator will not do much.
Expand All @@ -112,7 +112,7 @@ Both steps are described in the following sections.

### Configuring the Dash0 Backend Connection

You can skip this step if you provided `--set operator.dash0Backend.enabled=true` together with the endpoint and either
You can skip this step if you provided `--set operator.dash0Export.enabled=true` together with the endpoint and either
a token or a secret reference when running `helm install`. In that case, proceed to the next section,
[Enable Dash0 Monitoring For a Namespace](#enable-dash0-monitoring-for-a-namespace).

Expand Down Expand Up @@ -292,10 +292,10 @@ secret has been created as shown above:
```console
helm install \
--namespace dash0-system \
--set operator.dash0Backend.enabled=true \
--set operator.dash0Backend.endpoint=REPLACE THIS WITH YOUR DASH0 INGRESS ENDPOINT \
--set operator.dash0Backend.secretRef.name=dash0-authorization-secret \
--set operator.dash0Backend.secretRef.key=token \
--set operator.dash0Export.enabled=true \
--set operator.dash0Export.endpoint=REPLACE THIS WITH YOUR DASH0 INGRESS ENDPOINT \
--set operator.dash0Export.secretRef.name=dash0-authorization-secret \
--set operator.dash0Export.secretRef.key=token \
dash0-operator \
dash0-operator/dash0-operator
```
Expand Down Expand Up @@ -340,8 +340,8 @@ spec:
secretRef: {}
```

Note: There are no defaults when using `--set operator.dash0Backend.secretRef.name` and
`--set operator.dash0Backend.secretRef.key` with `helm install`, so for that approach the values must always be
Note: There are no defaults when using `--set operator.dash0Export.secretRef.name` and
`--set operator.dash0Export.secretRef.key` with `helm install`, so for that approach the values must always be
provided explicitly.

Note that by default, Kubernetes secrets are stored _unencrypted_, and anyone with API access to the Kubernetes cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,26 +78,26 @@ spec:
- --health-probe-bind-address=:8081
- --metrics-bind-address=127.0.0.1:8080
- --leader-elect
{{- if .Values.operator.dash0Backend.enabled }}
{{- if not .Values.operator.dash0Backend.endpoint }}
{{- fail "Error: operator.dash0Backend.enabled is set to true, but you did not provide a value for operator.dash0Backend.endpoint. Please refer to the installation instructions at https://github.com/dash0hq/dash0-operator/tree/main/helm-chart/dash0-operator." -}}
{{- if .Values.operator.dash0Export.enabled }}
{{- if not .Values.operator.dash0Export.endpoint }}
{{- fail "Error: operator.dash0Export.enabled is set to true, but you did not provide a value for operator.dash0Export.endpoint. Please refer to the installation instructions at https://github.com/dash0hq/dash0-operator/tree/main/helm-chart/dash0-operator." -}}
{{- end }}
- --operator-configuration-endpoint={{ .Values.operator.dash0Backend.endpoint }}
{{- if .Values.operator.dash0Backend.token }}
- --operator-configuration-token={{ .Values.operator.dash0Backend.token }}
{{- else if (and .Values.operator.dash0Backend.secretRef.name .Values.operator.dash0Backend.secretRef.key) }}
{{- $secret := lookup "v1" "Secret" .Release.Namespace .Values.operator.dash0Backend.secretRef.name -}}
- --operator-configuration-endpoint={{ .Values.operator.dash0Export.endpoint }}
{{- if .Values.operator.dash0Export.token }}
- --operator-configuration-token={{ .Values.operator.dash0Export.token }}
{{- else if (and .Values.operator.dash0Export.secretRef.name .Values.operator.dash0Export.secretRef.key) }}
{{- $secret := lookup "v1" "Secret" .Release.Namespace .Values.operator.dash0Export.secretRef.name -}}
{{- if $secret -}}
{{- if not (index $secret.data .Values.operator.dash0Backend.secretRef.key) -}}
{{- fail (printf "Error: There is a secret named \"%s\" in the target namespace \"%s\", but it does not have the required key \"%s\". Please refer to the installation instructions at https://github.com/dash0hq/dash0-operator/tree/main/helm-chart/dash0-operator." .Values.operator.dash0Backend.secretRef.name .Release.Namespace .Values.operator.dash0Backend.secretRef.key) -}}
{{- if not (index $secret.data .Values.operator.dash0Export.secretRef.key) -}}
{{- fail (printf "Error: There is a secret named \"%s\" in the target namespace \"%s\", but it does not have the required key \"%s\". Please refer to the installation instructions at https://github.com/dash0hq/dash0-operator/tree/main/helm-chart/dash0-operator." .Values.operator.dash0Export.secretRef.name .Release.Namespace .Values.operator.dash0Export.secretRef.key) -}}
{{- end -}}
{{- else -}}
{{- fail (printf "Error: There is no secret named \"%s\" in the target namespace \"%s\". Please refer to the installation instructions at https://github.com/dash0hq/dash0-operator/tree/main/helm-chart/dash0-operator." .Values.operator.dash0Backend.secretRef.name .Release.Namespace) -}}
{{- fail (printf "Error: There is no secret named \"%s\" in the target namespace \"%s\". Please refer to the installation instructions at https://github.com/dash0hq/dash0-operator/tree/main/helm-chart/dash0-operator." .Values.operator.dash0Export.secretRef.name .Release.Namespace) -}}
{{- end }}
- --operator-configuration-secret-ref-name={{ .Values.operator.dash0Backend.secretRef.name }}
- --operator-configuration-secret-ref-key={{ .Values.operator.dash0Backend.secretRef.key }}
- --operator-configuration-secret-ref-name={{ .Values.operator.dash0Export.secretRef.name }}
- --operator-configuration-secret-ref-key={{ .Values.operator.dash0Export.secretRef.key }}
{{- else }}
{{- fail "Error: operator.dash0Backend.enabled is set to true, but neither operator.dash0Backend.token nor operator.dash0Backend.secretRef.name & operator.dash0Backend.secretRef.key have been provided. Please refer to the installation instructions at https://github.com/dash0hq/dash0-operator/tree/main/helm-chart/dash0-operator." -}}
{{- fail "Error: operator.dash0Export.enabled is set to true, but neither operator.dash0Export.token nor operator.dash0Export.secretRef.name & operator.dash0Export.secretRef.key have been provided. Please refer to the installation instructions at https://github.com/dash0hq/dash0-operator/tree/main/helm-chart/dash0-operator." -}}
{{- end }}
{{- end }}
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ tests:
value: dash0-operator-controller
set:
operator:
dash0Backend:
dash0Export:
enabled: true
endpoint: https://ingress.dash0.com
token: "very-secret-dash0-auth-token"
Expand All @@ -252,7 +252,7 @@ tests:
- equal:
path: spec.template.spec.containers[0].args[4]
value: --operator-configuration-token=very-secret-dash0-auth-token
# Note: We deliberately do not have a test for the operator.dash0Backend.secretRef variant, since this would trigger
# Note: We deliberately do not have a test for the operator.dash0Export.secretRef variant, since this would trigger
# a check whether the secret actually exists in the cluster, which of course would fail when runnig helm chart unit
# tests.

Expand Down
16 changes: 8 additions & 8 deletions helm-chart/dash0-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@
# settings for the operator/controller
operator:

# Use the operator.dash0Backend settings to configure the connection to the Dash0 backend; telemetry will be sent to
# Use the operator.dash0Export settings to configure the connection to the Dash0 backend; telemetry will be sent to
# the configured Dash0 backend by default. Under the hood, this will create a Dash0OperatorConfiguration resource
# right away, when starting the operator. If left empty, you can always create a Dash0OperatorConfiguration resource
# manually later.
dash0Backend:
dash0Export:
# Set this to true to enable the creation of a Dash0OperatorConfiguration resource at startup. If a
# Dash0OperatorConfiguration already exists in the cluster, no action will be taken. Note that if this is set to
# true, you will also need to provide a valid endpoint (operator.dash0Backend.endpoint), and either or an auth
# token (operator.dash0Backend.token) or a reference to a Kubernetes secret containing that token
# (operator.dash0Backend.secretRef).
# true, you will also need to provide a valid endpoint (operator.dash0Export.endpoint), and either or an auth
# token (operator.dash0Export.token) or a reference to a Kubernetes secret containing that token
# (operator.dash0Export.secretRef).
enabled: false

# The URL of the Dash0 ingress endpoint to which telemetry data will be sent. This property is mandatory if
# operator.dash0Backend.enabled is true, otherwise it will be ignored. The value needs to be the OTLP/gRPC endpoint
# operator.dash0Export.enabled is true, otherwise it will be ignored. The value needs to be the OTLP/gRPC endpoint
# of your Dash0 organization. The correct OTLP/gRPC endpoint can be copied fom https://app.dash0.com -> organization
# settings -> "Endpoints". The correct endpoint value will always start with `ingress.` and end in `dash0.com:4317`.
endpoint:

# The Dash0 authorization token. This property is optional, but either this property or the secretRef configuration
# has to be provided if operator.dash0Backend.enabled is true. If operator.dash0Backend.enabled is false, this
# has to be provided if operator.dash0Export.enabled is true. If operator.dash0Export.enabled is false, this
# property will be ignored.
# If both token and secretRef are provided, the token will be used and secretRef will be ignored. The authorization
# token for your Dash0 organization can be copied from https://app.dash0.com -> organization settings ->
# "Auth Tokens".
token:

# A reference to a Kubernetes secret containing the Dash0 authorization token. This property is optional, and is
# ignored if either operator.dash0Backend.enabled is false or operator.dash0Backend.token is set. The authorization
# ignored if either operator.dash0Export.enabled is false or operator.dash0Export.token is set. The authorization
# token for your Dash0 organization can be copied from https://app.dash0.com -> organization settings ->
# "Auth Tokens".
secretRef:
Expand Down
10 changes: 5 additions & 5 deletions test-resources/bin/util
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ deploy_via_helm() {
fi

# Deploy an operator configuration right away.
helm_install_command+=" --set operator.dash0Backend.enabled=true"
helm_install_command+=" --set operator.dash0Backend.endpoint=ingress.eu-west-1.aws.dash0-dev.com:4317"
helm_install_command+=" --set operator.dash0Backend.secretRef.name=dash0-authorization-secret"
helm_install_command+=" --set operator.dash0Backend.secretRef.key=token"
helm_install_command+=" --set operator.dash0Export.enabled=true"
helm_install_command+=" --set operator.dash0Export.endpoint=ingress.eu-west-1.aws.dash0-dev.com:4317"
helm_install_command+=" --set operator.dash0Export.secretRef.name=dash0-authorization-secret"
helm_install_command+=" --set operator.dash0Export.secretRef.key=token"

helm_install_command+=" dash0-operator"
helm_install_command+=" ${OPERATOR_HELM_CHART:-helm-chart/dash0-operator}"
Expand All @@ -130,7 +130,7 @@ wait_for_operator_manager_and_webhook() {
sleep 0.3
done

# We deploy an operator configuration at startup via operator.dash0Backend.enabled=true, wait for that resource to
# We deploy an operator configuration at startup via operator.dash0Export.enabled=true, wait for that resource to
# become available as well.
echo "waiting for the automatically created operator configuration resource to become available"
for ((i=0; i<=20; i++)); do
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -773,9 +773,9 @@ var _ = Describe("Dash0 Kubernetes Operator", Ordered, func() {
)
Expect(err).To(
MatchError(
ContainSubstring("operator.dash0Backend.enabled is set to true, but neither " +
"operator.dash0Backend.token nor operator.dash0Backend.secretRef.name & " +
"operator.dash0Backend.secretRef.key have been provided.")))
ContainSubstring("operator.dash0Export.enabled is set to true, but neither " +
"operator.dash0Export.token nor operator.dash0Export.secretRef.name & " +
"operator.dash0Export.secretRef.key have been provided.")))
})
})

Expand Down
10 changes: 5 additions & 5 deletions test/e2e/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,17 @@ func deployOperatorWithAutoOperationConfiguration(
arguments = addOptionalHelmParameters(arguments, operatorHelmChart, images)

if operatorConfigurationValues != nil {
arguments = setHelmParameter(arguments, "operator.dash0Backend.enabled", "true")
arguments = setIfNotEmpty(arguments, "operator.dash0Backend.endpoint", operatorConfigurationValues.Endpoint)
arguments = setIfNotEmpty(arguments, "operator.dash0Backend.token", operatorConfigurationValues.Token)
arguments = setHelmParameter(arguments, "operator.dash0Export.enabled", "true")
arguments = setIfNotEmpty(arguments, "operator.dash0Export.endpoint", operatorConfigurationValues.Endpoint)
arguments = setIfNotEmpty(arguments, "operator.dash0Export.token", operatorConfigurationValues.Token)
arguments = setIfNotEmpty(
arguments,
"operator.dash0Backend.secretRef.name",
"operator.dash0Export.secretRef.name",
operatorConfigurationValues.SecretRef.Name,
)
arguments = setIfNotEmpty(
arguments,
"operator.dash0Backend.secretRef.key",
"operator.dash0Export.secretRef.key",
operatorConfigurationValues.SecretRef.Key,
)
}
Expand Down

0 comments on commit 4ef4140

Please sign in to comment.