diff --git a/docs/sp-migration/generate-manifests.sh b/docs/sp-migration/generate-manifests.sh index 83f16a16..22f6803d 100755 --- a/docs/sp-migration/generate-manifests.sh +++ b/docs/sp-migration/generate-manifests.sh @@ -1,13 +1,25 @@ #!/bin/sh set -e +# shellcheck disable=SC2034 version_aws=v0.37.0 +# shellcheck disable=SC2034 version_azure=v0.34.0 +# shellcheck disable=SC2034 version_gcp=v0.34.0 rm -f "sp-manual.yaml" && touch "sp-manual.yaml" rm -f "sp-family-manual.yaml" && touch "sp-family-manual.yaml" -kubectl get managed --no-headers -o jsonpath='{range .items[*]}{.apiVersion}{"\n"}{end}' | grep -E '(aws|gcp|azure).upbound.io' | sort | uniq | while read -r line + +if [ -n "$CONF_PATH" ]; then + echo "Generating manifests from $CONF_PATH. No runtime Managed Resources will be included" + apiGroups=$(grep -rh apiVersion: "$CONF_PATH" | grep -E '(aws|gcp|azure).upbound.io' | sort | uniq | tr -d '[:blank:]'| cut -d ":" -f 2) +else + echo "Generating manifests from current cluster" + apiGroups=$(kubectl get managed --no-headers -o jsonpath='{range .items[*]}{.apiVersion}{"\n"}{end}' | grep -E '(aws|gcp|azure).upbound.io' | sort | uniq) +fi + +echo "$apiGroups"| while read -r line do service=$(echo "${line}" | cut -d. -f1) provider=$(echo "${line}" | cut -d. -f2) @@ -28,7 +40,8 @@ do providername="family-$provider" filename="sp-family-manual.yaml" fi - if ! cat "${filename}" | grep provider-${providername}:${version} > /dev/null; then + # shellcheck disable=SC2154 + if ! grep provider-"${providername}:${version}" "${filename}" > /dev/null; then echo "apiVersion: pkg.crossplane.io/v1 kind: Provider metadata: @@ -39,4 +52,4 @@ spec: echo "---" >> "${filename}" fi done -done \ No newline at end of file +done diff --git a/docs/sp-migration/sp-migration-conf.md b/docs/sp-migration/sp-migration-conf.md index be5f9349..09054140 100644 --- a/docs/sp-migration/sp-migration-conf.md +++ b/docs/sp-migration/sp-migration-conf.md @@ -24,6 +24,14 @@ export KUBECONFIG= ./generate-manifests.sh ``` +Alternatively, you can generate the provider manifests out of the local +Configuration files. No runtime Managed Resources will be included in this case. + +```bash +export CONF_PATH= +./generate-manifests.sh +``` + 4. Install family providers with `revisionActivationPolicy: Manual`: Verify that `sp-family-manual.yaml` files are generated with the correct content @@ -107,4 +115,4 @@ export CONF_PATH= ```bash kubectl patch $(kubectl get managed -o name) -p '{"spec":{"deletionPolicy":"Delete"}}' --type=merge -``` \ No newline at end of file +```