Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set cluster api group in hooks #251

Merged
merged 1 commit into from
Jul 31, 2024
Merged

set cluster api group in hooks #251

merged 1 commit into from
Jul 31, 2024

Conversation

anvddriesch
Copy link
Contributor

@anvddriesch anvddriesch commented Jul 31, 2024

related giantswarm/roadmap#3619

This pr: fixes the hooks failing due to ambiguous api groups on some MCs (specifically this is the case on goat)

Trigger e2e tests

/run cluster-test-suites

@anvddriesch anvddriesch self-assigned this Jul 31, 2024
@anvddriesch anvddriesch requested a review from a team as a code owner July 31, 2024 09:50
Copy link
Contributor

There were differences in the rendered Helm template, please check! ⚠️

Output
=== Differences when rendered with values file helm/cluster-vsphere/ci/test-wc-values.yaml ===

/spec/template/spec/containers/name=post-delete-job/command  (batch/v1/Job/org-giantswarm/release-name-cleanup-helmreleases-hook)
  - one list entry removed:
    - |
      NAMESPACE="org-giantswarm"
      CLUSTER_NAME="release-name"
      
      for release in $(kubectl get HelmRelease -n ${NAMESPACE} -l "giantswarm.io/cluster=${CLUSTER_NAME}" -o json | jq -r '.items[].metadata.name'); do
        echo "Patching helmrelease $release to remove finalizers"
        kubectl patch -n ${NAMESPACE} helmrelease "${release}" --type=merge -p '{"metadata": {"finalizers": []}}'
      done
      
      for chart in $(kubectl get HelmChart -n ${NAMESPACE} -o json | jq -r ".items[] | select(.spec.sourceRef.name == \"${CLUSTER_NAME}-default\" or .spec.sourceRef.name == \"${CLUSTER_NAME}-cluster\") | .metadata.name"); do
        echo "Patching helmchart $chart to remove finalizers"
        kubectl patch -n ${NAMESPACE} helmchart "${chart}" --type=merge -p '{"metadata": {"finalizers": []}}'
        echo "Deleting helmchart $chart"
        kubectl delete -n ${NAMESPACE} helmchart "${chart}" --ignore-not-found=true
      done
      
      echo "Unpausing cluster ${CLUSTER_NAME} to allow deletion..."
      kubectl patch -n ${NAMESPACE} cluster "${CLUSTER_NAME}" --type=merge -p '{"spec": {"paused": false}}'
      
    
  
  + one list entry added:
    - |
      NAMESPACE="org-giantswarm"
      CLUSTER_NAME="release-name"
      
      for release in $(kubectl get HelmRelease -n ${NAMESPACE} -l "giantswarm.io/cluster=${CLUSTER_NAME}" -o json | jq -r '.items[].metadata.name'); do
        echo "Patching helmrelease $release to remove finalizers"
        kubectl patch -n ${NAMESPACE} helmrelease "${release}" --type=merge -p '{"metadata": {"finalizers": []}}'
      done
      
      for chart in $(kubectl get HelmChart -n ${NAMESPACE} -o json | jq -r ".items[] | select(.spec.sourceRef.name == \"${CLUSTER_NAME}-default\" or .spec.sourceRef.name == \"${CLUSTER_NAME}-cluster\") | .metadata.name"); do
        echo "Patching helmchart $chart to remove finalizers"
        kubectl patch -n ${NAMESPACE} helmchart "${chart}" --type=merge -p '{"metadata": {"finalizers": []}}'
        echo "Deleting helmchart $chart"
        kubectl delete -n ${NAMESPACE} helmchart "${chart}" --ignore-not-found=true
      done
      
      echo "Unpausing cluster ${CLUSTER_NAME} to allow deletion..."
      kubectl patch -n ${NAMESPACE} cluster.cluster.x-k8s.io "${CLUSTER_NAME}" --type=merge -p '{"spec": {"paused": false}}'
      
    
  

@tinkerers-ci
Copy link

tinkerers-ci bot commented Jul 31, 2024

cluster-test-suites

Run name pr-cluster-vsphere-251-cluster-test-suiteslw2lx
Commit SHA 0a1506a
Result Succeeded ✅

📋 View full results in Tekton Dashboard

Rerun trigger:
/run cluster-test-suites


Tip

To only re-run the failed test suites you can provide a TARGET_SUITES parameter with your trigger that points to the directory path of the test suites to run, e.g. /run cluster-test-suites TARGET_SUITES=./providers/capa/standard to re-run the CAPA standard test suite. This supports multiple test suites with each path separated by a comma.

@anvddriesch anvddriesch merged commit 23dfcc9 into main Jul 31, 2024
11 checks passed
@anvddriesch anvddriesch deleted the api-version branch July 31, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants