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

Merge two SP migration docs into a single file #206

Merged
merged 1 commit into from
May 25, 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
12 changes: 12 additions & 0 deletions docs/sp-migration/configuration-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Finding Configuration Dependencies

If you want to update your configuration dependencies with smaller providers, you can use the `find-dependencies.sh` script.
That script requires the path of the configuration files as an environment variable and traverse the composition files
to find which smaller providers are required by the configuration. It outputs a yaml
list of the smaller providers with corresponding versions and that list can be copy-pasted to the `crossplane.yaml` file
directly.

```bash
export CONF_PATH=<root path of the configuration files>
./find-dependencies.sh
```
16 changes: 16 additions & 0 deletions docs/sp-migration/example-lock-after.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: pkg.crossplane.io/v1beta1
kind: Lock
metadata:
creationTimestamp: "2023-05-16T14:37:01Z"
finalizers:
- lock.pkg.crossplane.io
generation: 99
name: lock
resourceVersion: "1969272"
uid: aa60ed13-ec55-4047-b409-b96beb9fe286
packages:
- dependencies: []
name: upbound-provider-gcp-a206c0fc297b
source: xpkg.upbound.io/upbound/provider-gcp
type: Provider
version: v0.32.0
24 changes: 24 additions & 0 deletions docs/sp-migration/example-lock-before.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: pkg.crossplane.io/v1beta1
kind: Lock
metadata:
creationTimestamp: "2023-05-16T14:37:01Z"
finalizers:
- lock.pkg.crossplane.io
generation: 99
name: lock
resourceVersion: "1969272"
uid: aa60ed13-ec55-4047-b409-b96beb9fe286
packages:
- dependencies:
- constraints: '>=v0.31.0'
package: xpkg.upbound.io/upbound/provider-gcp
type: Provider
name: ezgid-test-smaller-provider-migration-3a0d5472dd78
source: index.docker.io/ezgid/test-smaller-provider-migration
type: Configuration
version: v0.4.0
- dependencies: []
name: upbound-provider-gcp-a206c0fc297b
source: xpkg.upbound.io/upbound/provider-gcp
type: Provider
version: v0.32.0
6 changes: 3 additions & 3 deletions docs/sp-migration/find-dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/sh
set -e

function getsmallerproviders(){
get_smaller_providers(){
provider="${1}"
version="${2}"
smaller=$(grep -irn ${provider}.upbound.io/v1beta1 ${CONF_PATH} | awk '{print $3}'| cut -d '.' -f 1 | sort | uniq)
smaller=$(grep -irn ${provider}.upbound.io/v1beta1 "${CONF_PATH}" | awk '{print $3}'| cut -d '.' -f 1 | sort | uniq)

for s in ${smaller[@]}; do if [ $s != "azure" ]; then echo "- provider: xpkg.upbound.io/upbound-release-candidates/provider-$provider-$s";echo " version: \"$version\""; fi; done
}

providers=( "aws:v0.36.0" "gcp:v0.33.0" "azure:v0.34.0" )

for pp in ${providers[@]}; do getsmallerproviders "${pp%%:*}" "${pp##*:}"; done
for pp in "${providers[@]}"; do get_smaller_providers "${pp%%:*}" "${pp##*:}"; done
97 changes: 0 additions & 97 deletions docs/sp-migration/sp-migration-mr.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Configuration Migration to Smaller Providers
# Migration to Smaller Providers

1. Backup managed resource, composite and claim manifests:

Expand All @@ -10,14 +10,13 @@ kubectl get claim --all-namespaces -o yaml > backup-claims.yaml
```

2. Update deletion policy to `Orphan`:

P.S: If this field is used in the composition files, we need to have special treatment
P.S: If this field is used in the managed resources, we need to have special treatment

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

3. Generate smaller provider manifests
3. Generate smaller provider manifests with the script:

```bash
export KUBECONFIG=<path of the Kubeconfig file>
Expand Down Expand Up @@ -72,7 +71,16 @@ Make sure the smaller providers are in `Installed: False` and `Healthy: True` st
kubectl get providers.pkg
```

6. Remove monolith provider(s) from dependsOn. Build/push and update the configuration
6. If you installed monolith provider(s) as a configuration dependency; set `spec.skipDependencyResoultion: true` and
remove the configuration dependency from the lock resource to prevent reinstallation of the monolith provider(s).

```bash
kubectl patch configuration.pkg $CONFIGURATION_NAME -p '{"spec":{"skipDependencyResolution": true}}' --type=merge

kubectl edit lock lock
# remove `packages` array item where `type: Configuration` and `dependencies[0].package is the monolith provider
# example lock resources can be found docs/sp-migration/example-lock-before.yaml and docs/sp-migration/example-lock-after.yaml
```

7. Delete monolith provider(s):

Expand Down Expand Up @@ -102,17 +110,18 @@ kubectl get managed
kubectl get provider.pkg
```

10. Find new dependencies and add them to `dependsOn` field in the `crossplane.yaml` file:
10. If you want to add smaller providers to the configuration's `dependsOn` list, please follow the [guide] and build/push/update
the configuration to the new version. Once the configuration is updated, change `skipDependencyResolution` to `false` again:

```bash
export CONF_PATH=<root path of the configuration files>
./find-dependencies.sh
kubectl patch configuration.pkg $CONFIGURATION_NAME -p '{"spec":{"skipDependencyResolution": false}}' --type=merge
```

12. Build/push/update the configuration to the new version

13. Update deletion policy to `Delete`:
11. Update deletion policy to `Delete`:
P.S: If this field is used in the managed resources, we need to have special treatment

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

[guide]: configuration-dependencies.md