Skip to content

Commit

Permalink
chore: map only needed keys from odigos-deployment in envFrom (#2182)
Browse files Browse the repository at this point in the history
This is so we can add new keys to `odigos-deployment` without warring
about them blowing up deployments that map them as `envFrom`. This PR
makes it so we can only map what we actually use
  • Loading branch information
blumamir authored Jan 11, 2025
1 parent 0a7fb69 commit 4b07451
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 16 deletions.
16 changes: 10 additions & 6 deletions cli/cmd/resources/autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,19 +290,23 @@ func NewAutoscalerDeployment(ns string, version string, imagePrefix string, imag
},
},
},
}, optionalEnvs...),
EnvFrom: []corev1.EnvFromSource{
{
ConfigMapRef: &corev1.ConfigMapEnvSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: ownTelemetryOtelConfig,
Name: "ODIGOS_VERSION",
ValueFrom: &corev1.EnvVarSource{
ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
LocalObjectReference: corev1.LocalObjectReference{
Name: consts.OdigosDeploymentConfigMapName,
},
Key: "ODIGOS_VERSION",
},
},
},
}, optionalEnvs...),
EnvFrom: []corev1.EnvFromSource{
{
ConfigMapRef: &corev1.ConfigMapEnvSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: consts.OdigosDeploymentConfigMapName,
Name: ownTelemetryOtelConfig,
},
},
},
Expand Down
16 changes: 10 additions & 6 deletions cli/cmd/resources/instrumentor.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,19 +400,23 @@ func NewInstrumentorDeployment(ns string, version string, telemetryEnabled bool,
},
},
},
},
EnvFrom: []corev1.EnvFromSource{
{
ConfigMapRef: &corev1.ConfigMapEnvSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: ownTelemetryOtelConfig,
Name: "ODIGOS_TIER",
ValueFrom: &corev1.EnvVarSource{
ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
LocalObjectReference: corev1.LocalObjectReference{
Name: k8sutilsconsts.OdigosDeploymentConfigMapName,
},
Key: "ODIGOS_TIER",
},
},
},
},
EnvFrom: []corev1.EnvFromSource{
{
ConfigMapRef: &corev1.ConfigMapEnvSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: k8sutilsconsts.OdigosDeploymentConfigMapName,
Name: ownTelemetryOtelConfig,
},
},
},
Expand Down
7 changes: 5 additions & 2 deletions helm/odigos/templates/autoscaler/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: ODIGOS_VERSION
valueFrom:
configMapKeyRef:
key: ODIGOS_VERSION
name: odigos-deployment
envFrom:
- configMapRef:
name: odigos-own-telemetry-otel-config
optional: true
- configMapRef:
name: odigos-deployment
livenessProbe:
httpGet:
path: /healthz
Expand Down
7 changes: 5 additions & 2 deletions helm/odigos/templates/instrumentor/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: ODIGOS_TIER
valueFrom:
configMapKeyRef:
key: ODIGOS_TIER
name: odigos-deployment
volumeMounts:
- name: webhook-cert
mountPath: /tmp/k8s-webhook-server/serving-certs
Expand All @@ -48,8 +53,6 @@ spec:
- configMapRef:
name: odigos-own-telemetry-otel-config
optional: true
- configMapRef:
name: odigos-deployment
livenessProbe:
httpGet:
path: /healthz
Expand Down

0 comments on commit 4b07451

Please sign in to comment.