forked from signalfx/splunk-otel-collector-chart
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
183 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...le-operator-and-auto-instrumentation/rendered_manifests/operator/job-startupapicheck.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
# Source: splunk-otel-collector/templates/operator/job-startupapicheck.yaml | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: default-splunk-otel-collector-operator-startupapicheck | ||
namespace: default | ||
labels: | ||
app.kubernetes.io/name: splunk-otel-collector | ||
helm.sh/chart: splunk-otel-collector-0.113.0 | ||
app.kubernetes.io/managed-by: Helm | ||
app.kubernetes.io/instance: default | ||
app.kubernetes.io/version: "0.113.0" | ||
app: splunk-otel-collector | ||
component: otel-operator | ||
chart: splunk-otel-collector-0.113.0 | ||
release: default | ||
heritage: Helm | ||
app.kubernetes.io/component: otel-operator | ||
annotations: | ||
"helm.sh/hook": post-install,post-upgrade | ||
"helm.sh/hook-weight": "4" | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: startupapicheck | ||
image: registry.access.redhat.com/ubi9/ubi:latest | ||
env: | ||
- name: MANAGER_METRICS_SERVICE_CLUSTERIP | ||
value: "default-splunk-otel-collector-operator" | ||
- name: MANAGER_METRICS_SERVICE_PORT | ||
value: "8443" | ||
- name: WEBHOOK_SERVICE_CLUSTERIP | ||
value: "default-splunk-otel-collector-operator-webhook" | ||
- name: WEBHOOK_SERVICE_PORT | ||
value: "443" | ||
command: | ||
- sh | ||
- -c | ||
- | | ||
operator_service_checked=false | ||
operator_webhook_service_checked=false | ||
for i in $(seq 1 300); do | ||
# Checks for the Operator and Operator Webhook service availability using curl | ||
# The services are ready when curl receives an HTTP 400 error response. | ||
if [ "$operator_service_checked" = false ]; then | ||
curl_output_operator=$(curl -s -o /dev/null -w "%{http_code}" "$MANAGER_METRICS_SERVICE_CLUSTERIP:$MANAGER_METRICS_SERVICE_PORT") | ||
if [ "$curl_output_operator" = "400" ]; then | ||
operator_service_checked=true | ||
fi | ||
fi | ||
if [ "$operator_webhook_service_checked" = false ]; then | ||
curl_output_webhook=$(curl -s -o /dev/null -w "%{http_code}" "$WEBHOOK_SERVICE_CLUSTERIP:$WEBHOOK_SERVICE_PORT") | ||
if [ "$curl_output_webhook" = "400" ]; then | ||
operator_webhook_service_checked=true | ||
fi | ||
fi | ||
echo "Attempt $i: Operator Service=${operator_service_checked}, Operator Webhook Service=${operator_webhook_service_checked}" | ||
sleep 1 | ||
if [ "$operator_service_checked" = true ] && [ "$operator_webhook_service_checked" = true ]; then | ||
echo "All checks passed." | ||
exit 0 | ||
fi | ||
done | ||
echo "Timeout reached. Not all checks completed successfully." | ||
exit 1 | ||
restartPolicy: Never |
5 changes: 5 additions & 0 deletions
5
helm-charts/splunk-otel-collector/templates/operator/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
helm-charts/splunk-otel-collector/templates/operator/job-startupapicheck.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{{- if and .Values.operator.enabled .Values.instrumentation.jobs.startupapicheck.enabled }} | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ template "splunk-otel-collector.fullname" . }}-operator-startupapicheck | ||
namespace: {{ template "splunk-otel-collector.namespace" . }} | ||
labels: | ||
{{- include "splunk-otel-collector.commonLabels" . | nindent 4 }} | ||
app: {{ template "splunk-otel-collector.name" . }} | ||
component: otel-operator | ||
chart: {{ template "splunk-otel-collector.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
app.kubernetes.io/component: otel-operator | ||
annotations: | ||
"helm.sh/hook": post-install,post-upgrade | ||
"helm.sh/hook-weight": "4" | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: startupapicheck | ||
image: {{ template "splunk-otel-collector.operator.instrumentation-job.image" . }} | ||
env: | ||
- name: MANAGER_METRICS_SERVICE_CLUSTERIP | ||
value: "{{ template "splunk-otel-collector.fullname" . }}-operator" | ||
- name: MANAGER_METRICS_SERVICE_PORT | ||
value: "8443" | ||
- name: WEBHOOK_SERVICE_CLUSTERIP | ||
value: "{{ template "splunk-otel-collector.fullname" . }}-operator-webhook" | ||
- name: WEBHOOK_SERVICE_PORT | ||
value: "443" | ||
command: | ||
- sh | ||
- -c | ||
- | | ||
operator_service_checked=false | ||
operator_webhook_service_checked=false | ||
for i in $(seq 1 300); do | ||
# Checks for the Operator and Operator Webhook service availability using curl | ||
# The services are ready when curl receives an HTTP 400 error response. | ||
if [ "$operator_service_checked" = false ]; then | ||
curl_output_operator=$(curl -s -o /dev/null -w "%{http_code}" "$MANAGER_METRICS_SERVICE_CLUSTERIP:$MANAGER_METRICS_SERVICE_PORT") | ||
if [ "$curl_output_operator" = "400" ]; then | ||
operator_service_checked=true | ||
fi | ||
fi | ||
if [ "$operator_webhook_service_checked" = false ]; then | ||
curl_output_webhook=$(curl -s -o /dev/null -w "%{http_code}" "$WEBHOOK_SERVICE_CLUSTERIP:$WEBHOOK_SERVICE_PORT") | ||
if [ "$curl_output_webhook" = "400" ]; then | ||
operator_webhook_service_checked=true | ||
fi | ||
fi | ||
echo "Attempt $i: Operator Service=${operator_service_checked}, Operator Webhook Service=${operator_webhook_service_checked}" | ||
sleep 1 | ||
if [ "$operator_service_checked" = true ] && [ "$operator_webhook_service_checked" = true ]; then | ||
echo "All checks passed." | ||
exit 0 | ||
fi | ||
done | ||
echo "Timeout reached. Not all checks completed successfully." | ||
exit 1 | ||
restartPolicy: Never | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters