Skip to content

Commit 60dd99c

Browse files
committed
feat: manage limitrange objects for experimental feature gate
1 parent 07a081b commit 60dd99c

File tree

9 files changed

+112
-9
lines changed

9 files changed

+112
-9
lines changed

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.0.6)
2+
3+
## 2025.09.29 (1.0.6)
4+
- Bump Skaha API image to `1.0.5`
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.0.6
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.0.5"
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/_helpers.tpl

Lines changed: 35 additions & 0 deletions
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
*/}}

helm/applications/skaha/templates/limit-range.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,35 @@ spec:
1414
- type: Container
1515
{{ . | toYaml | indent 6 }}
1616
{{- end }}
17+
---
18+
apiVersion: rbac.authorization.k8s.io/v1
19+
kind: Role
20+
metadata:
21+
name: {{ $.Release.Name }}-session-limit-range-role
22+
namespace: {{ $.Values.skahaWorkload.namespace }}
23+
rules:
24+
- apiGroups:
25+
- ""
26+
resources:
27+
- limitranges
28+
verbs:
29+
- get
30+
- list
31+
- status
32+
---
33+
apiVersion: rbac.authorization.k8s.io/v1
34+
kind: RoleBinding
35+
metadata:
36+
name: {{ $.Release.Name }}-session-limit-range
37+
namespace: {{ $.Values.skahaWorkload.namespace }}
38+
roleRef:
39+
apiGroup: rbac.authorization.k8s.io
40+
kind: Role
41+
name: {{ $.Release.Name }}-session-limit-range-role
42+
subjects:
43+
- kind: ServiceAccount
44+
name: {{ $.Values.deployment.skaha.serviceAccountName | required ".Values.deployment.skaha.serviceAccountName value is required" }}
45+
namespace: {{ $.Release.Namespace }}
1746
{{- end }}
1847
{{- end }}
1948
{{- 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 }}

helm/applications/skaha/templates/skaha-tomcat-deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ spec:
8888
value: "{{ .Release.Name }}-redis-master.{{ .Release.Namespace }}.svc.{{ .Values.kubernetesClusterDomain }}"
8989
- name: REDIS_PORT
9090
value: "6379"
91+
- name: SKAHA_EXPERIMENTAL_FEATURE_GATES
92+
value: "{{ include "skaha.experimentalFeatureGates" $ }}"
9193
{{- with .Values.deployment.skaha.extraEnv }}
9294
{{- toYaml . | nindent 8 }}
9395
{{- end }}

helm/applications/skaha/values.yaml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ skahaWorkload:
1515
deployment:
1616
hostname: myhost.example.com # Change this!
1717
skaha:
18-
image: images.opencadc.org/platform/skaha:1.0.4
18+
image: images.opencadc.org/platform/skaha:1.0.5
1919
imagePullPolicy: Always
2020

2121
# Cron string for the image caching cron job schedule. Defaults to every half hour.
@@ -283,6 +283,37 @@ ingress:
283283
enabled: true
284284
path: /skaha
285285

286+
# Experimental features that can be enabled. These represent features that are not released and confined behind feature flags.
287+
experimentalFeatures:
288+
enabled: false
289+
290+
# YAML to pass to a LimitRange object called "{{ .Release.Name }}-session-limit-range" in the workload Namespace to define the resource limits.
291+
# These limits will be applied to Container objects (User Sessions).
292+
# See https://kubernetes.io/docs/concepts/policy/limit-range/
293+
#
294+
# Example:
295+
# sessionLimitRange:
296+
# enabled: true
297+
# limitSpec:
298+
# max:
299+
# memory: "96Gi"
300+
# cpu: "12"
301+
# "nvidia.com/gpu": "4"
302+
# min:
303+
# memory: "1Gi"
304+
# cpu: "1"
305+
# "nvidia.com/gpu": "0"
306+
# default: # actually refers to default limit
307+
# memory: "32Gi"
308+
# cpu: "8"
309+
# "nvidia.com/gpu": "1"
310+
# defaultRequest:
311+
# memory: "4Gi"
312+
# cpu: "1"
313+
sessionLimitRange:
314+
enabled: false
315+
limitSpec: {}
316+
286317
secrets:
287318
# Uncomment to enable local or self-signed CA certificates for your domain to be trusted.
288319
# skaha-cacert-secret:
@@ -295,7 +326,7 @@ storage:
295326
# YAML for service mounted storage.
296327
# Example is the persistentVolumeClaim below.
297328
# persistentVolumeClaim:
298-
# claimName: skaha-pvc\
329+
# claimName: skaha-pvc
299330

300331
# For caching images from the Image Repository and for the writing the POSIX Users and Groups to be shared with Job files
301332
redis:

0 commit comments

Comments
 (0)