Skip to content

Commit

Permalink
Add new CRD scale workload
Browse files Browse the repository at this point in the history
Signed-off-by: Sai Sindhur Malleni <[email protected]>
  • Loading branch information
smalleni committed Sep 12, 2023
1 parent 3993bf5 commit 6a1ab12
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cmd/kube-burner/ocp-config/crd-scale/crd-scale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
global:
gc: {{.GC}}
indexerConfig:
esServers: ["{{.ES_SERVER}}"]
insecureSkipVerify: true
defaultIndex: {{.ES_INDEX}}
type: {{.INDEXING_TYPE}}
jobs:
- name: crd-scale
namespace: crd-scale
jobIterations: {{.JOB_ITERATIONS}}
qps: {{.QPS}}
burst: {{.BURST}}
namespacedIterations: false
waitWhenFinished: false
objects:

- objectTemplate: example-crd.yml
replicas: 1

29 changes: 29 additions & 0 deletions cmd/kube-burner/ocp-config/crd-scale/example-crd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: kubeburners{{.Iteration}}.cloudbulldozer.example.com
spec:
group: cloudbulldozer.example.com
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
workload:
type: string
iterations:
type: integer
scope: Cluster
names:
plural: kubeburners{{.Iteration}}
singular: kubeburner{{.Iteration}}
kind: KubeBurner{{.Iteration}}
shortNames:
- kb{{.Iteration}}

1 change: 1 addition & 0 deletions cmd/kube-burner/ocp.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func openShiftCmd() *cobra.Command {
workloads.NewClusterDensity(&wh, "cluster-density"),
workloads.NewClusterDensity(&wh, "cluster-density-v2"),
workloads.NewClusterDensity(&wh, "cluster-density-ms"),
workloads.NewCrdScale(&wh),
workloads.NewNodeDensity(&wh),
workloads.NewNodeDensityHeavy(&wh),
workloads.NewNodeDensityCNI(&wh),
Expand Down
22 changes: 22 additions & 0 deletions examples/workloads/crd-scale/crd-scale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
global:
gc: true
indexerConfig:
esServers: [http://elastic-elk.apps.rsevilla.kube-burner.com]
insecureSkipVerify: true
defaultIndex: kube-burner
type: elastic

jobs:
- name: crd-scale
jobIterations: 1000
qps: 20
burst: 20
namespacedIterations: false
namespace: crd-scale
waitWhenFinished: false
objects:

- objectTemplate: templates/example-crd.yml
replicas: 1

29 changes: 29 additions & 0 deletions examples/workloads/crd-scale/templates/example-crd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: kubeburners{{.Iteration}}.cloudbulldozer.example.com
spec:
group: cloudbulldozer.example.com
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
workload:
type: string
iterations:
type: integer
scope: Cluster
names:
plural: kubeburners{{.Iteration}}
singular: kubeburner{{.Iteration}}
kind: KubeBurner{{.Iteration}}
shortNames:
- kb{{.Iteration}}

43 changes: 43 additions & 0 deletions pkg/workloads/crd-scale.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright 2022 The Kube-burner Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package workloads

import (
"fmt"
"os"

"github.com/spf13/cobra"
)

// NewCrdScale holds the crd-scale workload
func NewCrdScale(wh *WorkloadHelper) *cobra.Command {
var iterations int
cmd := &cobra.Command{
Use: "crd-scale",
Short: "Runs crd-scale workload",
SilenceUsage: true,
PreRun: func(cmd *cobra.Command, args []string) {
wh.Metadata.Benchmark = cmd.Name()
os.Setenv("JOB_ITERATIONS", fmt.Sprint(iterations))

},
Run: func(cmd *cobra.Command, args []string) {
wh.run(cmd.Name(), MetricsProfileMap[cmd.Name()])
},
}
cmd.Flags().IntVar(&iterations, "iterations", 0, "Number of CRDs to create")
cmd.MarkFlagRequired("iterations")
return cmd
}
1 change: 1 addition & 0 deletions pkg/workloads/workloads.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var MetricsProfileMap = map[string]string{
"cluster-density-ms": "metrics-aggregated.yml",
"cluster-density-v2": "metrics-aggregated.yml",
"cluster-density": "metrics-aggregated.yml",
"crd-scale": "metrics-aggregated.yml",
"node-density": "metrics.yml",
"node-density-heavy": "metrics.yml",
"node-density-cni": "metrics.yml",
Expand Down

0 comments on commit 6a1ab12

Please sign in to comment.