Skip to content

Commit

Permalink
loadgenerator fix app hipstershop
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnacioGoldman committed Jan 24, 2025
1 parent 3205148 commit 4abb0ca
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ spec:
fi
env:
- name: FRONTEND_ADDR
value: "{{ ingress_protocol }}://{{ hipstershop_domain }}"
value: "frontend:80"
containers:
- name: main
args:
- 'locust --host="${FRONTEND_ADDR}" --headless -u "${USERS}" 2>&1'
env:
- name: FRONTEND_ADDR
value: "{{ ingress_protocol }}://{{ hipstershop_domain }}"
value: "frontend:80"
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
group: "{{ ace_box_user }}"
mode: '0644'

- name: Template Hipsterhop Loadgenerator
template:
src: "{{ role_path }}/templates/loadgenerator.yaml.j2"
dest: "{{ role_path }}/files/kustomize/patches/loadgenerator.yaml"
owner: "{{ ace_box_user }}"
group: "{{ ace_box_user }}"
mode: '0644'

- name: Kustomize Build
set_fact:
resources: "{{ lookup('kubernetes.core.kustomize', dir=role_path+'/files/kustomize') }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2024 Dynatrace LLC
#
# 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
#
# https://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.

# vscode-kubernetes-tools:exclude
apiVersion: apps/v1
kind: Deployment
metadata:
name: loadgenerator
spec:
template:
spec:
initContainers:
- name: frontend-check
command:
- /bin/sh
- -exc
- |
echo "Init container pinging frontend: ${FRONTEND_ADDR}..."
STATUSCODE=$(wget --server-response ${FRONTEND_ADDR} 2>&1 | awk '/^ HTTP/{print $2}')
if test $STATUSCODE -ne 200; then
echo "Error: Could not reach frontend - Status code: ${STATUSCODE}"
exit 1
fi
env:
- name: FRONTEND_ADDR
value: "{{ ingress_protocol }}://{{ hipstershop_domain }}"
containers:
- name: main
args:
- 'locust --host="${FRONTEND_ADDR}" --headless -u "${USERS}" 2>&1'
env:
- name: FRONTEND_ADDR
value: "{{ ingress_protocol }}://{{ hipstershop_domain }}"

0 comments on commit 4abb0ca

Please sign in to comment.