From ce4b4eb7aac3b547d3f022a6b052f11ffc4f49ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Sevilla?= Date: Wed, 5 Apr 2023 13:10:03 +0200 Subject: [PATCH] Cluster-density managed-services edition (#285) * Cluster-density managed-services edition Signed-off-by: Raul Sevilla --- .../cluster-density-ms/cluster-density-ms.yml | 52 +++++++++ .../cluster-density-ms/configmap.yml | 7 ++ .../cluster-density-ms/deployment.yml | 101 ++++++++++++++++++ .../cluster-density-ms/imagestream.yml | 5 + .../ocp-config/cluster-density-ms/route.yml | 11 ++ .../ocp-config/cluster-density-ms/secret.yml | 7 ++ .../ocp-config/cluster-density-ms/service.yml | 18 ++++ cmd/kube-burner/ocp.go | 1 + docs/ocp.md | 1 + pkg/workloads/workloads.go | 1 + test/run-ocp.sh | 4 +- 11 files changed, 206 insertions(+), 2 deletions(-) create mode 100644 cmd/kube-burner/ocp-config/cluster-density-ms/cluster-density-ms.yml create mode 100644 cmd/kube-burner/ocp-config/cluster-density-ms/configmap.yml create mode 100644 cmd/kube-burner/ocp-config/cluster-density-ms/deployment.yml create mode 100644 cmd/kube-burner/ocp-config/cluster-density-ms/imagestream.yml create mode 100644 cmd/kube-burner/ocp-config/cluster-density-ms/route.yml create mode 100644 cmd/kube-burner/ocp-config/cluster-density-ms/secret.yml create mode 100644 cmd/kube-burner/ocp-config/cluster-density-ms/service.yml diff --git a/cmd/kube-burner/ocp-config/cluster-density-ms/cluster-density-ms.yml b/cmd/kube-burner/ocp-config/cluster-density-ms/cluster-density-ms.yml new file mode 100644 index 000000000..52d8c67db --- /dev/null +++ b/cmd/kube-burner/ocp-config/cluster-density-ms/cluster-density-ms.yml @@ -0,0 +1,52 @@ +--- +global: + gc: {{.GC}} + indexerConfig: + enabled: {{.INDEXING}} + esServers: ["{{.ES_SERVER}}"] + insecureSkipVerify: true + defaultIndex: {{.ES_INDEX}} + type: {{.INDEXING_TYPE}} + measurements: + - name: podLatency +jobs: + - name: cluster-density-ms + namespace: cluster-density-ms + jobIterations: {{.JOB_ITERATIONS}} + qps: {{.QPS}} + burst: {{.BURST}} + namespacedIterations: true + podWait: false + waitWhenFinished: true + preLoadImages: true + preLoadPeriod: 30s + churn: {{.CHURN}} + churnDuration: {{.CHURN_DURATION}} + churnPercent: {{.CHURN_PERCENT}} + churnDelay: {{.CHURN_DELAY}} + namespaceLabels: + security.openshift.io/scc.podSecurityLabelSync: false + pod-security.kubernetes.io/enforce: privileged + pod-security.kubernetes.io/audit: privileged + pod-security.kubernetes.io/warn: privileged + objects: + + - objectTemplate: imagestream.yml + replicas: 1 + + - objectTemplate: deployment.yml + replicas: 4 + inputVars: + podReplicas: 2 + + - objectTemplate: service.yml + replicas: 2 + + - objectTemplate: route.yml + replicas: 1 + + - objectTemplate: secret.yml + replicas: 20 + + - objectTemplate: configmap.yml + replicas: 10 diff --git a/cmd/kube-burner/ocp-config/cluster-density-ms/configmap.yml b/cmd/kube-burner/ocp-config/cluster-density-ms/configmap.yml new file mode 100644 index 000000000..eb7500f4f --- /dev/null +++ b/cmd/kube-burner/ocp-config/cluster-density-ms/configmap.yml @@ -0,0 +1,7 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{.JobName}}-{{.Replica}} +data: + key1: "{{rand 2048}}" diff --git a/cmd/kube-burner/ocp-config/cluster-density-ms/deployment.yml b/cmd/kube-burner/ocp-config/cluster-density-ms/deployment.yml new file mode 100644 index 000000000..7d989a11c --- /dev/null +++ b/cmd/kube-burner/ocp-config/cluster-density-ms/deployment.yml @@ -0,0 +1,101 @@ +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: cluster-density-{{.Replica}} +spec: + replicas: {{.podReplicas}} + selector: + matchLabels: + app: cluster-density-{{.Replica}} + template: + metadata: + labels: + app: cluster-density-{{.Replica}} + spec: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: node-role.kubernetes.io/worker + operator: Exists + - key: node-role.kubernetes.io/infra + operator: DoesNotExist + - key: node-role.kubernetes.io/workload + operator: DoesNotExist + containers: + - args: + - sleep + - infinity + image: registry.k8s.io/pause:3.1 + resources: + requests: + memory: "10Mi" + cpu: "10m" + volumeMounts: + - name: secret-1 + mountPath: /secret1 + - name: secret-2 + mountPath: /secret2 + - name: secret-3 + mountPath: /secret3 + - name: secret-4 + mountPath: /secret4 + - name: configmap-1 + mountPath: /configmap1 + - name: configmap-2 + mountPath: /configmap2 + - name: configmap-3 + mountPath: /configmap3 + - name: configmap-4 + mountPath: /configmap4 + - name: podinfo + mountPath: /etc/podlabels + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + protocol: TCP + - containerPort: 8443 + protocol: TCP + name: cluster-density + env: + - name: ENVVAR1 + value: "{{rand 250}}" + - name: ENVVAR2 + value: "{{rand 250}}" + - name: ENVVAR3 + value: "{{rand 250}}" + - name: ENVVAR4 + value: "{{rand 250}}" + volumes: + - name: secret-1 + secret: + secretName: {{.JobName}}-1 + - name: secret-2 + secret: + secretName: {{.JobName}}-2 + - name: secret-3 + secret: + secretName: {{.JobName}}-3 + - name: secret-4 + secret: + secretName: {{.JobName}}-4 + - name: configmap-1 + configMap: + name: {{.JobName}}-1 + - name: configmap-2 + configMap: + name: {{.JobName}}-2 + - name: configmap-3 + configMap: + name: {{.JobName}}-3 + - name: configmap-4 + configMap: + name: {{.JobName}}-4 + - name: podinfo + downwardAPI: + items: + - path: "labels" + fieldRef: + fieldPath: metadata.labels diff --git a/cmd/kube-burner/ocp-config/cluster-density-ms/imagestream.yml b/cmd/kube-burner/ocp-config/cluster-density-ms/imagestream.yml new file mode 100644 index 000000000..ef7cb251f --- /dev/null +++ b/cmd/kube-burner/ocp-config/cluster-density-ms/imagestream.yml @@ -0,0 +1,5 @@ +--- +kind: ImageStream +apiVersion: image.openshift.io/v1 +metadata: + name: cluster-density-{{.Replica}} diff --git a/cmd/kube-burner/ocp-config/cluster-density-ms/route.yml b/cmd/kube-burner/ocp-config/cluster-density-ms/route.yml new file mode 100644 index 000000000..72f7ea4f8 --- /dev/null +++ b/cmd/kube-burner/ocp-config/cluster-density-ms/route.yml @@ -0,0 +1,11 @@ +--- +kind: Route +apiVersion: route.openshift.io/v1 +metadata: + name: cluster-density-{{.Replica}} +spec: + to: + kind: Service + name: cluster-density-{{.Replica}} + tls: + termination: edge diff --git a/cmd/kube-burner/ocp-config/cluster-density-ms/secret.yml b/cmd/kube-burner/ocp-config/cluster-density-ms/secret.yml new file mode 100644 index 000000000..dbedef597 --- /dev/null +++ b/cmd/kube-burner/ocp-config/cluster-density-ms/secret.yml @@ -0,0 +1,7 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{.JobName}}-{{.Replica}} +data: + top-secret: "{{rand 2048}}" diff --git a/cmd/kube-burner/ocp-config/cluster-density-ms/service.yml b/cmd/kube-burner/ocp-config/cluster-density-ms/service.yml new file mode 100644 index 000000000..efd0f291a --- /dev/null +++ b/cmd/kube-burner/ocp-config/cluster-density-ms/service.yml @@ -0,0 +1,18 @@ +--- +kind: Service +apiVersion: v1 +metadata: + name: cluster-density-{{.Replica}} +spec: + selector: + app: cluster-density-{{.Replica}} + ports: + - name: http + protocol: TCP + port: 80 + targetPort: 8080 + - name: https + protocol: TCP + port: 443 + targetPort: 8443 + type: ClusterIP diff --git a/cmd/kube-burner/ocp.go b/cmd/kube-burner/ocp.go index dac588f04..d211e8ad7 100644 --- a/cmd/kube-burner/ocp.go +++ b/cmd/kube-burner/ocp.go @@ -95,6 +95,7 @@ func openShiftCmd() *cobra.Command { ocpCmd.AddCommand( workloads.NewClusterDensity(&wh, "cluster-density"), workloads.NewClusterDensity(&wh, "cluster-density-v2"), + workloads.NewClusterDensity(&wh, "cluster-density-ms"), workloads.NewNodeDensity(&wh), workloads.NewNodeDensityHeavy(&wh), workloads.NewNodeDensityCNI(&wh), diff --git a/docs/ocp.md b/docs/ocp.md index 773f75a6a..a2d4d2c8c 100644 --- a/docs/ocp.md +++ b/docs/ocp.md @@ -12,6 +12,7 @@ Usage: Available Commands: cluster-density Runs cluster-density workload cluster-density-v2 Runs cluster-density-v2 workload + cluster-density-ms Runs cluster-density-ms workload node-density Runs node-density workload node-density-cni Runs node-density-cni workload node-density-heavy Runs node-density-heavy workload diff --git a/pkg/workloads/workloads.go b/pkg/workloads/workloads.go index a3a477b68..f3f4355c4 100644 --- a/pkg/workloads/workloads.go +++ b/pkg/workloads/workloads.go @@ -1,6 +1,7 @@ package workloads var MetricsProfileMap = map[string]string{ + "cluster-density-ms": "metrics-aggregated.yml", "cluster-density-v2": "metrics-aggregated.yml", "cluster-density": "metrics-aggregated.yml", "node-density": "metrics.yml", diff --git a/test/run-ocp.sh b/test/run-ocp.sh index b84b5fc57..c05826428 100755 --- a/test/run-ocp.sh +++ b/test/run-ocp.sh @@ -30,8 +30,8 @@ echo "Running cluster-density wrapper and user metadata" kube-burner ocp cluster-density --iterations=2 --churn-duration=2m ${COMMON_FLAGS} --user-metadata=user-metadata.yml echo "Running cluster-density wrapper" kube-burner ocp cluster-density --iterations=2 --churn=false --uuid=${UUID} -echo "Running cluster-density wrapper for multiple endpoints case" -kube-burner ocp cluster-density --iterations=1 --churn-duration=2m --metrics-endpoint metrics-endpoints.yaml ${COMMON_FLAGS} +echo "Running cluster-density-ms wrapper for multiple endpoints case" +kube-burner ocp cluster-density-ms --iterations=1 --churn-duration=2m --metrics-endpoint metrics-endpoints.yaml ${COMMON_FLAGS} echo "Running cluster-density-v2 wrapper" kube-burner ocp cluster-density-v2 --iterations=2 --churn-duration=2m ${COMMON_FLAGS} # Disable gc and avoid metric indexing