diff --git a/functional_tests/functional_test.go b/functional_tests/functional_test.go index 4427f51152..157c8d8177 100644 --- a/functional_tests/functional_test.go +++ b/functional_tests/functional_test.go @@ -193,7 +193,9 @@ func deployChartsAndApps(t *testing.T) { install := action.NewInstall(actionConfig) install.Namespace = "default" install.ReleaseName = "sock" - install.IncludeCRDs = true + // install.WaitForJobs = true + // The default timeout is 5 mins when using the helm cli + install.Timeout = 5 * time.Minute _, err = install.Run(chart, values) if err != nil { t.Logf("error reported during helm install: %v\n", err) diff --git a/helm-charts/splunk-otel-collector/templates/operator/job-operator-crd.yaml b/helm-charts/splunk-otel-collector/templates/operator/job-operator-crd.yaml new file mode 100644 index 0000000000..b6a8430ba7 --- /dev/null +++ b/helm-charts/splunk-otel-collector/templates/operator/job-operator-crd.yaml @@ -0,0 +1,45 @@ +{{- if .Values.operator.enabled }} +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ template "splunk-otel-collector.fullname" . }}-operator-webhook-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: wget + image: "busybox:latest" + env: + - name: WEBHOOK_SERVICE_CLUSTERIP + value: "{{ template "splunk-otel-collector.fullname" . }}-operator-webhook" + - name: WEBHOOK_SERVICE_PORT + value: "443" + command: + - sh + - -c + - | + echo "Checking if 'otelinst' CRD is available..." + for i in $(seq 1 300); do + if kubectl get otelinst >/dev/null 2>&1; then + echo "'otelinst' CRD is available." + exit 0 + fi + echo "Waiting for 'otelinst' CRD to become available... (attempt $i)" + sleep 1 + done + echo "Timeout reached. 'otelinst' CRD did not become available." + exit 1 + restartPolicy: Never +{{- end }}