Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xenops 1200] add hibernation mode to scale down replicas #162

Merged
merged 8 commits into from
Sep 27, 2024
Merged
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
chronology things are added/fixed/changed and - where possible - links to the PRs involved.

### Changes
[v0.7.5]
* added general.hibernate to set all replicas to 0

[v0.7.4]
* added mq.additionalVolumes
* added mq.additionalVolumeMounts
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ For more information take a look at
Transform Service Shared File Storage, Clustering (replica count should always have a max of 1 for ACS pods), MQ and
Digital Workspace are disabled.

#### `general.hibernate`

* Required: false
* Default: false
* Description: Setting this parameter to true will set all replicas to 0 and alter the default
nginx rules to redirect the normal pages to a 503 maintenance page.



#### `general.strategy`

Expand Down
2 changes: 1 addition & 1 deletion xenit-alfresco/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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.5
version: 0.7.5

# 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
Expand Down
4 changes: 3 additions & 1 deletion xenit-alfresco/templates/acs/acs-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ metadata:
labels:
app: acs
spec:
{{- if .Values.general.enterprise }}
{{- if .Values.general.hibernate }}
replicas: 0
{{- else if .Values.general.enterprise }}
replicas: {{ .Values.acs.replicas }}
{{- else }}
replicas: 1
Expand Down
4 changes: 4 additions & 0 deletions xenit-alfresco/templates/active-mq/mq-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ metadata:
labels:
app: mq
spec:
{{- if .Values.general.hibernate }}
replicas: 0
{{- else }}
replicas: {{ .Values.mq.replicas }}
{{- end }}
selector:
matchLabels:
app: mq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ metadata:
labels:
app: digital-workspace
spec:
{{- if .Values.general.hibernate }}
replicas: 0
{{- else }}
replicas: {{ .Values.digitalWorkspace.replicas }}
{{- end }}
selector:
matchLabels:
app: digital-workspace
Expand Down
22 changes: 15 additions & 7 deletions xenit-alfresco/templates/ingress/alfresco-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ spec:
- host: {{ required "A host where your alfresco services can be reached on must be specified in values.ingress.host" .Values.ingress.host }}
http:
paths:
{{- if .Values.ingress.defaultPath }}
{{- if .Values.general.hibernate }}
- path: /
pathType: Prefix
backend:
service:
name: nginx-default-service
port:
number: 30403
{{- else if .Values.ingress.defaultPath }}
- path: /
pathType: Prefix
backend:
Expand All @@ -40,7 +48,7 @@ spec:
port:
number: {{ .Values.ingress.defaultPath.port }}
{{- end }}
{{- if .Values.acs.ingress.enabled }}
{{- if and .Values.acs.ingress.enabled (not .Values.general.hibernate) }}
- path: /alfresco
pathType: Prefix
backend:
Expand All @@ -49,7 +57,7 @@ spec:
port:
number: 30000
{{- end }}
{{- if and .Values.share.enabled .Values.share.ingress.enabled }}
{{- if and .Values.share.enabled .Values.share.ingress.enabled (not .Values.general.hibernate) }}
- path: /share
pathType: Prefix
backend:
Expand All @@ -58,7 +66,7 @@ spec:
port:
number: 30100
{{- end }}
{{- if and .Values.digitalWorkspace.enabled .Values.digitalWorkspace.ingress.enabled }}
{{- if and .Values.digitalWorkspace.enabled .Values.digitalWorkspace.ingress.enabled (not .Values.general.hibernate) }}
- path: {{ .Values.digitalWorkspace.basePath }}
pathType: Prefix
backend:
Expand All @@ -67,7 +75,7 @@ spec:
port:
number: 30200
{{- end }}
{{- if and .Values.ooi.enabled .Values.ooi.ingress.enabled }}
{{- if and .Values.ooi.enabled .Values.ooi.ingress.enabled (not .Values.general.hibernate) }}
- path: /ooi-service
pathType: Prefix
backend:
Expand All @@ -87,10 +95,10 @@ spec:
number: 30403
{{- end }}
{{- end }}
{{- if .Values.ingress.additionalPaths }}
{{- if and .Values.ingress.additionalPaths (not .Values.general.hibernate) }}
{{ toYaml .Values.ingress.additionalPaths | nindent 6 }}
{{- end }}
{{- if .Values.syncService.enabled }}
{{- if and .Values.syncService.enabled (not .Values.general.hibernate) }}
- host: {{ required "If sync Services are enabled a specific host for sync services must be specified in values.ingress.syncServiceHost" .Values.ingress.syncServiceHost }}
http:
paths:
Expand Down
25 changes: 24 additions & 1 deletion xenit-alfresco/templates/ingress/nginx-default-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,30 @@ data:
return 403 'Forbidden';
}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.general.hibernate }}
location /alfresco {
return 302 /maintenance;
}
{{- if and .Values.share.enabled .Values.share.ingress.enabled }}
location /share {
return 302 /maintenance;
}
{{- end }}
{{- if and .Values.digitalWorkspace.enabled .Values.digitalWorkspace.ingress.enabled }}
location {{ .Values.digitalWorkspace.basePath }} {
return 302 /maintenance;
}
{{- end }}
{{- if and .Values.ooi.enabled .Values.ooi.ingress.enabled }}
location /ooi-service {
return 302 /maintenance;
}
{{- end }}
location /maintenance {
return 503 'Sorry, this application is currently hibernated.';
}
{{- end }}
location / {
return 404 'Sorry, this page is not served here.';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ spec:
app: nginx-default
template:
metadata:
annotations:
{{- if .Values.general.hibernate }}
hibernated: 'true'
{{- end }}
labels:
app: nginx-default
spec:
Expand Down
4 changes: 4 additions & 0 deletions xenit-alfresco/templates/ooi/ooi-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ metadata:
labels:
app: ooi
spec:
{{- if .Values.general.hibernate }}
replicas: 0
{{- else }}
replicas: {{ .Values.ooi.replicas }}
{{- end }}
selector:
matchLabels:
app: ooi
Expand Down
4 changes: 4 additions & 0 deletions xenit-alfresco/templates/postgres/postgresql-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ metadata:
labels:
app: postgresql
spec:
{{- if .Values.general.hibernate }}
replicas: 0
{{- else }}
replicas: 1
{{- end }}
selector:
matchLabels:
app: postgresql
Expand Down
4 changes: 4 additions & 0 deletions xenit-alfresco/templates/share/share-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ metadata:
labels:
app: share
spec:
{{- if .Values.general.hibernate }}
replicas: 0
{{- else }}
replicas: {{ .Values.share.replicas }}
{{- end }}
selector:
matchLabels:
app: share
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and (.Values.solr.enabled) (.Values.solr.autoBackup.enabled) -}}
{{- if and (.Values.solr.enabled) (.Values.solr.autoBackup.enabled) (not .Values.general.hibernate) -}}
apiVersion: batch/v1
kind: CronJob
metadata:
Expand Down
4 changes: 4 additions & 0 deletions xenit-alfresco/templates/solr/solr-stateful-set.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ metadata:
labels:
app: solr
spec:
{{- if .Values.general.hibernate }}
replicas: 0
{{- else }}
replicas: {{ .Values.solr.replicas }}
{{- end }}
podManagementPolicy: {{ .Values.solr.podManagementPolicy }}
selector:
matchLabels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ metadata:
labels:
app: sync-service
spec:
{{- if .Values.general.hibernate }}
replicas: 0
{{- else }}
replicas: {{ .Values.syncService.replicas }}
{{- end }}
selector:
matchLabels:
app: sync-service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ metadata:
labels:
app: shared-file-store
spec:
{{- if .Values.general.hibernate }}
replicas: 0
{{- else }}
replicas: {{ .Values.transformServices.sharedFileStore.replicas }}
{{- end }}
selector:
matchLabels:
app: shared-file-store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ metadata:
labels:
app: transform-core-aio
spec:
{{- if .Values.general.hibernate }}
replicas: 0
{{- else }}
replicas: {{ .Values.transformServices.transformCoreAio.replicas }}
{{- end }}
selector:
matchLabels:
app: transform-core-aio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ metadata:
labels:
app: transform-router
spec:
{{- if .Values.general.hibernate }}
replicas: 0
{{- else }}
replicas: {{ .Values.transformServices.transformRouter.replicas }}
{{- end }}
selector:
matchLabels:
app: transform-router
Expand Down
1 change: 1 addition & 0 deletions xenit-alfresco/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
general:
hibernate: false
enterprise: true
strategy:
type: RollingUpdate
Expand Down
Loading