|
| 1 | +name: Test Chart |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +jobs: |
| 8 | + test-chart: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - name: Clone the code |
| 12 | + uses: actions/checkout@v4 |
| 13 | + |
| 14 | + - name: Setup Go |
| 15 | + uses: actions/setup-go@v5 |
| 16 | + with: |
| 17 | + go-version-file: go.mod |
| 18 | + |
| 19 | + - name: Install the latest version of kind |
| 20 | + run: | |
| 21 | + curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64 |
| 22 | + chmod +x ./kind |
| 23 | + sudo mv ./kind /usr/local/bin/kind |
| 24 | +
|
| 25 | + - name: Verify kind installation |
| 26 | + run: kind version |
| 27 | + |
| 28 | + - name: Create kind cluster |
| 29 | + run: kind create cluster |
| 30 | + |
| 31 | + - name: Prepare nodedrain |
| 32 | + run: | |
| 33 | + go mod tidy |
| 34 | + make docker-build IMG_NAME_CONTROLLER=nodedrain IMG_TAG=v0.1.0 |
| 35 | + kind load docker-image IMG_NAME_CONTROLLER=nodedrain IMG_TAG=v0.1.0 |
| 36 | +
|
| 37 | + - name: Install Helm |
| 38 | + run: | |
| 39 | + curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash |
| 40 | +
|
| 41 | + - name: Verify Helm installation |
| 42 | + run: helm version |
| 43 | + |
| 44 | + - name: Lint Helm Chart |
| 45 | + run: | |
| 46 | + helm lint ./dist/chart |
| 47 | +
|
| 48 | + - name: Install cert-manager via Helm |
| 49 | + run: | |
| 50 | + helm repo add jetstack https://charts.jetstack.io |
| 51 | + helm repo update |
| 52 | + helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true |
| 53 | +
|
| 54 | + - name: Wait for cert-manager to be ready |
| 55 | + run: | |
| 56 | + kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager |
| 57 | + kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-cainjector |
| 58 | + kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook |
| 59 | +# TODO: Uncomment if Prometheus is enabled |
| 60 | +# - name: Install Prometheus Operator CRDs |
| 61 | +# run: | |
| 62 | +# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts |
| 63 | +# helm repo update |
| 64 | +# helm install prometheus-crds prometheus-community/prometheus-operator-crds |
| 65 | +# |
| 66 | +# - name: Install Prometheus via Helm |
| 67 | +# run: | |
| 68 | +# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts |
| 69 | +# helm repo update |
| 70 | +# helm install prometheus prometheus-community/prometheus --namespace monitoring --create-namespace |
| 71 | +# |
| 72 | +# - name: Wait for Prometheus to be ready |
| 73 | +# run: | |
| 74 | +# kubectl wait --namespace monitoring --for=condition=available --timeout=300s deployment/prometheus-server |
| 75 | + |
| 76 | + - name: Install Helm chart for project |
| 77 | + run: | |
| 78 | + helm install my-release ./dist/chart --create-namespace --namespace nodedrain-system |
| 79 | +
|
| 80 | + - name: Check Helm release status |
| 81 | + run: | |
| 82 | + helm status my-release --namespace nodedrain-system |
| 83 | +
|
| 84 | +# TODO: Uncomment if prometheus.enabled is set to true to confirm that the ServiceMonitor gets created |
| 85 | +# - name: Check Presence of ServiceMonitor |
| 86 | +# run: | |
| 87 | +# kubectl wait --namespace nodedrain-system --for=jsonpath='{.kind}'=ServiceMonitor servicemonitor/nodedrain-controller-manager-metrics-monitor |
0 commit comments