integrate helmwave

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
This commit is contained in:
Andrei Kvapil
2023-12-28 22:41:42 +01:00
parent 44a755d4ed
commit dc95f4fbcd
186 changed files with 969 additions and 5397 deletions

View File

@@ -103,25 +103,29 @@ Write configuration for Cozystack:
```yaml
cat > patch.yaml <<EOT
machine:
kubelet:
nodeIP:
validSubnets:
- 192.168.100.0/24
kernel:
modules:
- name: drbd
parameters:
- usermode_helper=disabled
- name: openvswitch
- name: drbd
parameters:
- usermode_helper=disabled
- name: openvswitch
install:
image: ghcr.io/siderolabs/installer:v1.6.0
extensions:
- image: ghcr.io/siderolabs/drbd:9.2.6-v1.6.0
- image: ghcr.io/siderolabs/drbd:9.2.6-v1.6.0
cluster:
network:
cni:
name: none
podSubnets:
- 10.244.0.0/16
- 10.244.0.0/16
serviceSubnets:
- 10.96.0.0/16
- 10.96.0.0/16
allowSchedulingOnControlPlanes: true
controllerManager:
@@ -134,6 +138,9 @@ cluster:
disabled: true
discovery:
enabled: false
etcd:
advertisedSubnets:
- 192.168.100.0/24
EOT
```
@@ -145,50 +152,5 @@ Run [talos-bootstrap](https://github.com/aenix-io/talos-bootstrap/) to deploy cl
Install cozystack system components:
```
export KUBECONFIG=${PWD}/kubeconfig
for i in \
cilium \
kubeovn \
fluxcd \
cert-manager \
victoria-metrics-operator \
monitoring \
kubeapps \
kubevirt \
metallb \
grafana-operator \
mariadb-operator \
postgres-operator \
rabbitmq-operator \
piraeus-operator \
redis-operator \
linstor \
telepresence \
ingress-nginx \
do
make -C "system/$i" apply
done
```
Check status of deployments:
```
helm ls -A
# NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
# cert-manager cozy-cert-manager 1 2023-12-26 17:59:53.360566717 +0000 UTC deployed cozystack-0.0.0
# cilium cozy-cilium 1 2023-12-26 17:58:13.257363562 +0000 UTC deployed cozystack-0.0.0
# grafana-operator cozy-grafana-operator 1 2023-12-26 18:00:27.040639056 +0000 UTC deployed cozystack-0.0.0
# ingress-nginx cozy-ingress-nginx 1 2023-12-26 18:00:47.628341874 +0000 UTC deployed cozystack-0.0.0
# kubeapps cozy-kubeapps 1 2023-12-26 18:00:17.955946393 +0000 UTC deployed cozystack-0.0.0
# kubeapps cozy-fluxcd 1 2023-12-26 17:59:43.916449245 +0000 UTC deployed cozystack-0.0.0
# kubevirt cozy-kubevirt 1 2023-12-26 18:00:20.417334537 +0000 UTC deployed cozystack-0.0.0
# linstor cozy-linstor 1 2023-12-26 18:00:40.858381945 +0000 UTC deployed cozystack-0.0.0
# mariadb-operator cozy-mariadb-operator 1 2023-12-26 18:00:30.598967718 +0000 UTC deployed cozystack-0.0.0
# metallb cozy-metallb 1 2023-12-26 18:00:24.001145931 +0000 UTC deployed cozystack-0.0.0
# monitoring cozy-monitoring 1 2023-12-26 18:00:15.97255153 +0000 UTC deployed cozystack-0.0.0
# piraeus-operator cozy-linstor 1 2023-12-26 18:00:37.914192412 +0000 UTC deployed cozystack-0.0.0
# postgres-operator cozy-postgres-operator 1 2023-12-26 18:00:33.457111594 +0000 UTC deployed cozystack-0.0.0
# rabbitmq-operator cozy-rabbitmq-operator 1 2023-12-26 18:00:35.830732116 +0000 UTC deployed cozystack-0.0.0
# redis-operator cozy-redis-operator 1 2023-12-26 18:00:40.151932075 +0000 UTC deployed cozystack-0.0.0
# traffic-manager cozy-telepresence 1 2023-12-26 18:00:46.364632248 +0000 UTC deployed cozystack-0.0.0
# victoria-metrics-operator cozy-victoria-metrics-operator 1 2023-12-26 18:00:13.636953818 +0000 UTC deployed cozystack-0.0.0
kubectl apply -f cozystack.yaml
```

2
TODO
View File

@@ -14,3 +14,5 @@ migrate kubeapps redis to operator
kubeapps patch helm chart to use custom images
flux policies
talos linux firmware
replace reconcile.sh
remove hack/app-helm* and replace to helmwave

View File

@@ -1,23 +1 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
grafana-dashboards

View File

@@ -1,25 +1,2 @@
apiVersion: v2
name: monitoring-gateway
description: Monitoring and observability stack.
icon: https://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Grafana_icon.svg/351px-Grafana_icon.svg.png
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
name: cozystack
version: 0.0.0

View File

@@ -1,22 +0,0 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "monitoring-gateway.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "monitoring-gateway.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "monitoring-gateway.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "monitoring-gateway.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}

View File

@@ -1,51 +0,0 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "monitoring-gateway.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 "monitoring-gateway.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 "monitoring-gateway.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "monitoring-gateway.labels" -}}
helm.sh/chart: {{ include "monitoring-gateway.chart" . }}
{{ include "monitoring-gateway.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "monitoring-gateway.selectorLabels" -}}
app.kubernetes.io/name: {{ include "monitoring-gateway.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

View File

@@ -1,72 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "monitoring-gateway.fullname" . }}
labels:
{{- include "monitoring-gateway.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "monitoring-gateway.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "monitoring-gateway.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "monitoring-gateway.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@@ -1,32 +0,0 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "monitoring-gateway.fullname" . }}
labels:
{{- include "monitoring-gateway.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "monitoring-gateway.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

View File

@@ -1,61 +0,0 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "monitoring-gateway.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "monitoring-gateway.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

Some files were not shown because too many files have changed in this diff Show More