Skip to content

Commit

Permalink
Wait for healthy plan before continuing. (#468)
Browse files Browse the repository at this point in the history
* Wait for healthy plan before continuing.

* Switch test to use Service instead of Deployment so that it passes in integration test environment.
  • Loading branch information
runyontr authored and jbarrick-mesosphere committed Jul 1, 2019
1 parent 7899477 commit 1e7fd26
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 48 deletions.
29 changes: 9 additions & 20 deletions config/samples/test-operator/toy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ metadata:
labels:
controller-tools.k8s.io: "1.0"
name: toy-v1
namespace: default
spec:
version: "1.0.0"
connectionString: ""
Expand All @@ -20,28 +19,18 @@ spec:
kind: Operator
templates:
deployment.yaml: |
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
apiVersion: v1
kind: Service
metadata:
name: nginx-deployment
name: my-service
spec:
type: ClusterIP
ports:
- port: 80
name: http
selector:
matchLabels:
app: nginx
replicas: {{ .Params.Replicas }} # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
env:
- name: ENVIRONMENT_VARIABLE
value: "{{ .Params.Param }}"
ports:
- containerPort: 80
replicas: "{{ .Params.Replicas }}"
param: "{{ .Params.Param }}"
tasks:
deploy:
resources:
Expand Down
51 changes: 39 additions & 12 deletions pkg/test/test_data/patch/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
apiVersion: v1
kind: Service
metadata:
name: toy1-nginx-deployment
name: toy1-my-service
labels:
app: "toy"
version: "1.0.0"
Expand All @@ -11,12 +11,39 @@ metadata:
step: "deploy"
phase: "deploy"
spec:
replicas: 1
template:
spec:
containers:
- name: nginx
image: nginx:1.7.9
env:
- name: ENVIRONMENT_VARIABLE
value: "30"
selector:
replicas: "1"
param: "30"
---
apiVersion: kudo.k8s.io/v1alpha1
kind: Instance
metadata:
name: toy1
status:
status: COMPLETE
activePlan:
apiVersion: kudo.k8s.io/v1alpha1
kind: PlanExecution
---
apiVersion: kudo.k8s.io/v1alpha1
kind: PlanExecution
metadata:
labels:
instance: toy1
operator-version: toy-v1
ownerReferences:
- apiVersion: kudo.k8s.io/v1alpha1
blockOwnerDeletion: true
controller: true
kind: Instance
name: toy1
status:
name: deploy
phases:
- name: deploy
state: COMPLETE
steps:
- name: deploy
state: COMPLETE
state: COMPLETE
strategy: serial
2 changes: 1 addition & 1 deletion pkg/test/test_data/patch/00-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ metadata:
spec:
operatorVersion:
name: toy-v1
kind: OperatorVersion
namespace: default
type: OperatorVersions
# Add fields here
parameters:
Param: "30"
Expand Down
51 changes: 39 additions & 12 deletions pkg/test/test_data/patch/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
apiVersion: v1
kind: Service
metadata:
name: toy1-nginx-deployment
name: toy1-my-service
labels:
app: "toy"
version: "1.0.0"
Expand All @@ -11,12 +11,39 @@ metadata:
step: "scale"
phase: "scale"
spec:
replicas: 3
template:
spec:
containers:
- name: nginx
image: nginx:1.7.9
env:
- name: ENVIRONMENT_VARIABLE
value: "30"
selector:
replicas: "3"
param: "30"
---
apiVersion: kudo.k8s.io/v1alpha1
kind: Instance
metadata:
name: toy1
status:
status: COMPLETE
activePlan:
apiVersion: kudo.k8s.io/v1alpha1
kind: PlanExecution
---
apiVersion: kudo.k8s.io/v1alpha1
kind: PlanExecution
metadata:
labels:
instance: toy1
operator-version: toy-v1
ownerReferences:
- apiVersion: kudo.k8s.io/v1alpha1
blockOwnerDeletion: true
controller: true
kind: Instance
name: toy1
status:
name: scale
phases:
- name: scale
state: COMPLETE
steps:
- name: scale
state: COMPLETE
state: COMPLETE
strategy: serial
6 changes: 3 additions & 3 deletions pkg/test/test_data/patch/01-plan-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ metadata:
spec:
operatorVersion:
name: toy-v1
kind: OperatorVersion
namespace: default
type: OperatorVersions
# Add fields here
# Add fields here
parameters:
Param: "30"
Replicas: "3"
Replicas: "3"

0 comments on commit 1e7fd26

Please sign in to comment.