Skip to content

Commit

Permalink
FEAT: Create cosmos operator chart (#134)
Browse files Browse the repository at this point in the history
* FEAT: Create cosmos operator chart

* FEAT: Create cosmos operator chart
  • Loading branch information
Gustavobelfort authored Mar 5, 2024
1 parent 90c48bf commit 4f764ee
Show file tree
Hide file tree
Showing 13 changed files with 14,256 additions and 0 deletions.
9 changes: 9 additions & 0 deletions charts/cosmos-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v2
name: cosmos-operator
description: Cosmos Operator Chart
type: application
version: v0.21.8
appVersion: "v0.21.8"
maintainers:
- name: pokt-foundation
- name: GustavoBelfort
62 changes: 62 additions & 0 deletions charts/cosmos-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cosmos-operator.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "cosmos-operator.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "cosmos-operator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "cosmos-operator.labels" -}}
helm.sh/chart: {{ include "cosmos-operator.chart" . }}
{{ include "cosmos-operator.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "cosmos-operator.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cosmos-operator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "cosmos-operator.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "cosmos-operator.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
6,075 changes: 6,075 additions & 0 deletions charts/cosmos-operator/templates/cosmosfullnode-crd.yaml

Large diffs are not rendered by default.

91 changes: 91 additions & 0 deletions charts/cosmos-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "cosmos-operator.fullname" . }}-controller-manager
labels:
{{- include "cosmos-operator.labels" . | nindent 4 }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cosmos-operator.fullname" . }}-controller-manager
labels:
control-plane: controller-manager
{{- include "cosmos-operator.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.controllerManager.replicas }}
selector:
matchLabels:
control-plane: controller-manager
{{- include "cosmos-operator.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
control-plane: controller-manager
{{- include "cosmos-operator.selectorLabels" . | nindent 8 }}
annotations:
kubectl.kubernetes.io/default-container: manager
spec:
containers:
- args:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8080/
- --logtostderr=true
- --v=0
env:
- name: KUBERNETES_CLUSTER_DOMAIN
value: {{ .Values.kubernetesClusterDomain }}
image: {{ .Values.controllerManager.kubeRbacProxy.image.repository }}:{{ .Values.controllerManager.kubeRbacProxy.image.tag }}
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
protocol: TCP
resources: {{- toYaml .Values.controllerManager.kubeRbacProxy.resources | nindent
10 }}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
- args:
- --health-probe-bind-address=:8081
- --metrics-bind-address=127.0.0.1:8080
- --leader-elect
command:
- /manager
env:
- name: KUBERNETES_CLUSTER_DOMAIN
value: {{ .Values.kubernetesClusterDomain }}
image: {{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag }}
imagePullPolicy: Always
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
name: manager
ports:
- containerPort: 6060
name: pprof
protocol: TCP
readinessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
resources: {{- toYaml .Values.controllerManager.manager.resources | nindent 10
}}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
serviceAccountName: {{ include "cosmos-operator.fullname" . }}-controller-manager
terminationGracePeriodSeconds: 10
53 changes: 53 additions & 0 deletions charts/cosmos-operator/templates/leader-election-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "cosmos-operator.fullname" . }}-leader-election-role
labels:
{{- include "cosmos-operator.labels" . | nindent 4 }}
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "cosmos-operator.fullname" . }}-leader-election-rolebinding
labels:
{{- include "cosmos-operator.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: '{{ include "cosmos-operator.fullname" . }}-leader-election-role'
subjects:
- kind: ServiceAccount
name: '{{ include "cosmos-operator.fullname" . }}-controller-manager'
namespace: '{{ .Release.Namespace }}'
23 changes: 23 additions & 0 deletions charts/cosmos-operator/templates/manager-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "cosmos-operator.fullname" . }}-manager-config
labels:
{{- include "cosmos-operator.labels" . | nindent 4 }}
data:
controller_manager_config.yaml: |
apiVersion: controller-runtime.sigs.k8s.io/v1alpha1
health:
healthProbeBindAddress: {{ .Values.managerConfig.controllerManagerConfigYaml.health.healthProbeBindAddress
| quote }}
kind: ControllerManagerConfig
leaderElection:
leaderElect: {{ .Values.managerConfig.controllerManagerConfigYaml.leaderElection.leaderElect
}}
resourceName: {{ .Values.managerConfig.controllerManagerConfigYaml.leaderElection.resourceName
| quote }}
metrics:
bindAddress: {{ .Values.managerConfig.controllerManagerConfigYaml.metrics.bindAddress
| quote }}
webhook:
port: {{ .Values.managerConfig.controllerManagerConfigYaml.webhook.port }}
Loading

0 comments on commit 4f764ee

Please sign in to comment.