Skip to content
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
8 changes: 8 additions & 0 deletions tests/templates/kuttl/cluster-sync-cs-bug/00-patch-ns.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% if test_scenario['values']['openshift'] == 'true' %}
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: kubectl patch namespace $NAMESPACE -p '{"metadata":{"labels":{"pod-security.kubernetes.io/enforce":"privileged"}}}'
timeout: 120
{% endif %}
12 changes: 12 additions & 0 deletions tests/templates/kuttl/cluster-sync-cs-bug/20-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 1200
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: nifi-node-default
status:
readyReplicas: 2
replicas: 2
210 changes: 210 additions & 0 deletions tests/templates/kuttl/cluster-sync-cs-bug/20-install-nifi.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
---
apiVersion: authentication.stackable.tech/v1alpha1
kind: AuthenticationClass
metadata:
name: nifi-user-credentials
spec:
provider:
static:
userCredentialsSecret:
name: nifi-user-credentials
---
apiVersion: v1
kind: Secret
metadata:
name: nifi-user-credentials
stringData:
admin: admin
---
apiVersion: v1
kind: Secret
metadata:
name: nifi-sensitive-property-key
stringData:
nifiSensitivePropsKey: mYsUp3rS3cr3tk3y
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nifi-flow-trigger
data:
flow.json: |
{
"encodingVersion": {
"majorVersion": 2,
"minorVersion": 0
},
"maxTimerDrivenThreadCount": 10,
"registries": [],
"parameterContexts": [],
"parameterProviders": [],
"controllerServices": [],
"reportingTasks": [],
"flowAnalysisRules": [],
"rootGroup": {
"identifier": "root-group-0000-0000-000000000001",
"instanceIdentifier": "root-inst-0000-0000-000000000001",
"name": "NiFi Flow",
"comments": "",
"position": { "x": 0.0, "y": 0.0 },
"processGroups": [
{
"identifier": "child-group-000-0000-000000000001",
"instanceIdentifier": "child-inst-0000-0000-000000000001",
"name": "ChildGroup",
"comments": "",
"position": { "x": 400.0, "y": 0.0 },
"processGroups": [],
"remoteProcessGroups": [],
"processors": [],
"inputPorts": [],
"outputPorts": [],
"connections": [],
"labels": [],
"funnels": [],
"controllerServices": [
{
"identifier": "cs-http-ctx-0000-0000-000000000001",
"instanceIdentifier": "cs-http-inst-0000-0000-00000000child",
"name": "StandardHttpContextMap",
"comments": "",
"type": "org.apache.nifi.http.StandardHttpContextMap",
"bundle": {
"group": "org.apache.nifi",
"artifact": "nifi-http-context-map-nar",
"version": "{{ test_scenario['values']['nifi-latest'] }}"
},
"properties": {
"Request Expiration": "2 min",
"Maximum Outstanding Requests": "5000"
},
"propertyDescriptors": {},
"controllerServiceApis": [
{
"type": "org.apache.nifi.http.HttpContextMap",
"bundle": {
"group": "org.apache.nifi",
"artifact": "nifi-standard-services-api-nar",
"version": "{{ test_scenario['values']['nifi-latest'] }}"
}
}
],
"scheduledState": "ENABLED",
"bulletinLevel": "WARN",
"componentType": "CONTROLLER_SERVICE",
"groupIdentifier": "child-group-000-0000-000000000001"
}
],
"defaultFlowFileExpiration": "0 sec",
"defaultBackPressureObjectThreshold": 10000,
"defaultBackPressureDataSizeThreshold": "1 GB",
"scheduledState": "ENABLED",
"executionEngine": "INHERITED",
"maxConcurrentTasks": 1,
"statelessFlowTimeout": "1 min",
"flowFileConcurrency": "UNBOUNDED",
"flowFileOutboundPolicy": "STREAM_WHEN_AVAILABLE",
"componentType": "PROCESS_GROUP"
}
],
"remoteProcessGroups": [],
"processors": [],
"inputPorts": [],
"outputPorts": [],
"connections": [],
"labels": [],
"funnels": [],
"controllerServices": [
{
"identifier": "cs-http-ctx-0000-0000-000000000001",
"instanceIdentifier": "cs-http-inst-0000-0000-000000000root",
"name": "StandardHttpContextMap",
"comments": "",
"type": "org.apache.nifi.http.StandardHttpContextMap",
"bundle": {
"group": "org.apache.nifi",
"artifact": "nifi-http-context-map-nar",
"version": "{{ test_scenario['values']['nifi-latest'] }}"
},
"properties": {
"Request Expiration": "1 min",
"Maximum Outstanding Requests": "5000"
},
"propertyDescriptors": {},
"controllerServiceApis": [
{
"type": "org.apache.nifi.http.HttpContextMap",
"bundle": {
"group": "org.apache.nifi",
"artifact": "nifi-standard-services-api-nar",
"version": "{{ test_scenario['values']['nifi-latest'] }}"
}
}
],
"scheduledState": "ENABLED",
"bulletinLevel": "WARN",
"componentType": "CONTROLLER_SERVICE",
"groupIdentifier": "root-group-0000-0000-000000000001"
}
],
"defaultFlowFileExpiration": "0 sec",
"defaultBackPressureObjectThreshold": 10000,
"defaultBackPressureDataSizeThreshold": "1 GB",
"scheduledState": "ENABLED",
"executionEngine": "INHERITED",
"maxConcurrentTasks": 1,
"statelessFlowTimeout": "1 min",
"flowFileConcurrency": "UNBOUNDED",
"flowFileOutboundPolicy": "STREAM_WHEN_AVAILABLE",
"componentType": "PROCESS_GROUP"
}
}
---
apiVersion: nifi.stackable.tech/v1alpha1
kind: NifiCluster
metadata:
name: nifi
spec:
image:
{% if test_scenario['values']['nifi-v2'].find(",") > 0 %}
custom: "{{ test_scenario['values']['nifi-v2'].split(',')[1] }}"
productVersion: "{{ test_scenario['values']['nifi-v2'].split(',')[0] }}"
{% else %}
custom: null
productVersion: "{{ test_scenario['values']['nifi-v2'] }}"
{% endif %}
pullPolicy: IfNotPresent
clusterConfig:
authentication:
- authenticationClass: nifi-user-credentials
sensitiveProperties:
keySecret: nifi-sensitive-property-key
nodes:
roleConfig:
listenerClass: cluster-internal
configOverrides:
nifi.properties:
nifi.web.https.sni.required: "false"
nifi.web.https.sni.host.check: "false"
podOverrides:
spec:
initContainers:
- name: init-flow
image: oci.stackable.tech/sdp/testing-tools/nifi:0.3.0-stackable0.0.0-dev
command:
- /bin/bash
- -c
args:
- gzip --stdout /stackable/nifi/flow/flow.json > /stackable/data/database/flow.json.gz
volumeMounts:
- name: nifi-flow
mountPath: /stackable/nifi/flow
- name: database-repository
mountPath: /stackable/data/database
volumes:
- name: nifi-flow
configMap:
name: nifi-flow-trigger
roleGroups:
default:
replicas: 2
12 changes: 12 additions & 0 deletions tests/templates/kuttl/cluster-sync-cs-bug/30-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 1200
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test-nifi
status:
readyReplicas: 1
replicas: 1
108 changes: 108 additions & 0 deletions tests/templates/kuttl/cluster-sync-cs-bug/30-install-test-pod.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test-nifi
labels:
app: test-nifi
spec:
replicas: 1
selector:
matchLabels:
app: test-nifi
template:
metadata:
labels:
app: test-nifi
spec:
serviceAccountName: test-nifi-sa
securityContext:
fsGroup: 1000
containers:
- name: test-nifi
image: oci.stackable.tech/sdp/testing-tools/nifi:0.3.0-stackable0.0.0-dev
command: ["sleep", "infinity"]
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "128Mi"
cpu: "400m"
volumeMounts:
- name: tls
mountPath: /stackable/tls
volumes:
- name: tls
ephemeral:
volumeClaimTemplate:
metadata:
annotations:
secrets.stackable.tech/class: tls
secrets.stackable.tech/scope: pod
spec:
storageClassName: secrets.stackable.tech
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "1"
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: test-nifi-sa
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: test-nifi-pod-manager
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "delete"]
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["create"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get"]
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: test-nifi-pod-manager
subjects:
- kind: ServiceAccount
name: test-nifi-sa
roleRef:
kind: Role
name: test-nifi-pod-manager
apiGroup: rbac.authorization.k8s.io
{% if test_scenario['values']['openshift'] == 'true' %}
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: use-integration-tests-scc
rules:
- apiGroups: ["security.openshift.io"]
resources: ["securitycontextconstraints"]
resourceNames: ["privileged"]
verbs: ["use"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: use-integration-tests-scc
subjects:
- kind: ServiceAccount
name: test-nifi-sa
roleRef:
kind: Role
name: use-integration-tests-scc
apiGroup: rbac.authorization.k8s.io
{% endif %}
10 changes: 10 additions & 0 deletions tests/templates/kuttl/cluster-sync-cs-bug/40-assert.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 300
commands:
- script: >-
kubectl exec -n $NAMESPACE test-nifi-0 --
python /tmp/test_cluster_healthy.py
-u admin -p admin
-n $NAMESPACE -c 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: kubectl cp -n $NAMESPACE ./test_cluster_healthy.py test-nifi-0:/tmp
- script: kubectl cp -n $NAMESPACE ./test_trigger_reconnect.py test-nifi-0:/tmp
12 changes: 12 additions & 0 deletions tests/templates/kuttl/cluster-sync-cs-bug/60-trigger.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 900
commands:
- script: >-
kubectl exec -n $NAMESPACE test-nifi-0 --
python /tmp/test_trigger_reconnect.py
-u admin -p admin
-n $NAMESPACE -c 2
--stable-seconds 30
--timeout-seconds 180
Loading
Loading