Skip to content

Commit

Permalink
Merge pull request #1323 from FabianKramm/devspace-fix
Browse files Browse the repository at this point in the history
fix: allow custom k3s token
  • Loading branch information
FabianKramm authored Oct 26, 2023
2 parents a747c29 + 4816265 commit 9e8569f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
10 changes: 10 additions & 0 deletions charts/k3s/templates/token-secret.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
3 changes: 3 additions & 0 deletions charts/k3s/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 8 additions & 7 deletions devspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ deployments:
chart:
name: ./charts/k8s
values: &values
k3sToken: "devspace"
job:
enabled: false
fallbackHostDns: true
Expand Down Expand Up @@ -115,7 +116,7 @@ pipelines:
run: |-
# Deploy the vcluster
run_pipelines deploy --set-flag distro=$(get_flag distro)
# Start dev mode
start_dev --all
Expand 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
Expand All @@ -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}
Expand Down Expand Up @@ -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
Expand All @@ -198,7 +199,7 @@ profiles:
valuesFiles:
- ${COMMON_VALUES}
- ${VALUES_FILE}

- name: test-k0s
patches:
- op: add
Expand Down
1 change: 1 addition & 0 deletions pkg/config/helmvalues/base_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 9e8569f

Please sign in to comment.