From 2d90c933e60d2d5fcded07f3794a24cc1c1c7cbb Mon Sep 17 00:00:00 2001 From: Jeremy Facchetti Date: Tue, 30 Jan 2024 17:38:08 +0100 Subject: [PATCH] removed unused values since the merge into a single container (#1476) * removed unused values since the merge into a single container * removed enableHA * removed enableHA from k0s * fix * removed enableHA * removed references to enableHA --- charts/eks/templates/rbac/role.yaml | 2 +- charts/eks/templates/syncer.yaml | 6 +++--- charts/k0s/templates/rbac/role.yaml | 2 +- charts/k8s/templates/etcd-statefulset.yaml | 2 +- charts/k8s/templates/rbac/role.yaml | 2 +- charts/k8s/templates/syncer.yaml | 8 +++---- .../deploying-vclusters/high-availability.mdx | 21 +++++-------------- .../pages/fragments/high-availability-k3s.mdx | 7 ++----- .../pages/fragments/high-availability-k8s.mdx | 6 ------ load-test/ha-k8s.yaml | 4 ---- load-test/vcluster-k8s-3.yml | 3 --- test/values_ha.yaml | 6 ------ 12 files changed, 18 insertions(+), 51 deletions(-) diff --git a/charts/eks/templates/rbac/role.yaml b/charts/eks/templates/rbac/role.yaml index eb837e640..da4362387 100644 --- a/charts/eks/templates/rbac/role.yaml +++ b/charts/eks/templates/rbac/role.yaml @@ -50,7 +50,7 @@ rules: resources: ["endpoints"] verbs: ["create", "delete", "patch", "update"] {{- end }} - {{- if or .Values.enableHA .Values.rbac.role.extended }} + {{- if or (gt (int .Values.syncer.replicas) 1) .Values.rbac.role.extended }} - apiGroups: ["coordination.k8s.io"] resources: ["leases"] verbs: ["create", "delete", "patch", "update", "get", "list", "watch"] diff --git a/charts/eks/templates/syncer.yaml b/charts/eks/templates/syncer.yaml index 629d1cba9..6194a9999 100644 --- a/charts/eks/templates/syncer.yaml +++ b/charts/eks/templates/syncer.yaml @@ -43,7 +43,7 @@ spec: {{- if .Values.syncer.affinity }} affinity: {{ toYaml .Values.syncer.affinity | indent 8 }} - {{- else if .Values.enableHA }} + {{- else if (gt (int .Values.syncer.replicas) 1) }} affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: @@ -227,7 +227,7 @@ spec: - --etcd-replicas={{ .Values.syncer.replicas }} {{- end }} {{- end }} - {{- if .Values.enableHA }} + {{- if (gt (int .Values.syncer.replicas) 1) }} - --leader-elect=true {{- else }} - --leader-elect=false @@ -386,7 +386,7 @@ spec: - '--node-monitor-period=1h' - '--horizontal-pod-autoscaler-sync-period=60s' - '--kubeconfig=/pki/controller-manager.conf' - {{- if .Values.enableHA }} + {{- if (gt (int .Values.syncer.replicas) 1) }} - '--leader-elect=true' {{- else }} - '--leader-elect=false' diff --git a/charts/k0s/templates/rbac/role.yaml b/charts/k0s/templates/rbac/role.yaml index eb837e640..f0280e31c 100644 --- a/charts/k0s/templates/rbac/role.yaml +++ b/charts/k0s/templates/rbac/role.yaml @@ -50,7 +50,7 @@ rules: resources: ["endpoints"] verbs: ["create", "delete", "patch", "update"] {{- end }} - {{- if or .Values.enableHA .Values.rbac.role.extended }} + {{- if or ( gt (int (include "vcluster.replicas" . ) ) 1) .Values.rbac.role.extended }} - apiGroups: ["coordination.k8s.io"] resources: ["leases"] verbs: ["create", "delete", "patch", "update", "get", "list", "watch"] diff --git a/charts/k8s/templates/etcd-statefulset.yaml b/charts/k8s/templates/etcd-statefulset.yaml index b87465d11..7347cc7f9 100644 --- a/charts/k8s/templates/etcd-statefulset.yaml +++ b/charts/k8s/templates/etcd-statefulset.yaml @@ -66,7 +66,7 @@ spec: {{- if .Values.etcd.affinity }} affinity: {{ toYaml .Values.etcd.affinity | indent 8 }} - {{- else if .Values.enableHA }} + {{- else }} affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: diff --git a/charts/k8s/templates/rbac/role.yaml b/charts/k8s/templates/rbac/role.yaml index eb837e640..da4362387 100644 --- a/charts/k8s/templates/rbac/role.yaml +++ b/charts/k8s/templates/rbac/role.yaml @@ -50,7 +50,7 @@ rules: resources: ["endpoints"] verbs: ["create", "delete", "patch", "update"] {{- end }} - {{- if or .Values.enableHA .Values.rbac.role.extended }} + {{- if or (gt (int .Values.syncer.replicas) 1) .Values.rbac.role.extended }} - apiGroups: ["coordination.k8s.io"] resources: ["leases"] verbs: ["create", "delete", "patch", "update", "get", "list", "watch"] diff --git a/charts/k8s/templates/syncer.yaml b/charts/k8s/templates/syncer.yaml index 1cef14b87..669568eb8 100644 --- a/charts/k8s/templates/syncer.yaml +++ b/charts/k8s/templates/syncer.yaml @@ -43,7 +43,7 @@ spec: {{- if .Values.syncer.affinity }} affinity: {{ toYaml .Values.syncer.affinity | indent 8 }} - {{- else if .Values.enableHA }} + {{- else if (gt (int .Values.syncer.replicas) 1) }} affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: @@ -244,7 +244,7 @@ spec: - --etcd-replicas={{ .Values.syncer.replicas }} {{- end }} {{- end }} - {{- if .Values.enableHA }} + {{- if (gt (int .Values.syncer.replicas) 1)}} - --leader-elect=true {{- else }} - --leader-elect=false @@ -407,7 +407,7 @@ spec: {{- end }} - '--horizontal-pod-autoscaler-sync-period=60s' - '--kubeconfig=/pki/controller-manager.conf' - {{- if .Values.enableHA }} + {{- if (gt (int .Values.syncer.replicas) 1) }} - '--leader-elect=true' {{- else }} - '--leader-elect=false' @@ -432,7 +432,7 @@ spec: - '--authorization-kubeconfig=/pki/scheduler.conf' - '--bind-address=127.0.0.1' - '--kubeconfig=/pki/scheduler.conf' - {{- if .Values.enableHA }} + {{- if (gt (int .Values.syncer.replicas) 1) }} - '--leader-elect=true' {{- else }} - '--leader-elect=false' diff --git a/docs/pages/deploying-vclusters/high-availability.mdx b/docs/pages/deploying-vclusters/high-availability.mdx index 87cb29b63..fb46cae98 100644 --- a/docs/pages/deploying-vclusters/high-availability.mdx +++ b/docs/pages/deploying-vclusters/high-availability.mdx @@ -26,8 +26,8 @@ A distro in vcluster is the Kubernetes distribution that runs inside the virtual - k8s (a Kubernetes with etcd) The vcluster HA feature is only supported by the k3s and k8s distros. You need to choose one of those to take advantage of HA. -For this tutorial, we will use the k8s distro. -If you're interested in enabling HA in rootless mode, or using the k3s distro, see some examples at the bottom of this page. +For this tutorial, we will use the k8s distro. +If you're interested in enabling HA in rootless mode, or using the k3s distro, see some examples at the bottom of this page. # 3. Create a values.yaml file The values.yaml file is used to specify configuration options for the virtual cluster. In the case of the HA feature, we will specify the number of replicas we want to run for each vCluster component. @@ -35,9 +35,6 @@ The values.yaml file is used to specify configuration options for the virtual cl Create the file called values.yaml on the computer that the vcluster client is installed on with these contents: ``` -# Enable HA mode -enableHA: true - # Scale up syncer replicas syncer: replicas: 3 @@ -68,7 +65,7 @@ NAME STATUS ROLES AGE VERSION minikube Ready control-plane 2m5s v1.26.3 minikube-m02 Ready 105s v1.26.3 minikube-m03 Ready 93s v1.26.3 -minikube-m04 Ready 83s v1.26.3 +minikube-m04 Ready 83s v1.26.3 ``` # 4. Create the HA virtual cluster @@ -174,11 +171,9 @@ In order to run vCluster with k3s as Kubernetes distribution in high availabilit First create a `values.yaml` in the following form and make sure to change the connection string in `K3S_DATASTORE_ENDPOINT`: ``` -# Enable HA mode -enableHA: true - # Scale up k3s replicas -replicas: 2 +syncer: + replicas: 2 # Set external datastore endpoint vcluster: @@ -232,9 +227,6 @@ Check the [GitHub repository](https://github.com/loft-sh/vcluster/tree/main/char In order to run vCluster in high availability mode, create a `values.yaml` in the following form: ``` -# Enable HA mode -enableHA: true - # Scale up syncer replicas syncer: replicas: 3 @@ -298,9 +290,6 @@ You can find more about rootless mode [here](../security/rootless-mode.mdx). Below is HA configuration for running rootless vCluster with vanilla Kubernetes distribution. ``` -# Enable HA mode -enableHA: true - # Scale up syncer replicas syncer: replicas: 3 diff --git a/docs/pages/fragments/high-availability-k3s.mdx b/docs/pages/fragments/high-availability-k3s.mdx index 126e11c20..e9f3d706b 100644 --- a/docs/pages/fragments/high-availability-k3s.mdx +++ b/docs/pages/fragments/high-availability-k3s.mdx @@ -8,11 +8,8 @@ In order to run vCluster with k3s as Kubernetes distribution in high availabilit First create a `values.yaml` in the following form and make sure to change the connection string in `K3S_DATASTORE_ENDPOINT`: ``` -# Enable HA mode -enableHA: true - -# Scale up k3s replicas -replicas: 2 +syncer: + replicas: 3 # Set external datastore endpoint vcluster: diff --git a/docs/pages/fragments/high-availability-k8s.mdx b/docs/pages/fragments/high-availability-k8s.mdx index 62af0c8c6..73857dd6e 100644 --- a/docs/pages/fragments/high-availability-k8s.mdx +++ b/docs/pages/fragments/high-availability-k8s.mdx @@ -3,9 +3,6 @@ In order to run vCluster in high availability mode, create a `values.yaml` in the following form: ``` -# Enable HA mode -enableHA: true - # Scale up syncer replicas syncer: replicas: 3 @@ -69,9 +66,6 @@ You can find more about rootless mode [here](../security/rootless-mode.mdx). Below is HA configuration for running rootless vCluster with vanilla Kubernetes distribution. ``` -# Enable HA mode -enableHA: true - # Scale up syncer replicas syncer: replicas: 3 diff --git a/load-test/ha-k8s.yaml b/load-test/ha-k8s.yaml index a304cef44..1bd7cff2f 100644 --- a/load-test/ha-k8s.yaml +++ b/load-test/ha-k8s.yaml @@ -1,7 +1,3 @@ - -# Enable HA mode -enableHA: true - # Scale up syncer replicas syncer: replicas: 3 diff --git a/load-test/vcluster-k8s-3.yml b/load-test/vcluster-k8s-3.yml index 0c83463fe..ae7a02088 100644 --- a/load-test/vcluster-k8s-3.yml +++ b/load-test/vcluster-k8s-3.yml @@ -14,9 +14,6 @@ sync: # will sync all nodes instead of only the ones where some pods are running. syncAllNodes: true -# Enable HA mode -enableHA: true - # Scale up syncer replicas syncer: replicas: 3 diff --git a/test/values_ha.yaml b/test/values_ha.yaml index ced46787b..b0b6e35af 100644 --- a/test/values_ha.yaml +++ b/test/values_ha.yaml @@ -1,12 +1,6 @@ # this is for k3s pro replicas: 3 - -# this is for k8s -# -# Enable HA mode -enableHA: true - # Scale up syncer replicas syncer: replicas: 3