Skip to content

Commit 4c14919

Browse files
committed
[skip ci] repo-sync
1 parent 7f5dc7e commit 4c14919

23 files changed

+2193
-62
lines changed

chart/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ maintainers:
3232
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
3333
type: application
3434

35-
version:
35+
version: v4.8.0-rc.5

chart/templates/_helpers.tpl

Lines changed: 94 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,83 @@ Default image name for a given product
2727
{{- printf "ghcr.io/loft-sh/loft:%s" .Chart.Version -}}
2828
{{- end -}}
2929

30+
{{/*
31+
Populate image ref for a given product
32+
*/}}
33+
{{- define "loft.imageRef" -}}
34+
{{- $registry := default "ghcr.io" .Values.imageRef.registry -}}
35+
{{- $repository := coalesce .Values.imageRef.repository .repo "loft-sh/vcluster-platform" -}}
36+
{{- $tag := default .Chart.Version .Values.imageRef.tag -}}
37+
{{- printf "%s/%s:%s" $registry $repository $tag -}}
38+
{{- end -}}
39+
3040
{{- define "loft.image" -}}
3141
{{- if .Values.product -}}
3242
{{- if eq .Values.product "vcluster-pro" -}}
33-
{{- printf "ghcr.io/loft-sh/vcluster-platform:%s" .Chart.Version -}}
34-
{{- else if eq .Values.product "devpod-pro" -}}
35-
{{- printf "ghcr.io/loft-sh/devpod-pro:%s" .Chart.Version -}}
43+
{{- if .Values.imageRef -}}
44+
{{ include "loft.imageRef" $ }}
45+
{{- else -}}
46+
{{- printf "ghcr.io/loft-sh/vcluster-platform:%s" .Chart.Version -}}
47+
{{- end -}}
3648
{{- else -}}
37-
{{ include "loft.defaultImage" . }}
49+
{{- if .Values.imageRef -}}
50+
{{ include "loft.imageRef" (merge (dict "repo" "loft-sh/loft") $) }}
51+
{{- else -}}
52+
{{ coalesce .Values.image (include "loft.defaultImage" .) }}
53+
{{- end -}}
3854
{{- end -}}
3955
{{- else -}}
40-
{{ include "loft.defaultImage" . }}
56+
{{- if .Values.imageRef -}}
57+
{{ include "loft.imageRef" (merge (dict "repo" "loft-sh/loft") $) }}
58+
{{- else -}}
59+
{{ coalesce .Values.image (include "loft.defaultImage" .) }}
60+
{{- end -}}
4161
{{- end -}}
4262
{{- end -}}
4363

64+
65+
{{/*
66+
Populate audit image ref
67+
*/}}
68+
{{- define "loft.auditImageRef" -}}
69+
{{- $registry := default "docker.io" .Values.audit.imageRef.registry -}}
70+
{{- $repository := default "library/alpine" .Values.audit.imageRef.repository -}}
71+
{{- $tag := default "3.13.1" .Values.audit.imageRef.tag -}}
72+
{{- printf "%s/%s:%s" $registry $repository $tag -}}
73+
{{- end -}}
74+
75+
{{- define "loft.auditImage" -}}
76+
{{- if .Values.audit.imageRef -}}
77+
{{ include "loft.auditImageRef" . }}
78+
{{- else -}}
79+
{{ default "library/alpine:3.13.1" .Values.audit.image }}
80+
{{- end -}}
81+
{{- end -}}
82+
83+
{{/*
84+
True when multiRegion is set and enabled (safe when .Values.multiRegion is nil).
85+
Output is truthy when enabled, empty otherwise; use in {{ if include "loft.multiRegionEnabled" . }}.
86+
*/}}
87+
{{- define "loft.multiRegionEnabled" -}}
88+
{{- if and .Values.multiRegion .Values.multiRegion.enabled }}{{ true }}{{ end -}}
89+
{{- end -}}
90+
91+
{{/*
92+
True when config.database is set and enabled (safe when .Values.config or .Values.config.database is nil).
93+
Output is truthy when enabled, empty otherwise; use in {{ if include "loft.configDatabaseEnabled" . }}.
94+
*/}}
95+
{{- define "loft.configDatabaseEnabled" -}}
96+
{{- if and .Values.config .Values.config.database .Values.config.database.enabled }}{{ true }}{{ end -}}
97+
{{- end -}}
98+
99+
{{/*
100+
True when env.LOFT_EMBEDDED_K8S is set to "true" (safe when .Values.env is nil).
101+
Output is truthy when enabled, empty otherwise; use in {{ if include "loft.envEmbeddedK8sEnabled" . }}.
102+
*/}}
103+
{{- define "loft.envEmbeddedK8sEnabled" -}}
104+
{{- if eq (.Values.env.LOFT_EMBEDDED_K8S | toString) "true" }}{{ true }}{{ end -}}
105+
{{- end -}}
106+
44107
{{- define "loft.strategyType" -}}
45108
{{- if and .Values.strategy .Values.strategy.type -}}
46109
{{- .Values.strategy.type -}}
@@ -66,3 +129,29 @@ rollingUpdate:
66129
{{- end }}
67130
{{- end -}}
68131
{{- end -}}
132+
133+
{{- define "loft.leastPrivilegeModeValues" -}}
134+
{{- $defaultValues := dict
135+
"enabled" false
136+
"clusterAccess" (dict "enabled" true)
137+
"projectQuotas" (dict "enabled" true)
138+
"secrets" (dict "enabled" true)
139+
"sleepMode" (dict "enabled" true)
140+
"role" (dict "enabled" true "extraRules" (list) "overwriteRules" (list))
141+
"clusterRole" (dict "enabled" true "extraRules" (list) "overwriteRules" (list))
142+
"namespaceAdminRole" (dict "enabled" true "extraRules" (list) "overwriteRules" (list)) -}}
143+
{{- if .Values.leastPrivilegeMode -}}
144+
{{ mergeOverwrite $defaultValues .Values.leastPrivilegeMode | toJson }}
145+
{{- else -}}
146+
{{ $defaultValues | toJson }}
147+
{{- end -}}
148+
{{- end -}}
149+
150+
{{- define "loft.isLeastPrivilegeModeEnabled" -}}
151+
{{- if .Values.leastPrivilegeMode -}}
152+
{{- if eq true .Values.leastPrivilegeMode.enabled -}}
153+
{{ true }}
154+
{{- end -}}
155+
{{- end -}}
156+
{{- end -}}
157+

chart/templates/apiservice.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
{{- $isEmbedded := or (include "loft.envEmbeddedK8sEnabled" .) (include "loft.configDatabaseEnabled" .) -}}
2+
13
{{- if .Values.apiservice }}
24
{{- if .Values.apiservice.create }}
35
{{- if not .Values.agentOnly }}
6+
{{- if not $isEmbedded }}
47
apiVersion: apiregistration.k8s.io/v1
58
kind: APIService
69
metadata:
@@ -33,6 +36,7 @@ spec:
3336
selector:
3437
app: {{ template "loft.fullname" . }}
3538
release: {{ .Release.Name }}
39+
{{- end }}
3640
---
3741
{{- end }}
3842
apiVersion: v1

chart/templates/application.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{- if (dig "gcpMarketplace" "enabled" false (.Values|merge (dict) )) }}
2+
apiVersion: app.k8s.io/v1beta1
3+
kind: Application
4+
metadata:
5+
name: "{{ .Release.Name }}"
6+
namespace: "{{ .Release.Namespace }}"
7+
labels:
8+
app.kubernetes.io/name: "{{ .Release.Name }}"
9+
annotations:
10+
marketplace.cloud.google.com/deploy-info: '{"partner_id": "bji0uLnnv1", "product_id": "vcluster", "partner_name": "vCluster Labs"}'
11+
spec:
12+
descriptor:
13+
type: vClusterPlatform
14+
version: {{ .Chart.Version }}
15+
selector:
16+
matchLabels:
17+
app.kubernetes.io/name: "{{ .Release.Name }}"
18+
addOwnerRef: true
19+
componentKinds:
20+
# Core
21+
- group: ""
22+
kind: Service
23+
- group: ""
24+
kind: ServiceAccount
25+
- group: ""
26+
kind: ConfigMap
27+
- group: ""
28+
kind: Secret
29+
- group: policy
30+
kind: PodDisruptionBudget
31+
# Workloads
32+
- group: apps
33+
kind: Deployment
34+
# Networking
35+
- group: networking.k8s.io
36+
kind: Ingress
37+
# RBAC
38+
- group: rbac.authorization.k8s.io
39+
kind: Role
40+
- group: rbac.authorization.k8s.io
41+
kind: RoleBinding
42+
- group: rbac.authorization.k8s.io
43+
kind: ClusterRole
44+
- group: rbac.authorization.k8s.io
45+
kind: ClusterRoleBinding
46+
# Admission webhooks used by the chart
47+
- group: admissionregistration.k8s.io
48+
kind: MutatingWebhookConfiguration
49+
- group: admissionregistration.k8s.io
50+
kind: ValidatingWebhookConfiguration
51+
{{- end }}

0 commit comments

Comments
 (0)