Last active
December 23, 2021 18:28
-
-
Save colinjfw/58ec321708b761b79c0fd9c33eec8716 to your computer and use it in GitHub Desktop.
Revisions
-
colinjfw revised this gist
Aug 29, 2019 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,8 @@ # revision=ab331a # images='[{ "name": "nginx", "newTag": "latest" }]' # variables='{"host": "pr123.example.com"}' set -e echo "deploying $release into namespace $namespace using overlay overlays/$target" mkdir -p build cd build @@ -40,8 +42,6 @@ apiVersion: v1 kind: Namespace metadata: name: $namespace EOF echo $variables > variables.yaml @@ -50,4 +50,4 @@ yq --yaml-output -s add ../overlays/$target/variables.yaml variables.yaml > merg kustomize build | mustache merged.yaml - > build.yaml kubectl apply -f namespace.yaml kubectl apply -f build.yaml --prune --selector deliverybot.io/release=$release --prune-whitelist=core/v1/Namespace -
colinjfw revised this gist
Aug 29, 2019 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,23 @@ # Kustomize based deletion workflow. Requires jq, kubectl. # # Expected variables: # - namespace Namespace for the release. # - # - release A unique name to give to this collection of manifests. # - delete Resource delete whitelist. # # Example inputs: # namespace=pr123 # release=app-pr123 # delete='["deployment", "service", "ingress", "namespace"]' set -e echo "removing $release with resources $delete" resources=$(echo $delete | jq -r 'join(",")') kubectl --namespace $namespace delete $resources --selector deliverybot.io/release=$release remove_namespace=$(echo $delete | jq 'contains(["namespace"])') if [ "$remove_namespace" = "true" ]; then kubectl delete ns/$namespace || exit 0 fi -
colinjfw revised this gist
Aug 29, 2019 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes. -
colinjfw revised this gist
Aug 29, 2019 . No changes.There are no files selected for viewing
-
colinjfw revised this gist
Aug 29, 2019 . 2 changed files with 12 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ # Kustomize based deletion workflow. Requires jq, kubectl. # # Expected variables: # - release A unique name to give to this collection of manifests. # - delete Resource delete whitelist. # # Example inputs: # release=app-pr123 # delete='["deployment", "service", "ingress", "namespace"]' resources=$(echo $delete | jq -r 'join(",")') kubectl --namespace $namespace delete $resources --selector deliverybot.io/release=$release -
colinjfw revised this gist
Aug 29, 2019 . No changes.There are no files selected for viewing
-
colinjfw created this gist
Aug 29, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ # Kustomize based apply workflow. Requires jq, yq, kubectl, kustomize, mustache. # # Expected variables # - namespace Namespace for all resources. # - release A unique name to give to this collection of manifests. # - revision Release revision. # - images Image replacements. # - variables Variable replacements. # # Example inputs: # namespace=pr123 # release=app-pr123 # target=review # revision=ab331a # images='[{ "name": "nginx", "newTag": "latest" }]' # variables='{"host": "pr123.example.com"}' mkdir -p build cd build cat > kustomization.yaml <<EOF namespace: $namespace namePrefix: $release- commonLabels: deliverybot.io/release: $release commonAnnotations: deliverybot.io/target: $target deliverybot.io/revision: $revision images: $images resources: - ../overlays/$target EOF cat > namespace.yaml <<EOF apiVersion: v1 kind: Namespace metadata: name: $namespace labels: deliverybot.io/release: $release EOF echo $variables > variables.yaml yq --yaml-output -s add ../overlays/$target/variables.yaml variables.yaml > merged.yaml kustomize build | mustache merged.yaml - > build.yaml kubectl apply -f namespace.yaml kubectl apply -f build.yaml --prune --selector deliverybot.io/release=$release