Created
July 18, 2023 09:20
-
-
Save haarchri/62ba84e067660091349738359bd16ef6 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
set -e | |
## use this script if you what you want to do ;) | |
## check that crossplane is running as minimum with | |
## resources: | |
## limits: | |
## cpu: 2000m | |
## memory: 2Gi | |
## requests: | |
## cpu: 1000m | |
## memory: 2Gi | |
## | |
rawproviders=$(kubectl get providers --no-headers \ | |
| grep "provider-aws" \ | |
| awk {'print $1'} \ | |
| xargs -I% kubectl get providers % -o="custom-columns=NAME:.metadata.name,UID:.metadata.uid" --no-headers) | |
provider=$(echo $rawproviders | cut -d ' ' -f1) | |
provideruid=$(echo $rawproviders | cut -d ' ' -f2) | |
echo $provider | |
echo $provideruid | |
rawref=$(kubectl get pkgrev --no-headers \ | |
| grep "provider-aws" \ | |
| grep "v0.37.0" \ | |
| awk {'print $1'} \ | |
| xargs -I% kubectl get % -o="custom-columns=NAME:.metadata.name,UID:.metadata.uid" --no-headers) | |
providerrev=$(echo $rawref | cut -d ' ' -f1) | |
providerrevuidpath=$(echo $rawref | cut -d ' ' -f2) | |
echo $providerrev | |
echo $providerrevuidpath | |
kubectl get crds -o custom-columns=NAME:metadata.name --no-headers \ | |
| grep "aws.upbound.io" \ | |
| xargs -I% kubectl patch crd % -p "{\"metadata\":{\"ownerReferences\": [{\"apiVersion\": \"pkg.crossplane.io/v1\", \"kind\": \"ProviderRevision\",\"name\": \"$providerrev\",\"uid\": \"$providerrevuidpath\", \"blockOwnerDeletion\": true, \"controller\": true},{\"apiVersion\": \"pkg.crossplane.io/v1\", \"blockOwnerDeletion\": true, \"controller\": false, \"kind\": \"Provider\", \"name\": \"$provider\", \"uid\": \"$provideruid\"}]}}" --type=merge |
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
kubectl get pkgrev | |
NAME HEALTHY REVISION IMAGE STATE DEP-FOUND DEP-INSTALLED AGE | |
providerrevision.pkg.crossplane.io/provider-aws-324458c4c811 False 1 xpkg.upbound.io/upbound/provider-aws:v0.33.0 Inactive 13m | |
providerrevision.pkg.crossplane.io/provider-aws-3d6079c69877 True 2 xpkg.upbound.io/upbound/provider-aws:v0.37.0 Active 3m | |
kubectl get pods -n upbound-system | |
NAME READY STATUS RESTARTS AGE | |
crossplane-5794874978-lkqt7 1/1 Running 0 7m41s | |
crossplane-rbac-manager-d8cb49cbc-t6tq6 1/1 Running 2 (72m ago) 44h | |
provider-aws-3d6079c69877-5f9f454984-6q8qs 1/1 Running 0 108s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment