@@ -11,6 +11,7 @@ import (
1111 "testing"
1212
1313 "github.com/stretchr/testify/require"
14+ appsv1 "k8s.io/api/apps/v1"
1415 "k8s.io/utils/ptr"
1516
1617 "go.pinniped.dev/internal/here"
@@ -71,6 +72,7 @@ func TestFromPath(t *testing.T) {
7172 priorityClassName: %s
7273 runAsUser: 1
7374 runAsGroup: 2
75+ deploymentStrategyType: Recreate
7476 log:
7577 level: debug
7678 tls:
@@ -119,12 +121,13 @@ func TestFromPath(t *testing.T) {
119121 "myLabelKey2" : "myLabelValue2" ,
120122 },
121123 KubeCertAgentConfig : KubeCertAgentSpec {
122- NamePrefix : ptr .To ("kube-cert-agent-name-prefix-" ),
123- Image : ptr .To ("kube-cert-agent-image" ),
124- ImagePullSecrets : []string {"kube-cert-agent-image-pull-secret" },
125- PriorityClassName : stringOfLength253 ,
126- RunAsUser : ptr .To (int64 (1 )),
127- RunAsGroup : ptr .To (int64 (2 )),
124+ NamePrefix : ptr .To ("kube-cert-agent-name-prefix-" ),
125+ Image : ptr .To ("kube-cert-agent-image" ),
126+ ImagePullSecrets : []string {"kube-cert-agent-image-pull-secret" },
127+ PriorityClassName : stringOfLength253 ,
128+ RunAsUser : ptr .To (int64 (1 )),
129+ RunAsGroup : ptr .To (int64 (2 )),
130+ DeploymentStrategyType : ptr .To (appsv1 .RecreateDeploymentStrategyType ),
128131 },
129132 Log : plog.LogSpec {
130133 Level : plog .LevelDebug ,
@@ -184,6 +187,9 @@ func TestFromPath(t *testing.T) {
184187 image: kube-cert-agent-image
185188 imagePullSecrets: [kube-cert-agent-image-pull-secret]
186189 priorityClassName: kube-cert-agent-priority-class-name
190+ runAsUser: 1
191+ runAsGroup: 2
192+ deploymentStrategyType: RollingUpdate
187193 log:
188194 level: all
189195 format: json
@@ -227,10 +233,13 @@ func TestFromPath(t *testing.T) {
227233 "myLabelKey2" : "myLabelValue2" ,
228234 },
229235 KubeCertAgentConfig : KubeCertAgentSpec {
230- NamePrefix : ptr .To ("kube-cert-agent-name-prefix-" ),
231- Image : ptr .To ("kube-cert-agent-image" ),
232- ImagePullSecrets : []string {"kube-cert-agent-image-pull-secret" },
233- PriorityClassName : "kube-cert-agent-priority-class-name" ,
236+ NamePrefix : ptr .To ("kube-cert-agent-name-prefix-" ),
237+ Image : ptr .To ("kube-cert-agent-image" ),
238+ ImagePullSecrets : []string {"kube-cert-agent-image-pull-secret" },
239+ PriorityClassName : "kube-cert-agent-priority-class-name" ,
240+ RunAsUser : ptr .To (int64 (1 )),
241+ RunAsGroup : ptr .To (int64 (2 )),
242+ DeploymentStrategyType : ptr .To (appsv1 .RollingUpdateDeploymentStrategyType ),
234243 },
235244 Log : plog.LogSpec {
236245 Level : plog .LevelAll ,
@@ -801,6 +810,27 @@ func TestFromPath(t *testing.T) {
801810 ` ),
802811 wantError : `validate kubeCertAgent: runAsGroup must be 0 or greater (instead of -1)` ,
803812 },
813+ {
814+ name : "invalid deploymentStrategyType" ,
815+ yaml : here .Doc (`
816+ ---
817+ names:
818+ servingCertificateSecret: pinniped-concierge-api-tls-serving-certificate
819+ credentialIssuer: pinniped-config
820+ apiService: pinniped-api
821+ impersonationLoadBalancerService: impersonationLoadBalancerService-value
822+ impersonationClusterIPService: impersonationClusterIPService-value
823+ impersonationTLSCertificateSecret: impersonationTLSCertificateSecret-value
824+ impersonationCACertificateSecret: impersonationCACertificateSecret-value
825+ impersonationSignerSecret: impersonationSignerSecret-value
826+ agentServiceAccount: agentServiceAccount-value
827+ impersonationProxyServiceAccount: impersonationProxyServiceAccount-value
828+ impersonationProxyLegacySecret: impersonationProxyLegacySecret-value
829+ kubeCertAgent:
830+ deploymentStrategyType: thisIsInvalid
831+ ` ),
832+ wantError : `validate kubeCertAgent: deploymentStrategyType must be one of [Recreate RollingUpdate] (instead of thisIsInvalid)` ,
833+ },
804834 }
805835 for _ , test := range tests {
806836 t .Run (test .name , func (t * testing.T ) {
0 commit comments