Skip to content

Commit

Permalink
e2e testing for Minikube (#288)
Browse files Browse the repository at this point in the history
* e2e testing for Minikube

* Ingress certificate test edit
  • Loading branch information
halim-lee authored Dec 1, 2021
1 parent 44c89e6 commit 13c5c36
Show file tree
Hide file tree
Showing 20 changed files with 481 additions and 62 deletions.
29 changes: 14 additions & 15 deletions bundle/tests/scorecard/kuttl/probe/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: probes-rc
spec:
selector:
matchLabels:
app.kubernetes.io/instance: probes-rc
template:
spec:
containers:
- readinessProbe:
initialDelaySeconds: 1
livenessProbe:
initialDelaySeconds: 4
startupProbe:
failureThreshold: 10
periodSeconds: 5
status:
replicas: 1
readyReplicas: 1
updatedReplicas: 1
---
apiVersion: v1
kind: Pod
spec:
containers:
- startupProbe:
failureThreshold: 10
periodSeconds: 5
readinessProbe:
initialDelaySeconds: 1
livenessProbe:
initialDelaySeconds: 4
metadata:
labels:
app.kubernetes.io/instance: probes-rc
29 changes: 14 additions & 15 deletions bundle/tests/scorecard/kuttl/probe/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: probes-rc
spec:
selector:
matchLabels:
app.kubernetes.io/instance: probes-rc
template:
spec:
containers:
- readinessProbe:
initialDelaySeconds: 3
livenessProbe:
initialDelaySeconds: 6
startupProbe:
failureThreshold: 20
periodSeconds: 10
status:
replicas: 1
readyReplicas: 1
updatedReplicas: 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
34 changes: 21 additions & 13 deletions bundle/tests/scorecard/kuttl/probe/02-errors.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
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:
selector:
matchLabels:
app.kubernetes.io/instance: probes-rc
template:
spec:
containers:
- readinessProbe:
initialDelaySeconds: 3
livenessProbe:
initialDelaySeconds: 6
startupProbe:
failureThreshold: 20
periodSeconds: 10
status:
replicas: 1
readyReplicas: 1
updatedReplicas: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
type: kubernetes.io/tls
metadata:
name: ingress-tls-secret
data:
ca.crt: Y2FjcnQK
destCA.crt: ZGVzdENBY3J0Cg==
tls.crt: dGxzY3J0Cg==
tls.key: dGxza2V5Cg==
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Secret
metadata:
name: ingress-tls-secret
type: kubernetes.io/tls
data:
# 'tlscrt'
tls.crt: dGxzY3J0Cg==
# 'tlskey'
tls.key: dGxza2V5Cg==
# 'cacrt'
ca.crt: Y2FjcnQK
# 'destCAcrt'
destCA.crt: ZGVzdENBY3J0Cg==
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ingress-with-cert-rc
status:
replicas: 1
readyReplicas: 1
updatedReplicas: 1
---
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: ingress-with-cert-rc
spec:
tls:
- hosts:
- myapp.mycompany.com
secretName: ingress-tls-secret
rules:
- host: myapp.mycompany.com
http:
paths:
- path: /
pathType: Prefix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: rc.app.stacks/v1beta2
kind: RuntimeComponent
metadata:
name: ingress-with-cert-rc
spec:
# Add fields here
applicationImage: 'k8s.gcr.io/pause:2.0'
replicas: 1
expose: true
route:
host: myapp.mycompany.com
path: "/"
pathType: Prefix
certificateSecretRef: ingress-tls-secret
termination: reencrypt

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ingress-with-cert-rc
status:
replicas: 1
readyReplicas: 1
updatedReplicas: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: rc.app.stacks/v1beta2
kind: RuntimeComponent
metadata:
name: ingress-with-cert-rc
spec:
# Add fields here
applicationImage: 'k8s.gcr.io/pause:2.0'
replicas: 1
expose: false

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: ingress-with-cert-rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
delete:
- apiVersion: rc.app.stacks/v1beta2
kind: RuntimeComponent
- apiVersion: v1
kind: Secret
name: ingress-tls-secret

21 changes: 21 additions & 0 deletions bundle/tests/scorecard/minikube-kuttl/ingress/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ingress
status:
replicas: 1
readyReplicas: 1
updatedReplicas: 1
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress
spec:
rules:
- host: myapp.mycompany.com
http:
paths:
- path: /
pathType: Prefix

13 changes: 13 additions & 0 deletions bundle/tests/scorecard/minikube-kuttl/ingress/00-ingress.yaml
Original file line number Diff line number Diff line change
@@ -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
path: "/"
pathType: Prefix
8 changes: 8 additions & 0 deletions bundle/tests/scorecard/minikube-kuttl/ingress/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ingress
status:
replicas: 1
readyReplicas: 1
updatedReplicas: 1
Original file line number Diff line number Diff line change
@@ -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

4 changes: 4 additions & 0 deletions bundle/tests/scorecard/minikube-kuttl/ingress/01-errors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress
110 changes: 110 additions & 0 deletions config/rbac/minikube-kuttl-rbac.yaml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 3 additions & 4 deletions deploy/kustomize/daily/base/runtime-component-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,9 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: WATCH_NAMESPACE
value: default
# valueFrom:
# fieldRef:
# fieldPath: metadata.annotations['olm.targetNamespaces']
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: applicationstacks/operator:daily
imagePullPolicy: Always
name: manager
Expand Down
Loading

0 comments on commit 13c5c36

Please sign in to comment.