Skip to content

Commit

Permalink
fix(instrumentation): replace tools image with kubectl
Browse files Browse the repository at this point in the history
The kubernetes-tools image isn't supported for production use. The
kubectl image with minimal dependencies suffices for applying default
instrumentation CRs.

(cherry picked from commit d20f080)
  • Loading branch information
swiatekm committed Nov 3, 2023
1 parent 0228337 commit b1b0ba9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 45 deletions.
1 change: 1 addition & 0 deletions .changelog/3373.fixed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix(instrumentation): replace tools image with kubectl
4 changes: 2 additions & 2 deletions deploy/helm/sumologic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ The following table lists the configurable parameters of the Sumo Logic chart an
| `opentelemetry-operator.manager.resources.requests.cpu` | Used to set requested CPU for OpenTelemetry-Operator Manager. | `150m` |
| `opentelemetry-operator.manager.resources.requests.memory` | Used to set requested Memory for OpenTelemetry-Operator Manager. | `256Mi` |
| `opentelemetry-operator.instrumentationNamespaces` | Used to create `Instrumentation` resources in specified namespaces. | `Nil` |
| `opentelemetry-operator.instrumentationJobImage.image.repository` | Name of the image repository used to apply Instrumentation resource | `sumologic/kubernetes-tools` |
| `opentelemetry-operator.instrumentationJobImage.image.tag` | Name of the image tag used to apply Instrumentation resource | `2.14.0` |
| `opentelemetry-operator.instrumentationJobImage.image.repository` | Name of the image repository used to apply Instrumentation resource | `public.ecr.aws/sumologic/kubernetes-tools-kubectl` |
| `opentelemetry-operator.instrumentationJobImage.image.tag` | Name of the image tag used to apply Instrumentation resource | `2.20.0` |
| `opentelemetry-operator.admissionWebhooks` | Admission webhooks make sure only requests with correctly formatted rules will get into the Operator. They also enable the sidecar injection for OpenTelemetryCollector and Instrumentation CR's. | See [values.yaml] |
| `opentelemetry-operator.manager.env` | Additional environment variables for opentelemetry-operator helm chart. | {} |
| `otelcolInstrumentation.enabled` | Enables Sumo Otel Distro Collector StatefulSet to collect telemetry data. [See docs for more information.](/docs/opentelemetry-collector/traces.md) | `true` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,17 @@ spec:
- name: instrumentation-cr-configmap
mountPath: /tmp/instrumentation-cr.yaml
subPath: instrumentation.cr.yaml
command: ["/bin/bash", "-c"]
command: ["/usr/local/bin/bash", "-c"]
args:
- |
max_wait=180
sleep_interval=5
counter=0
ready=false
while [[ ready != "false" ]]
while ! kubectl apply -f /tmp/instrumentation-cr.yaml
do
is_ready=$(curl -s -o /dev/null -m 3 -L -w ''%{http_code}'' {{ template "opentelemetry-operator.controller.manager.metrics.service.url" . }})
if [[ is_ready -eq "200" ]]
then
ready=true
break
else
echo "Waiting for {{ .Release.Name }}-opentelemetry-operator"
sleep $sleep_interval
counter=$(($counter + $sleep_interval))
fi
echo "Waiting for {{ .Release.Name }}-opentelemetry-operator"
sleep $sleep_interval
counter=$(($counter + $sleep_interval))
if [[ "$counter" -gt "$max_wait" ]]
then
Expand All @@ -55,12 +46,9 @@ spec:
fi
done
if [[ $ready == true ]]
then
echo "Applying Instrumentation resources"
kubectl apply -f /tmp/instrumentation-cr.yaml
exit $?
fi
kubectl apply -f /tmp/instrumentation-cr.yaml || exit 1
echo "Successfully applied Instrumentation resources"
exit $?
volumes:
- name: instrumentation-cr-configmap
configMap:
Expand Down
4 changes: 2 additions & 2 deletions deploy/helm/sumologic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4605,8 +4605,8 @@ opentelemetry-operator:
## Specific for Sumo Logic chart - Instrumentation resource creation
instrumentationJobImage:
image:
repository: sumologic/kubernetes-tools
tag: 2.14.0
repository: public.ecr.aws/sumologic/kubernetes-tools-kubectl
tag: 2.20.0

createDefaultInstrumentation: false
instrumentationNamespaces: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,22 @@ spec:
serviceAccountName: RELEASE-NAME-sumologic
containers:
- name: instrumentation-cr-applier
image: sumologic/kubernetes-tools:2.14.0
image: public.ecr.aws/sumologic/kubernetes-tools-kubectl:2.20.0
volumeMounts:
- name: instrumentation-cr-configmap
mountPath: /tmp/instrumentation-cr.yaml
subPath: instrumentation.cr.yaml
command: ["/bin/bash", "-c"]
command: ["/usr/local/bin/bash", "-c"]
args:
- |
max_wait=180
sleep_interval=5
counter=0
ready=false
while [[ ready != "false" ]]
while ! kubectl apply -f /tmp/instrumentation-cr.yaml
do
is_ready=$(curl -s -o /dev/null -m 3 -L -w ''%{http_code}'' http://RELEASE-NAME-opentelemetry-operator.sumologic:8080/metrics)
if [[ is_ready -eq "200" ]]
then
ready=true
break
else
echo "Waiting for RELEASE-NAME-opentelemetry-operator"
sleep $sleep_interval
counter=$(($counter + $sleep_interval))
fi
echo "Waiting for RELEASE-NAME-opentelemetry-operator"
sleep $sleep_interval
counter=$(($counter + $sleep_interval))
if [[ "$counter" -gt "$max_wait" ]]
then
Expand All @@ -53,12 +44,9 @@ spec:
fi
done
if [[ $ready == true ]]
then
echo "Applying Instrumentation resources"
kubectl apply -f /tmp/instrumentation-cr.yaml
exit $?
fi
kubectl apply -f /tmp/instrumentation-cr.yaml || exit 1
echo "Successfully applied Instrumentation resources"
exit $?
volumes:
- name: instrumentation-cr-configmap
configMap:
Expand Down

0 comments on commit b1b0ba9

Please sign in to comment.