From a88b4d1c086977c05f3a15884dd370c6caf3531a Mon Sep 17 00:00:00 2001 From: "stu126940@mail.uni-kiel.de" <stu126940@mail.uni-kiel.de> Date: Wed, 26 May 2021 20:59:14 +0200 Subject: [PATCH] Make crds structural --- .../templates/theodolite/crd-benchmark.yaml | 114 +++++++++++++++- .../templates/theodolite/crd-execution.yaml | 123 ++++++++++++++++- .../config/example-operator-benchmark.yaml | 64 ++++----- .../config/example-operator-execution.yaml | 100 +++++++------- .../main/resources/operator/benchmarkCRD.yaml | 116 +++++++++++++++- .../example-benchmark-k8s-resource.yaml | 59 ++++---- .../example-execution-k8s-resource.yaml | 73 +++++----- .../main/resources/operator/executionCRD.yaml | 126 +++++++++++++++++- 8 files changed, 613 insertions(+), 162 deletions(-) diff --git a/execution/helm/templates/theodolite/crd-benchmark.yaml b/execution/helm/templates/theodolite/crd-benchmark.yaml index 9d7468b49..e6fc214df 100644 --- a/execution/helm/templates/theodolite/crd-benchmark.yaml +++ b/execution/helm/templates/theodolite/crd-benchmark.yaml @@ -1,15 +1,121 @@ {{- if .Values.benchmarkCRD.create -}} -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: benchmarks.theodolite.com spec: group: theodolite.com - version: v1alpha1 names: kind: benchmark plural: benchmarks + shortNames: + - bm + versions: + - name: v1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + required: ["spec"] + properties: + spec: + type: object + required: [] + properties: + name: + type: string + appResource: + type: array + minItems: 1 + items: + type: string + loadGenResource: + type: array + minItems: 1 + items: + type: string + resourceTypes: + type: array + minItems: 1 + items: + type: object + properties: + typeName: + type: string + patchers: + type: array + minItems: 1 + items: + type: object + properties: + type: + type: string + default: "" + resource: + type: string + default: "" + container: + type: string + default: "" + variableName: + type: string + default: "" + loadTypes: + type: array + minItems: 1 + items: + type: object + properties: + typeName: + type: string + patchers: + type: array + minItems: 1 + items: + type: object + properties: + type: + type: string + default: "" + resource: + type: string + default: "" + container: + type: string + default: "" + variableName: + type: string + default: "" + kafkaConfig: + type: object + properties: + bootstrapServer: + type: string + topics: + type: array + minItems: 1 + items: + type: object + required: [] + properties: + name: + type: string + default: "" + numPartitions: + type: integer + default: 0 + replicationFactor: + type: integer + default: 0 + removeOnly: + type: boolean + default: false + additionalPrinterColumns: + - name: Age + type: date + jsonPath: .metadata.creationTimestamp + subresources: + status: {} scope: Namespaced - subresources: - status: {} {{- end }} \ No newline at end of file diff --git a/execution/helm/templates/theodolite/crd-execution.yaml b/execution/helm/templates/theodolite/crd-execution.yaml index 73b58397b..8e26d9164 100644 --- a/execution/helm/templates/theodolite/crd-execution.yaml +++ b/execution/helm/templates/theodolite/crd-execution.yaml @@ -1,15 +1,132 @@ {{- if .Values.executionCRD.create -}} -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: executions.theodolite.com spec: group: theodolite.com - version: v1alpha1 names: kind: execution plural: executions + shortNames: + - ex + versions: + - name: v1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + required: ["spec"] + properties: + spec: + type: object + required: ["benchmark", "load", "resources", "slos", "execution", "configOverrides"] + properties: + name: + type: string + default: "" + benchmark: + type: string + load: # definition of the load dimension + type: object + required: ["loadType", "loadValues"] + properties: + loadType: + type: string + loadValues: + type: array + items: + type: integer + resources: # definition of the resource dimension + type: object + required: ["resourceType", "resourceValues"] + properties: + resourceType: + type: string + resourceValues: + type: array + items: + type: integer + slos: # def of service level objectives + type: array + items: + type: object + required: ["sloType", "threshold", "prometheusUrl", "externalSloUrl", "offset", "warmup"] + properties: + sloType: + type: string + threshold: + type: integer + prometheusUrl: + type: string + externalSloUrl: + type: string + offset: + type: integer + warmup: + type: integer + execution: # def execution config + type: object + required: ["strategy", "duration", "repetitions", "restrictions"] + properties: + strategy: + type: string + duration: + type: integer + repetitions: + type: integer + loadGenerationDelay: + type: integer + restrictions: + type: array + items: + type: string + configOverrides: + type: array + items: + type: object + properties: + patcher: + type: object + properties: + type: + type: string + default: "" + resource: + type: string + default: "" + container: + type: string + default: "" + variableName: + type: string + default: "" + value: + type: string + status: + type: object + properties: + executionState: + description: "" + type: string + executionDuration: + description: "Duration of the execution in seconds" + type: string + additionalPrinterColumns: + - name: STATUS + type: string + description: State of the execution + jsonPath: .status.executionState + - name: Duration + type: string + description: Duration of the execution + jsonPath: .status.executionDuration + - name: Age + type: date + jsonPath: .metadata.creationTimestamp + subresources: + status: {} scope: Namespaced - subresources: status: {} {{- end }} \ No newline at end of file diff --git a/theodolite-quarkus/config/example-operator-benchmark.yaml b/theodolite-quarkus/config/example-operator-benchmark.yaml index 3ed5218d8..5cf39492a 100644 --- a/theodolite-quarkus/config/example-operator-benchmark.yaml +++ b/theodolite-quarkus/config/example-operator-benchmark.yaml @@ -1,35 +1,35 @@ -apiVersion: theodolite.com/v1alpha1 +apiVersion: theodolite.com/v1 kind: benchmark metadata: name: uc1-kstreams -#name: "uc1-kstreams" -appResource: - - "uc1-kstreams-deployment.yaml" - - "aggregation-service.yaml" - - "jmx-configmap.yaml" - - "uc1-service-monitor.yaml" -loadGenResource: - - "uc1-load-generator-deployment.yaml" - - "uc1-load-generator-service.yaml" -resourceTypes: - - typeName: "Instances" - patchers: - - type: "ReplicaPatcher" - resource: "uc1-kstreams-deployment.yaml" -loadTypes: - - typeName: "NumSensors" - patchers: - - type: "EnvVarPatcher" - resource: "uc1-load-generator-deployment.yaml" - container: "workload-generator" - variableName: "NUM_SENSORS" - - type: "NumSensorsLoadGeneratorReplicaPatcher" - resource: "uc1-load-generator-deployment.yaml" -kafkaConfig: - bootstrapServer: "theodolite-cp-kafka:9092" - topics: - - name: "input" - numPartitions: 40 - replicationFactor: 1 - - name: "theodolite-.*" - removeOnly: True \ No newline at end of file +spec: + appResource: + - "uc1-kstreams-deployment.yaml" + - "aggregation-service.yaml" + - "jmx-configmap.yaml" + - "uc1-service-monitor.yaml" + loadGenResource: + - "uc1-load-generator-deployment.yaml" + - "uc1-load-generator-service.yaml" + resourceTypes: + - typeName: "Instances" + patchers: + - type: "ReplicaPatcher" + resource: "uc1-kstreams-deployment.yaml" + loadTypes: + - typeName: "NumSensors" + patchers: + - type: "EnvVarPatcher" + resource: "uc1-load-generator-deployment.yaml" + container: "workload-generator" + variableName: "NUM_SENSORS" + - type: "NumSensorsLoadGeneratorReplicaPatcher" + resource: "uc1-load-generator-deployment.yaml" + kafkaConfig: + bootstrapServer: "theodolite-cp-kafka:9092" + topics: + - name: "input" + numPartitions: 40 + replicationFactor: 1 + - name: "theodolite-.*" + removeOnly: True \ No newline at end of file diff --git a/theodolite-quarkus/config/example-operator-execution.yaml b/theodolite-quarkus/config/example-operator-execution.yaml index 882c38a97..e01ea377e 100644 --- a/theodolite-quarkus/config/example-operator-execution.yaml +++ b/theodolite-quarkus/config/example-operator-execution.yaml @@ -1,53 +1,53 @@ -apiVersion: theodolite.com/v1alpha1 +apiVersion: theodolite.com/v1 kind: execution metadata: name: example-execution -#name: example-execution -benchmark: "uc1-kstreams" -load: - loadType: "NumSensors" - loadValues: [25000, 50000, 75000, 100000, 125000, 150000] -resources: - resourceType: "Instances" - resourceValues: [1, 2, 3, 4, 5] -slos: - - sloType: "lag trend" - threshold: 2000 - prometheusUrl: "http://prometheus-operated:9090" - externalSloUrl: "http://localhost:80/evaluate-slope" - offset: 0 - warmup: 60 # in seconds -execution: - strategy: "LinearSearch" - duration: 300 # in seconds - repetitions: 1 - delay: 30 # in seconds - restrictions: - - "LowerBound" -configOverrides: [] -# - patcher: -# type: "NodeSelectorPatcher" -# resource: "uc1-load-generator-deployment.yaml" -# variableName: "env" -# value: "prod" -# - patcher: -# type: "NodeSelectorPatcher" -# resource: "uc1-kstreams-deployment.yaml" -# variableName: "env" -# value: "prod" -# - patcher: -# type: "ResourceLimitPatcher" -# resource: "uc1-kstreams-deployment.yaml" -# container: "uc-application" -# variableName: "cpu" -# value: "1000m" -# - patcher: -# type: "ResourceLimitPatcher" -# resource: "uc1-kstreams-deployment.yaml" -# container: "uc-application" -# variableName: "memory" -# value: "2Gi" -# - patcher: -# type: "SchedulerNamePatcher" -# resource: "uc1-kstreams-deployment.yaml" -# value: "random-scheduler" +spec: + benchmark: "uc1-kstreams" + load: + loadType: "NumSensors" + loadValues: [25000, 50000, 75000, 100000, 125000, 150000] + resources: + resourceType: "Instances" + resourceValues: [1, 2, 3, 4, 5] + slos: + - sloType: "lag trend" + threshold: 2000 + prometheusUrl: "http://prometheus-operated:9090" + externalSloUrl: "http://localhost:80/evaluate-slope" + offset: 0 + warmup: 60 # in seconds + execution: + strategy: "LinearSearch" + duration: 300 # in seconds + repetitions: 1 + delay: 30 # in seconds + restrictions: + - "LowerBound" + configOverrides: [] + # - patcher: + # type: "NodeSelectorPatcher" + # resource: "uc1-load-generator-deployment.yaml" + # variableName: "env" + # value: "prod" + # - patcher: + # type: "NodeSelectorPatcher" + # resource: "uc1-kstreams-deployment.yaml" + # variableName: "env" + # value: "prod" + # - patcher: + # type: "ResourceLimitPatcher" + # resource: "uc1-kstreams-deployment.yaml" + # container: "uc-application" + # variableName: "cpu" + # value: "1000m" + # - patcher: + # type: "ResourceLimitPatcher" + # resource: "uc1-kstreams-deployment.yaml" + # container: "uc-application" + # variableName: "memory" + # value: "2Gi" + # - patcher: + # type: "SchedulerNamePatcher" + # resource: "uc1-kstreams-deployment.yaml" + # value: "random-scheduler" diff --git a/theodolite-quarkus/src/main/resources/operator/benchmarkCRD.yaml b/theodolite-quarkus/src/main/resources/operator/benchmarkCRD.yaml index 8fb3de192..8bfc8d3b6 100644 --- a/theodolite-quarkus/src/main/resources/operator/benchmarkCRD.yaml +++ b/theodolite-quarkus/src/main/resources/operator/benchmarkCRD.yaml @@ -1,13 +1,119 @@ -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: benchmarks.theodolite.com spec: group: theodolite.com - version: v1alpha1 names: kind: benchmark plural: benchmarks - scope: Namespaced - subresources: - status: {} \ No newline at end of file + shortNames: + - bm + versions: + - name: v1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + required: ["spec"] + properties: + spec: + type: object + required: [] + properties: + name: + type: string + appResource: + type: array + minItems: 1 + items: + type: string + loadGenResource: + type: array + minItems: 1 + items: + type: string + resourceTypes: + type: array + minItems: 1 + items: + type: object + properties: + typeName: + type: string + patchers: + type: array + minItems: 1 + items: + type: object + properties: + type: + type: string + default: "" + resource: + type: string + default: "" + container: + type: string + default: "" + variableName: + type: string + default: "" + loadTypes: + type: array + minItems: 1 + items: + type: object + properties: + typeName: + type: string + patchers: + type: array + minItems: 1 + items: + type: object + properties: + type: + type: string + default: "" + resource: + type: string + default: "" + container: + type: string + default: "" + variableName: + type: string + default: "" + kafkaConfig: + type: object + properties: + bootstrapServer: + type: string + topics: + type: array + minItems: 1 + items: + type: object + required: [] + properties: + name: + type: string + default: "" + numPartitions: + type: integer + default: 0 + replicationFactor: + type: integer + default: 0 + removeOnly: + type: boolean + default: false + additionalPrinterColumns: + - name: Age + type: date + jsonPath: .metadata.creationTimestamp + subresources: + status: {} + scope: Namespaced \ No newline at end of file diff --git a/theodolite-quarkus/src/main/resources/operator/example-benchmark-k8s-resource.yaml b/theodolite-quarkus/src/main/resources/operator/example-benchmark-k8s-resource.yaml index 19ec972be..16c14b665 100644 --- a/theodolite-quarkus/src/main/resources/operator/example-benchmark-k8s-resource.yaml +++ b/theodolite-quarkus/src/main/resources/operator/example-benchmark-k8s-resource.yaml @@ -1,31 +1,34 @@ -apiVersion: theodolite.com/v1alpha1 +apiVersion: theodolite.com/v1 kind: benchmark metadata: name: uc1-kstreams -appResource: - - "uc1-kstreams-deployment.yaml" - - "aggregation-service.yaml" - - "jmx-configmap.yaml" -loadGenResource: - - "uc1-load-generator-deployment.yaml" - - "uc1-load-generator-service.yaml" -resourceTypes: - - typeName: "Instances" - patchers: - - type: "ReplicaPatcher" - resource: "uc1-kstreams-deployment.yaml" -loadTypes: - - typeName: "NumSensors" - patchers: - - type: "EnvVarPatcher" - resource: "uc1-load-generator-deployment.yaml" - container: "workload-generator" - variableName: "NUM_SENSORS" -kafkaConfig: - bootstrapServer: "localhost:31290" - topics: - - name: "input" - numPartitions: 40 - replicationFactor: 1 - - name: "theodolite-.*" - removeOnly: True \ No newline at end of file +spec: + name: test + appResource: + - "uc1-kstreams-deployment.yaml" + - "aggregation-service.yaml" + - "jmx-configmap.yaml" + loadGenResource: + - "uc1-load-generator-deployment.yaml" + - "uc1-load-generator-service.yaml" + - "uc1-load-generator-service.yaml" + resourceTypes: + - typeName: "Instances" + patchers: + - type: "ReplicaPatcher" + resource: "uc1-kstreams-deployment.yaml" + loadTypes: + - typeName: "NumSensors" + patchers: + - type: "EnvVarPatcher" + resource: "uc1-load-generator-deployment.yaml" + container: "workload-generator" + variableName: "NUM_SENSORS" + kafkaConfig: + bootstrapServer: "localhost:31290" + topics: + - name: "input" + numPartitions: 40 + replicationFactor: 1 + - name: "theodolite-.*" + removeOnly: True \ No newline at end of file diff --git a/theodolite-quarkus/src/main/resources/operator/example-execution-k8s-resource.yaml b/theodolite-quarkus/src/main/resources/operator/example-execution-k8s-resource.yaml index 7f76b1bca..4227020e7 100644 --- a/theodolite-quarkus/src/main/resources/operator/example-execution-k8s-resource.yaml +++ b/theodolite-quarkus/src/main/resources/operator/example-execution-k8s-resource.yaml @@ -1,38 +1,41 @@ -apiVersion: theodolite.com/v1alpha1 +apiVersion: theodolite.com/v1 kind: execution metadata: name: theodolite-example-execution -benchmark: "uc1-kstreams" -load: - loadType: "NumSensors" - loadValues: - - 50000 -resources: - resourceType: "Instances" - resourceValues: - - 1 -slos: - - sloType: "lag trend" - threshold: 1000 - prometheusUrl: "http://localhost:32656" - externalSloUrl: "http://localhost:80/evaluate-slope" - offset: 0 - warmup: 0 -execution: - strategy: "LinearSearch" - duration: 60 - repetitions: 1 - delay: 30 # in seconds - restrictions: - - "LowerBound" -configOverrides: - - patcher: - type: "NodeSelectorPatcher" - resource: "uc1-load-generator-deployment.yaml" - variableName: "env" - value: "prod" - - patcher: - type: "NodeSelectorPatcher" - resource: "uc1-kstreams-deployment.yaml" - variableName: "env" - value: "prod" \ No newline at end of file +spec: + benchmark: uc1-kstreams + load: + loadType: "NumSensors" + loadValues: + - 50000 + resources: + resourceType: "Instances" + resourceValues: + - 1 + slos: + - sloType: "lag trend" + threshold: 1000 + prometheusUrl: "http://localhost:32656" + externalSloUrl: "http://localhost:80/evaluate-slope" + offset: 0 + warmup: 0 + execution: + strategy: "LinearSearch" + duration: 60 + repetitions: 1 + loadGenerationDelay: 30 # in seconds + restrictions: + - "LowerBound" + configOverrides: + - patcher: + type: "NodeSelectorPatcher" + resource: "uc1-load-generator-deployment.yaml" + container: "" + variableName: "env" + value: "prod" + - patcher: + type: "NodeSelectorPatcher" + resource: "uc1-kstreams-deployment.yaml" + container: "" + variableName: "env" + value: "prod" diff --git a/theodolite-quarkus/src/main/resources/operator/executionCRD.yaml b/theodolite-quarkus/src/main/resources/operator/executionCRD.yaml index 0bdb83c62..cfe54d0c6 100644 --- a/theodolite-quarkus/src/main/resources/operator/executionCRD.yaml +++ b/theodolite-quarkus/src/main/resources/operator/executionCRD.yaml @@ -1,13 +1,129 @@ -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: executions.theodolite.com spec: group: theodolite.com - version: v1alpha1 names: kind: execution plural: executions - scope: Namespaced - subresources: - status: {} \ No newline at end of file + shortNames: + - ex + versions: + - name: v1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + required: ["spec"] + properties: + spec: + type: object + required: ["benchmark", "load", "resources", "slos", "execution", "configOverrides"] + properties: + name: + type: string + default: "" + benchmark: + type: string + load: # definition of the load dimension + type: object + required: ["loadType", "loadValues"] + properties: + loadType: + type: string + loadValues: + type: array + items: + type: integer + resources: # definition of the resource dimension + type: object + required: ["resourceType", "resourceValues"] + properties: + resourceType: + type: string + resourceValues: + type: array + items: + type: integer + slos: # def of service level objectives + type: array + items: + type: object + required: ["sloType", "threshold", "prometheusUrl", "externalSloUrl", "offset", "warmup"] + properties: + sloType: + type: string + threshold: + type: integer + prometheusUrl: + type: string + externalSloUrl: + type: string + offset: + type: integer + warmup: + type: integer + execution: # def execution config + type: object + required: ["strategy", "duration", "repetitions", "restrictions"] + properties: + strategy: + type: string + duration: + type: integer + repetitions: + type: integer + loadGenerationDelay: + type: integer + restrictions: + type: array + items: + type: string + configOverrides: + type: array + items: + type: object + properties: + patcher: + type: object + properties: + type: + type: string + default: "" + resource: + type: string + default: "" + container: + type: string + default: "" + variableName: + type: string + default: "" + value: + type: string + status: + type: object + properties: + executionState: + description: "" + type: string + executionDuration: + description: "Duration of the execution in seconds" + type: string + additionalPrinterColumns: + - name: STATUS + type: string + description: State of the execution + jsonPath: .status.executionState + - name: Duration + type: string + description: Duration of the execution + jsonPath: .status.executionDuration + - name: Age + type: date + jsonPath: .metadata.creationTimestamp + subresources: + status: {} + scope: Namespaced \ No newline at end of file -- GitLab