From 64d7c11506c8cf0930565f76ac3fc95c668226f0 Mon Sep 17 00:00:00 2001 From: Steve Mattar Date: Thu, 4 Mar 2021 04:56:01 +0200 Subject: [PATCH] refactor: globalnet should be under the broker Signed-off-by: Steve Mattar --- Makefile | 12 ++++++++++- deploy_helm | 4 ++++ submariner-k8s-broker/values.yaml | 2 -- submariner-operator/questions.yml | 27 ++++++++++++++++++------- submariner-operator/templates/rbac.yaml | 4 ++-- submariner-operator/values.yaml | 1 + submariner/questions.yml | 6 ++++++ submariner/templates/globalnet.yaml | 2 +- submariner/templates/lighthouse.yaml | 2 +- submariner/templates/rbac.yaml | 4 ++-- submariner/values.yaml | 1 + 11 files changed, 49 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 8694e72..3153e0a 100644 --- a/Makefile +++ b/Makefile @@ -6,13 +6,23 @@ include $(SHIPYARD_DIR)/Makefile.inc CLUSTER_SETTINGS_FLAG = --cluster_settings $(DAPPER_SOURCE)/cluster_settings override CLUSTERS_ARGS += $(CLUSTER_SETTINGS_FLAG) -override DEPLOY_ARGS += $(CLUSTER_SETTINGS_FLAG) --deploytool helm --deploytool_broker_args '--set submariner.serviceDiscovery=true' +override DEPLOY_ARGS += $(CLUSTER_SETTINGS_FLAG) --deploytool helm export DEPLOY_ARGS GH_URL=https://submariner-io.github.io/submariner-charts/charts CHARTS_DIR=charts CHARTS_VERSION=0.7.0 REPO_URL=$(shell git config remote.origin.url) +# Process extra flags from the `using=a,b,c` optional flag + +ifneq (,$(filter lighthouse,$(_using))) +override DEPLOY_ARGS += --service_discovery +endif + +ifneq (,$(filter globalnet,$(_using))) +override DEPLOY_ARGS += --globalnet +endif + # Targets to make deploy: clusters preload-images diff --git a/deploy_helm b/deploy_helm index 0aedd4c..0c44d84 100644 --- a/deploy_helm +++ b/deploy_helm @@ -51,12 +51,16 @@ function helm_install_subm() { --set broker.token="${submariner_broker_token}" \ --set broker.namespace="${SUBMARINER_BROKER_NS}" \ --set broker.ca="${submariner_broker_ca}" \ + --set broker.globalnet="${globalnet}" \ + --set submariner.serviceDiscovery="${service_discovery}" \ --set submariner.cableDriver="${cable_driver}" \ --set submariner.clusterId="${cluster}" \ --set submariner.clusterCidr="${cluster_CIDRs[$cluster]}" \ --set submariner.serviceCidr="${service_CIDRs[$cluster]}" \ --set submariner.globalCidr="${global_CIDRs[$cluster]}" \ --set serviceAccounts.globalnet.create="${globalnet}" \ + --set serviceAccounts.lighthouseAgent.create="${service_discovery}" \ + --set serviceAccounts.lighthouseCoreDns.create="${service_discovery}" \ --set submariner.natEnabled="false" \ --set operator.image.repository="localhost:5000/submariner-operator" \ --set operator.image.tag="local" \ diff --git a/submariner-k8s-broker/values.yaml b/submariner-k8s-broker/values.yaml index 2ef184c..edd37f5 100644 --- a/submariner-k8s-broker/values.yaml +++ b/submariner-k8s-broker/values.yaml @@ -7,5 +7,3 @@ serviceAccounts: client: create: true name: "" -submariner: - serviceDiscovery: false diff --git a/submariner-operator/questions.yml b/submariner-operator/questions.yml index da77e0f..0407fd7 100644 --- a/submariner-operator/questions.yml +++ b/submariner-operator/questions.yml @@ -92,13 +92,26 @@ questions: label: "Service CIDR" group: "CIDR Configuration" required: true -- variable: submariner.globalCidr - default: "" - description: "Enter the globalnet CIDR (i.e. 169.254.1.0/24) for this cluster if using globalnet" - type: string - label: "Globalnet CIDR" - group: "CIDR Configuration" - required: false +- variable: submariner.serviceDiscovery + type: boolean + default: false + group: "Advanced Configuration" + description: "Enable multicluster service discovery" + label: "Service Discovery Enabled" +- variable: broker.globalnet + type: boolean + default: false + group: "Broker Configuration" + description: "Enable support for overlapping Cluster/Service CIDRs in connecting clusters" + label: "Globalnet Enabled" + subquestions: + - variable: submariner.globalCidr + default: "" + description: "Enter the globalnet CIDR (i.e. 169.254.1.0/24) for this cluster if using globalnet" + type: string + label: "Globalnet CIDR" + group: "CIDR Configuration" + required: false - variable: submariner.natEnabled type: boolean default: false diff --git a/submariner-operator/templates/rbac.yaml b/submariner-operator/templates/rbac.yaml index dde1aee..4952c5b 100644 --- a/submariner-operator/templates/rbac.yaml +++ b/submariner-operator/templates/rbac.yaml @@ -279,7 +279,7 @@ subjects: name: {{ template "submariner.routeAgentServiceAccountName" . }} namespace: {{ .Release.Namespace }} --- -{{- if ne .Values.submariner.globalCidr "" }} +{{- if .Values.broker.globalnet }} apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: @@ -622,7 +622,7 @@ subjects: name: {{ template "submariner.routeAgentServiceAccountName" . }} namespace: {{ .Release.Namespace }} --- -{{- if ne .Values.submariner.globalCidr "" }} +{{- if .Values.broker.globalnet }} apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: diff --git a/submariner-operator/values.yaml b/submariner-operator/values.yaml index 3b7584a..923df87 100644 --- a/submariner-operator/values.yaml +++ b/submariner-operator/values.yaml @@ -19,6 +19,7 @@ broker: namespace: xyz insecure: false ca: "" + globalnet: false rbac: create: true ipsec: diff --git a/submariner/questions.yml b/submariner/questions.yml index d04fa30..103aeb0 100644 --- a/submariner/questions.yml +++ b/submariner/questions.yml @@ -136,3 +136,9 @@ questions: group: "Advanced Configuration" description: "Cable driver implementation" label: "Cable Driver" +- variable: submariner.serviceDiscovery + type: boolean + default: false + group: "Advanced Configuration" + description: "Enable multicluster service discovery" + label: "Service Discovery Enabled" \ No newline at end of file diff --git a/submariner/templates/globalnet.yaml b/submariner/templates/globalnet.yaml index ce89803..68e194b 100644 --- a/submariner/templates/globalnet.yaml +++ b/submariner/templates/globalnet.yaml @@ -1,4 +1,4 @@ -{{- if ne .Values.submariner.globalCidr "" }} +{{- if .Values.broker.globalnet }} apiVersion: apps/v1 kind: DaemonSet metadata: diff --git a/submariner/templates/lighthouse.yaml b/submariner/templates/lighthouse.yaml index f47ce49..c19a57d 100644 --- a/submariner/templates/lighthouse.yaml +++ b/submariner/templates/lighthouse.yaml @@ -30,7 +30,7 @@ spec: value: "{{ .Values.submariner.clusterId }}" - name: SUBMARINER_DEBUG value: "{{ .Values.submariner.debug }}" -{{- if ne .Values.submariner.globalCidr "" }} +{{- if .Values.broker.globalnet }} - name: SUBMARINER_GLOBALNET_ENABLED value: "true" {{- end }} diff --git a/submariner/templates/rbac.yaml b/submariner/templates/rbac.yaml index d2240bc..71fb0ee 100644 --- a/submariner/templates/rbac.yaml +++ b/submariner/templates/rbac.yaml @@ -195,7 +195,7 @@ subjects: name: {{ template "submariner.routeAgentServiceAccountName" . }} namespace: {{ .Release.Namespace }} --- -{{- if ne .Values.submariner.globalCidr "" }} +{{- if .Values.broker.globalnet }} apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: @@ -463,7 +463,7 @@ subjects: name: {{ template "submariner.routeAgentServiceAccountName" . }} namespace: {{ .Release.Namespace }} --- -{{- if ne .Values.submariner.globalCidr "" }} +{{- if .Values.broker.globalnet }} apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: diff --git a/submariner/values.yaml b/submariner/values.yaml index ae718f2..5f49405 100644 --- a/submariner/values.yaml +++ b/submariner/values.yaml @@ -19,6 +19,7 @@ broker: namespace: xyz insecure: false ca: "" + globalnet: false rbac: create: true ipsec: