@@ -12,6 +12,7 @@ import (
12
12
apierrors "k8s.io/apimachinery/pkg/api/errors"
13
13
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
14
14
"k8s.io/apimachinery/pkg/util/intstr"
15
+ "k8s.io/apimachinery/pkg/util/sets"
15
16
corev1ac "k8s.io/client-go/applyconfigurations/core/v1"
16
17
rbacv1ac "k8s.io/client-go/applyconfigurations/rbac/v1"
17
18
@@ -274,15 +275,15 @@ func shouldRotateCerts(certSecret *corev1.Secret, hosts []string) bool {
274
275
func (i * StrategyDeploymentInstaller ) ShouldRotateCerts (s Strategy ) (bool , error ) {
275
276
strategy , ok := s .(* v1alpha1.StrategyDetailsDeployment )
276
277
if ! ok {
277
- return false , fmt .Errorf ("attempted to install %s strategy with deployment installer" , strategy .GetStrategyName ())
278
+ return false , fmt .Errorf ("failed to install %s strategy with deployment installer: unsupported deployment install strategy " , strategy .GetStrategyName ())
278
279
}
279
280
280
- hasCerts := map [ string ] struct {}{}
281
+ hasCerts := sets . NewString ()
281
282
for _ , c := range i .getCertResources () {
282
- hasCerts [ c .getDeploymentName ()] = struct {}{}
283
+ hasCerts . Insert ( c .getDeploymentName ())
283
284
}
284
285
for _ , sddSpec := range strategy .DeploymentSpecs {
285
- if _ , ok := hasCerts [ sddSpec .Name ]; ok {
286
+ if hasCerts . Has ( sddSpec .Name ) {
286
287
certSecret , err := i .strategyClient .GetOpLister ().CoreV1 ().SecretLister ().Secrets (i .owner .GetNamespace ()).Get (SecretName (ServiceName (sddSpec .Name )))
287
288
if err == nil {
288
289
if shouldRotateCerts (certSecret , HostnamesForService (ServiceName (sddSpec .Name ), i .owner .GetNamespace ())) {
0 commit comments