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

DEVOPS-2370 Node 4.10 #322

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
66eb3b0
Initial commit for 4.10
nedvna Dec 18, 2023
cb52e28
Add liveness probe for apifw
nedvna Dec 20, 2023
12a4d0a
add new test with TEST_RC flag
denisqsound Dec 21, 2023
c1f2225
Update workflow for RC charts
nedvna Dec 21, 2023
1b1d193
Bump versions
nedvna Dec 21, 2023
b8dbbeb
Add scripts for 4.10
nedvna Dec 21, 2023
25280c4
tmp switch to audit cloud
nedvna Dec 21, 2023
d432374
Fix scripts for api-wf
Dec 22, 2023
8e8ef45
Fix TEST_RC flag
Dec 22, 2023
19c2fb0
fix quotation marks for TEST_RC
denisqsound Dec 22, 2023
41a5ae7
Add paths for apifw
Dec 22, 2023
d6a39b4
bump base versions
nedvna Dec 22, 2023
379c1cd
Fix TEST_RC flag (set default for local run)
Dec 25, 2023
a3679a8
Add health and readiness probes
Dec 25, 2023
0183cca
Fix nginx.tmpl
Dec 25, 2023
fe79aca
Add WALLARM_API_HOST in e2e tests
Dec 25, 2023
eb6cbc9
fix nginx.tmpl
Dec 25, 2023
2b8e595
Ability to turn off API Firewall functionality
Dec 26, 2023
654fbf8
Getting api_host, api_preset and client_id from Vault
Dec 26, 2023
10c2e79
Ability to turn off API Firewall functionality - fix
Dec 26, 2023
631fa4f
Switch tests from Audit to EU
Dec 26, 2023
2b97043
Disabled liveness nad readiness probe for api-fw
Dec 26, 2023
e5d53cf
Add wallarm_enable_apifw and disable access logs for api-fw locations
Dec 26, 2023
10fe33f
Disable Wallarm on health and metrics endpoints
Dec 27, 2023
add168c
Update API-FW ports
Dec 27, 2023
a69e9c3
Move api-fw location to proper place
Dec 27, 2023
ee6dd75
Fix var names for linter
134171E Dec 28, 2023
13d5272
Do not enable Wallarm API FW for unsupported backend protocols
134171E Dec 27, 2023
94ccb70
Add logLevel for cron jobs
Dec 27, 2023
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
20 changes: 15 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ jobs:
method: kubernetes
path: kubernetes-ci
secrets: |
kv-gitlab-ci/data/github/ingress api_token ;
kv-gitlab-ci/data/github/ingress user_secret ;
kv-gitlab-ci/data/github/ingress user_uuid ;
kv-gitlab-ci/data/github/ingress-audit api_token ;
kv-gitlab-ci/data/github/ingress-audit user_secret ;
kv-gitlab-ci/data/github/ingress-audit user_uuid ;
kv-gitlab-ci/data/github/shared/smoke-tests-registry-creds token_name ;
kv-gitlab-ci/data/github/shared/smoke-tests-registry-creds token_secret ;

Expand All @@ -150,6 +150,9 @@ jobs:
SKIP_CLUSTER_CREATION: true
SKIP_IMAGE_CREATION: true
WALLARM_API_TOKEN: ${{ steps.secrets.outputs.api_token }}
WALLARM_API_HOST: audit.api.wallarm.com # TODO: tmp
WALLARM_API_PRESET: audit # TODO: tmp
CLIENT_ID: "55146" # TODO: tmp
USER_UUID: ${{ steps.secrets.outputs.user_uuid }}
USER_SECRET: ${{ steps.secrets.outputs.user_secret }}
SMOKE_REGISTRY_TOKEN: ${{ steps.secrets.outputs.token_name }}
Expand All @@ -161,6 +164,7 @@ jobs:
ALLURE_PROJECT_ID: ${{ secrets.ALLURE_PROJECT_ID }}
ALLURE_ENVIRONMENT_K8S: ${{ matrix.k8s }}
ALLURE_ENVIRONMENT_ARCH: ${{ matrix.ARCH }}
TEST_RC: 'True'
run: |
make kind-smoke-test

Expand All @@ -187,7 +191,7 @@ jobs:
role: ${{ secrets.VAULT_ROLE }}
method: kubernetes
path: kubernetes-ci
secrets: kv-gitlab-ci/data/github/ingress api_token
secrets: kv-gitlab-ci/data/github/ingress-audit api_token

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3.0.2
Expand All @@ -211,6 +215,9 @@ jobs:
SKIP_CLUSTER_CREATION: true
SKIP_IMAGE_CREATION: true
WALLARM_API_TOKEN: ${{ steps.secrets.outputs.api_token }}
WALLARM_API_PRESET: audit # TODO: tmp
WALLARM_API_HOST: audit.api.wallarm.com # TODO: tmp
CLIENT_ID: "55146" # TODO: tmp
CT_MODE: ${{ matrix.method }}
run: |
kind get kubeconfig > $GITHUB_WORKSPACE/kind-config-kind
Expand Down Expand Up @@ -277,7 +284,7 @@ jobs:
role: ${{ secrets.VAULT_ROLE }}
method: kubernetes
path: kubernetes-ci
secrets: kv-gitlab-ci/data/github/ingress api_token
secrets: kv-gitlab-ci/data/github/ingress-audit api_token

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3.0.2
Expand All @@ -301,6 +308,9 @@ jobs:
SKIP_E2E_IMAGE_CREATION: true
WALLARM_ENABLED: true
WALLARM_API_TOKEN: ${{ steps.secrets.outputs.api_token }}
WALLARM_API_HOST: audit.api.wallarm.com # TODO: tmp
WALLARM_API_PRESET: audit # TODO: tmp
CLIENT_ID: "55146" # TODO: tmp
run: |
kind get kubeconfig > $HOME/.kube/kind-config-kind
make E2E_NODES=6 kind-e2e-test
Expand Down
27 changes: 7 additions & 20 deletions .github/workflows/helm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,14 @@ jobs:
echo "Release type: ${TYPE}"
echo "type=${TYPE}" >> $GITHUB_OUTPUT

- name: Publish Helm charts (Prod)
if: steps.check_release.outputs.type == 'production'
uses: stefanprodan/helm-gh-pages@0ad2bb377311d61ac04ad9eb6f252fb68e207260 # master
with:
token: ${{ steps.secrets.outputs.GITHUB_TOKEN }}
charts_dir: ./charts
charts_url: https://charts.wallarm.com
linting: off
repository: helm-charts
branch: main
target_dir: "wallarm-ingress"
index_dir: .
app_version: "${{ env.X_TAG }}"
chart_version: "${{ env.X_TAG }}"

- name: Update chart name for RC versions
- name: Update versions for RC
if: steps.check_release.outputs.type == 'release-candidate'
run: yq -y -i '.name = "wallarm-ingress-rc"' ./charts/ingress-nginx/Chart.yaml
run: |
yq -y -i '.version += "-rc"' ./charts/ingress-nginx/Chart.yaml
echo "X_TAG=${X_TAG}-rc" >> $GITHUB_ENV

- name: Publish Helm charts (RC)
if: steps.check_release.outputs.type == 'release-candidate'
- name: Publish Helm charts
if: steps.check_release.outputs.type =~ 'production|release-candidate'
uses: stefanprodan/helm-gh-pages@0ad2bb377311d61ac04ad9eb6f252fb68e207260 # master
with:
token: ${{ steps.secrets.outputs.GITHUB_TOKEN }}
Expand All @@ -76,7 +63,7 @@ jobs:
linting: off
repository: helm-charts
branch: main
target_dir: "wallarm-ingress-rc"
target_dir: "wallarm-ingress"
index_dir: .
app_version: "${{ env.X_TAG }}"
chart_version: "${{ env.X_TAG }}"
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/smoke-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
method: kubernetes
path: kubernetes-ci
secrets: |
kv-gitlab-ci/data/github/ingress api_token ;
kv-gitlab-ci/data/github/ingress user_secret ;
kv-gitlab-ci/data/github/ingress user_uuid ;
kv-gitlab-ci/data/github/ingress-audit api_token ;
kv-gitlab-ci/data/github/ingress-audit user_secret ;
kv-gitlab-ci/data/github/ingress-audit user_uuid ;
kv-gitlab-ci/data/github/shared/smoke-tests-registry-creds token_name ;
kv-gitlab-ci/data/github/shared/smoke-tests-registry-creds token_secret ;

Expand All @@ -59,12 +59,16 @@ jobs:
ALLURE_ENDPOINT: ${{ secrets.ALLURE_SERVER_URL }}
ALLURE_PROJECT_ID: ${{ secrets.ALLURE_PROJECT_ID }}
WALLARM_API_TOKEN: ${{ steps.secrets.outputs.api_token }}
WALLARM_API_HOST: audit.api.wallarm.com # TODO: tmp
WALLARM_API_PRESET: audit # TODO: tmp
CLIENT_ID: "55146" # TODO: tmp
USER_UUID: ${{ steps.secrets.outputs.user_uuid }}
USER_SECRET: ${{ steps.secrets.outputs.user_secret }}
SMOKE_REGISTRY_TOKEN: ${{ steps.secrets.outputs.token_name }}
SMOKE_REGISTRY_SECRET: ${{ steps.secrets.outputs.token_secret }}
ALLURE_ENVIRONMENT_K8S: ${{ matrix.k8s }}
ALLURE_ENVIRONMENT_ARCH: amd64
TEST_RC: 'True'
run: |
if [ ${{ github.event_name }} == 'workflow_dispatch' ];
then
Expand Down
2 changes: 1 addition & 1 deletion AIO_BASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.8.0
4.10.0-rc1
2 changes: 1 addition & 1 deletion TAG
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.8.1-1
4.10.0-1
4 changes: 2 additions & 2 deletions charts/ingress-nginx/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: wallarm-ingress
version: 4.8.5
appVersion: 4.8.1-1
version: 4.10.0
appVersion: 4.10.0-1
home: https://github.com/wallarm/ingress
description: Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer with Wallarm module
icon: https://static.wallarm.com/wallarm-logo.svg
Expand Down
19 changes: 19 additions & 0 deletions charts/ingress-nginx/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,25 @@ Create the name of the controller service account to use
{{ toYaml .Values.controller.wallarm.collectd.resources | indent 4 }}
{{- end -}}

{{- define "ingress-nginx.wallarmApifirewallContainer" -}}
- name: api-firewall
{{- if .Values.controller.wallarm.apifirewall.image }}
{{- with .Values.controller.wallarm.apifirewall.image }}
image: "{{ .repository }}:{{ .tag }}"
{{- end }}
{{- else }}
image: "{{ .Values.controller.wallarm.helpers.image }}:{{ .Values.controller.wallarm.helpers.tag }}"
{{- end }}
imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}"
args: ["api-firewall"]
volumeMounts:
- name: wallarm
mountPath: {{ include "wallarm.path" . }}
securityContext: {{ include "controller.containerSecurityContext" . | nindent 4 }}
resources:
{{ toYaml .Values.controller.wallarm.apifirewall.resources | indent 4 }}
{{- end -}}

{{/*
Create the name of the backend service account to use - only used when podsecuritypolicy is also enabled
*/}}
Expand Down
10 changes: 10 additions & 0 deletions charts/ingress-nginx/templates/controller-configmap-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,13 @@ data:
# sync-node
{{ .schedule }} /opt/wallarm/usr/share/wallarm-common/syncnode -f -p -r 120 -l STDOUT -L DEBUG
{{- end }}

{{- with .Values.controller.wallarm.cron.jobs.syncApiSpecs }}
# sync-api-specs
{{ .schedule }} /opt/wallarm/usr/share/wallarm-common/sync-api-specs -l STDOUT
{{- end }}

{{- with .Values.controller.wallarm.cron.jobs.apiFirewall }}
# api-firewall
{{ .schedule }} /opt/wallarm/usr/bin/api-firewall --log-level=DEBUG
{{- end }}
1 change: 1 addition & 0 deletions charts/ingress-nginx/templates/controller-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ spec:
{{- if .Values.controller.wallarm.enabled }}
{{ include "ingress-nginx.wallarmCronContainer" . | nindent 8 }}
{{ include "ingress-nginx.wallarmCollectdContainer" . | nindent 8 }}
{{ include "ingress-nginx.wallarmApifirewallContainer" . | nindent 8 }}
{{- end }}
{{- if (or .Values.controller.extraInitContainers .Values.controller.extraModules .Values.controller.opentelemetry.enabled .Values.controller.wallarm.enabled) }}
initContainers:
Expand Down
1 change: 1 addition & 0 deletions charts/ingress-nginx/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ spec:
{{- if .Values.controller.wallarm.enabled }}
{{ include "ingress-nginx.wallarmCronContainer" . | nindent 8 }}
{{ include "ingress-nginx.wallarmCollectdContainer" . | nindent 8 }}
{{ include "ingress-nginx.wallarmApifirewallContainer" . | nindent 8 }}
{{- end }}
{{- if (or .Values.controller.extraInitContainers .Values.controller.extraModules .Values.controller.opentelemetry.enabled .Values.controller.wallarm.enabled) }}
initContainers:
Expand Down
7 changes: 6 additions & 1 deletion charts/ingress-nginx/templates/tarantool-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,9 @@ data:
{{- with .Values.controller.wallarm.cron.jobs.exportBlockedStat }}
# export-blocked-stats
{{ .schedule }} timeout {{ .timeout }} /opt/wallarm/usr/share/wallarm-common/export-blocked-stats -l STDOUT -L DEBUG
{{- end }}
{{- end }}

{{- with .Values.controller.wallarm.cron.jobs.detectCredStuffing }}
# detect-cred-stuffing
{{ .schedule }} timeout {{ .timeout }} /opt/wallarm/usr/share/wallarm-common/detect-cred-stuffing -l STDOUT
{{- end }}
25 changes: 23 additions & 2 deletions charts/ingress-nginx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ controller:
## for backwards compatibility consider setting the full image url via the repository value below
## use *either* current default registry/image or repository format or installing chart by providing the values.yaml will fail
## repository:
tag: "4.8.1-1"
tag: "4.10.0-1"
pullPolicy: IfNotPresent
# www-data -> uid 101
runAsUser: 101
Expand Down Expand Up @@ -790,7 +790,7 @@ controller:
## The image name and tag for the helper image
##
image: docker.io/wallarm/node-helpers
tag: 4.8.1
tag: 4.10.0-rc1
tarantool:
kind: Deployment
service:
Expand Down Expand Up @@ -874,9 +874,30 @@ controller:
exportBlockedStat:
schedule: "* * * * *"
timeout: 24h
detectCredStuffing:
schedule: "* * * * *"
timeout: 10m
syncApiSpecs:
schedule: "* * * * *"
timeout: 10m
apiFirewall:
schedule: "* * * * *"
timeout: 10m
resources: {}
collectd:
resources: {}
apifirewall:
resources: {}
livenessProbe:
httpGet:
path: "/"
port: 9667
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 5

# -- Rollback limit
##
Expand Down
15 changes: 15 additions & 0 deletions rootfs/etc/nginx/template/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,21 @@ stream {
{{ end }}
{{ end }}

{{ if $all.Cfg.EnableWallarm }}
# api firewall
location ~ ^/wallarm-apifw(.*)$ {
wallarm_mode off;
proxy_pass http://api-firewall:8088$1;
error_page 404 431 = @wallarm-apifw-fallback;
error_page 500 502 503 504 = @wallarm-apifw-fallback;
}

location @wallarm-apifw-fallback {
wallarm_mode off;
return 500 "API FW fallback";
}
{{ end }}

location {{ $path }} {
{{ $ing := (getIngressInformation $location.Ingress $server.Hostname $location.IngressPath) }}
set $namespace {{ $ing.Namespace | quote}};
Expand Down
1 change: 1 addition & 0 deletions test/smoke/run-smoke-suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ spec:
- {name: ALLURE_PROJECT_ID, value: "${ALLURE_PROJECT_ID:-}"}
- {name: ALLURE_TOKEN, value: "${ALLURE_TOKEN:-}"}
- {name: ALLURE_RESULTS, value: "${ALLURE_RESULTS:-/tests/_out/allure_report}"}
- {name: TEST_RC, value: "${TEST_RC:-'True'}"}
xDmitriev marked this conversation as resolved.
Show resolved Hide resolved
- name: ALLURE_LAUNCH_TAGS
value: >
USER:${GITHUB_ACTOR:-local},
Expand Down
Loading