From 916993a09139c10827f94c6f85e9997bb3a4bb0b Mon Sep 17 00:00:00 2001 From: Dustin Falgout Date: Tue, 20 Aug 2024 13:25:20 -0500 Subject: [PATCH] feat: update ingress template for divi sites server to include rate limit whitelist annotation --- charts/ds-server/Chart.yaml | 4 ++-- charts/ds-server/templates/_helpers.tpl | 8 ++++++++ charts/ds-server/templates/ingress.yml | 1 + charts/ds-server/values.yaml | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 charts/ds-server/templates/_helpers.tpl diff --git a/charts/ds-server/Chart.yaml b/charts/ds-server/Chart.yaml index 21286cc..55ad019 100644 --- a/charts/ds-server/Chart.yaml +++ b/charts/ds-server/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v1 -description: Divi DS Server +description: Divi Sites Server icon: https://raw.githubusercontent.com/nodejs/nodejs.org/main/public/static/images/logo-hexagon.svg maintainers: - email: dustin@elegantthemes.com name: Elegant Themes name: ds-server -version: 1.0.6 +version: 1.0.7 diff --git a/charts/ds-server/templates/_helpers.tpl b/charts/ds-server/templates/_helpers.tpl new file mode 100644 index 0000000..1681ab6 --- /dev/null +++ b/charts/ds-server/templates/_helpers.tpl @@ -0,0 +1,8 @@ +{{- define "addCIDRToIPs" -}} + {{- $ips := . | split "," -}} + {{- $ipsWithCIDR := list -}} + {{- range $ip := $ips -}} + {{- $ipsWithCIDR = append $ipsWithCIDR (print $ip "/32") -}} + {{- end -}} + {{ $ipsWithCIDR | join "," | quote }} +{{- end -}} diff --git a/charts/ds-server/templates/ingress.yml b/charts/ds-server/templates/ingress.yml index 0d08ae6..2d3eefc 100644 --- a/charts/ds-server/templates/ingress.yml +++ b/charts/ds-server/templates/ingress.yml @@ -17,6 +17,7 @@ metadata: nginx.ingress.kubernetes.io/enable-rewrite-log: "false" nginx.ingress.kubernetes.io/ssl-redirect: "false" nginx.ingress.kubernetes.io/proxy-read-timeout: "300" + nginx.ingress.kubernetes.io/limit-whitelist: {{ include "addCIDRToIPs" .Values.ETDC_IP_ADDRESSES }} spec: tls: - hosts: diff --git a/charts/ds-server/values.yaml b/charts/ds-server/values.yaml index f2224de..a4b22d8 100644 --- a/charts/ds-server/values.yaml +++ b/charts/ds-server/values.yaml @@ -5,6 +5,7 @@ DS_SERVER_PORT: DS_SERVER_IMAGE: DS_SERVER_REPO_URL: DS_SERVER_VERSION: +ETDC_IP_ADDRESSES: GITHUB_TOKEN: GIT_REF: INSTALL_PATH: