From 04eb928e13603977ea0479940d397fd2d66e5e6f Mon Sep 17 00:00:00 2001 From: Jina Jain Date: Thu, 16 Jan 2025 12:45:48 -0800 Subject: [PATCH] test some more scenarios --- .github/workflows/functional_test_v2.yaml | 207 +++++++++++++++++++++- 1 file changed, 199 insertions(+), 8 deletions(-) diff --git a/.github/workflows/functional_test_v2.yaml b/.github/workflows/functional_test_v2.yaml index 18711fce71..3bddf5fd9a 100644 --- a/.github/workflows/functional_test_v2.yaml +++ b/.github/workflows/functional_test_v2.yaml @@ -544,9 +544,8 @@ jobs: kubectl get instrumentations.opentelemetry.io -A - name: check operator run: | - kubectl describe po -lapp.kubernetes.io/name=operator kubectl get po -lapp.kubernetes.io/name=operator -o=name | xargs -n 1 kubectl wait --for=condition=Ready --timeout=2m - kubectl describe po -lapp.kubernetes.io/name=operator + kubectl get po -lapp.kubernetes.io/name=operator continue-on-error: true - name: upgrade old again run: | @@ -633,9 +632,8 @@ jobs: kubectl get instrumentations.opentelemetry.io -A - name: check operator run: | - kubectl describe po -lapp.kubernetes.io/name=operator kubectl get po -lapp.kubernetes.io/name=operator -o=name | xargs -n 1 kubectl wait --for=condition=Ready --timeout=2m - kubectl describe po -lapp.kubernetes.io/name=operator + kubectl get po -lapp.kubernetes.io/name=operator continue-on-error: true - name: upgrade old again run: | @@ -722,9 +720,8 @@ jobs: kubectl get instrumentations.opentelemetry.io -A - name: check operator run: | - kubectl describe po -lapp.kubernetes.io/name=operator kubectl get po -lapp.kubernetes.io/name=operator -o=name | xargs -n 1 kubectl wait --for=condition=Ready --timeout=2m - kubectl describe po -lapp.kubernetes.io/name=operator + kubectl get po -lapp.kubernetes.io/name=operator continue-on-error: true - name: upgrade old again run: | @@ -811,9 +808,8 @@ jobs: kubectl get instrumentations.opentelemetry.io -A - name: check operator run: | - kubectl describe po -lapp.kubernetes.io/name=operator kubectl get po -lapp.kubernetes.io/name=operator -o=name | xargs -n 1 kubectl wait --for=condition=Ready --timeout=2m - kubectl describe po -lapp.kubernetes.io/name=operator + kubectl get po -lapp.kubernetes.io/name=operator continue-on-error: true - name: upgrade old again run: | @@ -844,3 +840,198 @@ jobs: - name: check crds are installed run: | kubectl get crds | grep 'opentelemetry.io' + + kuberenetes-test-new-install-w-subchart: + name: Test helm install in kind with subchart + if: github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ~1.22.5 + cache: false + - name: Cache Go + id: go-cache + timeout-minutes: 5 + uses: actions/cache@v4 + with: + path: | + ~/go/bin + ~/go/pkg/mod + key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} + - name: Create kind cluster + uses: helm/kind-action@v1.12.0 + with: + node_image: kindest/node:v1.30.0 + kubectl_version: v1.30.0 + cluster_name: kind + config: ./.github/workflows/configs/kind-config.yaml + - name: Fix kubelet TLS server certificates + run: | + kubectl get csr -o=jsonpath='{range.items[?(@.spec.signerName=="kubernetes.io/kubelet-serving")]}{.metadata.name}{" "}{end}' | xargs kubectl certificate approve + - name: Update dependencies + run: | + make dep-update + - name: Deploy cert-manager + run: | + make cert-manager + - name: helm install with operator enabled and no crds + run: | + helm install sock helm-charts/splunk-otel-collector --debug \ + --set splunkObservability.realm=us0 --set splunkObservability.accessToken=xxxxx \ + --set operator.enabled=true --set environment=dev --set clusterName=dev + continue-on-error: true + - name: check crds are installed + run: | + kubectl get crds | grep 'opentelemetry.io' + - name: check operator and instrumentation + run: | + kubectl get instrumentations.opentelemetry.io -A + kubectl get po -lapp.kubernetes.io/name=operator -o=name | xargs -n 1 kubectl wait --for=condition=Ready --timeout=2m + kubectl get po -lapp.kubernetes.io/name=operator + kubectl get instrumentations.opentelemetry.io -A + + kubernetes-test-new-install-wo-subchart: + name: Test helm install in kind without helm managed crds. CRDs are installed using kubectl. + if: github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ~1.22.5 + cache: false + - name: Cache Go + id: go-cache + timeout-minutes: 5 + uses: actions/cache@v4 + with: + path: | + ~/go/bin + ~/go/pkg/mod + key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} + - name: Create kind cluster + uses: helm/kind-action@v1.12.0 + with: + node_image: kindest/node:v1.30.0 + kubectl_version: v1.30.0 + cluster_name: kind + config: ./.github/workflows/configs/kind-config.yaml + - name: Fix kubelet TLS server certificates + run: | + kubectl get csr -o=jsonpath='{range.items[?(@.spec.signerName=="kubernetes.io/kubelet-serving")]}{.metadata.name}{" "}{end}' | xargs kubectl certificate approve + - name: Update dependencies + run: | + make dep-update + - name: Deploy cert-manager + run: | + make cert-manager + - name: install crds from helm template with kubectl + run: | + helm template helm-charts/splunk-otel-collector/ --include-crds \ + --set="splunkObservability.realm=us0,splunkObservability.accessToken=xxxxxx,clusterName=my-cluster,operatorcrds.install=true" \ + | yq e '. | select(.kind == "CustomResourceDefinition")' | kubectl apply -f - + continue-on-error: true + - name: check crds are installed + run: | + kubectl get crds | grep 'opentelemetry.io' + - name: helm install with operator enabled and no crds + run: | + helm install sock helm-charts/splunk-otel-collector --debug \ + --set splunkObservability.realm=us0 --set splunkObservability.accessToken=xxxxx \ + --set operator.enabled=true --set environment=dev --set clusterName=dev + continue-on-error: true + - name: check operator and instrumentation + run: | + kubectl get instrumentations.opentelemetry.io -A + kubectl get po -lapp.kubernetes.io/name=operator -o=name | xargs -n 1 kubectl wait --for=condition=Ready --timeout=2m + kubectl get po -lapp.kubernetes.io/name=operator + kubectl get instrumentations.opentelemetry.io -A + + kubernetes-test-upgrade-keep-crd-rm-from-helm: + name: Steps to helm upgrade but keeping crds in cluster but removing from helm release + if: github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Checkout old release + uses: actions/checkout@v4 + with: + path: base + ref: splunk-otel-collector-0.113.0 + fetch-depth: 0 + - uses: actions/setup-go@v5 + with: + go-version: ~1.22.5 + cache: false + - name: Cache Go + id: go-cache + timeout-minutes: 5 + uses: actions/cache@v4 + with: + path: | + ~/go/bin + ~/go/pkg/mod + key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} + - name: Create kind cluster + uses: helm/kind-action@v1.12.0 + with: + node_image: kindest/node:v1.30.0 + kubectl_version: v1.30.0 + cluster_name: kind + config: ./.github/workflows/configs/kind-config.yaml + - name: Fix kubelet TLS server certificates + run: | + kubectl get csr -o=jsonpath='{range.items[?(@.spec.signerName=="kubernetes.io/kubelet-serving")]}{.metadata.name}{" "}{end}' | xargs kubectl certificate approve + - name: Update dependencies + run: | + cd base && make dep-update + - name: Deploy cert-manager + run: | + cd base && make cert-manager + - name: install helm chart with operator enabled + run: | + cd base && helm install sock helm-charts/splunk-otel-collector --debug \ + --set splunkObservability.realm=us0 --set splunkObservability.accessToken=xxxxx \ + --set operator.enabled=true --set environment=dev --set clusterName=dev + continue-on-error: true + - name: check crds are installed + run: | + kubectl get crds | grep 'opentelemetry.io' + - name: check operator + run: | + kubectl get po -lapp.kubernetes.io/name=operator -o=name | xargs -n 1 kubectl wait --for=condition=Ready --timeout=2m + kubectl get po -lapp.kubernetes.io/name=operator + continue-on-error: true + - name: upgrade old again + run: | + cd base && helm upgrade sock helm-charts/splunk-otel-collector --debug \ + --set splunkObservability.realm=us0 --set splunkObservability.accessToken=xxxxx \ + --set operator.enabled=true --set environment=dev --set clusterName=dev + - name: check helm release status + run: | + helm status sock + - name: check instrumentations installed + run: | + kubectl describe instrumentations.opentelemetry.io -A + - name: Update dependencies + run: | + make dep-update + - name: tell helm to keep CRDs + run: | + kubectl get crds -o=name | grep 'opentelemetry.io' | xargs -I% kubectl annotate % helm.sh/resource-policy=keep + - name: import instrumentation to helm release + run: | + NAMESPACE=default + RELEASE_NAME=sock + kubectl get -n $NAMESPACE instrumentations.opentelemetry.io -o name | xargs -I % kubectl annotate -n $NAMESPACE % meta.helm.sh/release-name=$RELEASE_NAME + kubectl get -n $NAMESPACE instrumentations.opentelemetry.io -o name | xargs -I % kubectl annotate -n $NAMESPACE % meta.helm.sh/release-namespace=$NAMESPACE + - name: upgrade helm chart + run: | + helm upgrade --install sock helm-charts/splunk-otel-collector --debug \ + --set splunkObservability.realm=us0 --set splunkObservability.accessToken=xxxxx \ + --set operator.enabled=true --set operatorcrds.install=true --set environment=dev --set clusterName=dev + - name: check crds are still installed + run: | + kubectl get crds -Lapp.kubernetes.io/managed-by | grep 'opentelemetry.io'