diff --git a/charts/k3s/templates/token-secret.yaml b/charts/k3s/templates/token-secret.yaml new file mode 100644 index 000000000..40c36f6d9 --- /dev/null +++ b/charts/k3s/templates/token-secret.yaml @@ -0,0 +1,10 @@ +{{- if .Values.k3sToken }} +apiVersion: v1 +kind: Secret +metadata: + name: "vc-token-{{ .Release.Name }}" + namespace: {{ .Release.Namespace }} +type: Opaque +data: + token: {{ .Values.k3sToken | b64enc | quote }} +{{- end }} diff --git a/charts/k3s/values.yaml b/charts/k3s/values.yaml index a4377dcb1..ed5d2f0f5 100644 --- a/charts/k3s/values.yaml +++ b/charts/k3s/values.yaml @@ -269,6 +269,9 @@ podDisruptionBudget: minAvailable: 1 # maxUnavailable: 1 +# The k3s token to use. If empty will generate one automatically +k3sToken: "" + # Service configurations service: type: ClusterIP diff --git a/devspace.yaml b/devspace.yaml index 3ad17cbad..4597f9aba 100644 --- a/devspace.yaml +++ b/devspace.yaml @@ -26,6 +26,7 @@ deployments: chart: name: ./charts/k8s values: &values + k3sToken: "devspace" job: enabled: false fallbackHostDns: true @@ -115,7 +116,7 @@ pipelines: run: |- # Deploy the vcluster run_pipelines deploy --set-flag distro=$(get_flag distro) - + # Start dev mode start_dev --all @@ -128,14 +129,14 @@ pipelines: run: |- # Make sure pull secrets are there ensure_pull_secrets --all - + # Build the vcluster image build_images --all - + # Deploy the vcluster if is_equal $(get_flag distro) k8s; then kubectl apply -f ./hack/vcluster-certs.yaml -n ${DEVSPACE_NAMESPACE} - create_deployments vcluster-k8s + create_deployments vcluster-k8s elif is_equal $(get_flag distro) k0s; then create_deployments vcluster-k0s else @@ -146,7 +147,7 @@ pipelines: run: |- # Purge the vcluster run_default_pipeline purge - + # Make sure the pvcs are deleted as well kubectl delete pvc --all -n ${DEVSPACE_NAMESPACE} @@ -180,7 +181,7 @@ profiles: - --tls-san=vcluster vcluster-k0s: *hostmapper_patch # reuses the same patch defined under the &hostmapper_patch anchor vcluster-k8s: *hostmapper_patch # reuses the same patch defined under the &hostmapper_patch anchor - + - name: test-k3s patches: - op: add @@ -198,7 +199,7 @@ profiles: valuesFiles: - ${COMMON_VALUES} - ${VALUES_FILE} - + - name: test-k0s patches: - op: add diff --git a/pkg/config/helmvalues/base_values.go b/pkg/config/helmvalues/base_values.go index caa6677f5..0e2831211 100644 --- a/pkg/config/helmvalues/base_values.go +++ b/pkg/config/helmvalues/base_values.go @@ -53,6 +53,7 @@ type BaseHelm struct { } type K3s struct { + K3sToken string `json:"k3sToken,omitempty"` BaseHelm VCluster VClusterValues `json:"vcluster,omitempty"` Syncer SyncerValues `json:"syncer,omitempty"`