Skip to content

Commit b7fd886

Browse files
committed
feat: Add cluster-controller chart as a dependency
1 parent 87add33 commit b7fd886

15 files changed

+595
-5
lines changed

charts/cluster-controller/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/cluster-controller/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: cluster-controller
3+
description: A Helm chart for Kubernetes
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: 1.0.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: "1.0.0"
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 "cluster-controller.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 "cluster-controller.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 "cluster-controller.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "cluster-controller.labels" -}}
37+
helm.sh/chart: {{ include "cluster-controller.chart" . }}
38+
{{ include "cluster-controller.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 "cluster-controller.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "cluster-controller.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 "cluster-controller.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "cluster-controller.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
# Removed `-controller-manager` suffix to simplify name
5+
name: {{ include "cluster-controller.fullname" . }}
6+
labels:
7+
{{- include "cluster-controller.labels" . | nindent 4 }}
8+
---
9+
apiVersion: apps/v1
10+
kind: Deployment
11+
metadata:
12+
name: {{ include "cluster-controller.fullname" . }}
13+
labels:
14+
control-plane: controller-manager
15+
{{- include "cluster-controller.labels" . | nindent 4 }}
16+
spec:
17+
replicas: {{ .Values.controllerManager.replicas }}
18+
selector:
19+
matchLabels:
20+
control-plane: controller-manager
21+
{{- include "cluster-controller.selectorLabels" . | nindent 6 }}
22+
template:
23+
metadata:
24+
labels:
25+
control-plane: controller-manager
26+
{{- include "cluster-controller.selectorLabels" . | nindent 8 }}
27+
annotations:
28+
kubectl.kubernetes.io/default-container: manager
29+
spec:
30+
containers:
31+
- args:
32+
- --secure-listen-address=0.0.0.0:8443
33+
- --upstream=http://127.0.0.1:8080/
34+
- --logtostderr=true
35+
- --v=0
36+
env:
37+
- name: KUBERNETES_CLUSTER_DOMAIN
38+
value: {{ .Values.kubernetesClusterDomain }}
39+
image: {{ .Values.controllerManager.kubeRbacProxy.image.repository }}:{{ .Values.controllerManager.kubeRbacProxy.image.tag
40+
| default .Chart.AppVersion }}
41+
name: kube-rbac-proxy
42+
ports:
43+
- containerPort: 8443
44+
name: https
45+
protocol: TCP
46+
resources: {{- toYaml .Values.controllerManager.kubeRbacProxy.resources | nindent
47+
10 }}
48+
- args:
49+
- --health-probe-bind-address=:8081
50+
- --metrics-bind-address=127.0.0.1:8080
51+
- --leader-elect
52+
command:
53+
- /manager
54+
env:
55+
- name: KUBERNETES_CLUSTER_DOMAIN
56+
value: {{ .Values.kubernetesClusterDomain }}
57+
image: {{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag
58+
| default .Chart.AppVersion }}
59+
livenessProbe:
60+
httpGet:
61+
path: /healthz
62+
port: 8081
63+
initialDelaySeconds: 15
64+
periodSeconds: 20
65+
name: manager
66+
readinessProbe:
67+
httpGet:
68+
path: /readyz
69+
port: 8081
70+
initialDelaySeconds: 5
71+
periodSeconds: 10
72+
resources: {{- toYaml .Values.controllerManager.manager.resources | nindent 10
73+
}}
74+
securityContext:
75+
allowPrivilegeEscalation: false
76+
securityContext:
77+
runAsNonRoot: true
78+
serviceAccountName: {{ include "cluster-controller.fullname" . }}
79+
terminationGracePeriodSeconds: 10
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: gitopsclusters.gitops.weave.works
5+
annotations:
6+
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ include "cluster-controller.fullname" . }}-
7+
controller-gen.kubebuilder.io/version: v0.7.0
8+
labels:
9+
{{- include "cluster-controller.labels" . | nindent 4 }}
10+
spec:
11+
group: gitops.weave.works
12+
names:
13+
kind: GitopsCluster
14+
listKind: GitopsClusterList
15+
plural: gitopsclusters
16+
singular: gitopscluster
17+
scope: Namespaced
18+
versions:
19+
- additionalPrinterColumns:
20+
- jsonPath: .metadata.creationTimestamp
21+
name: Age
22+
type: date
23+
- jsonPath: .status.conditions[?(@.type=="Ready")].status
24+
name: Ready
25+
type: string
26+
- jsonPath: .status.conditions[?(@.type=="Ready")].message
27+
name: Status
28+
type: string
29+
name: v1alpha1
30+
schema:
31+
openAPIV3Schema:
32+
description: GitopsCluster is the Schema for the gitopsclusters API
33+
properties:
34+
apiVersion:
35+
description: 'APIVersion defines the versioned schema of this representation
36+
of an object. Servers should convert recognized schemas to the latest
37+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
38+
type: string
39+
kind:
40+
description: 'Kind is a string value representing the REST resource this
41+
object represents. Servers may infer this from the endpoint the client
42+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
43+
type: string
44+
metadata:
45+
type: object
46+
spec:
47+
description: GitopsClusterSpec defines the desired state of GitopsCluster
48+
properties:
49+
capiClusterRef:
50+
description: CAPIClusterRef specifies the CAPI Cluster.
51+
properties:
52+
name:
53+
description: Name of the referent.
54+
type: string
55+
required:
56+
- name
57+
type: object
58+
secretRef:
59+
description: SecretRef specifies the Secret containing the kubeconfig
60+
for a cluster.
61+
properties:
62+
name:
63+
description: Name of the referent.
64+
type: string
65+
required:
66+
- name
67+
type: object
68+
type: object
69+
status:
70+
description: GitopsClusterStatus defines the observed state of GitopsCluster
71+
properties:
72+
conditions:
73+
description: Conditions holds the conditions for the Cluster.
74+
items:
75+
description: "Condition contains details for one aspect of the current
76+
state of this API Resource. --- This struct is intended for direct
77+
use as an array at the field path .status.conditions. For example,
78+
type FooStatus struct{ // Represents the observations of a foo's
79+
current state. // Known .status.conditions.type are: \"Available\",
80+
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
81+
// +listType=map // +listMapKey=type Conditions []metav1.Condition
82+
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
83+
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
84+
properties:
85+
lastTransitionTime:
86+
description: lastTransitionTime is the last time the condition
87+
transitioned from one status to another. This should be when
88+
the underlying condition changed. If that is not known, then
89+
using the time when the API field changed is acceptable.
90+
format: date-time
91+
type: string
92+
message:
93+
description: message is a human readable message indicating details
94+
about the transition. This may be an empty string.
95+
maxLength: 32768
96+
type: string
97+
observedGeneration:
98+
description: observedGeneration represents the .metadata.generation
99+
that the condition was set based upon. For instance, if .metadata.generation
100+
is currently 12, but the .status.conditions[x].observedGeneration
101+
is 9, the condition is out of date with respect to the current
102+
state of the instance.
103+
format: int64
104+
minimum: 0
105+
type: integer
106+
reason:
107+
description: reason contains a programmatic identifier indicating
108+
the reason for the condition's last transition. Producers of
109+
specific condition types may define expected values and meanings
110+
for this field, and whether the values are considered a guaranteed
111+
API. The value should be a CamelCase string. This field may
112+
not be empty.
113+
maxLength: 1024
114+
minLength: 1
115+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
116+
type: string
117+
status:
118+
description: status of the condition, one of True, False, Unknown.
119+
enum:
120+
- "True"
121+
- "False"
122+
- Unknown
123+
type: string
124+
type:
125+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
126+
--- Many .condition.type values are consistent across resources
127+
like Available, but because arbitrary conditions can be useful
128+
(see .node.status.conditions), the ability to deconflict is
129+
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
130+
maxLength: 316
131+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
132+
type: string
133+
required:
134+
- lastTransitionTime
135+
- message
136+
- reason
137+
- status
138+
- type
139+
type: object
140+
type: array
141+
type: object
142+
type: object
143+
served: true
144+
storage: true
145+
subresources:
146+
status: {}
147+
status:
148+
acceptedNames:
149+
kind: ""
150+
plural: ""
151+
conditions: []
152+
storedVersions: []
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: Role
3+
metadata:
4+
name: {{ include "cluster-controller.fullname" . }}-leader-election-role
5+
labels:
6+
{{- include "cluster-controller.labels" . | nindent 4 }}
7+
rules:
8+
- apiGroups:
9+
- ""
10+
resources:
11+
- configmaps
12+
verbs:
13+
- get
14+
- list
15+
- watch
16+
- create
17+
- update
18+
- patch
19+
- delete
20+
- apiGroups:
21+
- coordination.k8s.io
22+
resources:
23+
- leases
24+
verbs:
25+
- get
26+
- list
27+
- watch
28+
- create
29+
- update
30+
- patch
31+
- delete
32+
- apiGroups:
33+
- ""
34+
resources:
35+
- events
36+
verbs:
37+
- create
38+
- patch
39+
---
40+
apiVersion: rbac.authorization.k8s.io/v1
41+
kind: RoleBinding
42+
metadata:
43+
name: {{ include "cluster-controller.fullname" . }}-leader-election-rolebinding
44+
labels:
45+
{{- include "cluster-controller.labels" . | nindent 4 }}
46+
roleRef:
47+
apiGroup: rbac.authorization.k8s.io
48+
kind: Role
49+
name: '{{ include "cluster-controller.fullname" . }}-leader-election-role'
50+
subjects:
51+
- kind: ServiceAccount
52+
name: '{{ include "cluster-controller.fullname" . }}'
53+
namespace: '{{ .Release.Namespace }}'

0 commit comments

Comments
 (0)