Skip to content

Commit

Permalink
NODE-5400 Migration to wcli scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
nedvna committed Jul 22, 2024
1 parent 6499e11 commit ec78084
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 317 deletions.
4 changes: 0 additions & 4 deletions charts/ingress-nginx/ci/daemonset-extra-envs-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,3 @@ controller:
extraEnvs:
- name: EXTRA_APPSTRUCT_KEY
value: EXTRA_APPSTRUCT_VAL
wallarm-antibot:
extraEnvs:
- name: EXTRA_ANTIBOT_KEY
value: EXTRA_ANTIBOT_VAL
4 changes: 0 additions & 4 deletions charts/ingress-nginx/ci/deployment-extra-envs-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,3 @@ controller:
extraEnvs:
- name: EXTRA_APPSTRUCT_KEY
value: EXTRA_APPSTRUCT_VAL
wallarm-antibot:
extraEnvs:
- name: EXTRA_ANTIBOT_KEY
value: EXTRA_ANTIBOT_VAL
28 changes: 18 additions & 10 deletions charts/ingress-nginx/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ Create the name of the controller service account to use
{{- end }}
- name: WALLARM_API_TOKEN_PATH
value: "/secrets/wallarm/token"
- name: WALLARM_COMPONENT_NAME
value: wallarm-ingress-controller
- name: WALLARM_COMPONENT_VERSION
value: {{ .Chart.Version | quote }}
{{- end -}}

{{- define "ingress-nginx.wallarmInitContainer.addNode" -}}
Expand All @@ -227,7 +231,7 @@ Create the name of the controller service account to use
image: "{{ .Values.controller.wallarm.helpers.image }}:{{ .Values.controller.wallarm.helpers.tag }}"
{{- end }}
imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}"
args: [ "register" {{- if eq .Values.controller.wallarm.fallback "on" }}, "fallback"{{- end }} ]
args: [ "register", "{{ .Values.register_mode }}" {{- if eq .Values.controller.wallarm.fallback "on" }}, "fallback"{{- end }} ]
env:
{{- include "wallarm.credentials" . | nindent 2 }}
- name: WALLARM_NODE_NAME
Expand All @@ -238,8 +242,6 @@ Create the name of the controller service account to use
value: www-data
- name: WALLARM_SYNCNODE_GROUP
value: www-data
- name: WALLARM_INGRESS_CONTROLLER_VERSION
value: {{ .Chart.Version | quote }}
{{- if .Values.controller.wallarm.nodeGroup }}
- name: WALLARM_LABELS
value: "group={{ .Values.controller.wallarm.nodeGroup }}"
Expand Down Expand Up @@ -273,15 +275,13 @@ Create the name of the controller service account to use
image: "{{ .Values.controller.wallarm.helpers.image }}:{{ .Values.controller.wallarm.helpers.tag }}"
{{- end }}
imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}"
args: ["supervisord"]
args: ["wcli", "run", {{ include "ingress-nginx.wcli-args" . }}]
env:
{{- include "wallarm.credentials" . | nindent 2 }}
- name: WALLARM_NODE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: WALLARM_INGRESS_CONTROLLER_VERSION
value: {{ .Chart.Version | quote }}
{{- if .Values.controller.wallarm.cron.extraEnvs }}
{{- toYaml .Values.controller.wallarm.cron.extraEnvs | nindent 2 }}
{{- end }}
Expand All @@ -292,10 +292,6 @@ Create the name of the controller service account to use
name: wallarm-acl
- mountPath: {{ include "wallarm-apifw.path" . }}
name: wallarm-apifw
- mountPath: /opt/supervisord/supervisord.conf
name: wallarm-cron
subPath: supervisord.conf
readOnly: true
- mountPath: /secrets/wallarm/token
name: wallarm-token
subPath: token
Expand Down Expand Up @@ -507,3 +503,15 @@ Extra modules.
- name: modules
mountPath: /modules_mount
{{- end -}}

{{/*
Wcli arguments building
*/}}
{{- define "ingress-nginx.wcli-args" -}}
"-log-level", "{{ .Values.controller.wallarm.cron.logLevel }}",{{ " " }}
{{- with .Values.controller.wallarm.cron.commands -}}
{{- range $name, $value := . -}}
"job:{{ $name }}", "-log-level", "{{ $value.logLevel }}",{{ " " }}
{{- end -}}
{{- end -}}
{{- end -}}
92 changes: 0 additions & 92 deletions charts/ingress-nginx/templates/controller-configmap-cron.yaml

This file was deleted.

4 changes: 1 addition & 3 deletions charts/ingress-nginx/templates/controller-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ spec:
{{- end }}
{{- end }}
{{- if .Values.controller.wallarm.enabled }}
{{ $_ := set .Values "register_mode" "filtering" }}
{{ include "ingress-nginx.wallarmInitContainer.addNode" . | nindent 8 }}
{{- end }}
{{- if .Values.controller.hostNetwork }}
Expand Down Expand Up @@ -257,9 +258,6 @@ spec:
emptyDir: {}
- name: wallarm-apifw
emptyDir: {}
- name: wallarm-cron
configMap:
name: {{ template "ingress-nginx.wallarmControllerCronConfig" . }}
{{- include "ingress-nginx.wallarmTokenVolume" . | nindent 8 }}
{{- end }}
{{- if .Values.controller.customTemplate.configMapName }}
Expand Down
4 changes: 1 addition & 3 deletions charts/ingress-nginx/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ spec:
{{- end }}
{{- end }}
{{- if .Values.controller.wallarm.enabled }}
{{ $_ := set .Values "register_mode" "filtering" }}
{{ include "ingress-nginx.wallarmInitContainer.addNode" . | nindent 8 }}
{{- end }}
{{- end }}
Expand Down Expand Up @@ -260,9 +261,6 @@ spec:
emptyDir: {}
- name: wallarm-apifw
emptyDir: {}
- name: wallarm-cron
configMap:
name: {{ template "ingress-nginx.wallarmControllerCronConfig" . }}
{{- include "ingress-nginx.wallarmTokenVolume" . | nindent 8 }}
{{- end }}
{{- if .Values.controller.customTemplate.configMapName }}
Expand Down
126 changes: 0 additions & 126 deletions charts/ingress-nginx/templates/tarantool-configmap.yaml

This file was deleted.

25 changes: 1 addition & 24 deletions charts/ingress-nginx/templates/tarantool-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ spec:
{{- end }}
terminationGracePeriodSeconds: {{ .Values.controller.wallarm.tarantool.terminationGracePeriodSeconds }}
initContainers:
{{ $_ := set .Values "register_mode" "post_analytic" }}
{{ include "ingress-nginx.wallarmInitContainer.addNode" . | nindent 8 }}
containers:
{{ include "ingress-nginx.wallarmCronContainer" . | nindent 8 }}
Expand Down Expand Up @@ -99,27 +100,6 @@ spec:
{{- if index .Values "controller" "wallarm" "wallarm-appstructure" "resources" }}
resources: {{ toYaml (index .Values "controller" "wallarm" "wallarm-appstructure" "resources") | nindent 12 }}
{{- end }}
- name: wallarm-antibot
{{- if (index .Values "controller" "wallarm" "wallarm-antibot" "image") }}
{{- with (index .Values "controller" "wallarm" "wallarm-antibot" "image") }}
image: "{{ .repository }}:{{ .tag }}"
{{- end }}
{{- else }}
image: "{{ .Values.controller.wallarm.helpers.image }}:{{ .Values.controller.wallarm.helpers.tag }}"
{{- end }}
imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}"
args: ["antibot"]
{{- if (index .Values "controller" "wallarm" "wallarm-antibot" "extraEnvs") }}
env:
{{- toYaml (index .Values "controller" "wallarm" "wallarm-antibot" "extraEnvs") | nindent 12 }}
{{- end }}
securityContext: {{ include "ingress-nginx.controller.containerSecurityContext" . | nindent 12 }}
volumeMounts:
- mountPath: /opt/wallarm/etc/wallarm
name: wallarm
{{- if index .Values "controller" "wallarm" "wallarm-antibot" "resources" }}
resources: {{ toYaml (index .Values "controller" "wallarm" "wallarm-antibot" "resources") | nindent 12 }}
{{- end }}
{{- if .Values.controller.wallarm.tarantool.nodeSelector }}
nodeSelector: {{ toYaml .Values.controller.wallarm.tarantool.nodeSelector | nindent 8 }}
{{- end }}
Expand All @@ -139,9 +119,6 @@ spec:
emptyDir: {}
- name: wallarm-apifw
emptyDir: {}
- name: wallarm-cron
configMap:
name: {{ template "ingress-nginx.wallarmTarantoolCronConfig" . }}
{{- include "ingress-nginx.wallarmTokenVolume" . | nindent 8 }}
{{- end }}
{{- end }}
Loading

0 comments on commit ec78084

Please sign in to comment.