Skip to content

Commit

Permalink
Merge pull request #37 from replicatedhq/cbo/sc-100079/support-no-minio
Browse files Browse the repository at this point in the history
deploy kots without minio
  • Loading branch information
Craig O'Donnell authored Mar 6, 2024
2 parents 0e396a6 + f83dc67 commit 320680a
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 214 deletions.
1 change: 1 addition & 0 deletions templates/kotsadm-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ data:
minio-enabled-snapshots: "false"
registry-is-read-only: "false"
skip-preflights: {{ .Values.automation.skipPreflights | quote }}
with-minio: "false"
{{- if .Values.automation.appVersionLabel }}
app-version-label: {{ .Values.automation.appVersionLabel | quote }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
labels:
{{- include "admin-console.labels" . | nindent 4 }}
Expand All @@ -8,14 +8,13 @@ spec:
selector:
matchLabels:
app: kotsadm
strategy: {}
serviceName: kotsadm
template:
metadata:
annotations:
backup.velero.io/backup-volumes: backup
pre.hook.backup.velero.io/command: '["/backup.sh"]'
pre.hook.backup.velero.io/timeout: 10m
creationTimestamp: null
labels:
app: kotsadm
{{- include "admin-console.labels" . | nindent 8 }}
Expand Down Expand Up @@ -57,8 +56,6 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_OWNER_KIND
value: deployment
- name: API_ENCRYPTION_KEY
valueFrom:
secretKeyRef:
Expand All @@ -68,24 +65,6 @@ spec:
value: http://kotsadm.{{ .Release.Namespace }}.svc.cluster.local:3000
- name: API_ADVERTISE_ENDPOINT
value: http://localhost:8800
{{ if not .Values.isHelmManaged }}
- name: S3_ENDPOINT
value: http://kotsadm-minio:9000
- name: S3_BUCKET_NAME
value: kotsadm
- name: S3_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
key: accesskey
name: kotsadm-minio
- name: S3_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
key: secretkey
name: kotsadm-minio
- name: S3_BUCKET_ENDPOINT
value: "true"
{{ end }}
{{ if .Values.embeddedClusterID }}
- name: EMBEDDED_CLUSTER_ID
value: {{ .Values.embeddedClusterID | quote }}
Expand All @@ -97,7 +76,7 @@ spec:
- name: HTTP_PROXY
- name: HTTPS_PROXY
- name: NO_PROXY
value: kotsadm-rqlite,kotsadm-minio,kotsadm-api-node
value: kotsadm-rqlite,kotsadm-api-node
- name: IS_HELM_MANAGED
value: {{ .Values.isHelmManaged | quote }}
image: {{ .Values.images.kotsadm }}
Expand All @@ -122,6 +101,8 @@ spec:
cpu: 100m
memory: 100Mi
volumeMounts:
- mountPath: /kotsadmdata
name: kotsadmdata
- mountPath: /backup
name: backup
- mountPath: /tmp
Expand Down Expand Up @@ -181,7 +162,7 @@ spec:
- mountPath: /migrations
name: migrations
- command:
- /restore-db.sh
- /restore.sh
env:
- name: RQLITE_PASSWORD
valueFrom:
Expand All @@ -190,7 +171,7 @@ spec:
name: kotsadm-rqlite
image: {{ .Values.images.kotsadm }}
imagePullPolicy: IfNotPresent
name: restore-db
name: restore-data
resources:
limits:
cpu: "1"
Expand All @@ -199,54 +180,36 @@ spec:
cpu: 100m
memory: 100Mi
volumeMounts:
- mountPath: /kotsadmdata
name: kotsadmdata
- mountPath: /backup
name: backup
- mountPath: /tmp
name: tmp
- command:
- /restore-s3.sh
env:
- name: S3_ENDPOINT
value: http://kotsadm-minio:9000
- name: S3_BUCKET_NAME
value: kotsadm
- name: S3_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
key: accesskey
name: kotsadm-minio
- name: S3_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
key: secretkey
name: kotsadm-minio
- name: S3_BUCKET_ENDPOINT
value: "true"
image: {{ .Values.images.kotsadm }}
imagePullPolicy: IfNotPresent
name: restore-s3
resources:
limits:
cpu: "1"
memory: 2Gi
requests:
cpu: 100m
memory: 100Mi
volumeMounts:
- mountPath: /backup
name: backup
{{ end }}
restartPolicy: Always
securityContext:
fsGroup: 1001
runAsUser: 1001
serviceAccountName: kotsadm
volumes:
- persistentVolumeClaim:
claimName: kotsadmdata
name: kotsadmdata
- emptyDir:
medium: Memory
name: migrations
- emptyDir: {}
name: backup
- emptyDir: {}
name: tmp
status: {}
volumeClaimTemplates:
- metadata:
name: kotsadmdata
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 4Gi

89 changes: 89 additions & 0 deletions templates/migrate-s3-hook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@

{{ $kotsminio := lookup "apps/v1" "StatefulSet" .Release.Namespace "kotsadm-minio" }}
{{ if $kotsminio }}
# if minio exists, we need to migrate the data to a PVC
apiVersion: batch/v1
kind: Job
metadata:
name: kotsadm-migrate-s3
annotations:
helm.sh/hook: pre-upgrade
helm.sh/hook-weight: "1"
labels:
{{- include "admin-console.labels" . | nindent 4 }}
spec:
template:
metadata:
labels:
{{- include "admin-console.labels" . | nindent 8 }}
spec:
initContainers:
- command:
- /bin/sh
- -c
- |
kubectl scale deploy/kotsadm -n {{ .Release.Namespace }} --replicas=0
kubectl wait --for delete pod --selector=app=kotsadm -n {{ .Release.Namespace }} --timeout=300s
image: {{ .Values.images.kotsadm }}
imagePullPolicy: IfNotPresent
name: scale-down-kotsadm
resources:
requests:
cpu: 100m
memory: 100Mi
containers:
- command:
- /migrate-s3.sh
env:
- name: S3_ENDPOINT
value: http://kotsadm-minio:9000
- name: S3_BUCKET_NAME
value: kotsadm
- name: S3_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
key: accesskey
name: kotsadm-minio
- name: S3_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
key: secretkey
name: kotsadm-minio
- name: S3_BUCKET_ENDPOINT
value: "true"
image: {{ .Values.images.kotsadm }}
imagePullPolicy: IfNotPresent
name: migrate-s3
resources:
limits:
cpu: "1"
memory: 2Gi
requests:
cpu: 100m
memory: 100Mi
volumeMounts:
- mountPath: /kotsadmdata
name: kotsadmdata
restartPolicy: OnFailure
serviceAccountName: kotsadm
volumes:
- persistentVolumeClaim:
claimName: kotsadmdata-kotsadm-0
name: kotsadmdata
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: kotsadmdata-kotsadm-0
annotations:
helm.sh/hook: pre-upgrade
helm.sh/hook-weight: "0"
labels:
{{- include "admin-console.immutableLabels" . | nindent 4 }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 4Gi
{{ end }}
18 changes: 0 additions & 18 deletions templates/minio-service.yaml

This file was deleted.

116 changes: 0 additions & 116 deletions templates/minio-statefulset.yaml

This file was deleted.

Loading

0 comments on commit 320680a

Please sign in to comment.