From 9360dfd1b2c7b441a45461be298742d5ed7fc6ee Mon Sep 17 00:00:00 2001 From: "Roland.Ma" Date: Thu, 2 Sep 2021 03:31:58 +0000 Subject: [PATCH] add config property to save the additional configuration Signed-off-by: Roland.Ma --- config/crds/gateway.kubesphere.io_gateways.yaml | 4 ++++ config/gateway/Chart.yaml | 2 +- config/gateway/templates/nginx-ingress.yaml | 6 ++++-- config/gateway/values.yaml | 4 +++- .../src/kubesphere.io/api/gateway/v1alpha1/gateway_types.go | 2 ++ 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/config/crds/gateway.kubesphere.io_gateways.yaml b/config/crds/gateway.kubesphere.io_gateways.yaml index a8f4ddf64..a4658c01a 100644 --- a/config/crds/gateway.kubesphere.io_gateways.yaml +++ b/config/crds/gateway.kubesphere.io_gateways.yaml @@ -42,6 +42,10 @@ spec: additionalProperties: type: string type: object + config: + additionalProperties: + type: string + type: object replicas: format: int32 type: integer diff --git a/config/gateway/Chart.yaml b/config/gateway/Chart.yaml index 469d90832..9071344be 100644 --- a/config/gateway/Chart.yaml +++ b/config/gateway/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 appVersion: 1.16.0 -description: A Helm chart for Kubernetes +description: The Gateway helm Chart creates a Nginx Ingress Controller release by render a Nginx.gateway.kubesphere.io Kind. name: gateway type: application version: 0.1.0 diff --git a/config/gateway/templates/nginx-ingress.yaml b/config/gateway/templates/nginx-ingress.yaml index 2229da6d9..1960b0488 100644 --- a/config/gateway/templates/nginx-ingress.yaml +++ b/config/gateway/templates/nginx-ingress.yaml @@ -16,7 +16,9 @@ spec: enabled: {{ eq .Values.service.type "LoadBalancer" }} # Will add custom configuration options to Nginx https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/ - config: {} + {{- if .Values.controller.config }} + config: {{ toYaml .Values.controller.config | nindent 6 }} + {{- end }} ## Annotations to be added to the controller config configuration configmap ## @@ -256,7 +258,7 @@ spec: enabled: true serviceMonitor: - enabled: false + enabled: true prometheusRule: enabled: false diff --git a/config/gateway/values.yaml b/config/gateway/values.yaml index 9ca7b68ae..bddfed4f9 100644 --- a/config/gateway/values.yaml +++ b/config/gateway/values.yaml @@ -3,13 +3,15 @@ controller: replicas: 1 annotations: {} + # add custom configuration options + config: {} ## Limit the scope of the controller ## scope: enabled: false namespace: "" # defaults to .Release.Namespace image: - repository: kubesphere/ingress-nginx-controller + repository: kubesphere/nginx-ingress-controller tag: "v0.48.1" pullPolicy: IfNotPresent diff --git a/staging/src/kubesphere.io/api/gateway/v1alpha1/gateway_types.go b/staging/src/kubesphere.io/api/gateway/v1alpha1/gateway_types.go index 6312dfd52..7a29220d4 100644 --- a/staging/src/kubesphere.io/api/gateway/v1alpha1/gateway_types.go +++ b/staging/src/kubesphere.io/api/gateway/v1alpha1/gateway_types.go @@ -35,6 +35,8 @@ type ControllerSpec struct { // +optional Annotations map[string]string `json:"annotations,omitempty"` // +optional + Config map[string]string `json:"config,omitempty"` + // +optional Scope Scope `json:"scope,omitempty"` }