Skip to content

Commit

Permalink
Dc to deploy (#28)
Browse files Browse the repository at this point in the history
* Rstudio. From DeploymentConfig to Deployment

DeploymentConfig is deprecated since OKD 4.14:
- Switch from DeploymentConfig to Deployment
- Add `initContainers` to wait for the build to be completed
- Create a `serviceaccount`, `role` and `rolebinding`
  to be used to read the build status (oc wait)

* Matomo. From DeploymentConfig to Deployment

DeploymentConfig is deprecated since OKD 4.14:
- Switch from DeploymentConfig to Deployment
- Add annotations to keep the PVC after uninstalling the Chart
- Fix Services

* Minio. From DeploymentConfig to Deployment

DeploymentConfig is deprecated since OKD 4.14:
- Switch from DeploymentConfig to Deployment
- Add annotations to keep the PVC after uninstalling the Chart
- Update README

* Update Charts version

* Change to Recreate
  • Loading branch information
trispera authored Apr 11, 2024
1 parent 70002b1 commit 6c032b3
Show file tree
Hide file tree
Showing 15 changed files with 96 additions and 75 deletions.
4 changes: 2 additions & 2 deletions charts/matomo/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
name: matomo-helm
name: matomo
description: Matomo Helm Chart for Rahti platform
Link to the repo https://github.com/CSCfi/helm-charts
version: 1.1.1
version: 1.2.1
sources:
- https://github.com/CSCfi/helm-charts
icon: https://avatars.githubusercontent.com/u/698038?s=280&v=4
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: {{ .Values.mariadb.name }}
annotations:
template.alpha.openshift.io/wait-for-ready: "true"
name: mariadb
name: {{ .Values.mariadb.name }}
spec:
replicas: 1
selector:
name: mariadb
matchLabels:
app: {{ .Values.mariadb.name }}
strategy:
type: Recreate
template:
metadata:
labels:
name: mariadb
app: {{ .Values.mariadb.name }}
spec:
containers:
- env:
Expand Down Expand Up @@ -46,7 +48,7 @@ spec:
port: 3306
timeoutSeconds: {{ .Values.mariadb.livenessProbe.timeoutSeconds }}
{{- end }}
name: mariadb
name: {{ .Values.mariadb.name }}
ports:
- containerPort: 3306
{{- if .Values.mariadb.readinessProbe.enabled }}
Expand All @@ -70,44 +72,24 @@ spec:
- name: {{ .Values.mariadb.name }}-data
persistentVolumeClaim:
claimName: {{ .Values.mariadb.name }}
triggers:
- imageChangeParams:
automatic: true
containerNames:
- mariadb
from:
kind: ImageStreamTag
name: {{ .Values.mariadb.imageStream.name }}:{{ .Values.mariadb.imageStream.tag }}
namespace: {{ .Values.mariadb.imageStream.namespace }}
type: ImageChange
- type: ConfigChange

---
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: matomo
name: matomo
app: {{ .Values.matomo.name }}
name: {{ .Values.matomo.name }}
spec:
replicas: 1
selector:
app: matomo
deploymentconfig: matomo
matchLabels:
app: {{ .Values.matomo.name }}
strategy:
resources: {}
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
type: Rolling
type: RollingUpdate
template:
metadata:
labels:
app: matomo
deploymentconfig: matomo
app: {{ .Values.matomo.name }}
spec:
containers:
- env:
Expand Down Expand Up @@ -138,7 +120,7 @@ spec:
name: {{ .Values.mariadb.name }}
image: {{ .Values.matomo.image }}
imagePullPolicy: Always
name: matomo
name: {{ .Values.matomo.name }}
ports:
- containerPort: 8080
protocol: TCP
Expand Down
2 changes: 2 additions & 0 deletions charts/matomo/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.mariadb.name }}
annotations:
helm.sh/resource-policy: "keep"
spec:
accessModes:
- ReadWriteOnce
Expand Down
4 changes: 2 additions & 2 deletions charts/matomo/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
- name: mariadb
port: 3306
selector:
name: {{ .Values.mariadb.name }}
app: {{ .Values.mariadb.name }}
type: {{ .Values.mariadb.service.type }}

---
Expand All @@ -30,5 +30,5 @@ spec:
protocol: TCP
targetPort: 8443
selector:
deploymentconfig: {{ .Values.matomo.name }}
app: {{ .Values.matomo.name }}
type: {{ .Values.matomo.service.type }}
4 changes: 2 additions & 2 deletions charts/minio/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
name: minio-helm
name: minio
description: Minio Helm Chart for Rahti platform
Link to the repo https://github.com/CSCfi/helm-charts
version: 1.1.1
version: 1.2.1
sources:
- https://github.com/CSCfi/helm-charts
icon: https://min.io/resources/img/logo.svg
2 changes: 1 addition & 1 deletion charts/minio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ helm upgrade --install minio .
```

## Explanations
This Helm Chart helps you to deploy Minio on CSC Rahti 2 (Openshift 4).
This Helm Chart helps you to deploy Minio on CSC Rahti (Openshift 4).
If you want to use it with different values, you can edit `values.yaml` file and then run:
```sh
helm upgrade --install minio . -f {custom_values.yaml}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: {{ .Values.minio.clusterName }}
name: {{ .Values.minio.clusterName }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ .Values.minio.clusterName }}
strategy:
type: Recreate
template:
metadata:
labels:
Expand All @@ -21,8 +25,9 @@ spec:
- mountPath: /mnt/default-config-json/
name: default-config-json
containers:
- image: {{ .Values.minio.image }}
name: {{ .Values.minio.clusterName }}
- name: {{ .Values.minio.clusterName }}
imagePullPolicy: IfNotPresent
image: {{ .Values.minio.image }}
ports:
- containerPort: 9000
protocol: TCP
Expand All @@ -31,11 +36,11 @@ spec:
{{- if .Values.minio.readinessProbe.enabled }}
readinessProbe:
httpGet:
{{- .Values.minio.readinessProbe.httpGet | toYaml | nindent 12 }}
{{- end }}
{{- .Values.minio.readinessProbe.httpGet | toYaml | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /data/files
name: minio-vol
- name: minio-vol
mountPath: /data/files
command:
- minio
- server
Expand Down
2 changes: 2 additions & 0 deletions charts/minio/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.minio.pvc.name }}
annotations:
helm.sh/resource-policy: "keep"
labels:
app: {{ .Values.minio.clusterName }}
spec:
Expand Down
4 changes: 2 additions & 2 deletions charts/rstudio/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
name: rstudio-helm
name: rstudio
description: RStudio Helm Chart for Rahti platform
Link to the repo https://github.com/CSCfi/helm-charts
version: 1.0.1
version: 1.2.1
sources:
- https://github.com/CSCfi/helm-charts
icon: https://upload.wikimedia.org/wikipedia/commons/0/0e/Eo_circle_light-blue_white_letter-r.svg
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: {{ .Values.appName }}
name: {{ .Values.appName }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ .Values.appName }}
strategy:
type: Rolling
type: Recreate
template:
metadata:
labels:
app: {{ .Values.appName }}
spec:
serviceAccount: build-reader
initContainers:
- name: wait-for-build
imagePullPolicy: IfNotPresent
image: quay.io/openshift/origin-cli:4.16
command:
- sh
- -c
- oc wait --for=jsonpath='{.status.phase}'=Complete build -l buildconfig={{ .Values.appName }} --timeout=900s
containers:
- image: {{ .Values.appName }}:latest
- name: {{ .Values.appName }}
imagePullPolicy: IfNotPresent
name: {{ .Values.appName }}
image: image-registry.openshift-image-registry.svc:5000/{{ .Release.Namespace }}/{{ .Values.appName }}:latest
ports:
- containerPort: 3838
protocol: TCP
Expand All @@ -33,28 +42,15 @@ spec:
securityContext:
{{- .Values.rstudio.containerSecurityContext | toYaml | nindent 10 }}
{{- end }}
{{- if .Values.openshift.enabled }}
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
{{- if .Values.openshift.enabled }}
securityContext:
{{- .Values.rstudio.podSecurityContext | toYaml | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: 30
volumes:
- name: {{ .Values.rstudio.pvc.mountName }}
persistentVolumeClaim:
claimName: {{ .Values.rstudio.pvc.mountName }}
- name: {{ .Values.shiny.pvc.mountName }}
persistentVolumeClaim:
claimName: {{ .Values.shiny.pvc.mountName }}
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- {{ .Values.appName }}
from:
kind: ImageStreamTag
name: {{ .Values.appName }}:latest
type: ImageChange
4 changes: 3 additions & 1 deletion charts/rstudio/templates/imagestream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ metadata:
annotations:
description: Keeps track of changes in the appliation image
name: {{ .Values.appName }}

spec:
lookupPolicy:
local: true
4 changes: 4 additions & 0 deletions charts/rstudio/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.rstudio.pvc.mountName }}
annotations:
helm.sh/resource-policy: "keep"
spec:
resources:
requests:
Expand All @@ -15,6 +17,8 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.shiny.pvc.mountName }}
annotations:
helm.sh/resource-policy: "keep"
spec:
resources:
requests:
Expand Down
13 changes: 13 additions & 0 deletions charts/rstudio/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: build-reader
rules:
- apiGroups:
- build.openshift.io
resources:
- builds
verbs:
- get
- list
- watch
11 changes: 11 additions & 0 deletions charts/rstudio/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: build-reader
subjects:
- kind: ServiceAccount
name: build-reader
roleRef:
kind: Role
name: build-reader
apiGroup: rbac.authorization.k8s.io
4 changes: 4 additions & 0 deletions charts/rstudio/templates/sa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: build-reader

0 comments on commit 6c032b3

Please sign in to comment.