Skip to content

Commit

Permalink
chore: reduce infra costs during e2e tests (#5058)
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>
  • Loading branch information
JorTurFer authored Oct 9, 2023
1 parent dbb906f commit 9adebb8
Show file tree
Hide file tree
Showing 30 changed files with 47 additions and 89 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/pr-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ jobs:
id: checkout
run: |
gh pr checkout ${{ needs.triage.outputs.pr_num }}
git checkout ${{ needs.triage.outputs.commit_sha }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand Down Expand Up @@ -134,6 +135,7 @@ jobs:
id: checkout
run: |
gh pr checkout ${{ needs.triage.outputs.pr_num }}
git checkout ${{ needs.triage.outputs.commit_sha }}
- uses: oNaiPs/secrets-to-env-action@v1
with:
Expand All @@ -142,7 +144,7 @@ jobs:
- name: Scale cluster
run: make scale-node-pool
env:
NODE_POOL_SIZE: 4
NODE_POOL_SIZE: 2
TEST_CLUSTER_NAME: keda-e2e-cluster-pr

- name: Run end to end tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/template-main-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Scale cluster
run: make scale-node-pool
env:
NODE_POOL_SIZE: 4
NODE_POOL_SIZE: 2

- name: Run end to end tests
env:
Expand Down
25 changes: 12 additions & 13 deletions tests/internals/custom_hpa_name/custom_hpa_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ spec:
image: registry.k8s.io/hpa-example
ports:
- containerPort: 80
resources:
limits:
cpu: 500m
requests:
cpu: 200m
imagePullPolicy: IfNotPresent
`

Expand All @@ -68,10 +63,12 @@ spec:
maxReplicaCount: 1
cooldownPeriod: 10
triggers:
- type: cpu
metadata:
type: Utilization
value: "50"
- type: metrics-api
metadata:
targetValue: "2"
url: "invalid-invalid"
valueLocation: 'value'
method: "query"
`

scaledObjectTemplateWithCustomName = `
Expand All @@ -90,10 +87,12 @@ spec:
horizontalPodAutoscalerConfig:
name: {{.CustomHpaName}}
triggers:
- type: cpu
metadata:
type: Utilization
value: "50"
- type: metrics-api
metadata:
targetValue: "2"
url: "invalid-invalid"
valueLocation: 'value'
method: "query"
`
)

Expand Down
5 changes: 0 additions & 5 deletions tests/internals/replica_update_so/replica_update_so_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ spec:
image: nginxinc/nginx-unprivileged
ports:
- containerPort: 80
resources:
requests:
cpu: "200m"
limits:
cpu: "500m"
`

metricsServerDeploymentTemplate = `
Expand Down
13 changes: 5 additions & 8 deletions tests/internals/trigger_update_so/trigger_update_so_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ spec:
image: nginxinc/nginx-unprivileged
ports:
- containerPort: 80
resources:
requests:
cpu: "200m"
limits:
cpu: "500m"
`

workloadDeploymentTemplate = `apiVersion: apps/v1
Expand Down Expand Up @@ -270,10 +265,12 @@ spec:
metadata:
podSelector: 'pod={{.WorkloadDeploymentName}}'
value: '1'
- type: cpu
metricType: Utilization
- type: metrics-api
metadata:
value: "50"
targetValue: "2"
url: "invalid-invalid"
valueLocation: 'value'
method: "query"
`

updateMetricTemplate = `
Expand Down
42 changes: 20 additions & 22 deletions tests/internals/update_ta/update_ta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ spec:
image: nginxinc/nginx-unprivileged
ports:
- containerPort: 80
resources:
requests:
cpu: "200m"
limits:
cpu: "500m"
`

deployment2Template = `
Expand All @@ -130,11 +125,6 @@ spec:
image: nginxinc/nginx-unprivileged
ports:
- containerPort: 80
resources:
requests:
cpu: "200m"
limits:
cpu: "500m"
`

scaledObjectTriggerTemplate = `
Expand All @@ -158,10 +148,12 @@ spec:
maxReplicaCount: {{.MaxReplicas}}
cooldownPeriod: 1
triggers:
- type: cpu
metricType: Utilization
- type: metrics-api
metadata:
value: "50"
targetValue: "2"
url: "invalid-invalid"
valueLocation: 'value'
method: "query"
authenticationRef:
name: {{.TriggerAuthName}}
kind: {{.TriggerAuthKind}}
Expand All @@ -188,10 +180,12 @@ spec:
maxReplicaCount: {{.MaxReplicas}}
cooldownPeriod: 1
triggers:
- type: cpu
metricType: Utilization
- type: metrics-api
metadata:
value: "50"
targetValue: "2"
url: "invalid-invalid"
valueLocation: 'value'
method: "query"
authenticationRef:
name: {{.TriggerAuthName}}
kind: {{.TriggerAuthKind}}
Expand Down Expand Up @@ -222,10 +216,12 @@ spec:
successfulJobsHistoryLimit: 0
failedJobsHistoryLimit: 0
triggers:
- type: cpu
- type: metrics-api
metadata:
type: Utilization
value: "50"
targetValue: "2"
url: "invalid-invalid"
valueLocation: 'value'
method: "query"
authenticationRef:
name: {{.TriggerAuthName}}
kind: {{.TriggerAuthKind}}
Expand Down Expand Up @@ -256,10 +252,12 @@ spec:
successfulJobsHistoryLimit: 0
failedJobsHistoryLimit: 0
triggers:
- type: cpu
- type: metrics-api
metadata:
type: Utilization
value: "50"
targetValue: "2"
url: "invalid-invalid"
valueLocation: 'value'
method: "query"
authenticationRef:
name: {{.TriggerAuthName}}
kind: {{.TriggerAuthKind}}
Expand Down
1 change: 0 additions & 1 deletion tests/scalers/activemq/activemq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ spec:
- containerPort: 1883
name: mqtt
protocol: TCP
resources:
volumeMounts:
- name: remote-access-cm
mountPath: /opt/apache-activemq-5.16.3/webapps/api/WEB-INF/classes/jolokia-access.xml
Expand Down
6 changes: 3 additions & 3 deletions tests/scalers/arangodb/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
architectures:
- arm64
- amd64
mode: Cluster
mode: Single
image: "arangodb/arangodb:3.10.1"
`

Expand Down Expand Up @@ -90,12 +90,12 @@ func InstallArangoDB(t *testing.T, kc *kubernetes.Clientset, testNamespace strin
assert.NoErrorf(t, err, "cannot install crds - %s", err)

t.Log("installing arangodb operator")
_, err = helper.ExecuteCommand(fmt.Sprintf("helm install arangodb https://github.com/arangodb/kube-arangodb/releases/download/1.2.20/kube-arangodb-1.2.20.tgz --set 'operator.architectures={arm64,amd64}' --namespace=%s --wait", testNamespace))
_, err = helper.ExecuteCommand(fmt.Sprintf("helm install arangodb https://github.com/arangodb/kube-arangodb/releases/download/1.2.20/kube-arangodb-1.2.20.tgz --set 'operator.architectures={arm64,amd64}' --set 'operator.resources.requests.cpu=1m' --set 'operator.resources.requests.memory=1Mi' --namespace=%s --wait", testNamespace))
assert.NoErrorf(t, err, "cannot create operator deployment - %s", err)

t.Log("creating arangodeployment resource")
helper.KubectlApplyWithTemplate(t, templateData{Namespace: testNamespace}, "arangoDeploymentTemplate", arangoDeploymentTemplate)
assert.True(t, helper.WaitForPodCountInNamespace(t, kc, testNamespace, 11, 5, 20), "pod count should be 11")
assert.True(t, helper.WaitForPodCountInNamespace(t, kc, testNamespace, 3, 5, 20), "pod count should be 3")
assert.True(t, helper.WaitForAllPodRunningInNamespace(t, kc, testNamespace, 5, 20), "all pods should be running")
}

Expand Down
1 change: 0 additions & 1 deletion tests/scalers/artemis/artemis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ spec:
- name: artemis-activemq-artemis
image: docker.io/vromero/activemq-artemis:2.6.2
imagePullPolicy:
resources:
env:
- name: ARTEMIS_PASSWORD
valueFrom:
Expand Down
1 change: 0 additions & 1 deletion tests/scalers/azure/azure_blob/azure_blob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ spec:
containers:
- name: {{.DeploymentName}}
image: slurplk/blob-consumer:latest
resources:
env:
- name: FUNCTIONS_WORKER_RUNTIME
value: dotnet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ spec:
containers:
- name: {{.DeploymentName}}
image: slurplk/blob-consumer:latest
resources:
env:
- name: FUNCTIONS_WORKER_RUNTIME
value: dotnet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ spec:
containers:
- name: {{.DeploymentName}}
image: slurplk/blob-consumer:latest
resources:
env:
- name: FUNCTIONS_WORKER_RUNTIME
value: dotnet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ spec:
containers:
- name: {{.DeploymentName}}
image: ghcr.io/kedacore/tests-azure-eventhub-golang
resources:
env:
- name: EVENTHUB_CONNECTION_STRING
valueFrom:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ spec:
containers:
- name: {{.DeploymentName}}
image: ghcr.io/kedacore/tests-azure-eventhub-golang
resources:
env:
- name: EVENTHUB_CONNECTION_STRING
valueFrom:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ spec:
containers:
- name: {{.DeploymentName}}
image: ghcr.io/kedacore/tests-azure-eventhub-dotnet
resources:
env:
- name: EVENTHUB_CONNECTION_STRING
valueFrom:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,12 @@ spec:
image: daprio/daprd:1.9.5-mariner
imagePullPolicy: Always
command: ["./daprd", "-app-id", "azure-eventhub-dapr", "-app-port", "3000", "-components-path", "/components", "-log-level", "debug"]
resources:
volumeMounts:
- mountPath: "/components"
name: {{.SecretName}}
readOnly: true
- name: {{.DeploymentName}}
image: ghcr.io/kedacore/tests-azure-eventhub-dapr
resources:
env:
- name: APP_PORT
value: "3000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ spec:
containers:
- name: {{.DeploymentName}}
image: ghcr.io/kedacore/tests-azure-eventhub-golang
resources:
env:
- name: EVENTHUB_CONNECTION_STRING
valueFrom:
Expand Down
1 change: 0 additions & 1 deletion tests/scalers/azure/azure_queue/azure_queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ spec:
containers:
- name: {{.DeploymentName}}
image: ghcr.io/kedacore/tests-azure-queue
resources:
env:
- name: FUNCTIONS_WORKER_RUNTIME
value: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ spec:
containers:
- name: {{.DeploymentName}}
image: ghcr.io/kedacore/tests-azure-queue
resources:
env:
- name: FUNCTIONS_WORKER_RUNTIME
value: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ spec:
containers:
- name: {{.DeploymentName}}
image: ghcr.io/kedacore/tests-azure-queue
resources:
env:
- name: FUNCTIONS_WORKER_RUNTIME
value: node
Expand Down
1 change: 0 additions & 1 deletion tests/scalers/elasticsearch/elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ spec:
- containerPort: 9300
name: transport
protocol: TCP
resources:
readinessProbe:
exec:
command:
Expand Down
7 changes: 0 additions & 7 deletions tests/scalers/etcd/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,6 @@ spec:
- containerPort: 2379
name: client
protocol: TCP
resources:
requests:
memory: "0.5Gi"
cpu: "500m"
limits:
memory: "1Gi"
cpu: "1000m"
volumeMounts:
- mountPath: /etcd-data
name: cache-volume
Expand Down
2 changes: 1 addition & 1 deletion tests/scalers/github_runner/github_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ spec:
containers:
- name: github-runner
image: myoung34/github-runner
imagePullPolicy: IfNotPresent
imagePullPolicy: Always
env:
- name: EPHEMERAL
value: "true"
Expand Down
3 changes: 1 addition & 2 deletions tests/scalers/graphite/graphite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,7 @@ spec:
httpGet:
path: /
port: graphite-gui
resources:
{}
volumeMounts:
- name: graphite-configmap
mountPath: /opt/graphite/conf/
Expand Down
Loading

0 comments on commit 9adebb8

Please sign in to comment.