diff --git a/docs/_guide/install.md b/docs/_guide/install.md index 055111c..c7e6a94 100644 --- a/docs/_guide/install.md +++ b/docs/_guide/install.md @@ -29,7 +29,7 @@ Replace `` and `` above based on the account you use to authentica ```sh # Create 'metacontroller' namespace, service account, and role/binding. kubectl apply -f {{ site.repo_raw }}/manifests/metacontroller-rbac.yaml -# Create CRDs for Metacontroller APIs, and the Metacontroller Deployment. +# Create CRDs for Metacontroller APIs, and the Metacontroller StatefulSet. kubectl apply -f {{ site.repo_raw }}/manifests/metacontroller.yaml ``` @@ -39,7 +39,7 @@ If you prefer to build and host your own images, please see the ## Configuration The Metacontroller server has a few settings that can be configured -with command-line flags (by editing the Metacontroller Deployment +with command-line flags (by editing the Metacontroller StatefulSet in `manifests/metacontroller.yaml`): | Flag | Description | diff --git a/examples/bluegreen/test.sh b/examples/bluegreen/test.sh index 1013634..43691d9 100755 --- a/examples/bluegreen/test.sh +++ b/examples/bluegreen/test.sh @@ -12,12 +12,14 @@ trap cleanup EXIT set -ex +bgd="bluegreendeployments" + echo "Install controller..." kubectl create configmap bluegreen-controller -n metacontroller --from-file=sync.js kubectl apply -f bluegreen-controller.yaml echo "Wait until CRD is available..." -until kubectl get bgd; do sleep 1; done +until kubectl get $bgd; do sleep 1; done echo "Create an object..." kubectl apply -f my-bluegreen.yaml @@ -27,14 +29,14 @@ until [[ "$(kubectl get rs nginx-blue -o 'jsonpath={.status.readyReplicas}')" -e until [[ "$(kubectl get rs nginx-green -o 'jsonpath={.status.replicas}')" -eq 0 ]]; do sleep 1; done echo "Trigger a rollout..." -kubectl patch bgd nginx --type=merge -p '{"spec":{"template":{"metadata":{"labels":{"new":"label"}}}}}' +kubectl patch $bgd nginx --type=merge -p '{"spec":{"template":{"metadata":{"labels":{"new":"label"}}}}}' echo "Wait for nginx-green RS to be active..." until [[ "$(kubectl get rs nginx-green -o 'jsonpath={.status.readyReplicas}')" -eq 3 ]]; do sleep 1; done until [[ "$(kubectl get rs nginx-blue -o 'jsonpath={.status.replicas}')" -eq 0 ]]; do sleep 1; done echo "Trigger another rollout..." -kubectl patch bgd nginx --type=merge -p '{"spec":{"template":{"metadata":{"labels":{"new2":"label2"}}}}}' +kubectl patch $bgd nginx --type=merge -p '{"spec":{"template":{"metadata":{"labels":{"new2":"label2"}}}}}' echo "Wait for nginx-blue RS to be active..." until [[ "$(kubectl get rs nginx-blue -o 'jsonpath={.status.readyReplicas}')" -eq 3 ]]; do sleep 1; done diff --git a/examples/catset/test.sh b/examples/catset/test.sh index ede66b5..da9a59d 100755 --- a/examples/catset/test.sh +++ b/examples/catset/test.sh @@ -12,27 +12,29 @@ trap cleanup EXIT set -ex +cs="catsets" + echo "Install controller..." kubectl create configmap catset-controller -n metacontroller --from-file=sync.js kubectl apply -f catset-controller.yaml echo "Wait until CRD is available..." -until kubectl get catsets; do sleep 1; done +until kubectl get $cs; do sleep 1; done echo "Create an object..." kubectl apply -f my-catset.yaml echo "Wait for 3 Pods to be Ready..." -until [[ "$(kubectl get cs nginx-backend -o 'jsonpath={.status.readyReplicas}')" -eq 3 ]]; do sleep 1; done +until [[ "$(kubectl get $cs nginx-backend -o 'jsonpath={.status.readyReplicas}')" -eq 3 ]]; do sleep 1; done echo "Scale up to 4 replicas..." -kubectl patch catset nginx-backend --type=merge -p '{"spec":{"replicas":4}}' +kubectl patch $cs nginx-backend --type=merge -p '{"spec":{"replicas":4}}' echo "Wait for 4 Pods to be Ready..." -until [[ "$(kubectl get cs nginx-backend -o 'jsonpath={.status.readyReplicas}')" -eq 4 ]]; do sleep 1; done +until [[ "$(kubectl get $cs nginx-backend -o 'jsonpath={.status.readyReplicas}')" -eq 4 ]]; do sleep 1; done echo "Scale down to 2 replicas..." -kubectl patch catset nginx-backend --type=merge -p '{"spec":{"replicas":2}}' +kubectl patch $cs nginx-backend --type=merge -p '{"spec":{"replicas":2}}' echo "Wait for 2 Pods to be Ready..." -until [[ "$(kubectl get cs nginx-backend -o 'jsonpath={.status.readyReplicas}')" -eq 2 ]]; do sleep 1; done +until [[ "$(kubectl get $cs nginx-backend -o 'jsonpath={.status.readyReplicas}')" -eq 2 ]]; do sleep 1; done diff --git a/examples/indexedjob/test.sh b/examples/indexedjob/test.sh index e1d644f..935938e 100755 --- a/examples/indexedjob/test.sh +++ b/examples/indexedjob/test.sh @@ -12,18 +12,20 @@ trap cleanup EXIT set -ex +ij="indexedjobs" + echo "Install controller..." kubectl create configmap indexedjob-controller -n metacontroller --from-file=sync.py kubectl apply -f indexedjob-controller.yaml echo "Wait until CRD is available..." -until kubectl get indexedjobs; do sleep 1; done +until kubectl get $ij; do sleep 1; done echo "Create an object..." kubectl apply -f my-indexedjob.yaml echo "Wait for 10 successful completions..." -until [[ "$(kubectl get indexedjob print-index -o 'jsonpath={.status.succeeded}')" -eq 10 ]]; do sleep 1; done +until [[ "$(kubectl get $ij print-index -o 'jsonpath={.status.succeeded}')" -eq 10 ]]; do sleep 1; done echo "Check that correct index is printed..." if [[ "$(kubectl logs print-index-9)" != "9" ]]; then diff --git a/manifests/dev/args.yaml b/manifests/dev/args.yaml index 2f2855e..d43be62 100644 --- a/manifests/dev/args.yaml +++ b/manifests/dev/args.yaml @@ -1,6 +1,6 @@ # Override args for development mode. -apiVersion: apps/v1beta1 -kind: Deployment +apiVersion: apps/v1beta2 +kind: StatefulSet metadata: name: metacontroller namespace: metacontroller diff --git a/manifests/dev/image.yaml b/manifests/dev/image.yaml index f235a21..26e8521 100644 --- a/manifests/dev/image.yaml +++ b/manifests/dev/image.yaml @@ -1,6 +1,6 @@ # Override image for development mode (skaffold fills in the tag). -apiVersion: apps/v1beta1 -kind: Deployment +apiVersion: apps/v1beta2 +kind: StatefulSet metadata: name: metacontroller namespace: metacontroller diff --git a/manifests/metacontroller.yaml b/manifests/metacontroller.yaml index 1433792..ac98a03 100644 --- a/manifests/metacontroller.yaml +++ b/manifests/metacontroller.yaml @@ -43,8 +43,8 @@ spec: singular: controllerrevision kind: ControllerRevision --- -apiVersion: apps/v1beta1 -kind: Deployment +apiVersion: apps/v1beta2 +kind: StatefulSet metadata: name: metacontroller namespace: metacontroller @@ -55,6 +55,7 @@ spec: selector: matchLabels: app: metacontroller + serviceName: "" template: metadata: labels: