Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kim benchmark docs #4

Closed
wants to merge 5 commits into from
Closed
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
4 changes: 2 additions & 2 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: custom-infrastructure-manager
newTag: 0.0.1
newName: infrastructure-manager
newTag: 2.2.2
22 changes: 11 additions & 11 deletions config/samples/infrastructuremanager_v1_gardenercluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ apiVersion: infrastructuremanager.kyma-project.io/v1
kind: GardenerCluster
metadata:
labels:
kyma-project.io/instance-id: instance-id
kyma-project.io/runtime-id: runtime-id
kyma-project.io/instance-id: md-test
kyma-project.io/runtime-id: non-existing-runtime-id
kyma-project.io/broker-plan-id: plan-id
kyma-project.io/broker-plan-name: plan-name
kyma-project.io/global-account-id: global-account-id
kyma-project.io/subaccount-id: subAccount-id
kyma-project.io/shoot-name: shoot-name
kyma-project.io/region: region
kyma-project.io/broker-plan-name: aws
kyma-project.io/global-account-id: 461f6292-8085-41c8-af0c-e185f39b5e18
kyma-project.io/subaccount-id: 7d598f4b-580d-4d11-981a-2dcf766f9b2e
kyma-project.io/shoot-name: c-3acbdd1
kyma-project.io/region: eu-central-1
operator.kyma-project.io/kyma-name: kymaName
name: runtime-id
name: c-3acbdd1
namespace: kcp-system
spec:
shoot:
name: shoot-name
name: dummy-shoot
kubeconfig:
secret:
name: kubeconfig-runtime-id
name: kubeconfig-non-existing-runtime-id
namespace: kcp-system
key: "config"
key: "config"
24 changes: 24 additions & 0 deletions hack/benchmark/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Benchmark
The 'benchmark.sh' script creates secrets that can be used for benchmarking infrastructure manager.

## Usage

In order to use it, call `./hack/benchmark/benchmark.sh {number_of_secrets_to_generate) {path_to_secret_template)`

Example usage `./hack/benchmark/benchmark.sh 10 ./hack/benchmark/secret.template.json`

Script generates `/tmp/input_{currentdateandtime}.json` input file containing list of runtimeIDs of generated secrets:
``` json
[
"AB65AB53-7B0A-481C-A472-349B4947D50D",
"C212033F-A5F8-416F-BF9C-E735A37D4B0E",
"2FFAEDD5-EE90-40F4-955D-DA5493F98263",
"C4E7015A-A79A-457D-A5BC-782D8E614568",
"70607990-5581-445F-A4D1-2AC9C845DB19",
"B9900F40-3A28-4025-A653-353FC91CC603",
"BCE7D3F5-8221-48E5-B634-3FB8EC4F2BA8",
"32054BD1-5AEA-481A-A9A5-1D8CF7CDF4AD",
"AEF09754-E727-4C12-B147-806481D529E5",
"F107C364-5144-4F58-ACD0-2111CADF128B"
]
```
6 changes: 4 additions & 2 deletions hack/benchmark/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ _count=$1
_secret_template_path=$2

function generate_data {
jq -nR --arg _count $_count '[range(0;($_count|tonumber)) | input]' < <(while true; do uuidgen ; done)
jq -nR --arg _count $_count '[range(0;($_count|tonumber)) | input]' < <(while true; do uuidgen | awk '{print tolower($0)}' ; done)
}

function create_secrets {
cat /dev/stdin | jq -r --argjson t "$(<$_secret_template_path)" '.[] as $id | $t | .metadata.name=$id | .metadata.labels["kyma-project.io/runtime-id"]=$id'
}

generate_data $1 $2 | tee /tmp/input.json | create_secrets
datetime_postfix=$(date -u +%Y-%m-%dT%H:%M:%S)
input_filename="/tmp/input_"$datetime_postfix".json"
generate_data $1 $2 | tee $input_filename | create_secrets
4 changes: 2 additions & 2 deletions hack/benchmark/secret.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"kind": "Secret",
"metadata": {
"labels": {
"kyma-project.io/runtime-id": "01a5af79-b073-48a1-906d-26c15933b12a",
"kyma-project.io/runtime-id": "f4090746-7610-42bf-92a7-355f1c9dd38a",
"kyma-project.io/shoot-name": "benchmark-invalid"
},
"name": "kubeconfig-01a5af79-b073-48a1-906d-26c15933b12a",
"name": "kubeconfig-f4090746-7610-42bf-92a7-355f1c9dd38a",
"namespace": "kcp-system"
},
"type": "Opaque"
Expand Down