Skip to content

Commit

Permalink
NODE-5888 Use node group instead of node uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
dmironov-wallarm committed Nov 27, 2024
1 parent 5b0e795 commit 5d8de29
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ jobs:
DOCKERHUB_USER: ${{ steps.secrets.outputs.user }}
DOCKERHUB_PASSWORD: ${{ steps.secrets.outputs.password }}
INJECTION_STRATEGY: ${{ matrix.INJECTION_STRATEGY }}
WALLARM_API_TOKEN: ${{ steps.secrets.outputs.api_token }}
WALLARM_API_TOKEN: ${{ steps.secrets.outputs.user_token }}
WALLARM_API_HOST: ${{ steps.secrets.outputs.api_host }}
WALLARM_API_PRESET: ${{ steps.secrets.outputs.api_preset }}
USER_TOKEN: ${{ steps.secrets.outputs.user_token }}
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ clean-all:
### Helm routines
###
HELMARGS := --set "config.wallarm.api.token=$(WALLARM_API_TOKEN)" \
--set "config.wallarm.api.host=$(WALLARM_API_HOST)"
--set "config.wallarm.api.host=$(WALLARM_API_HOST)" \
--set "config.wallarm.api.nodeGroup=$(NODE_GROUP_NAME)" \

helm-template:
@$(HELM) template wallarm-sidecar ./helm -f ./helm/values.dev.yaml $(HELMARGS) --debug
Expand Down
1 change: 1 addition & 0 deletions test/smoke/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function check_mandatory_vars() {
WEBHOOK_UUID
SMOKE_REGISTRY_TOKEN
SMOKE_REGISTRY_SECRET
NODE_GROUP_NAME
)

env_list=""
Expand Down
11 changes: 1 addition & 10 deletions test/smoke/run-smoke-suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,8 @@ if ! kubectl get secret "${SMOKE_IMAGE_PULL_SECRET_NAME}" &> /dev/null; then
[email protected]
fi

echo "Retrieving Wallarm Node UUID ..."
POD=$(kubectl get pod -l app=workload -o=name | cut -d/ -f 2)
NODE_UUID=$(kubectl exec "${POD}" -c sidecar-proxy -- cat /opt/wallarm/etc/wallarm/node.yaml | grep uuid | awk '{print $2}' | xargs)
if [[ -z "${NODE_UUID}" ]]; then
echo "Failed to retrieve Wallarm Node UUID"
get_logs_and_fail
fi
echo "Node UUID: ${NODE_UUID}"

echo "Retrieving Wallarm NODE_VERSION ..."
POD=$(kubectl get pod -l app=workload -o=name | cut -d/ -f 2)
NODE_VERSION=$(kubectl get pod ${POD} -o jsonpath="{.spec.containers[?(@.name=='sidecar-proxy')].image}" | awk -F ":" '{print $2}')
echo "Node version: ${NODE_VERSION}"

Expand All @@ -89,7 +81,6 @@ spec:
- command: [sleep, infinity]
env:
- {name: NODE_BASE_URL, value: "${NODE_BASE_URL}"}
- {name: NODE_UUID, value: "${NODE_UUID}"}
- {name: WALLARM_API_HOST, value: "${WALLARM_API_HOST}"}
- {name: WALLARM_API_PRESET, value: "${WALLARM_API_PRESET}"}
- {name: API_CA_VERIFY, value: "${WALLARM_API_CA_VERIFY}"}
Expand Down
6 changes: 5 additions & 1 deletion test/smoke/run.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/bin/bash

#import functions
# import functions
source "${PWD}/test/smoke/functions.sh"

# generate unique group name
export NODE_GROUP_NAME="github-sidecar-$(tr -dc A-Za-z0-9 </dev/urandom | head -c 12; echo)"

# check if all mandatory vars was defined
check_mandatory_vars

Expand Down Expand Up @@ -138,6 +141,7 @@ config:
api:
token: ${WALLARM_API_TOKEN}
host: ${WALLARM_API_HOST}
nodeGroup: ${NODE_GROUP_NAME}
injectionStrategy:
schema: ${INJECTION_STRATEGY}
controller:
Expand Down

0 comments on commit 5d8de29

Please sign in to comment.