Skip to content

Commit b1efd17

Browse files
bentitoPer Goncalves da Silva
authored andcommitted
Fix linter issues
Signed-off-by: btofel <[email protected]> Signed-off-by: Brett Tofel <[email protected]>
1 parent 36aea12 commit b1efd17

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

pkg/controller/registry/reconciler/configmap.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"context"
66
"fmt"
77

8-
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
98
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install"
109
hashutil "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/kubernetes/pkg/util/hash"
1110
"github.com/pkg/errors"
@@ -111,7 +110,7 @@ func (s *configMapCatalogSourceDecorator) Service() (*corev1.Service, error) {
111110
return svc, nil
112111
}
113112

114-
func (s *configMapCatalogSourceDecorator) getNamespaceSecurityContextConfig() (operatorsv1alpha1.SecurityConfig, error) {
113+
func (s *configMapCatalogSourceDecorator) getNamespaceSecurityContextConfig() (v1alpha1.SecurityConfig, error) {
115114
namespace := s.GetNamespace()
116115
if config, ok := s.Reconciler.namespacePSAConfigCache[namespace]; ok {
117116
return config, nil
@@ -126,10 +125,10 @@ func (s *configMapCatalogSourceDecorator) getNamespaceSecurityContextConfig() (o
126125
// 'pod-security.kubernetes.io/enforce' is the label used for enforcing namespace level security,
127126
// and 'restricted' is the value indicating a restricted security policy.
128127
if val, exists := ns.Labels["pod-security.kubernetes.io/enforce"]; exists && val == "restricted" {
129-
return operatorsv1alpha1.Restricted, nil
128+
return v1alpha1.Restricted, nil
130129
}
131130

132-
return operatorsv1alpha1.Legacy, nil
131+
return v1alpha1.Legacy, nil
133132
}
134133
func (s *configMapCatalogSourceDecorator) Pod(image string) (*corev1.Pod, error) {
135134
securityContextConfig, err := s.getNamespaceSecurityContextConfig()
@@ -214,7 +213,7 @@ type ConfigMapRegistryReconciler struct {
214213
OpClient operatorclient.ClientInterface
215214
Image string
216215
createPodAsUser int64
217-
namespacePSAConfigCache map[string]operatorsv1alpha1.SecurityConfig
216+
namespacePSAConfigCache map[string]v1alpha1.SecurityConfig
218217
}
219218

220219
var _ RegistryEnsurer = &ConfigMapRegistryReconciler{}
@@ -302,7 +301,7 @@ func (c *ConfigMapRegistryReconciler) currentPodsWithCorrectResourceVersion(sour
302301
// EnsureRegistryServer ensures that all components of registry server are up to date.
303302
func (c *ConfigMapRegistryReconciler) EnsureRegistryServer(logger *logrus.Entry, catalogSource *v1alpha1.CatalogSource) error {
304303
if c.namespacePSAConfigCache == nil {
305-
c.namespacePSAConfigCache = make(map[string]operatorsv1alpha1.SecurityConfig)
304+
c.namespacePSAConfigCache = make(map[string]v1alpha1.SecurityConfig)
306305
}
307306
source := configMapCatalogSourceDecorator{catalogSource, c, c.createPodAsUser}
308307

pkg/controller/registry/reconciler/grpc.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/google/go-cmp/cmp"
1313
"github.com/operator-framework/api/pkg/operators/v1alpha1"
1414

15-
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
1615
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install"
1716
controllerclient "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/controller-runtime/client"
1817
hashutil "github.com/operator-framework/operator-lifecycle-manager/pkg/lib/kubernetes/pkg/util/hash"
@@ -72,7 +71,7 @@ func (s *grpcCatalogSourceDecorator) Labels() map[string]string {
7271
}
7372
}
7473

75-
func (s *grpcCatalogSourceDecorator) getNamespaceSecurityContextConfig() (operatorsv1alpha1.SecurityConfig, error) {
74+
func (s *grpcCatalogSourceDecorator) getNamespaceSecurityContextConfig() (v1alpha1.SecurityConfig, error) {
7675
namespace := s.GetNamespace()
7776
if config, ok := s.Reconciler.namespacePSAConfigCache[namespace]; ok {
7877
return config, nil
@@ -87,10 +86,10 @@ func (s *grpcCatalogSourceDecorator) getNamespaceSecurityContextConfig() (operat
8786
// 'pod-security.kubernetes.io/enforce' is the label used for enforcing namespace level security,
8887
// and 'restricted' is the value indicating a restricted security policy.
8988
if val, exists := ns.Labels["pod-security.kubernetes.io/enforce"]; exists && val == "restricted" {
90-
return operatorsv1alpha1.Restricted, nil
89+
return v1alpha1.Restricted, nil
9190
}
9291

93-
return operatorsv1alpha1.Legacy, nil
92+
return v1alpha1.Legacy, nil
9493
}
9594

9695
func (s *grpcCatalogSourceDecorator) Annotations() map[string]string {
@@ -179,7 +178,7 @@ type GrpcRegistryReconciler struct {
179178
createPodAsUser int64
180179
opmImage string
181180
utilImage string
182-
namespacePSAConfigCache map[string]operatorsv1alpha1.SecurityConfig
181+
namespacePSAConfigCache map[string]v1alpha1.SecurityConfig
183182
}
184183

185184
var _ RegistryReconciler = &GrpcRegistryReconciler{}
@@ -280,7 +279,7 @@ func correctImages(source grpcCatalogSourceDecorator, pod *corev1.Pod) bool {
280279
// EnsureRegistryServer ensures that all components of registry server are up to date.
281280
func (c *GrpcRegistryReconciler) EnsureRegistryServer(logger *logrus.Entry, catalogSource *v1alpha1.CatalogSource) error {
282281
if c.namespacePSAConfigCache == nil {
283-
c.namespacePSAConfigCache = make(map[string]operatorsv1alpha1.SecurityConfig)
282+
c.namespacePSAConfigCache = make(map[string]v1alpha1.SecurityConfig)
284283
}
285284
source := grpcCatalogSourceDecorator{CatalogSource: catalogSource, createPodAsUser: c.createPodAsUser, opmImage: c.opmImage, utilImage: c.utilImage}
286285

pkg/controller/registry/reconciler/reconciler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func Pod(source *operatorsv1alpha1.CatalogSource, name, opmImg, utilImage, img s
207207
}
208208

209209
// Define default security context config
210-
securityContextConfig := operatorsv1alpha1.Legacy
210+
var securityContextConfig operatorsv1alpha1.SecurityConfig
211211

212212
// Determine the security context configuration based on GrpcPodConfig
213213
if source.Spec.GrpcPodConfig != nil {

0 commit comments

Comments
 (0)