From 3a61646b1d1e9e11a7234696888ca491906092e0 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 2 Sep 2018 16:19:11 -0700 Subject: [PATCH] Add global.enabled to disable all components by default --- templates/client-daemonset.yaml | 2 +- templates/connect-inject-deployment.yaml | 2 +- templates/connect-inject-mutatingwebhook.yaml | 2 +- templates/connect-inject-service.yaml | 2 +- templates/server-config-configmap.yaml | 2 +- templates/server-disruptionbudget.yaml | 2 +- templates/server-service.yaml | 2 +- templates/server-statefulset.yaml | 2 +- templates/ui-service.yaml | 2 +- values.yaml | 17 ++++++++++++----- 10 files changed, 21 insertions(+), 14 deletions(-) diff --git a/templates/client-daemonset.yaml b/templates/client-daemonset.yaml index c32d48e..be50c9c 100644 --- a/templates/client-daemonset.yaml +++ b/templates/client-daemonset.yaml @@ -1,5 +1,5 @@ # DaemonSet to run the Consul clients on every node. -{{- if .Values.client.enabled }} +{{- if (default .Values.client.enabled .Values.global.enabled) }} apiVersion: apps/v1 kind: DaemonSet metadata: diff --git a/templates/connect-inject-deployment.yaml b/templates/connect-inject-deployment.yaml index aced776..98dab69 100644 --- a/templates/connect-inject-deployment.yaml +++ b/templates/connect-inject-deployment.yaml @@ -1,5 +1,5 @@ # The deployment for running the Connect sidecar injector -{{- if .Values.connectInject.enabled }} +{{- if (default .Values.connectInject.enabled .Values.global.enabled) }} apiVersion: apps/v1 kind: Deployment metadata: diff --git a/templates/connect-inject-mutatingwebhook.yaml b/templates/connect-inject-mutatingwebhook.yaml index 387e4fb..50ff573 100644 --- a/templates/connect-inject-mutatingwebhook.yaml +++ b/templates/connect-inject-mutatingwebhook.yaml @@ -1,5 +1,5 @@ # The MutatingWebhookConfiguration to enable the Connect injector. -{{- if (.Values.connectInject.enabled) and (.Values.connectInject.caBundle) }} +{{- if (default .Values.connectInject.enabled .Values.global.enabled) }} apiVersion: admissionregistration.k8s.io/v1beta1 kind: MutatingWebhookConfiguration metadata: diff --git a/templates/connect-inject-service.yaml b/templates/connect-inject-service.yaml index 65c2efa..df27d59 100644 --- a/templates/connect-inject-service.yaml +++ b/templates/connect-inject-service.yaml @@ -1,5 +1,5 @@ # The service for the Connect sidecar injector -{{- if .Values.connectInject.enabled }} +{{- if (default .Values.connectInject.enabled .Values.global.enabled) }} apiVersion: v1 kind: Service metadata: diff --git a/templates/server-config-configmap.yaml b/templates/server-config-configmap.yaml index 7d1c7fd..d1ed4cd 100644 --- a/templates/server-config-configmap.yaml +++ b/templates/server-config-configmap.yaml @@ -1,5 +1,5 @@ # StatefulSet to run the actual Consul server cluster. -{{- if .Values.server.enabled }} +{{- if (default .Values.server.enabled .Values.global.enabled) }} apiVersion: v1 kind: ConfigMap metadata: diff --git a/templates/server-disruptionbudget.yaml b/templates/server-disruptionbudget.yaml index f06087a..252b0c6 100644 --- a/templates/server-disruptionbudget.yaml +++ b/templates/server-disruptionbudget.yaml @@ -1,6 +1,6 @@ # PodDisruptionBudget to prevent degrading the server cluster through # voluntary cluster changes. -{{- if (.Values.server.enabled) and (.Values.server.disruptionBudget.enabled) }} +{{- if (and (default .Values.server.enabled .Values.global.enabled) (default .Values.server.disruptionBudget.enabled .Values.global.enabled)) }} apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: diff --git a/templates/server-service.yaml b/templates/server-service.yaml index 5e02384..79badf8 100644 --- a/templates/server-service.yaml +++ b/templates/server-service.yaml @@ -3,7 +3,7 @@ # the agent is installed locally on the node and the NODE_IP should be used. # If the node can't run a Consul agent, then this service can be used to # communicate directly to a server agent. -{{- if .Values.server.enabled }} +{{- if (default .Values.server.enabled .Values.global.enabled) }} apiVersion: v1 kind: Service metadata: diff --git a/templates/server-statefulset.yaml b/templates/server-statefulset.yaml index 728e9a9..3ef66c4 100644 --- a/templates/server-statefulset.yaml +++ b/templates/server-statefulset.yaml @@ -1,5 +1,5 @@ # StatefulSet to run the actual Consul server cluster. -{{- if .Values.server.enabled }} +{{- if (default .Values.server.enabled .Values.global.enabled) }} apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/templates/ui-service.yaml b/templates/ui-service.yaml index d2fd328..dddba17 100644 --- a/templates/ui-service.yaml +++ b/templates/ui-service.yaml @@ -3,7 +3,7 @@ # the agent is installed locally on the node and the NODE_IP should be used. # If the node can't run a Consul agent, then this service can be used to # communicate directly to a server agent. -{{- if (.Values.server.enabled) and (.Values.ui.enabled) and (.Values.ui.service) }} +{{- if (and (default .Values.server.enabled .Values.global.enabled) (default .Values.ui.enabled .Values.global.enabled) (default .Values.ui.service .Values.global.enabled)) }} apiVersion: v1 kind: Service metadata: diff --git a/values.yaml b/values.yaml index cf22426..1900e8e 100644 --- a/values.yaml +++ b/values.yaml @@ -4,12 +4,19 @@ # be disabled if you plan on connecting to a Consul cluster external to # the Kube cluster. +global: + # enabled is the master enabled switch. Setting this to true or false + # will enable or disable all the components within this chart by default. + # Each component can be overridden using the component-specific "enabled" + # value. + enabled: true + common: # Domain to register the Consul DNS server to listen for. domain: consul server: - enabled: true + enabled: null image: "consul:1.2.2" replicas: 3 bootstrapExpect: 3 # Should <= replicas count @@ -39,7 +46,7 @@ server: # disruptionBudget enables the creation of a PodDisruptionBudget to # prevent voluntary degrading of the Consul server cluster. disruptionBudget: - enabled: true + enabled: null # maxUnavailable will default to (n/2)-1 where n is the number of # replicas. If you'd like a custom value, you can specify an override here. @@ -54,13 +61,13 @@ server: # within the Kube cluster. The current deployment model follows a traditional # DC where a single agent is deployed per node. client: - enabled: true + enabled: null image: "consul:1.2.2" join: null # ConnectInject will enable the automatic Connect sidecar injector. connectInject: - enabled: true + enabled: null image: "us.gcr.io/mitchellh-k8s/consul-k8s:latest" default: false # true will inject by default, otherwise requires annotation caBundle: "" # empty will auto generate the bundle @@ -97,7 +104,7 @@ ui: # on the server nodes. This makes UI access via the service below (if # enabled) predictable rather than "any node" if you're running Consul # clients as well. - enabled: true + enabled: null # True if you want to create a Service entry for the Consul UI. #