Skip to content

Commit e5aa7be

Browse files
authored
Merge pull request #93 from opencadc/limit-range-feature-gate
Limit range feature gate
2 parents eddda5b + 4eaf993 commit e5aa7be

File tree

13 files changed

+168
-13
lines changed

13 files changed

+168
-13
lines changed

helm/applications/science-portal/config/org.opencadc.science-portal.properties

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ org.opencadc.science-portal.logoURL = {{ .Values.deployment.sciencePortal.logoUR
44
org.opencadc.science-portal.themeName = {{ .Values.deployment.sciencePortal.themeName | required "Please set the deployment.sciencePortal.themeName to either src or canfar" }}
55

66
{{- if empty .Values.deployment.sciencePortal.tabLabels }}
7-
{{ required ".Values.deployment.sciencePortal.tabLabels is missing or empty" .Values.deployment.sciencePortal.tabLabels }}
7+
{{ required ".Values.deployment.sciencePortal.tabLabels is missing or empty" .Values.deployment.sciencePortal.tabLabels }}
88
{{- else }}
9-
org.opencadc.science-portal.tabLabels = {{ .Values.deployment.sciencePortal.tabLabels | join "," }}
9+
org.opencadc.science-portal.tabLabels = {{ .Values.deployment.sciencePortal.tabLabels | join "," }}
1010
{{- end }}
1111

1212
{{- with .Values.deployment.sciencePortal.oidc }}
@@ -31,7 +31,13 @@ org.opencadc.science-portal.tokenCache.url = redis://{{ $.Release.Name }}-redis-
3131
{{ with .Values.experimentalFeatures }}
3232
{{- with .storageHomePanel }}
3333
{{- if .enabled }}
34+
# This feature is NOT namespaced with experimental as it's grandfathered.
3435
org.opencadc.science-portal.storageXmlInfoUrl = {{ .url }}
3536
{{- end }}
3637
{{- end }}
38+
{{- with .slider }}
39+
{{- if .enabled }}
40+
org.opencadc.science-portal.experimental.slider.enabled = true
41+
{{- end }}
42+
{{- end }}
3743
{{- end }}

helm/applications/science-portal/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ tolerations: []
139139

140140
# For the token caching
141141
redis:
142+
image:
143+
repository: redis
144+
tag: 8.2.2-bookworm
142145
architecture: 'standalone'
143146
auth:
144147
enabled: false

helm/applications/skaha/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# CHANGELOG for Skaha User Session API (Chart 1.0.5)
1+
# CHANGELOG for Skaha User Session API (Chart 1.1.0)
2+
3+
## 2025.09.29 (1.1.0)
4+
- Bump Skaha API image to `1.1.0`
5+
- Feature Gate to support `LimitRange` objects to enforce resource limits on User Sessions
26

37
## 2025.09.29 (1.0.5)
48
- Fix for status reporting in User Sessions

helm/applications/skaha/Chart.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apiVersion: v2
22
name: skaha
33
description: "A Helm chart to install the Skaha web service of the CANFAR Science Platform"
4+
icon: https://www.canfar.net/css/images/logo.png
45

56
# A chart can be either an 'application' or a 'library' chart.
67
#
@@ -15,13 +16,13 @@ type: application
1516
# This is the chart version. This version number should be incremented each time you make changes
1617
# to the chart and its templates, including the app version.
1718
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 1.0.5
19+
version: 1.1.0
1920

2021
# This is the version number of the application being deployed. This version number should be
2122
# incremented each time you make changes to the application. Versions are not expected to
2223
# follow Semantic Versioning. They should reflect the version the application is using.
2324
# It is recommended to use it with quotes.
24-
appVersion: "1.0.4"
25+
appVersion: "1.1.0"
2526

2627
dependencies:
2728
- name: "redis"

helm/applications/skaha/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ The following table lists the configurable parameters for the Skaha Helm chart:
9595
| `deployment.skaha.sessions.gpuEnabled` | Enable GPU support for User Sessions. Defaults to `false` | `false` |
9696
| `deployment.skaha.sessions.nodeAffinity` | Kubernetes Node affinity for the Skaha User Session Pods | `{}` |
9797
| `deployment.skaha.sessions.tolerations` | Array of tolerations to pass to Kubernetes for fine-grained Node targeting of the `skaha` User Sessions | `[]` |
98+
| `experimentalFeatures.enabled` | Enable experimental features in Skaha. | `false` |
99+
| `experimentalFeatures.sessionLimitRange` | Kubernete LimitRange for User Sessions to enforce minimum and maximum resource usage. Only applied if `experimentalFeatures.enabled` and `sessionLimitRange.enabled` are `true`. | `{ enabled: false }` |
98100
| `secrets` | List of secrets to be mounted in the Skaha API defined as objects (i.e `secretName: {cert.pem: xxx}`) | `[]` |
99101
| `storage.service.spec` | Storage class specification for the Skaha API. Can be `persistentVolumeClaim` or a dynamic instantiation like `hostPath`. See [Volumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/). | `{}` |
100102
| `redis` | [Redis sub-chart configuration](https://github.com/bitnami/charts/tree/main/bitnami/redis) for Skaha's caching of Harbor Docker image metadata. | See [`values.yaml`](https://github.com/bitnami/charts/blob/main/bitnami/redis/values.yaml) for available configuration values. |

helm/applications/skaha/skaha-config/k8s-resources.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"default": 1,
44
"defaultRequest": 1,
55
"defaultLimit": 8,
6-
"defaultHeadless": 1,
76
"options": [
87
1,
98
2,
@@ -27,7 +26,6 @@
2726
"default": 1,
2827
"defaultRequest": 4,
2928
"defaultLimit": 32,
30-
"defaultHeadless": 4,
3129
"options": [
3230
1,
3331
2,
@@ -90,5 +88,6 @@
9088
27,
9189
28
9290
]
93-
}
91+
},
92+
"maxInteractiveSessions": {{ .Values.deployment.skaha.sessions.maxCount }}
9493
}

helm/applications/skaha/templates/NOTES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,10 @@ If user Jobs remain Pending:
3131
- Ensure LocalQueue exists in {{ .Values.skahaWorkload.namespace }} and references your configured ClusterQueue.
3232
- Verify ClusterQueue quotas are sufficient.
3333
- Confirm priority classes referenced by sessions exist or are created.
34+
35+
Experimental Features Configured:
36+
{{- if and .Values.experimentalFeatures .Values.experimentalFeatures.enabled }}
37+
{{ include "skaha.experimentalFeatureGates" $ }}
38+
{{- else }}
39+
None
40+
{{- end }}

helm/applications/skaha/templates/_helpers.tpl

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,41 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
4242
app.kubernetes.io/managed-by: {{ .Release.Service }}
4343
{{- end }}
4444

45+
{{/*
46+
Obtain a comma-delimited string of Experimental Features and a flag to set if any are enabled.
47+
*/}}
48+
{{- define "skaha.experimentalFeatureGates" -}}
49+
{{- $features := "" -}}
50+
{{- $featureEnabled := false -}}
51+
{{- with .Values.experimentalFeatures }}
52+
{{- if .enabled }}
53+
{{- range $feature, $map := . }}
54+
55+
{{- if eq $feature "enabled" -}}
56+
{{- continue -}}
57+
{{- end -}}
58+
59+
{{- if ne $feature "" }}
60+
{{- $thisMap := $map | default dict }}
61+
62+
{{- if or (not (hasKey $thisMap "enabled")) (not (kindIs "bool" $thisMap.enabled)) -}}
63+
{{- fail ( printf "Feature gate '%s' must have 'enabled' (false | true) key" $feature ) -}}
64+
{{- end }}
65+
66+
{{- if eq $features "" -}}
67+
{{- $features = printf "%s=%t" $feature $thisMap.enabled -}}
68+
{{- else -}}
69+
{{- $features = printf "%s,%s=%t" $features $feature $thisMap.enabled -}}
70+
{{- end }}
71+
{{- end }}
72+
73+
{{- end }}
74+
{{- end }}
75+
{{- end }}
76+
{{- printf "%s" $features -}}
77+
{{- end }}
78+
*/}}
79+
4580
{{/*
4681
Selector labels
4782
*/}}
@@ -85,7 +120,7 @@ The init containers for the launch scripts.
85120
drop:
86121
- ALL
87122
- name: init-users-groups
88-
image: {{ $.Values.deployment.skaha.sessions.initContainerImage | default "redis:7.4.2-alpine3.21" }}
123+
image: {{ $.Values.deployment.skaha.sessions.initContainerImage | default "redis:8.2.2-bookworm" }}
89124
command: ["/init-users-groups/init-users-groups.sh"]
90125
env:
91126
- name: HOME
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{{- with .Values.experimentalFeatures }}
2+
{{- if eq .enabled true }}
3+
{{- with .sessionLimitRange }}
4+
{{- if eq .enabled true }}
5+
---
6+
apiVersion: v1
7+
kind: LimitRange
8+
metadata:
9+
name: {{ $.Release.Name }}-session-limit-range
10+
namespace: {{ $.Values.skahaWorkload.namespace }}
11+
spec:
12+
{{- with .limitSpec }}
13+
limits:
14+
- type: Container
15+
{{- if .max }}
16+
max:
17+
{{ toYaml .max | indent 8 }}
18+
{{- end }}
19+
{{- if .default }}
20+
default:
21+
{{ toYaml .default | indent 8 }}
22+
{{- end }}
23+
{{- if .defaultRequest }}
24+
defaultRequest:
25+
{{ toYaml .defaultRequest | indent 8 }}
26+
{{- end }}
27+
{{- end }}
28+
---
29+
apiVersion: rbac.authorization.k8s.io/v1
30+
kind: Role
31+
metadata:
32+
name: {{ $.Release.Name }}-session-limit-range-role
33+
namespace: {{ $.Values.skahaWorkload.namespace }}
34+
rules:
35+
- apiGroups:
36+
- ""
37+
resources:
38+
- limitranges
39+
verbs:
40+
- get
41+
- list
42+
- status
43+
---
44+
apiVersion: rbac.authorization.k8s.io/v1
45+
kind: RoleBinding
46+
metadata:
47+
name: {{ $.Release.Name }}-session-limit-range
48+
namespace: {{ $.Values.skahaWorkload.namespace }}
49+
roleRef:
50+
apiGroup: rbac.authorization.k8s.io
51+
kind: Role
52+
name: {{ $.Release.Name }}-session-limit-range-role
53+
subjects:
54+
- kind: ServiceAccount
55+
name: {{ $.Values.deployment.skaha.serviceAccountName | required ".Values.deployment.skaha.serviceAccountName value is required" }}
56+
namespace: {{ $.Release.Namespace }}
57+
{{- end }}
58+
{{- end }}
59+
{{- end }}
60+
{{- end }}

helm/applications/skaha/templates/skaha-config-configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ data:
2121
{{ base $path }}: |
2222
{{- tpl ($.Files.Get $path) $currContext | nindent 4 }}
2323
{{ end }}
24-
{{ ($.Files.Glob "skaha-config/*.json").AsConfig | indent 2 }}
24+
{{ tpl ($.Files.Glob "skaha-config/*.json").AsConfig . | indent 2 }}
2525
{{- include "utils.extraConfig" (dict "extraConfigData" .Values.deployment.skaha.extraConfigData) -}}
2626
{{- (.Files.Glob "image-cache/*").AsConfig | nindent 2 }}

0 commit comments

Comments
 (0)