Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ConfigMap tests supporting AllNamespaces and SingleNamespace install modes #256

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: configmap-wsliberty-app
status:
replicas: 1
readyReplicas: 1
updatedReplicas: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: liberty.websphere.ibm.com/v1
kind: WebSphereLibertyApplication
metadata:
name: configmap-wsliberty-app
spec:
applicationImage: icr.io/appcafe/websphere-liberty:full-java8-openj9-ubi
license:
accept: true
replicas: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: kubectl delete webspherelibertyapplications --all --all-namespaces
- command: kubectl delete configmap websphere-liberty-operator -n openshift-operators
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: websphere-liberty-operator
namespace: openshift-operators
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: websphere-liberty-operator
namespace: openshift-operators
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: liberty.websphere.ibm.com/v1
kind: WebSphereLibertyApplication
metadata:
name: configmap-wsliberty-app
spec:
applicationImage: icr.io/appcafe/websphere-liberty:full-java8-openj9-ubi
license:
accept: true
replicas: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: configmap-wsliberty-app
status:
replicas: 1
readyReplicas: 1
updatedReplicas: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: liberty.websphere.ibm.com/v1
kind: WebSphereLibertyApplication
metadata:
name: configmap-wsliberty-app
spec:
applicationImage: icr.io/appcafe/websphere-liberty:full-java8-openj9-ubi
license:
accept: true
replicas: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: kubectl delete webspherelibertyapplications --all
namespaced: true
- command: kubectl delete configmap websphere-liberty-operator -n WEBSPHERE_LIBERTY_OPERATOR_NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: websphere-liberty-operator
namespace: WEBSPHERE_LIBERTY_OPERATOR_NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: websphere-liberty-operator
namespace: WEBSPHERE_LIBERTY_OPERATOR_NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: liberty.websphere.ibm.com/v1
kind: WebSphereLibertyApplication
metadata:
name: configmap-wsliberty-app
spec:
applicationImage: icr.io/appcafe/websphere-liberty:full-java8-openj9-ubi
license:
accept: true
replicas: 1
8 changes: 8 additions & 0 deletions bundle/tests/scorecard/kuttl/configmap/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: configmap-wsliberty-app
status:
replicas: 1
readyReplicas: 1
updatedReplicas: 1
9 changes: 9 additions & 0 deletions bundle/tests/scorecard/kuttl/configmap/00-dry-run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: liberty.websphere.ibm.com/v1
kind: WebSphereLibertyApplication
metadata:
name: configmap-wsliberty-app
spec:
applicationImage: icr.io/appcafe/websphere-liberty:full-java8-openj9-ubi
license:
accept: true
replicas: 1
7 changes: 7 additions & 0 deletions bundle/tests/scorecard/kuttl/configmap/01-delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: kubectl delete webspherelibertyapplications --all
namespaced: true
- command: kubectl delete configmap websphere-liberty-operator
namespaced: true
4 changes: 4 additions & 0 deletions bundle/tests/scorecard/kuttl/configmap/01-errors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: websphere-liberty-operator
4 changes: 4 additions & 0 deletions bundle/tests/scorecard/kuttl/configmap/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: websphere-liberty-operator
9 changes: 9 additions & 0 deletions bundle/tests/scorecard/kuttl/configmap/02-liberty.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: liberty.websphere.ibm.com/v1
kind: WebSphereLibertyApplication
metadata:
name: configmap-wsliberty-app
spec:
applicationImage: icr.io/appcafe/websphere-liberty:full-java8-openj9-ubi
license:
accept: true
replicas: 1
53 changes: 53 additions & 0 deletions config/rbac/kuttl-rbac-watch-all.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: scorecard-kuttl-watch-all
namespace: WEBSPHERE_LIBERTY_WATCH_NAMESPACE
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: scorecard-kuttl-watch-all
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: scorecard-kuttl-watch-all
subjects:
- kind: ServiceAccount
name: scorecard-kuttl-watch-all
namespace: WEBSPHERE_LIBERTY_WATCH_NAMESPACE
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: scorecard-kuttl-watch-all
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- delete
- apiGroups:
- apps
resources:
- deployments
- statefulsets
verbs:
- get
- create
- patch
- apiGroups:
- liberty.websphere.ibm.com
resources:
- webspherelibertyapplications
- webspherelibertydumps
- webspherelibertytraces
verbs:
- get
- list
- create
- patch
- delete
83 changes: 83 additions & 0 deletions config/rbac/kuttl-rbac-watch-another.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: scorecard-kuttl-watch-another
namespace: WEBSPHERE_LIBERTY_WATCH_NAMESPACE
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: watched-role
namespace: WEBSPHERE_LIBERTY_OPERATOR_NAMESPACE
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- delete
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: watcher-role
namespace: WEBSPHERE_LIBERTY_WATCH_NAMESPACE
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- delete
- apiGroups:
- apps
resources:
- deployments
- statefulsets
verbs:
- get
- create
- patch
- apiGroups:
- liberty.websphere.ibm.com
resources:
- webspherelibertyapplications
- webspherelibertydumps
- webspherelibertytraces
verbs:
- get
- list
- create
- patch
- delete
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: watched-rolebinding
namespace: WEBSPHERE_LIBERTY_OPERATOR_NAMESPACE
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: watched-role
subjects:
- kind: ServiceAccount
name: scorecard-kuttl-watch-another
namespace: WEBSPHERE_LIBERTY_WATCH_NAMESPACE
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: watcher-rolebinding
namespace: WEBSPHERE_LIBERTY_WATCH_NAMESPACE
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: watcher-role
subjects:
- kind: ServiceAccount
name: scorecard-kuttl-watch-another
8 changes: 8 additions & 0 deletions config/rbac/kuttl-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ rules:
verbs:
- get
- list
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- delete
- apiGroups:
- ""
resources:
Expand Down
Loading