Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions api/v1beta1/loginset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package v1beta1

import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -61,6 +62,11 @@ type LoginSetSpec struct {
// +required
SssdConfRef corev1.SecretKeySelector `json:"sssdConfRef,omitzero"`

// Strategy is the deployment strategy to use to replace existing pods with new ones.
// Ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
// +optional
Strategy appsv1.DeploymentStrategy `json:"strategy,omitzero"`

// Service defines a template for a Kubernetes Service object.
// +optional
Service ServiceSpec `json:"service,omitzero"`
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions config/crd/bases/slinky.slurm.net_loginsets.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions helm/slurm-operator-crds/templates/slinky.slurm.net_loginsets.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions helm/slurm/templates/loginset/loginset-cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ spec:
{{ if $loginset.replicas }}
replicas: {{ $loginset.replicas }}
{{- end }}{{- /* if $loginset.replicas */}}
{{- with $loginset.strategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}{{- /* with $loginset.strategy */}}
login:
{{- $_ := set $loginset.login "imagePullPolicy" (get $loginset.login "imagePullPolicy" | default $.Values.imagePullPolicy ) -}}
{{- include "format-container" $loginset.login | nindent 4 }}
Expand Down
20 changes: 20 additions & 0 deletions helm/slurm/tests/loginset_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,26 @@ tests:
- equal:
path: spec.template.spec.topologySpreadConstraints[0].labelSelector.matchLabels.foo
value: bar
- it: should set strategy
set:
loginsets:
slinky:
enabled: true
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 0
asserts:
- equal:
path: spec.strategy.type
value: RollingUpdate
- equal:
path: spec.strategy.rollingUpdate.maxUnavailable
value: 1
- equal:
path: spec.strategy.rollingUpdate.maxSurge
value: 0
- it: should not use priority class
set:
priorityClass:
Expand Down
7 changes: 7 additions & 0 deletions helm/slurm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,13 @@ loginsets:
enabled: false
# -- Number of replicas to deploy.
replicas: 1
# -- Deployment strategy configuration.
# Ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
strategy: {}
# type: RollingUpdate
# rollingUpdate:
# maxUnavailable: 0
# maxSurge: 1
# login container configurations.
login:
# -- (string \| object) The image to use.
Expand Down
1 change: 1 addition & 0 deletions internal/builder/loginbuilder/login_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func (b *LoginBuilder) BuildLogin(loginset *slinkyv1beta1.LoginSet) (*appsv1.Dep
Spec: appsv1.DeploymentSpec{
Replicas: loginset.Spec.Replicas,
RevisionHistoryLimit: ptr.To[int32](0),
Strategy: loginset.Spec.Strategy,
Selector: &metav1.LabelSelector{
MatchLabels: selectorLabels,
},
Expand Down