diff --git a/bundle/tests/scorecard/kuttl/probe/00-assert.yaml b/bundle/tests/scorecard/kuttl/probe/00-assert.yaml index 92c38d723..5adaf1d0d 100644 --- a/bundle/tests/scorecard/kuttl/probe/00-assert.yaml +++ b/bundle/tests/scorecard/kuttl/probe/00-assert.yaml @@ -9,17 +9,26 @@ metadata: status: readyReplicas: 1 --- -apiVersion: v1 -kind: Pod -spec: - containers: - - startupProbe: - failureThreshold: 10 - periodSeconds: 5 - readinessProbe: - initialDelaySeconds: 1 - livenessProbe: - initialDelaySeconds: 4 +apiVersion: apps/v1 +kind: Deployment metadata: - labels: - app.kubernetes.io/instance: probes-rc + name: probes-rc +spec: + template: + containers: +spec: + selector: + matchLabels: + app.kubernetes.io/instance: probes-rc + template: + spec: + containers: + - readinessProbe: + initialDelaySeconds: 1 + livenessProbe: + initialDelaySeconds: 4 + startupProbe: + failureThreshold: 10 + periodSeconds: 5 +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/kuttl/probe/01-assert.yaml b/bundle/tests/scorecard/kuttl/probe/01-assert.yaml index c35bd9d66..c57c17a09 100644 --- a/bundle/tests/scorecard/kuttl/probe/01-assert.yaml +++ b/bundle/tests/scorecard/kuttl/probe/01-assert.yaml @@ -6,20 +6,22 @@ apiVersion: apps/v1 kind: Deployment metadata: name: probes-rc +spec: + template: + containers: +spec: + selector: + matchLabels: + app.kubernetes.io/instance: probes-rc + template: + spec: + containers: + - readinessProbe: + initialDelaySeconds: 3 + livenessProbe: + initialDelaySeconds: 6 + startupProbe: + failureThreshold: 20 + periodSeconds: 10 status: readyReplicas: 1 ---- -apiVersion: v1 -kind: Pod -spec: - containers: - - readinessProbe: - initialDelaySeconds: 3 - livenessProbe: - initialDelaySeconds: 6 - startupProbe: - failureThreshold: 20 - periodSeconds: 10 -metadata: - labels: - app.kubernetes.io/instance: probes-rc diff --git a/bundle/tests/scorecard/kuttl/probe/02-errors.yaml b/bundle/tests/scorecard/kuttl/probe/02-errors.yaml index 7e2b969fc..7c164af63 100644 --- a/bundle/tests/scorecard/kuttl/probe/02-errors.yaml +++ b/bundle/tests/scorecard/kuttl/probe/02-errors.yaml @@ -1,14 +1,23 @@ -apiVersion: v1 -kind: Pod -spec: - containers: - - readinessProbe: - initialDelaySeconds: 3 - livenessProbe: - initialDelaySeconds: 6 - startupProbe: - failureThreshold: 20 - periodSeconds: 10 +apiVersion: apps/v1 +kind: Deployment metadata: - labels: - app.kubernetes.io/instance: probes-rc + name: probes-rc +spec: + template: + containers: +spec: + selector: + matchLabels: + app.kubernetes.io/instance: probes-rc + template: + spec: + containers: + - readinessProbe: + initialDelaySeconds: 3 + livenessProbe: + initialDelaySeconds: 6 + startupProbe: + failureThreshold: 20 + periodSeconds: 10 +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/annotations/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/annotations/00-assert.yaml new file mode 100644 index 000000000..12c3549a5 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/annotations/00-assert.yaml @@ -0,0 +1,35 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: rc-deployment-annotations + annotations: + bar2: foo2 + foo1: bar1 + conflict: deployment +spec: + template: + metadata: + annotations: + bar2: foo2 + foo1: bar1 + conflict: deployment +status: + readyReplicas: 1 +--- +apiVersion: v1 +kind: Service +metadata: + name: rc-deployment-annotations + annotations: + foo1: bar1 + conflict: component +--- +apiVersion: v1 +kind: Pod +metadata: + annotations: + bar2: foo2 + foo1: bar1 + conflict: deployment + labels: + app.kubernetes.io/instance: rc-deployment-annotations diff --git a/bundle/tests/scorecard/minikube-kuttl/annotations/00-errors.yaml b/bundle/tests/scorecard/minikube-kuttl/annotations/00-errors.yaml new file mode 100644 index 000000000..9f21bd6ba --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/annotations/00-errors.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: Service +metadata: + name: rc-deployment-annotations + annotations: + bar2: foo2 diff --git a/bundle/tests/scorecard/minikube-kuttl/annotations/00-rc-deployment.yaml b/bundle/tests/scorecard/minikube-kuttl/annotations/00-rc-deployment.yaml new file mode 100644 index 000000000..7fdbf1ae9 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/annotations/00-rc-deployment.yaml @@ -0,0 +1,16 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: rc-deployment-annotations + annotations: + foo1: bar1 + conflict: component +spec: + # Add fields here + applicationImage: 'k8s.gcr.io/pause:2.0' + replicas: 1 + deployment: + annotations: + bar2: foo2 + conflict: deployment + diff --git a/bundle/tests/scorecard/minikube-kuttl/annotations/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/annotations/01-assert.yaml new file mode 100644 index 000000000..3a129f689 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/annotations/01-assert.yaml @@ -0,0 +1,35 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: rc-deployment-annotations + annotations: + bar2: foo2 + foo1: bar1 + conflict: statefulSet +spec: + template: + metadata: + annotations: + bar2: foo2 + foo1: bar1 + conflict: statefulSet +status: + readyReplicas: 1 +--- +apiVersion: v1 +kind: Service +metadata: + name: rc-deployment-annotations + annotations: + foo1: bar1 +--- +apiVersion: v1 +kind: Pod +metadata: + annotations: + bar2: foo2 + foo1: bar1 + conflict: statefulSet + labels: + app.kubernetes.io/instance: rc-deployment-annotations + diff --git a/bundle/tests/scorecard/minikube-kuttl/annotations/01-errors.yaml b/bundle/tests/scorecard/minikube-kuttl/annotations/01-errors.yaml new file mode 100644 index 000000000..54a996663 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/annotations/01-errors.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: rc-deployment-annotations + annotations: + bar2: foo2 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: rc-deployment-annotations + diff --git a/bundle/tests/scorecard/minikube-kuttl/annotations/01-rc-statefulset.yaml b/bundle/tests/scorecard/minikube-kuttl/annotations/01-rc-statefulset.yaml new file mode 100644 index 000000000..52694d5df --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/annotations/01-rc-statefulset.yaml @@ -0,0 +1,14 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: rc-deployment-annotations + annotations: + foo1: bar1 +spec: + # Add fields here + applicationImage: 'k8s.gcr.io/pause:2.0' + replicas: 1 + statefulSet: + annotations: + bar2: foo2 + conflict: statefulSet diff --git a/bundle/tests/scorecard/minikube-kuttl/auto1/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/auto1/00-assert.yaml new file mode 100644 index 000000000..440ee1883 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto1/00-assert.yaml @@ -0,0 +1,10 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: autoscaling1-rc +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/auto1/00-runtime-basic.yaml b/bundle/tests/scorecard/minikube-kuttl/auto1/00-runtime-basic.yaml new file mode 100644 index 000000000..2957fb359 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto1/00-runtime-basic.yaml @@ -0,0 +1,8 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: autoscaling1-rc +spec: + # Add fields here + applicationImage: 'k8s.gcr.io/pause:2.0' + replicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/auto1/01-add-autoscale.yaml b/bundle/tests/scorecard/minikube-kuttl/auto1/01-add-autoscale.yaml new file mode 100644 index 000000000..fe9e8ba4c --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto1/01-add-autoscale.yaml @@ -0,0 +1,12 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: autoscaling1-rc +spec: + resourceConstraints: + requests: + cpu: "0.2" + autoscaling: + maxReplicas: 5 + targetCPUUtilizationPercentage: 50 + diff --git a/bundle/tests/scorecard/minikube-kuttl/auto1/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/auto1/01-assert.yaml new file mode 100644 index 000000000..d01d90c98 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto1/01-assert.yaml @@ -0,0 +1,19 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: autoscaling1-rc +status: + readyReplicas: 1 +--- +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: autoscaling1-rc +spec: + maxReplicas: 5 + minReplicas: 1 + targetCPUUtilizationPercentage: 50 diff --git a/bundle/tests/scorecard/minikube-kuttl/auto1/02-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/auto1/02-assert.yaml new file mode 100644 index 000000000..b07843d2b --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto1/02-assert.yaml @@ -0,0 +1,19 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: autoscaling1-rc +status: + readyReplicas: 2 +--- +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: autoscaling1-rc +spec: + maxReplicas: 3 + minReplicas: 2 + targetCPUUtilizationPercentage: 30 diff --git a/bundle/tests/scorecard/minikube-kuttl/auto1/02-update-autoscaling.yaml b/bundle/tests/scorecard/minikube-kuttl/auto1/02-update-autoscaling.yaml new file mode 100644 index 000000000..502e854c0 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto1/02-update-autoscaling.yaml @@ -0,0 +1,10 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: autoscaling1-rc +spec: + autoscaling: + maxReplicas: 3 + minReplicas: 2 + targetCPUUtilizationPercentage: 30 + diff --git a/bundle/tests/scorecard/minikube-kuttl/auto1/03-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/auto1/03-assert.yaml new file mode 100644 index 000000000..b07843d2b --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto1/03-assert.yaml @@ -0,0 +1,19 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: autoscaling1-rc +status: + readyReplicas: 2 +--- +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: autoscaling1-rc +spec: + maxReplicas: 3 + minReplicas: 2 + targetCPUUtilizationPercentage: 30 diff --git a/bundle/tests/scorecard/minikube-kuttl/auto1/03-minmax-autoscaling.yaml b/bundle/tests/scorecard/minikube-kuttl/auto1/03-minmax-autoscaling.yaml new file mode 100644 index 000000000..6cd1f4152 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto1/03-minmax-autoscaling.yaml @@ -0,0 +1,10 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: autoscaling1-rc +spec: + autoscaling: + maxReplicas: 1 + minReplicas: 6 + targetCPUUtilizationPercentage: 10 + diff --git a/bundle/tests/scorecard/minikube-kuttl/auto1/04-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/auto1/04-assert.yaml new file mode 100644 index 000000000..b07843d2b --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto1/04-assert.yaml @@ -0,0 +1,19 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: autoscaling1-rc +status: + readyReplicas: 2 +--- +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: autoscaling1-rc +spec: + maxReplicas: 3 + minReplicas: 2 + targetCPUUtilizationPercentage: 30 diff --git a/bundle/tests/scorecard/minikube-kuttl/auto1/04-autoscaling-boundary.yaml b/bundle/tests/scorecard/minikube-kuttl/auto1/04-autoscaling-boundary.yaml new file mode 100644 index 000000000..0ff8ff081 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto1/04-autoscaling-boundary.yaml @@ -0,0 +1,12 @@ +# Check that when minReplicas is set to less that one that the update is rejected +# There should be no change to the existing autoscale resource +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: autoscaling1-rc +spec: + autoscaling: + maxReplicas: 4 + minReplicas: 0 + targetCPUUtilizationPercentage: 20 + diff --git a/bundle/tests/scorecard/minikube-kuttl/auto2/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/auto2/00-assert.yaml new file mode 100644 index 000000000..1c2acd4e1 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto2/00-assert.yaml @@ -0,0 +1,10 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: scale2-runtime-component +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/auto2/00-runtime-basic.yaml b/bundle/tests/scorecard/minikube-kuttl/auto2/00-runtime-basic.yaml new file mode 100644 index 000000000..966aa9dc1 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto2/00-runtime-basic.yaml @@ -0,0 +1,8 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: scale2-runtime-component +spec: + # Add fields here + applicationImage: 'k8s.gcr.io/pause:2.0' + replicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/auto2/01-bad-autoscaling.yaml b/bundle/tests/scorecard/minikube-kuttl/auto2/01-bad-autoscaling.yaml new file mode 100644 index 000000000..71bbe17dd --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto2/01-bad-autoscaling.yaml @@ -0,0 +1,14 @@ +# Not all required fields are set, so autoscaling +# should not be enabled +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: scale2-runtime-component +spec: + resourceConstraints: + requests: + cpu: "0.2" + autoscaling: + minReplicas: 5 + targetCPUUtilizationPercentage: 50 + diff --git a/bundle/tests/scorecard/minikube-kuttl/auto2/01-errors.yaml b/bundle/tests/scorecard/minikube-kuttl/auto2/01-errors.yaml new file mode 100644 index 000000000..54889cd72 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto2/01-errors.yaml @@ -0,0 +1,4 @@ +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: scale2-runtime-component diff --git a/bundle/tests/scorecard/minikube-kuttl/auto3/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/auto3/00-assert.yaml new file mode 100644 index 000000000..c7927981d --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto3/00-assert.yaml @@ -0,0 +1,10 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: scale3-runtime-component +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/auto3/00-runtime-basic.yaml b/bundle/tests/scorecard/minikube-kuttl/auto3/00-runtime-basic.yaml new file mode 100644 index 000000000..2119fd03b --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto3/00-runtime-basic.yaml @@ -0,0 +1,8 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: scale3-runtime-component +spec: + # Add fields here + applicationImage: 'k8s.gcr.io/pause:2.0' + replicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/auto3/01-add-scaling.yaml b/bundle/tests/scorecard/minikube-kuttl/auto3/01-add-scaling.yaml new file mode 100644 index 000000000..a0ec64779 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto3/01-add-scaling.yaml @@ -0,0 +1,13 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: scale3-runtime-component +spec: + resourceConstraints: + requests: + cpu: "0.5" + autoscaling: + maxReplicas: 5 + minReplicas: 3 + targetCPUUtilizationPercentage: 50 + diff --git a/bundle/tests/scorecard/minikube-kuttl/auto3/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/auto3/01-assert.yaml new file mode 100644 index 000000000..6613a5bee --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto3/01-assert.yaml @@ -0,0 +1,19 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: scale3-runtime-component +status: + readyReplicas: 3 +--- +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: scale3-runtime-component +spec: + maxReplicas: 5 + minReplicas: 3 + targetCPUUtilizationPercentage: 50 diff --git a/bundle/tests/scorecard/minikube-kuttl/auto3/02-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/auto3/02-assert.yaml new file mode 100644 index 000000000..5d0dec3c4 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto3/02-assert.yaml @@ -0,0 +1,11 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: scale3-runtime-component +status: + readyReplicas: 1 + diff --git a/bundle/tests/scorecard/minikube-kuttl/auto3/02-errors.yaml b/bundle/tests/scorecard/minikube-kuttl/auto3/02-errors.yaml new file mode 100644 index 000000000..ada8c14e3 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto3/02-errors.yaml @@ -0,0 +1,5 @@ +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: scale3-runtime-component + diff --git a/bundle/tests/scorecard/minikube-kuttl/auto3/02-remove-scaling.yaml b/bundle/tests/scorecard/minikube-kuttl/auto3/02-remove-scaling.yaml new file mode 100644 index 000000000..599e8b477 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/auto3/02-remove-scaling.yaml @@ -0,0 +1,8 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: scale3-runtime-component +spec: + resourceConstraints: + autoscaling: + diff --git a/bundle/tests/scorecard/minikube-kuttl/basic/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/basic/00-assert.yaml new file mode 100644 index 000000000..bf48864bb --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/basic/00-assert.yaml @@ -0,0 +1,10 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: example-runtime-component +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/basic/00-runtime-basic.yaml b/bundle/tests/scorecard/minikube-kuttl/basic/00-runtime-basic.yaml new file mode 100644 index 000000000..28fdea291 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/basic/00-runtime-basic.yaml @@ -0,0 +1,9 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: example-runtime-component +spec: + # Add fields here + applicationImage: 'k8s.gcr.io/pause:2.0' + replicas: 1 + diff --git a/bundle/tests/scorecard/minikube-kuttl/basic/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/basic/01-assert.yaml new file mode 100644 index 000000000..3b21deca4 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/basic/01-assert.yaml @@ -0,0 +1,10 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: example-runtime-component +status: + readyReplicas: 2 diff --git a/bundle/tests/scorecard/minikube-kuttl/basic/01-runtime-basic-scale.yaml b/bundle/tests/scorecard/minikube-kuttl/basic/01-runtime-basic-scale.yaml new file mode 100644 index 000000000..ee863b74e --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/basic/01-runtime-basic-scale.yaml @@ -0,0 +1,7 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: example-runtime-component +spec: + replicas: 2 + diff --git a/bundle/tests/scorecard/minikube-kuttl/basic/02-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/basic/02-assert.yaml new file mode 100644 index 000000000..cf04dcec4 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/basic/02-assert.yaml @@ -0,0 +1,6 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: example-runtime-component +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/basic/02-runtime-basic-remove-reps.yaml b/bundle/tests/scorecard/minikube-kuttl/basic/02-runtime-basic-remove-reps.yaml new file mode 100644 index 000000000..3cadab789 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/basic/02-runtime-basic-remove-reps.yaml @@ -0,0 +1,7 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: example-runtime-component +spec: + replicas: + diff --git a/bundle/tests/scorecard/minikube-kuttl/day2operation/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/day2operation/00-assert.yaml new file mode 100644 index 000000000..4ff2d6fd9 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/day2operation/00-assert.yaml @@ -0,0 +1,10 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: day2-operation-rc +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/day2operation/00-runtime.yaml b/bundle/tests/scorecard/minikube-kuttl/day2operation/00-runtime.yaml new file mode 100644 index 000000000..b52e3b43f --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/day2operation/00-runtime.yaml @@ -0,0 +1,12 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: day2-operation-rc +spec: + # Add fields here + applicationImage: 'navidsh/demo-day' + replicas: 1 + statefulSet: + storage: + size: 100Mi + mountPath: /data diff --git a/bundle/tests/scorecard/minikube-kuttl/day2operation/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/day2operation/01-assert.yaml new file mode 100644 index 000000000..c000b92f3 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/day2operation/01-assert.yaml @@ -0,0 +1,13 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeOperation +metadata: + name: example-runtime-operation-0 +spec: + podName: day2-operation-rc-0 + containerName: app +status: + conditions: + - status: 'True' + type: Started + - status: 'True' + type: Completed \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/day2operation/01-day2operation.yaml b/bundle/tests/scorecard/minikube-kuttl/day2operation/01-day2operation.yaml new file mode 100644 index 000000000..63be40417 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/day2operation/01-day2operation.yaml @@ -0,0 +1,11 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeOperation +metadata: + name: example-runtime-operation-0 +spec: + podName: day2-operation-rc-0 + containerName: app + command: + - /bin/sh + - '-c' + - echo "Hello" > /tmp/runtime-operation.log \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/day2operation/02-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/day2operation/02-assert.yaml new file mode 100644 index 000000000..03e9e2ed7 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/day2operation/02-assert.yaml @@ -0,0 +1,10 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: day2-operation-rc +status: + replicas: 0 diff --git a/bundle/tests/scorecard/minikube-kuttl/day2operation/02-runtime-no-replicas.yaml b/bundle/tests/scorecard/minikube-kuttl/day2operation/02-runtime-no-replicas.yaml new file mode 100644 index 000000000..32b8ed776 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/day2operation/02-runtime-no-replicas.yaml @@ -0,0 +1,9 @@ +# Setting replicas to 0 - If no replicas then the day2 Operation should return False but continue to attempt to complete +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: day2-operation-rc +spec: + # Add fields here + applicationImage: 'navidsh/demo-day' + replicas: 0 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/day2operation/03-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/day2operation/03-assert.yaml new file mode 100644 index 000000000..abc444f59 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/day2operation/03-assert.yaml @@ -0,0 +1,12 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeOperation +metadata: + name: example-runtime-operation-1 +spec: + podName: day2-operation-rc-0 + containerName: app +status: + conditions: + - reason: Error + status: 'False' + type: Started \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/day2operation/03-day2operation-no-replicas.yaml b/bundle/tests/scorecard/minikube-kuttl/day2operation/03-day2operation-no-replicas.yaml new file mode 100644 index 000000000..376f57356 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/day2operation/03-day2operation-no-replicas.yaml @@ -0,0 +1,12 @@ +# If no replicas then the day2 Operation should return False but continue to attempt to complete +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeOperation +metadata: + name: example-runtime-operation-1 +spec: + podName: day2-operation-rc-0 + containerName: app + command: + - /bin/sh + - '-c' + - echo "Hello" > /tmp/runtime-operation.log \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/day2operation/04-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/day2operation/04-assert.yaml new file mode 100644 index 000000000..5a9af1280 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/day2operation/04-assert.yaml @@ -0,0 +1,24 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: day2-operation-rc +status: + readyReplicas: 1 +--- +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeOperation +metadata: + name: example-runtime-operation-1 +spec: + podName: day2-operation-rc-0 + containerName: app +status: + conditions: + - status: 'True' + type: Started + - status: 'True' + type: Completed diff --git a/bundle/tests/scorecard/minikube-kuttl/day2operation/04-runtime-new-replica.yaml b/bundle/tests/scorecard/minikube-kuttl/day2operation/04-runtime-new-replica.yaml new file mode 100644 index 000000000..bf31ce08a --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/day2operation/04-runtime-new-replica.yaml @@ -0,0 +1,9 @@ +# Once a new replica is running the day2 Operation should complete +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: day2-operation-rc +spec: + # Add fields here + applicationImage: 'navidsh/demo-day' + replicas: 1 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/day2operation/05-delete-operations.yaml b/bundle/tests/scorecard/minikube-kuttl/day2operation/05-delete-operations.yaml new file mode 100644 index 000000000..de74f76ae --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/day2operation/05-delete-operations.yaml @@ -0,0 +1,16 @@ +# Need to manually delete Runtime Operations as kuttl does not automatically delete these at the end of the test +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +delete: + - apiVersion: rc.app.stacks/v1beta2 + kind: RuntimeOperation + metadata: + name: example-runtime-operation-0 + - apiVersion: rc.app.stacks/v1beta2 + kind: RuntimeOperation + metadata: + name: example-runtime-operation-1 + - apiVersion: rc.app.stacks/v1beta2 + kind: RuntimeComponent + metadata: + name: day2-operation-rc \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/00-assert.yaml new file mode 100644 index 000000000..4741ddf47 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/00-assert.yaml @@ -0,0 +1,16 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 90 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: deployment-strategy-rc +spec: + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 1 + maxUnavailable: 2 +status: + readyReplicas: 3 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/00-runtime-rolling-update.yaml b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/00-runtime-rolling-update.yaml new file mode 100644 index 000000000..388f87a7e --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/00-runtime-rolling-update.yaml @@ -0,0 +1,14 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: deployment-strategy-rc +spec: + # Add fields here + applicationImage: k8s.gcr.io/pause:2.0 + replicas: 3 + deployment: + updateStrategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 1 + maxUnavailable: 2 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/01-assert.yaml new file mode 100644 index 000000000..752393ae6 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/01-assert.yaml @@ -0,0 +1,13 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: deployment-strategy-rc +spec: + strategy: + type: Recreate +status: + readyReplicas: 3 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/01-runtime-recreate-update.yaml b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/01-runtime-recreate-update.yaml new file mode 100644 index 000000000..f414ee97a --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/01-runtime-recreate-update.yaml @@ -0,0 +1,11 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: deployment-strategy-rc +spec: + # Add fields here + replicas: 3 + deployment: + updateStrategy: + rollingUpdate: null + type: Recreate \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/02-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/02-assert.yaml new file mode 100644 index 000000000..b3750b8a7 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/02-assert.yaml @@ -0,0 +1,13 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: deployment-strategy-rc +spec: + strategy: + type: RollingUpdate +status: + readyReplicas: 3 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/02-remove-strategy.yaml b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/02-remove-strategy.yaml new file mode 100644 index 000000000..67126f6e4 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/02-remove-strategy.yaml @@ -0,0 +1,9 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: deployment-strategy-rc +spec: + # Add fields here + replicas: 3 + deployment: + updateStrategy: \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/03-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/03-assert.yaml new file mode 100644 index 000000000..752393ae6 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/03-assert.yaml @@ -0,0 +1,13 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: deployment-strategy-rc +spec: + strategy: + type: Recreate +status: + readyReplicas: 3 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/03-runtime-recreate-update.yaml b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/03-runtime-recreate-update.yaml new file mode 100644 index 000000000..3341a1cf3 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/03-runtime-recreate-update.yaml @@ -0,0 +1,10 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: deployment-strategy-rc +spec: + # Add fields here + replicas: 3 + deployment: + updateStrategy: + type: Recreate \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/04-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/04-assert.yaml new file mode 100644 index 000000000..b3750b8a7 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/04-assert.yaml @@ -0,0 +1,13 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: deployment-strategy-rc +spec: + strategy: + type: RollingUpdate +status: + readyReplicas: 3 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/04-remove-deployment.yaml b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/04-remove-deployment.yaml new file mode 100644 index 000000000..3cf544661 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/deployment-strategy/04-remove-deployment.yaml @@ -0,0 +1,8 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: deployment-strategy-rc +spec: + # Add fields here + replicas: 3 + deployment: \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/ingress/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/ingress/00-assert.yaml new file mode 100644 index 000000000..a147387d4 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/ingress/00-assert.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ingress +status: + readyReplicas: 1 +--- +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ingress +spec: + rules: + - host: myapp.mycompany.com + http: + paths: + - path: / + pathType: Prefix + diff --git a/bundle/tests/scorecard/minikube-kuttl/ingress/00-ingress.yaml b/bundle/tests/scorecard/minikube-kuttl/ingress/00-ingress.yaml new file mode 100644 index 000000000..95b8b66e7 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/ingress/00-ingress.yaml @@ -0,0 +1,13 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: ingress +spec: + # Add fields here + applicationImage: 'k8s.gcr.io/pause:2.0' + replicas: 1 + expose: true + route: + host: myapp.mycompany.com + pathType: Prefix + path: "/" diff --git a/bundle/tests/scorecard/minikube-kuttl/ingress/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/ingress/01-assert.yaml new file mode 100644 index 000000000..246c3d3a5 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/ingress/01-assert.yaml @@ -0,0 +1,6 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ingress +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/ingress/01-delete-ingress.yaml b/bundle/tests/scorecard/minikube-kuttl/ingress/01-delete-ingress.yaml new file mode 100644 index 000000000..fc2bbf21e --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/ingress/01-delete-ingress.yaml @@ -0,0 +1,10 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: ingress +spec: + # Add fields here + applicationImage: 'k8s.gcr.io/pause:2.0' + replicas: 1 + expose: false + diff --git a/bundle/tests/scorecard/minikube-kuttl/ingress/01-errors.yaml b/bundle/tests/scorecard/minikube-kuttl/ingress/01-errors.yaml new file mode 100644 index 000000000..2d98cf8b3 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/ingress/01-errors.yaml @@ -0,0 +1,4 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ingress diff --git a/bundle/tests/scorecard/minikube-kuttl/kuttl-test.yaml b/bundle/tests/scorecard/minikube-kuttl/kuttl-test.yaml new file mode 100644 index 000000000..e57f28592 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/kuttl-test.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestSuite +parallel: 1 +timeout: 120 +startControlPlane: false diff --git a/bundle/tests/scorecard/minikube-kuttl/monitor/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/monitor/00-assert.yaml new file mode 100644 index 000000000..b4524bdc7 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/monitor/00-assert.yaml @@ -0,0 +1,10 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: service-monitor-rc +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/monitor/00-errors.yaml b/bundle/tests/scorecard/minikube-kuttl/monitor/00-errors.yaml new file mode 100644 index 000000000..138cb388a --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/monitor/00-errors.yaml @@ -0,0 +1,4 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: service-monitor-rc diff --git a/bundle/tests/scorecard/minikube-kuttl/monitor/00-runtime-basic.yaml b/bundle/tests/scorecard/minikube-kuttl/monitor/00-runtime-basic.yaml new file mode 100644 index 000000000..2d984fe22 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/monitor/00-runtime-basic.yaml @@ -0,0 +1,12 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: service-monitor-rc +spec: + # Add fields here + applicationImage: 'navidsh/demo-day' + service: + type: "ClusterIP" + port: 3000 + replicas: 1 + diff --git a/bundle/tests/scorecard/minikube-kuttl/monitor/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/monitor/01-assert.yaml new file mode 100644 index 000000000..4b6c6eb58 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/monitor/01-assert.yaml @@ -0,0 +1,16 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: service-monitor-rc +status: + readyReplicas: 1 +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: service-monitor-rc + diff --git a/bundle/tests/scorecard/minikube-kuttl/monitor/01-runtime-add-monitor.yaml b/bundle/tests/scorecard/minikube-kuttl/monitor/01-runtime-add-monitor.yaml new file mode 100644 index 000000000..b30300b3c --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/monitor/01-runtime-add-monitor.yaml @@ -0,0 +1,11 @@ +# Adding a label should be sufficient to cause the operator +# to create the monitor +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: service-monitor-rc +spec: + monitoring: + labels: + apps-prometheus: '' + diff --git a/bundle/tests/scorecard/minikube-kuttl/monitor/02-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/monitor/02-assert.yaml new file mode 100644 index 000000000..9bc936c05 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/monitor/02-assert.yaml @@ -0,0 +1,38 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: service-monitor-rc +status: + readyReplicas: 1 +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: service-monitor-rc +spec: + selector: + matchLabels: + app.kubernetes.io/instance: service-monitor-rc + endpoints: + - path: "/path" + scheme: "myScheme" + port: 3000-tcp + params: + params: + - param1 + - param2 + scrapeTimeout: 10s + interval: 30s + bearerTokenFile: myBTF + tlsConfig: + insecureSkipVerify: true + basicAuth: + password: + key: password + username: + key: username + diff --git a/bundle/tests/scorecard/minikube-kuttl/monitor/02-runtime-update-monitor.yaml b/bundle/tests/scorecard/minikube-kuttl/monitor/02-runtime-update-monitor.yaml new file mode 100644 index 000000000..f0f313770 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/monitor/02-runtime-update-monitor.yaml @@ -0,0 +1,24 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: service-monitor-rc +spec: + monitoring: + endpoints: + - path: "/path" + scheme: "myScheme" + params: + params: + - "param1" + - "param2" + interval: "30s" + scrapeTimeout: "10s" + tlsConfig: + insecureSkipVerify: true + bearerTokenFile: "myBTF" + basicAuth: + username: + key: "username" + password: + key: "password" + diff --git a/bundle/tests/scorecard/minikube-kuttl/monitor/03-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/monitor/03-assert.yaml new file mode 100644 index 000000000..ee83f376c --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/monitor/03-assert.yaml @@ -0,0 +1,6 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: service-monitor-rc +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/monitor/03-errors.yaml b/bundle/tests/scorecard/minikube-kuttl/monitor/03-errors.yaml new file mode 100644 index 000000000..138cb388a --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/monitor/03-errors.yaml @@ -0,0 +1,4 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: service-monitor-rc diff --git a/bundle/tests/scorecard/minikube-kuttl/monitor/03-remove-monitor.yaml b/bundle/tests/scorecard/minikube-kuttl/monitor/03-remove-monitor.yaml new file mode 100644 index 000000000..9ac440ae5 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/monitor/03-remove-monitor.yaml @@ -0,0 +1,6 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: service-monitor-rc +spec: + monitoring: diff --git a/bundle/tests/scorecard/minikube-kuttl/monitor/README.txt b/bundle/tests/scorecard/minikube-kuttl/monitor/README.txt new file mode 100644 index 000000000..f36d9c904 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/monitor/README.txt @@ -0,0 +1,3 @@ +This test requires monitoring to be enabled for user projects +See the Openshift documentation for how to enable this +https://docs.openshift.com/container-platform/4.6/monitoring/configuring-the-monitoring-stack.html diff --git a/bundle/tests/scorecard/minikube-kuttl/persistent-storage/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/00-assert.yaml new file mode 100644 index 000000000..76eff3c68 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/00-assert.yaml @@ -0,0 +1,6 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: persistent-rc +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/persistent-storage/00-errors.yaml b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/00-errors.yaml new file mode 100644 index 000000000..3ef19baa9 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/00-errors.yaml @@ -0,0 +1,4 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: persistent-rc diff --git a/bundle/tests/scorecard/minikube-kuttl/persistent-storage/00-persistent-storage-rc.yaml b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/00-persistent-storage-rc.yaml new file mode 100644 index 000000000..78d7cea0a --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/00-persistent-storage-rc.yaml @@ -0,0 +1,20 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: persistent-rc +spec: + applicationImage: navidsh/demo-day + replicas: 1 + volumeMounts: + - name: pvc + mountPath: /data + statefulSet: + storage: + volumeClaimTemplate: + metadata: + name: pvc + spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 15Mi diff --git a/bundle/tests/scorecard/minikube-kuttl/persistent-storage/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/01-assert.yaml new file mode 100644 index 000000000..76eff3c68 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/01-assert.yaml @@ -0,0 +1,6 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: persistent-rc +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/persistent-storage/01-errors.yaml b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/01-errors.yaml new file mode 100644 index 000000000..3ef19baa9 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/01-errors.yaml @@ -0,0 +1,4 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: persistent-rc diff --git a/bundle/tests/scorecard/minikube-kuttl/persistent-storage/01-no-storage-rc.yaml b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/01-no-storage-rc.yaml new file mode 100644 index 000000000..96cbeb3d5 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/01-no-storage-rc.yaml @@ -0,0 +1,9 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: persistent-rc +spec: + applicationImage: navidsh/demo-day + replicas: 1 + volumeMounts: + statefulSet: {} diff --git a/bundle/tests/scorecard/minikube-kuttl/persistent-storage/02-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/02-assert.yaml new file mode 100644 index 000000000..eecd29e78 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/02-assert.yaml @@ -0,0 +1,6 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: persistent-rc +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/persistent-storage/02-errors.yaml b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/02-errors.yaml new file mode 100644 index 000000000..13b1af2a9 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/02-errors.yaml @@ -0,0 +1,4 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: persistent-rc diff --git a/bundle/tests/scorecard/minikube-kuttl/persistent-storage/02-no-statefulset-rc.yaml b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/02-no-statefulset-rc.yaml new file mode 100644 index 000000000..3f343aa10 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/02-no-statefulset-rc.yaml @@ -0,0 +1,9 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: persistent-rc +spec: + applicationImage: navidsh/demo-day + replicas: 1 + volumeMounts: + statefulSet: diff --git a/bundle/tests/scorecard/minikube-kuttl/persistent-storage/README.txt b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/README.txt new file mode 100644 index 000000000..67d3f5eb9 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/persistent-storage/README.txt @@ -0,0 +1,2 @@ +In order to run this test, the cluster must +have a storage class enabled diff --git a/bundle/tests/scorecard/minikube-kuttl/probe/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/probe/00-assert.yaml new file mode 100644 index 000000000..5adaf1d0d --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/probe/00-assert.yaml @@ -0,0 +1,34 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 120 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: probes-rc +status: + readyReplicas: 1 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: probes-rc +spec: + template: + containers: +spec: + selector: + matchLabels: + app.kubernetes.io/instance: probes-rc + template: + spec: + containers: + - readinessProbe: + initialDelaySeconds: 1 + livenessProbe: + initialDelaySeconds: 4 + startupProbe: + failureThreshold: 10 + periodSeconds: 5 +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/probe/00-runtime-probe.yaml b/bundle/tests/scorecard/minikube-kuttl/probe/00-runtime-probe.yaml new file mode 100644 index 000000000..50ddcf80a --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/probe/00-runtime-probe.yaml @@ -0,0 +1,29 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: probes-rc +spec: + # Add fields here + applicationImage: navidsh/demo-day + service: + type: "ClusterIP" + port: 3000 + replicas: 1 + probes: + startup: + failureThreshold: 10 + periodSeconds: 5 + httpGet: + path: "/" + port: 3000 + liveness: + initialDelaySeconds: 4 + httpGet: + path: "/" + port: 3000 + readiness: + initialDelaySeconds: 1 + httpGet: + path: "/" + port: 3000 + diff --git a/bundle/tests/scorecard/minikube-kuttl/probe/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/probe/01-assert.yaml new file mode 100644 index 000000000..c57c17a09 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/probe/01-assert.yaml @@ -0,0 +1,27 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: probes-rc +spec: + template: + containers: +spec: + selector: + matchLabels: + app.kubernetes.io/instance: probes-rc + template: + spec: + containers: + - readinessProbe: + initialDelaySeconds: 3 + livenessProbe: + initialDelaySeconds: 6 + startupProbe: + failureThreshold: 20 + periodSeconds: 10 +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/probe/01-runtime-update-probe.yaml b/bundle/tests/scorecard/minikube-kuttl/probe/01-runtime-update-probe.yaml new file mode 100644 index 000000000..293e07988 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/probe/01-runtime-update-probe.yaml @@ -0,0 +1,14 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: probes-rc +spec: + probes: + liveness: + initialDelaySeconds: 6 + readiness: + initialDelaySeconds: 3 + startup: + failureThreshold: 20 + periodSeconds: 10 + diff --git a/bundle/tests/scorecard/minikube-kuttl/probe/02-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/probe/02-assert.yaml new file mode 100644 index 000000000..5dffbb33a --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/probe/02-assert.yaml @@ -0,0 +1,10 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: probes-rc +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/probe/02-errors.yaml b/bundle/tests/scorecard/minikube-kuttl/probe/02-errors.yaml new file mode 100644 index 000000000..7c164af63 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/probe/02-errors.yaml @@ -0,0 +1,23 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: probes-rc +spec: + template: + containers: +spec: + selector: + matchLabels: + app.kubernetes.io/instance: probes-rc + template: + spec: + containers: + - readinessProbe: + initialDelaySeconds: 3 + livenessProbe: + initialDelaySeconds: 6 + startupProbe: + failureThreshold: 20 + periodSeconds: 10 +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/probe/02-runtime-remove-probe.yaml b/bundle/tests/scorecard/minikube-kuttl/probe/02-runtime-remove-probe.yaml new file mode 100644 index 000000000..ee8fd7812 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/probe/02-runtime-remove-probe.yaml @@ -0,0 +1,7 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: probes-rc +spec: + # Add fields here + probes: diff --git a/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/00-always.yaml b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/00-always.yaml new file mode 100644 index 000000000..cd28a2117 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/00-always.yaml @@ -0,0 +1,9 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: example-runtime-component +spec: + applicationImage: navidsh/demo-day + replicas: 1 + pullPolicy: "Always" + diff --git a/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/00-assert.yaml new file mode 100644 index 000000000..e487c864e --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/00-assert.yaml @@ -0,0 +1,19 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: example-runtime-component +status: + readyReplicas: 1 +--- +apiVersion: v1 +kind: Pod +spec: + containers: + - imagePullPolicy: "Always" +metadata: + labels: + app.kubernetes.io/instance: example-runtime-component diff --git a/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/01-assert.yaml new file mode 100644 index 000000000..639c91715 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/01-assert.yaml @@ -0,0 +1,19 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: example-runtime-component +status: + readyReplicas: 1 +--- +apiVersion: v1 +kind: Pod +spec: + containers: + - imagePullPolicy: "IfNotPresent" +metadata: + labels: + app.kubernetes.io/instance: example-runtime-component diff --git a/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/01-ifNotPresent.yaml b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/01-ifNotPresent.yaml new file mode 100644 index 000000000..475e40f3d --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/01-ifNotPresent.yaml @@ -0,0 +1,9 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: example-runtime-component +spec: + applicationImage: navidsh/demo-day + replicas: 1 + pullPolicy: "IfNotPresent" + diff --git a/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/02-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/02-assert.yaml new file mode 100644 index 000000000..fe79b2326 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/02-assert.yaml @@ -0,0 +1,19 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: example-runtime-component +status: + readyReplicas: 1 +--- +apiVersion: v1 +kind: Pod +spec: + containers: + - imagePullPolicy: "Never" +metadata: + labels: + app.kubernetes.io/instance: example-runtime-component diff --git a/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/02-never.yaml b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/02-never.yaml new file mode 100644 index 000000000..fdd30903a --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/02-never.yaml @@ -0,0 +1,8 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: example-runtime-component +spec: + applicationImage: navidsh/demo-day + replicas: 1 + pullPolicy: "Never" diff --git a/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/03-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/03-assert.yaml new file mode 100644 index 000000000..7f6a2dafa --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/03-assert.yaml @@ -0,0 +1,19 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: example-runtime-component +status: + readyReplicas: 1 +--- +apiVersion: v1 +kind: Pod +spec: + containers: + - imagePullPolicy: IfNotPresent +metadata: + labels: + app.kubernetes.io/instance: example-runtime-component diff --git a/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/03-default.yaml b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/03-default.yaml new file mode 100644 index 000000000..13426d481 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/runtime_pullpolicy/03-default.yaml @@ -0,0 +1,8 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: example-runtime-component +spec: + applicationImage: navidsh/demo-day + replicas: 1 + pullPolicy: null \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/service-binding1/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/service-binding1/00-assert.yaml new file mode 100644 index 000000000..33067bb1c --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-binding1/00-assert.yaml @@ -0,0 +1,25 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: service-binding-rc +status: + binding: + name: service-binding-rc-expose-binding +--- +apiVersion: v1 +kind: Service +metadata: + name: service-binding-rc +spec: + ports: + - port: 8080 +--- +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + name: service-binding-rc-expose-binding \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/service-binding1/00-service-binding.yaml b/bundle/tests/scorecard/minikube-kuttl/service-binding1/00-service-binding.yaml new file mode 100644 index 000000000..a493afc9f --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-binding1/00-service-binding.yaml @@ -0,0 +1,11 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: service-binding-rc +spec: + # Add fields here + applicationImage: k8s.gcr.io/pause:2.0 + replicas: 1 + service: + bindable: true + port: 8080 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/service-binding1/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/service-binding1/01-assert.yaml new file mode 100644 index 000000000..a729bac0b --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-binding1/01-assert.yaml @@ -0,0 +1,11 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: v1 +kind: Service +metadata: + name: service-binding-rc +spec: + ports: + - port: 8080 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/service-binding1/01-errors.yaml b/bundle/tests/scorecard/minikube-kuttl/service-binding1/01-errors.yaml new file mode 100644 index 000000000..464238c34 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-binding1/01-errors.yaml @@ -0,0 +1,13 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: service-binding-rc +status: + binding: + name: service-binding-rc-expose-binding +--- +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + name: service-binding-rc-expose-binding \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/service-binding1/01-remove-service-binding.yaml b/bundle/tests/scorecard/minikube-kuttl/service-binding1/01-remove-service-binding.yaml new file mode 100644 index 000000000..be36a2d82 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-binding1/01-remove-service-binding.yaml @@ -0,0 +1,9 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: service-binding-rc +spec: + # Add fields here + replicas: 1 + service: + bindable: false \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/service-binding2/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/service-binding2/00-assert.yaml new file mode 100644 index 000000000..33067bb1c --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-binding2/00-assert.yaml @@ -0,0 +1,25 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: service-binding-rc +status: + binding: + name: service-binding-rc-expose-binding +--- +apiVersion: v1 +kind: Service +metadata: + name: service-binding-rc +spec: + ports: + - port: 8080 +--- +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + name: service-binding-rc-expose-binding \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/service-binding2/00-service-binding.yaml b/bundle/tests/scorecard/minikube-kuttl/service-binding2/00-service-binding.yaml new file mode 100644 index 000000000..a493afc9f --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-binding2/00-service-binding.yaml @@ -0,0 +1,11 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: service-binding-rc +spec: + # Add fields here + applicationImage: k8s.gcr.io/pause:2.0 + replicas: 1 + service: + bindable: true + port: 8080 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/service-binding2/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/service-binding2/01-assert.yaml new file mode 100644 index 000000000..a729bac0b --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-binding2/01-assert.yaml @@ -0,0 +1,11 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: v1 +kind: Service +metadata: + name: service-binding-rc +spec: + ports: + - port: 8080 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/service-binding2/01-errors.yaml b/bundle/tests/scorecard/minikube-kuttl/service-binding2/01-errors.yaml new file mode 100644 index 000000000..464238c34 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-binding2/01-errors.yaml @@ -0,0 +1,13 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: service-binding-rc +status: + binding: + name: service-binding-rc-expose-binding +--- +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + name: service-binding-rc-expose-binding \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/service-binding2/01-remove-service-binding.yaml b/bundle/tests/scorecard/minikube-kuttl/service-binding2/01-remove-service-binding.yaml new file mode 100644 index 000000000..ecc2f0b94 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-binding2/01-remove-service-binding.yaml @@ -0,0 +1,9 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: service-binding-rc +spec: + # Add fields here + replicas: 1 + service: + bindable: \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/service-certificate/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/service-certificate/00-assert.yaml new file mode 100644 index 000000000..24793678c --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-certificate/00-assert.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Secret +type: kubernetes.io/tls +metadata: + name: service-tls-secret +data: + ca.crt: Y2FjcnQK + destCA.crt: ZGVzdENBY3J0Cg== + tls.crt: dGxzY3J0Cg== + tls.key: dGxza2V5Cg== diff --git a/bundle/tests/scorecard/minikube-kuttl/service-certificate/00-secret.yaml b/bundle/tests/scorecard/minikube-kuttl/service-certificate/00-secret.yaml new file mode 100644 index 000000000..2af326186 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-certificate/00-secret.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Secret +metadata: + name: service-tls-secret +type: kubernetes.io/tls +data: + # 'tlscrt' + tls.crt: dGxzY3J0Cg== + # 'tlskey' + tls.key: dGxza2V5Cg== + # 'cacrt' + ca.crt: Y2FjcnQK + # 'destCAcrt' + destCA.crt: ZGVzdENBY3J0Cg== diff --git a/bundle/tests/scorecard/minikube-kuttl/service-certificate/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/service-certificate/01-assert.yaml new file mode 100644 index 000000000..36706a8cb --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-certificate/01-assert.yaml @@ -0,0 +1,14 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: service-with-cert-rc +status: + readyReplicas: 1 +spec: + template: + spec: + volumes: + - name: svc-certificate + secret: + defaultMode: 420 + secretName: service-tls-secret diff --git a/bundle/tests/scorecard/minikube-kuttl/service-certificate/01-rc-with-cert.yaml b/bundle/tests/scorecard/minikube-kuttl/service-certificate/01-rc-with-cert.yaml new file mode 100644 index 000000000..a1ee7cd30 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-certificate/01-rc-with-cert.yaml @@ -0,0 +1,11 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: service-with-cert-rc +spec: + # Add fields here + applicationImage: 'k8s.gcr.io/pause:2.0' + replicas: 1 + service: + certificateSecretRef: service-tls-secret + diff --git a/bundle/tests/scorecard/minikube-kuttl/service-certificate/02-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/service-certificate/02-assert.yaml new file mode 100644 index 000000000..b5efe2b2a --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-certificate/02-assert.yaml @@ -0,0 +1,6 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: service-with-cert-rc +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/service-certificate/02-errors.yaml b/bundle/tests/scorecard/minikube-kuttl/service-certificate/02-errors.yaml new file mode 100644 index 000000000..ca7cdf181 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-certificate/02-errors.yaml @@ -0,0 +1,12 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: service-with-cert-rc +spec: + template: + spec: + volumes: + - name: svc-certificate + secret: + defaultMode: 420 + secretName: service-tls-secret diff --git a/bundle/tests/scorecard/minikube-kuttl/service-certificate/02-remove-cert.yaml b/bundle/tests/scorecard/minikube-kuttl/service-certificate/02-remove-cert.yaml new file mode 100644 index 000000000..07e1772b0 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-certificate/02-remove-cert.yaml @@ -0,0 +1,11 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: service-with-cert-rc +spec: + # Add fields here + applicationImage: 'k8s.gcr.io/pause:2.0' + replicas: 1 + service: + certificateSecretRef: + diff --git a/bundle/tests/scorecard/minikube-kuttl/service-certificate/03-delete-secret.yaml b/bundle/tests/scorecard/minikube-kuttl/service-certificate/03-delete-secret.yaml new file mode 100644 index 000000000..56df55a5a --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/service-certificate/03-delete-secret.yaml @@ -0,0 +1,9 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +delete: +- apiVersion: rc.app.stacks/v1beta2 + kind: RuntimeComponent +- apiVersion: v1 + kind: Secret + name: service-tls-secret + diff --git a/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/00-assert.yaml new file mode 100644 index 000000000..7bd4a4573 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/00-assert.yaml @@ -0,0 +1,15 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 90 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: statefulset-strategy-rc +spec: + updateStrategy: + type: RollingUpdate + rollingUpdate: + partition: 2 +status: + readyReplicas: 3 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/00-runtime-rolling-update.yaml b/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/00-runtime-rolling-update.yaml new file mode 100644 index 000000000..c1fe04bd4 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/00-runtime-rolling-update.yaml @@ -0,0 +1,16 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: statefulset-strategy-rc +spec: + # Add fields here + applicationImage: k8s.gcr.io/pause:2.0 + replicas: 3 + statefulSet: + updateStrategy: + type: RollingUpdate + rollingUpdate: + partition: 2 + storage: + size: 100Mi + mountPath: /data \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/01-assert.yaml new file mode 100644 index 000000000..744c42ae9 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/01-assert.yaml @@ -0,0 +1,13 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: statefulset-strategy-rc +spec: + updateStrategy: + type: OnDelete +status: + readyReplicas: 3 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/01-runtime-ondelete-update.yaml b/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/01-runtime-ondelete-update.yaml new file mode 100644 index 000000000..1dea007c8 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/01-runtime-ondelete-update.yaml @@ -0,0 +1,11 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: statefulset-strategy-rc +spec: + # Add fields here + replicas: 3 + statefulSet: + updateStrategy: + rollingUpdate: null + type: OnDelete \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/02-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/02-assert.yaml new file mode 100644 index 000000000..6efe1bf5b --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/02-assert.yaml @@ -0,0 +1,13 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: statefulset-strategy-rc +spec: + updateStrategy: + type: RollingUpdate +status: + readyReplicas: 3 \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/02-remove-strategy.yaml b/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/02-remove-strategy.yaml new file mode 100644 index 000000000..bc18bfad6 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/02-remove-strategy.yaml @@ -0,0 +1,9 @@ +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: statefulset-strategy-rc +spec: + # Add fields here + replicas: 3 + statefulSet: + updateStrategy: \ No newline at end of file diff --git a/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/README.txt b/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/README.txt new file mode 100644 index 000000000..67d3f5eb9 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/statefulset-strategy/README.txt @@ -0,0 +1,2 @@ +In order to run this test, the cluster must +have a storage class enabled diff --git a/bundle/tests/scorecard/minikube-kuttl/storage/00-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/storage/00-assert.yaml new file mode 100644 index 000000000..c5177bc20 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/storage/00-assert.yaml @@ -0,0 +1,10 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: storage-rc +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/storage/00-runtime-storage.yaml b/bundle/tests/scorecard/minikube-kuttl/storage/00-runtime-storage.yaml new file mode 100644 index 000000000..d181ff923 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/storage/00-runtime-storage.yaml @@ -0,0 +1,15 @@ +# With some storage configured, the operator +# should create a stateful set +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: storage-rc +spec: + # Add fields here + applicationImage: 'k8s.gcr.io/pause:2.0' + replicas: 1 + statefulSet: + storage: + size: "10Mi" + mountPath: "/mnt/data" + diff --git a/bundle/tests/scorecard/minikube-kuttl/storage/01-assert.yaml b/bundle/tests/scorecard/minikube-kuttl/storage/01-assert.yaml new file mode 100644 index 000000000..359d14c02 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/storage/01-assert.yaml @@ -0,0 +1,10 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 60 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: storage-rc +status: + readyReplicas: 1 diff --git a/bundle/tests/scorecard/minikube-kuttl/storage/01-runtime-no-storage.yaml b/bundle/tests/scorecard/minikube-kuttl/storage/01-runtime-no-storage.yaml new file mode 100644 index 000000000..baca84ca0 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/storage/01-runtime-no-storage.yaml @@ -0,0 +1,12 @@ +# Removing the storage, and the operator should +# move from a stateful set back to a deployment +apiVersion: rc.app.stacks/v1beta2 +kind: RuntimeComponent +metadata: + name: storage-rc +spec: + # Add fields here + applicationImage: 'k8s.gcr.io/pause:2.0' + replicas: 1 + statefulSet: + diff --git a/bundle/tests/scorecard/minikube-kuttl/storage/README.txt b/bundle/tests/scorecard/minikube-kuttl/storage/README.txt new file mode 100644 index 000000000..67d3f5eb9 --- /dev/null +++ b/bundle/tests/scorecard/minikube-kuttl/storage/README.txt @@ -0,0 +1,2 @@ +In order to run this test, the cluster must +have a storage class enabled diff --git a/config/rbac/minikube-kuttl-rbac.yaml b/config/rbac/minikube-kuttl-rbac.yaml new file mode 100644 index 000000000..fb40fa107 --- /dev/null +++ b/config/rbac/minikube-kuttl-rbac.yaml @@ -0,0 +1,110 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: scorecard-kuttl +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: scorecard-kuttl +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: scorecard-kuttl +subjects: +- kind: ServiceAccount + name: scorecard-kuttl +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: scorecard-kuttl +rules: +- apiGroups: + - "" + resources: + - secrets + verbs: + - get + - list + - create + - delete +- apiGroups: + - "" + resources: + - namespaces + - pods + - services + - routes + verbs: + - get + - list +- apiGroups: + - apps + resources: + - deployments + - statefulsets + verbs: + - get +- apiGroups: + - autoscaling + resources: + - horizontalpodautoscalers + verbs: + - get +- apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - get +- apiGroups: + - image.openshift.io + resources: + - imagestreams + verbs: + - get + - list + - create + - patch + - delete +- apiGroups: + - events.k8s.io + resources: + - events + verbs: + - get + - list +- apiGroups: + - serving.knative.dev + resources: + - services + verbs: + - get +- apiGroups: + - rc.app.stacks + resources: + - runtimecomponents + - runtimeoperations + verbs: + - get + - list + - create + - patch + - delete +- apiGroups: + - route.openshift.io + resources: + - routes + verbs: + - get + - list + - delete +- apiGroups: + - extensions + resources: + - ingresses + verbs: + - get + - list + - delete diff --git a/scripts/e2e-minikube.sh b/scripts/e2e-minikube.sh new file mode 100755 index 000000000..74c0802c3 --- /dev/null +++ b/scripts/e2e-minikube.sh @@ -0,0 +1,98 @@ +#!/bin/bash + +readonly usage="Usage: e2e-minikube.sh -n " +readonly SERVICE_ACCOUNT="travis-tests" + +# setup_env: Download kubectl cli and Minikube, start Minikube, and create a test project +setup_env() { + # Install Minikube and Start a cluster + echo "****** Installing and starting Minikube" + scripts/installers/install-minikube.sh + + echo "****** Creating test namespace: ${TEST_NAMESPACE}" + kubectl create namespace "${TEST_NAMESPACE}" + kubectl config set-context $(kubectl config current-context) --namespace="${TEST_NAMESPACE}" + + ## Create service account for Kuttl tests + kubectl apply -f config/rbac/minikube-kuttl-rbac.yaml +} + +# install_rco: Kustomize and install Runtime-Component-Operator +install_rco() { + echo "****** Install RCO in namespace: ${TEST_NAMESPACE}" + kubectl apply -f bundle/manifests/rc.app.stacks_runtimecomponents.yaml + kubectl apply -f bundle/manifests/rc.app.stacks_runtimeoperations.yaml + kubectl apply -f deploy/kustomize/daily/base/runtime-component-operator.yaml -n ${TEST_NAMESPACE} +} + +function install_tools() { + echo "****** Install Prometheus" + kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/bundle.yaml + + echo "****** Enable Ingress" + minikube addons enable ingress +} + +## cleanup_env : Delete generated resources that are not bound to a test TEST_NAMESPACE. +cleanup_env() { + kubectl delete namespace "${TEST_NAMESPACE}" + minikube stop +} + +main() { + parse_args "$@" + + if [[ -z "${TEST_NAMESPACE}" ]]; then + echo "****** Missing test namespace, see usage" + echo "${usage}" + exit 1 + fi + + echo "****** Setting up test environment..." + setup_env + install_rco + install_tools + + # Wait for operator deployment to be ready + while [[ $(kubectl get deploy rco-controller-manager -o jsonpath='{ .status.readyReplicas }') -ne "1" ]]; do + echo "****** Waiting for rco-controller-manager to be ready..." + sleep 10 + done + echo "****** rco-controller-manager deployment is ready..." + + echo "****** Starting minikube scorecard tests..." + mv bundle/tests/scorecard/kuttl/ bundle/tests/scorecard/disable-kuttl/ + mv bundle/tests/scorecard/minikube-kuttl/ bundle/tests/scorecard/kuttl/ + + operator-sdk scorecard --verbose --selector=suite=kuttlsuite --namespace "${TEST_NAMESPACE}" --service-account scorecard-kuttl --wait-time 30m ./bundle || { + echo "****** Scorecard tests failed..." + } + result=$? + + mv bundle/tests/scorecard/kuttl/ bundle/tests/scorecard/minikube-kuttl/ + mv bundle/tests/scorecard/disable-kuttl/ bundle/tests/scorecard/kuttl/ + + echo "****** Cleaning up test environment..." + cleanup_env + + echo "****** Minikube stopped" +} + +parse_args() { + while [ $# -gt 0 ]; do + case "$1" in + -n) + shift + readonly TEST_NAMESPACE="${1}" + ;; + *) + echo "Error: Invalid argument - $1" + echo "$usage" + exit 1 + ;; + esac + shift + done +} + +main "$@" diff --git a/scripts/installers/install-minikube.sh b/scripts/installers/install-minikube.sh index 7027dd1fe..555acc78e 100755 --- a/scripts/installers/install-minikube.sh +++ b/scripts/installers/install-minikube.sh @@ -10,44 +10,53 @@ export CHANGE_MINIKUBE_NONE_USER=true export KUBECONFIG=$HOME/.kube/config function main () { - echo "****** Installing minikube..." install_minikube echo "****** Verifying installation..." kubectl cluster-info wait_for_kube - ## Run tests below - echo "Minikube enabled job is running..." + + echo "****** Minikube enabled job is running..." } function install_minikube() { + echo "****** Installing minikube for linux..." + sudo apt-get update -y sudo apt-get -qq -y install conntrack + ## get kubectl - curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.18.1/bin/linux/amd64/kubectl \ - && chmod +x kubectl \ - && sudo mv kubectl /usr/local/bin/ + echo "****** Installing kubectl v1.20.1..." + curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.20.1/bin/linux/amd64/kubectl \ + && chmod +x kubectl \ + && sudo mv kubectl /usr/local/bin/ + ## Download minikube - curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.8.1/minikube-linux-amd64 \ - && chmod +x minikube \ - && sudo mv minikube /usr/local/bin/ + echo "****** Installing Minikube v1.21.0..." + curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.21.0/minikube-linux-amd64 \ + && chmod +x minikube \ + && sudo mv minikube /usr/local/bin/ + mkdir -p $HOME/.kube $HOME/.minikube touch $KUBECONFIG - sudo minikube start --profile=minikube --vm-driver=none --kubernetes-version=v1.18.1 + minikube start --profile=minikube --kubernetes-version=v1.20.1 minikube update-context --profile=minikube eval "$(minikube docker-env --profile=minikube)" && export DOCKER_CLI='docker' } + function wait_for_kube() { local json_path='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}' + echo "****** Waiting for kube-controller-manager to be available..." - until kubectl -n kube-system get pods -l k8s-app=kube-dns -o jsonpath="$json_path" 2>&1 | grep -q "Ready=True"; do - sleep 5;echo "waiting for kube-dns to be available" - kubectl get pods --all-namespaces + until kubectl -n kube-system get pods -l component=kube-controller-manager -o jsonpath="$json_path" 2>&1 | grep -q "Ready=True"; do + sleep 5; done + + kubectl get pods --all-namespaces } main "$@"