Skip to content

Commit 2bc72e6

Browse files
authored
Merge pull request #282 from SovereignCloudStack/feat/charts
✨ Basic Helm charts for CSO
2 parents c78ef91 + 53929ef commit 2bc72e6

18 files changed

+1377
-0
lines changed

charts/Chart.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v2
2+
name: cso
3+
description: A Helm chart for Cluster Stack Operator
4+
# A chart can be either an 'application' or a 'library' chart.
5+
#
6+
# Application charts are a collection of templates that can be packaged into versioned archives
7+
# to be deployed.
8+
#
9+
# Library charts provide useful utilities or functions for the chart developer. They're included as
10+
# a dependency of application charts to inject those utilities and functions into the rendering
11+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
12+
type: application
13+
# This is the chart version. This version number should be incremented each time you make changes
14+
# to the chart and its templates, including the app version.
15+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
16+
version: 0.2.0
17+
# This is the version number of the application being deployed. This version number should be
18+
# incremented each time you make changes to the application. Versions are not expected to
19+
# follow Semantic Versioning. They should reflect the version the application is using.
20+
# It is recommended to use it with quotes.
21+
appVersion: "0.1.0"

charts/templates/_helpers.tpl

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "cso.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "cso.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "cso.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "cso.labels" -}}
37+
helm.sh/chart: {{ include "cso.chart" . }}
38+
{{ include "cso.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "cso.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "cso.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "cso.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "cso.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: {{ include "cso.fullname" . }}-cluster-stack-variables
5+
labels:
6+
cluster.x-k8s.io/provider: cluster-stack-operator
7+
{{- include "cso.labels" . | nindent 4 }}
8+
data:
9+
{{- if eq .Values.controllerManager.manager.source "github" }}
10+
git-access-token: {{ required "clusterStackVariables.gitAccessToken is required"
11+
.Values.clusterStackVariables.gitAccessToken | b64enc | quote }}
12+
git-org-name: {{ required "clusterStackVariables.gitOrgName is required" .Values.clusterStackVariables.gitOrgName
13+
| b64enc | quote }}
14+
git-provider: {{ required "clusterStackVariables.gitProvider is required" .Values.clusterStackVariables.gitProvider
15+
| b64enc | quote }}
16+
git-repo-name: {{ required "clusterStackVariables.gitRepoName is required" .Values.clusterStackVariables.gitRepoName
17+
| b64enc | quote }}
18+
{{- else}}
19+
oci-registry: {{ required "clusterStackVariables.ociRegistry is required" .Values.clusterStackVariables.ociRegistry
20+
| b64enc | quote }}
21+
oci-repository: {{ required "clusterStackVariables.ociRepository is required" .Values.clusterStackVariables.ociRepository
22+
| b64enc | quote }}
23+
oci-username: {{ .Values.clusterStackVariables.ociUsername | b64enc | quote }}
24+
oci-access-token: {{ .Values.clusterStackVariables.ociAccessToken | b64enc | quote }}
25+
oci-password: {{ .Values.clusterStackVariables.ociPassword | b64enc | quote }}
26+
{{- end }}
27+
type: Opaque
Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: clusteraddons.clusterstack.x-k8s.io
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.16.2
7+
labels:
8+
cluster.x-k8s.io/provider: cluster-stack-operator
9+
cluster.x-k8s.io/v1beta1: v1beta1
10+
{{- include "cso.labels" . | nindent 4 }}
11+
spec:
12+
group: clusterstack.x-k8s.io
13+
names:
14+
kind: ClusterAddon
15+
listKind: ClusterAddonList
16+
plural: clusteraddons
17+
shortNames:
18+
- caddon
19+
singular: clusteraddon
20+
scope: Namespaced
21+
versions:
22+
- additionalPrinterColumns:
23+
- jsonPath: .metadata.ownerReferences[?(@.kind=="Cluster")].name
24+
name: Cluster
25+
type: string
26+
- description: Present running hook
27+
jsonPath: .spec.hook
28+
name: Hook
29+
type: string
30+
- jsonPath: .status.ready
31+
name: Ready
32+
type: boolean
33+
- description: Time duration since creation of Cluster Addon
34+
jsonPath: .metadata.creationTimestamp
35+
name: Age
36+
type: date
37+
- jsonPath: .status.conditions[?(@.type=='Ready')].reason
38+
name: Reason
39+
type: string
40+
- jsonPath: .status.conditions[?(@.type=='Ready')].message
41+
name: Message
42+
type: string
43+
name: v1alpha1
44+
schema:
45+
openAPIV3Schema:
46+
description: ClusterAddon is the schema for the clusteraddons API.
47+
properties:
48+
apiVersion:
49+
description: |-
50+
APIVersion defines the versioned schema of this representation of an object.
51+
Servers should convert recognized schemas to the latest internal value, and
52+
may reject unrecognized values.
53+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
54+
type: string
55+
kind:
56+
description: |-
57+
Kind is a string value representing the REST resource this object represents.
58+
Servers may infer this from the endpoint the client submits requests to.
59+
Cannot be updated.
60+
In CamelCase.
61+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
62+
type: string
63+
metadata:
64+
type: object
65+
spec:
66+
description: ClusterAddonSpec defines the desired state of a ClusterAddon
67+
object.
68+
properties:
69+
clusterRef:
70+
description: |-
71+
ClusterRef is the reference to the clusterv1.Cluster object that corresponds to the workload cluster where this
72+
controller applies the cluster addons.
73+
properties:
74+
apiVersion:
75+
description: API version of the referent.
76+
type: string
77+
fieldPath:
78+
description: |-
79+
If referring to a piece of an object instead of an entire object, this string
80+
should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2].
81+
For example, if the object reference is to a container within a pod, this would take on a value like:
82+
"spec.containers{name}" (where "name" refers to the name of the container that triggered
83+
the event) or if no container name is specified "spec.containers[2]" (container with
84+
index 2 in this pod). This syntax is chosen only to have some well-defined way of
85+
referencing a part of an object.
86+
type: string
87+
kind:
88+
description: |-
89+
Kind of the referent.
90+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
91+
type: string
92+
name:
93+
description: |-
94+
Name of the referent.
95+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
96+
type: string
97+
namespace:
98+
description: |-
99+
Namespace of the referent.
100+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
101+
type: string
102+
resourceVersion:
103+
description: |-
104+
Specific resourceVersion to which this reference is made, if any.
105+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
106+
type: string
107+
uid:
108+
description: |-
109+
UID of the referent.
110+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
111+
type: string
112+
type: object
113+
x-kubernetes-map-type: atomic
114+
clusterStack:
115+
description: |-
116+
ClusterStack is the full string <provider>-<name>-<Kubernetes version>-<version> that will be filled with the cluster stack that
117+
the respective cluster uses currently. It always matches cluster.spec.topology.class if the work of this controller is done.
118+
type: string
119+
hook:
120+
description: Hook specifies the runtime hook for the Cluster event.
121+
type: string
122+
version:
123+
description: Version is the version of the cluster addons that have
124+
been applied in the workload cluster.
125+
type: string
126+
required:
127+
- clusterRef
128+
type: object
129+
status:
130+
description: ClusterAddonStatus defines the observed state of ClusterAddon.
131+
properties:
132+
conditions:
133+
description: Conditions define the current service state of the ClusterAddon.
134+
items:
135+
description: Condition defines an observation of a Cluster API resource
136+
operational state.
137+
properties:
138+
lastTransitionTime:
139+
description: |-
140+
Last time the condition transitioned from one status to another.
141+
This should be when the underlying condition changed. If that is not known, then using the time when
142+
the API field changed is acceptable.
143+
format: date-time
144+
type: string
145+
message:
146+
description: |-
147+
A human readable message indicating details about the transition.
148+
This field may be empty.
149+
type: string
150+
reason:
151+
description: |-
152+
The reason for the condition's last transition in CamelCase.
153+
The specific API may choose whether or not this field is considered a guaranteed API.
154+
This field may not be empty.
155+
type: string
156+
severity:
157+
description: |-
158+
Severity provides an explicit classification of Reason code, so the users or machines can immediately
159+
understand the current situation and act accordingly.
160+
The Severity field MUST be set only when Status=False.
161+
type: string
162+
status:
163+
description: Status of the condition, one of True, False, Unknown.
164+
type: string
165+
type:
166+
description: |-
167+
Type of condition in CamelCase or in foo.example.com/CamelCase.
168+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
169+
can be useful (see .node.status.conditions), the ability to deconflict is important.
170+
type: string
171+
required:
172+
- lastTransitionTime
173+
- status
174+
- type
175+
type: object
176+
type: array
177+
ready:
178+
default: false
179+
type: boolean
180+
resources:
181+
description: Resources specifies the status of the resources that this
182+
object administrates.
183+
items:
184+
description: Resource defines the status of a resource.
185+
properties:
186+
error:
187+
description: Error specifies the error of the last time this object
188+
has been applied.
189+
type: string
190+
group:
191+
description: Group specifies the group of the object.
192+
type: string
193+
kind:
194+
description: Kind specifies the kind of the object.
195+
type: string
196+
name:
197+
description: Name specifies the name of the object.
198+
type: string
199+
namespace:
200+
description: Namespace specifies the namespace of the object.
201+
type: string
202+
status:
203+
description: Status specifies the status of the object being applied.
204+
type: string
205+
version:
206+
description: Version specifies the version of the object.
207+
type: string
208+
type: object
209+
type: array
210+
stages:
211+
description: Stages shows the state of all stages in the current running
212+
hook.
213+
items:
214+
description: StageStatus represents the helm charts of the hook and
215+
it's phases.
216+
properties:
217+
action:
218+
description: Action is the action of the helm chart. e.g. - apply
219+
and delete.
220+
type: string
221+
name:
222+
description: Name represent name of the helm chart
223+
type: string
224+
phase:
225+
description: Phase is the current phase of the helm chart.
226+
type: string
227+
type: object
228+
type: array
229+
type: object
230+
type: object
231+
served: true
232+
storage: true
233+
subresources:
234+
status: {}
235+
status:
236+
acceptedNames:
237+
kind: ""
238+
plural: ""
239+
conditions: []
240+
storedVersions: []

0 commit comments

Comments
 (0)