Skip to content

Commit

Permalink
operator: k8s: Add kminion to e2e tests for artificial load
Browse files Browse the repository at this point in the history
Kminion will create artificial load to have any values for
`vectorized_cluster_partition_under_replicated_replicas` metric.
  • Loading branch information
Rafal Korepta committed Jan 6, 2023
1 parent 6855b8e commit 3f3da27
Show file tree
Hide file tree
Showing 36 changed files with 1,243 additions and 364 deletions.
29 changes: 10 additions & 19 deletions tests/e2e/update-image-and-node-port/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,16 @@ kind: StatefulSet
metadata:
name: update-image-cluster-and-node-port
status:
readyReplicas: 2
readyReplicas: 3

---

apiVersion: kuttl.dev/v1beta1
kind: TestAssert
collectors:
- type: pod
pod: update-image-cluster-and-node-port-0

---

apiVersion: kuttl.dev/v1beta1
kind: TestAssert
collectors:
- type: pod
pod: update-image-cluster-and-node-port-1
selector: app.kubernetes.io/name=redpanda
tail: -1

---

Expand All @@ -44,18 +37,16 @@ spec:

---

apiVersion: kuttl.dev/v1beta1
kind: TestAssert
collectors:
- type: pod
selector: app.kubernetes.io/name=redpanda
tail: -1

---

apiVersion: redpanda.vectorized.io/v1alpha1
kind: Cluster
metadata:
name: update-image-cluster-and-node-port
status:
version: "v22.1.10"
readyReplicas: 3
replicas: 3
upgrading: false
restarting: false
conditions:
- type: ClusterConfigured
status: "True"
4 changes: 3 additions & 1 deletion tests/e2e/update-image-and-node-port/00-current-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ metadata:
spec:
image: "vectorized/redpanda"
version: "v22.1.10"
replicas: 2
replicas: 3
restartConfig:
underReplicatedPartitionThreshold: 0.00
resources:
requests:
cpu: 100m
Expand Down
101 changes: 12 additions & 89 deletions tests/e2e/update-image-and-node-port/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,99 +1,22 @@
apiVersion: apps/v1
kind: StatefulSet
kind: Deployment
metadata:
name: update-image-cluster-and-node-port
name: kminion
status:
readyReplicas: 2

---

apiVersion: v1
kind: Pod
metadata:
name: update-image-cluster-and-node-port-0
spec:
containers:
- name: redpanda
image: "vectorized/redpanda:v22.2.8"
volumeMounts:
- mountPath: /etc/redpanda
name: config-dir
- mountPath: /scripts
name: hook-scripts-dir
- mountPath: /etc/redpanda/.bootstrap.yaml
name: configmap-dir
subPath: .bootstrap.yaml
- mountPath: /var/lib/redpanda/data
name: datadir
- mountPath: /var/lib/shadow-index-cache
name: shadow-index-cache
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
readOnly: true
status:
phase: "Running"

---

apiVersion: v1
kind: Pod
metadata:
name: update-image-cluster-and-node-port-1
spec:
containers:
- name: redpanda
image: "vectorized/redpanda:v22.2.8"
volumeMounts:
- mountPath: /etc/redpanda
name: config-dir
- mountPath: /scripts
name: hook-scripts-dir
- mountPath: /etc/redpanda/.bootstrap.yaml
name: configmap-dir
subPath: .bootstrap.yaml
- mountPath: /var/lib/redpanda/data
name: datadir
- mountPath: /var/lib/shadow-index-cache
name: shadow-index-cache
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
readOnly: true
status:
phase: "Running"

---

apiVersion: v1
kind: Service
metadata:
name: update-image-cluster-and-node-port-external
spec:
externalTrafficPolicy: Local
ports:
- name: kafka-external
nodePort: 32748
port: 9093
protocol: TCP
targetPort: 9093
- name: admin-external
nodePort: 31178
port: 9645
protocol: TCP
targetPort: 9645
type: NodePort
availableReplicas: 1
readyReplicas: 1
replicas: 1
updatedReplicas: 1

---

apiVersion: kuttl.dev/v1beta1
kind: TestAssert
collectors:
- type: command
command: kubectl get pod -o json -n $NAMESPACE
- type: command
command: kubectl describe pod -n $NAMESPACE
- type: pod
selector: app.kubernetes.io/name=redpanda
tail: -1

---

apiVersion: redpanda.vectorized.io/v1alpha1
kind: Cluster
metadata:
name: update-image-cluster-and-node-port
status:
version: "v22.2.8"
selector: app.kubernetes.io/name=kminion
tail: -1
126 changes: 126 additions & 0 deletions tests/e2e/update-image-and-node-port/01-create-kminion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: kminion
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app.kubernetes.io/instance: kminion
app.kubernetes.io/name: kminion
template:
metadata:
labels:
app.kubernetes.io/instance: kminion
app.kubernetes.io/name: kminion
spec:
containers:
- env:
- name: CONFIG_FILEPATH
value: /etc/kminion/config.yaml
image: quay.io/cloudhut/kminion:v2.2.0
imagePullPolicy: IfNotPresent
name: kminion
ports:
- containerPort: 8080
name: metrics
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /ready
port: 8080
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi
securityContext: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /etc/kminion
name: config
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext:
fsGroup: 99
runAsUser: 99
terminationGracePeriodSeconds: 30
volumes:
- configMap:
defaultMode: 420
name: kminion
name: config
---
apiVersion: v1
data:
config.yaml: |
exporter:
host: ""
namespace: test_sla
port: 8080
kafka:
brokers:
- update-image-cluster-and-node-port-0.update-image-cluster-and-node-port:9092
- update-image-cluster-and-node-port-1.update-image-cluster-and-node-port:9092
- update-image-cluster-and-node-port-2.update-image-cluster-and-node-port:9092
clientId: kminion
rackId: ""
sasl:
enabled: false
tls:
caFilepath: ""
certFilepath: ""
enabled: false
insecureSkipTlsVerify: false
keyFilepath: ""
passphrase: ""
logger:
level: info
minion:
consumerGroups:
allowedGroups: []
enabled: false
granularity: partition
ignoredGroups: []
scrapeMode: adminApi
endToEnd:
consumer:
commitSla: 2s
deleteStaleConsumerGroups: false
groupIdPrefix: test
roundtripSla: 2s
enabled: true
probeInterval: 3ns
producer:
ackSla: 1s
requiredAcks: all
topicManagement:
enabled: true
name: test_e2e_probe
partitionsPerBroker: 5
reconciliationInterval: 1m
replicationFactor: 3
logDirs:
enabled: false
topics:
allowedTopics: []
granularity: partition
ignoredTopics: []
infoMetric:
configKeys:
- cleanup.policy
kind: ConfigMap
metadata:
name: kminion
Loading

0 comments on commit 3f3da27

Please sign in to comment.