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

Extend SSOP migration script and process with the local source #207

Merged
merged 3 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions docs/sp-migration/generate-manifests.sh
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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:
Expand All @@ -39,4 +52,4 @@ spec:
echo "---" >> "${filename}"
fi
done
done
done
10 changes: 9 additions & 1 deletion docs/sp-migration/sp-migration-conf.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ export KUBECONFIG=<path of the Kubeconfig file>
./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=<root path of the configuration files>
./generate-manifests.sh
```

4. Install family providers with `revisionActivationPolicy: Manual`:

Verify that `sp-family-manual.yaml` files are generated with the correct content
Expand Down Expand Up @@ -107,4 +115,4 @@ export CONF_PATH=<root path of the configuration files>

```bash
kubectl patch $(kubectl get managed -o name) -p '{"spec":{"deletionPolicy":"Delete"}}' --type=merge
```
```