Skip to content

Commit

Permalink
Fix builds for new controller runtime version
Browse files Browse the repository at this point in the history
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
  • Loading branch information
saschagrunert committed May 24, 2023
1 parent 0ae6ae0 commit f1bc4f3
Show file tree
Hide file tree
Showing 31 changed files with 141 additions and 181 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.ubi
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# for more details

# hash below referred to latest
FROM registry.access.redhat.com/ubi8/go-toolset@sha256:160ff3bc88c4921f7b602f56b6115fe8bc99212f81f1d5acf5c259210d0261f3 as build
FROM registry.access.redhat.com/ubi8/go-toolset@sha256:3668078d16ac1cdb28544554a0578f71bb83b09c1e9c0666f12079d61826110e as build
USER root
WORKDIR /work

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
controller-gen.kubebuilder.io/version: v0.12.0
creationTimestamp: null
labels:
app: security-profiles-operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
controller-gen.kubebuilder.io/version: v0.12.0
creationTimestamp: null
labels:
app: security-profiles-operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
controller-gen.kubebuilder.io/version: v0.12.0
creationTimestamp: null
labels:
app: security-profiles-operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
controller-gen.kubebuilder.io/version: v0.12.0
creationTimestamp: null
labels:
app: security-profiles-operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
controller-gen.kubebuilder.io/version: v0.12.0
creationTimestamp: null
labels:
app: security-profiles-operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
controller-gen.kubebuilder.io/version: v0.12.0
creationTimestamp: null
labels:
app: security-profiles-operator
Expand Down Expand Up @@ -929,7 +929,8 @@ spec:
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
to an implementation-defined value. Requests cannot exceed Limits.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
enableAppArmor:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
controller-gen.kubebuilder.io/version: v0.12.0
creationTimestamp: null
labels:
app: security-profiles-operator
Expand Down
21 changes: 8 additions & 13 deletions cmd/security-profiles-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ func setControllerOptionsForNamespaces(opts *ctrl.Options) {
// listen globally
if namespace == "" {
setupLog.Info("watching all namespaces")
opts.Namespace = namespace
return
}

Expand All @@ -378,11 +377,11 @@ func setControllerOptionsForNamespaces(opts *ctrl.Options) {
// More Info: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/cache#MultiNamespacedCacheBuilder
// Adding "" adds cluster namespaced resources
if strings.Contains(namespace, ",") {
opts.NewCache = cache.MultiNamespacedCacheBuilder(namespaceList)
opts.Cache.Namespaces = namespaceList
setupLog.Info("watching multiple namespaces", "namespaces", namespaceList)
} else {
// listen to a specific namespace only
opts.Namespace = namespace
opts.Cache.Namespaces = []string{namespace}
setupLog.Info("watching single namespace", "namespace", namespace)
}
}
Expand Down Expand Up @@ -414,17 +413,13 @@ func getEnabledControllers(ctx *cli.Context) []controller.Controller {
func newMemoryOptimizedCache(ctx *cli.Context) cache.NewCacheFunc {
if ctx.Bool(memOptimFlag) {
return func(config *rest.Config, opts cache.Options) (cache.Cache, error) {
opts.Resync = &sync
opts.SelectorsByObject = cache.SelectorsByObject{
&corev1.Pod{}: {
Label: labels.SelectorFromSet(labels.Set{
bindata.EnableRecordingLabel: "true",
}),
},
}
opts.DefaultSelector = cache.ObjectSelector{
Label: labels.Everything(),
opts.SyncPeriod = &sync
opts.ByObject[&corev1.Pod{}] = cache.ByObject{
Label: labels.SelectorFromSet(labels.Set{
bindata.EnableRecordingLabel: "true",
}),
}
opts.DefaultLabelSelector = labels.Everything()
return cache.New(config, opts)
}
}
Expand Down
2 changes: 1 addition & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ dependencies:
match: registry.access.redhat.com/ubi8/ubi-minimal

- name: ubi8-go-toolset
version: sha256:160ff3bc88c4921f7b602f56b6115fe8bc99212f81f1d5acf5c259210d0261f3
version: sha256:3668078d16ac1cdb28544554a0578f71bb83b09c1e9c0666f12079d61826110e
refPaths:
- path: Dockerfile.ubi
match: registry.access.redhat.com/ubi8/go-toolset
Expand Down
3 changes: 1 addition & 2 deletions deploy/base-crds/crds/profilebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
name: profilebindings.security-profiles-operator.x-k8s.io
spec:
group: security-profiles-operator.x-k8s.io
Expand Down
3 changes: 1 addition & 2 deletions deploy/base-crds/crds/profilerecording.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
name: profilerecordings.security-profiles-operator.x-k8s.io
spec:
group: security-profiles-operator.x-k8s.io
Expand Down
3 changes: 1 addition & 2 deletions deploy/base-crds/crds/seccompprofile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
name: seccompprofiles.security-profiles-operator.x-k8s.io
spec:
group: security-profiles-operator.x-k8s.io
Expand Down
3 changes: 1 addition & 2 deletions deploy/base-crds/crds/securityprofilenodestatus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
name: securityprofilenodestatuses.security-profiles-operator.x-k8s.io
spec:
group: security-profiles-operator.x-k8s.io
Expand Down
6 changes: 3 additions & 3 deletions deploy/base-crds/crds/securityprofilesoperatordaemon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
name: securityprofilesoperatordaemons.security-profiles-operator.x-k8s.io
spec:
group: security-profiles-operator.x-k8s.io
Expand Down Expand Up @@ -927,7 +926,8 @@ spec:
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
to an implementation-defined value. Requests cannot exceed Limits.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
enableAppArmor:
Expand Down
6 changes: 2 additions & 4 deletions deploy/base-crds/crds/selinuxpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
name: rawselinuxprofiles.security-profiles-operator.x-k8s.io
spec:
group: security-profiles-operator.x-k8s.io
Expand Down Expand Up @@ -141,8 +140,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
name: selinuxprofiles.security-profiles-operator.x-k8s.io
spec:
group: security-profiles-operator.x-k8s.io
Expand Down
6 changes: 0 additions & 6 deletions deploy/base/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: security-profiles-operator
rules:
- apiGroups:
Expand Down Expand Up @@ -262,7 +261,6 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
creationTimestamp: null
name: security-profiles-operator
namespace: security-profiles-operator
rules:
Expand All @@ -284,7 +282,6 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: spod
rules:
- apiGroups:
Expand Down Expand Up @@ -472,7 +469,6 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
creationTimestamp: null
name: spod
namespace: security-profiles-operator
rules:
Expand All @@ -486,7 +482,6 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: spo-webhook
rules:
- apiGroups:
Expand Down Expand Up @@ -579,7 +574,6 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
creationTimestamp: null
name: spo-webhook
namespace: security-profiles-operator
rules:
Expand Down
24 changes: 9 additions & 15 deletions deploy/helm/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
labels:
app: security-profiles-operator
name: profilebindings.security-profiles-operator.x-k8s.io
Expand Down Expand Up @@ -79,8 +78,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
labels:
app: security-profiles-operator
name: profilerecordings.security-profiles-operator.x-k8s.io
Expand Down Expand Up @@ -215,8 +213,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
labels:
app: security-profiles-operator
name: seccompprofiles.security-profiles-operator.x-k8s.io
Expand Down Expand Up @@ -500,8 +497,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
labels:
app: security-profiles-operator
name: securityprofilenodestatuses.security-profiles-operator.x-k8s.io
Expand Down Expand Up @@ -565,8 +561,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
labels:
app: security-profiles-operator
name: securityprofilesoperatordaemons.security-profiles-operator.x-k8s.io
Expand Down Expand Up @@ -1492,7 +1487,8 @@ spec:
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
to an implementation-defined value. Requests cannot exceed Limits.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
enableAppArmor:
Expand Down Expand Up @@ -1808,8 +1804,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
labels:
app: security-profiles-operator
name: rawselinuxprofiles.security-profiles-operator.x-k8s.io
Expand Down Expand Up @@ -1949,8 +1944,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
labels:
app: security-profiles-operator
name: selinuxprofiles.security-profiles-operator.x-k8s.io
Expand Down
6 changes: 0 additions & 6 deletions deploy/helm/templates/static-resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ metadata:
annotations:
meta.helm.sh/release-name: security-profiles-operator
meta.helm.sh/release-namespace: '{{ .Release.Namespace }}'
creationTimestamp: null
labels:
app: security-profiles-operator
app.kubernetes.io/managed-by: Helm
Expand Down Expand Up @@ -310,7 +309,6 @@ metadata:
annotations:
meta.helm.sh/release-name: security-profiles-operator
meta.helm.sh/release-namespace: '{{ .Release.Namespace }}'
creationTimestamp: null
labels:
app: security-profiles-operator
app.kubernetes.io/managed-by: Helm
Expand Down Expand Up @@ -339,7 +337,6 @@ metadata:
annotations:
meta.helm.sh/release-name: security-profiles-operator
meta.helm.sh/release-namespace: '{{ .Release.Namespace }}'
creationTimestamp: null
labels:
app: security-profiles-operator
app.kubernetes.io/managed-by: Helm
Expand Down Expand Up @@ -534,7 +531,6 @@ metadata:
annotations:
meta.helm.sh/release-name: security-profiles-operator
meta.helm.sh/release-namespace: '{{ .Release.Namespace }}'
creationTimestamp: null
labels:
app: security-profiles-operator
app.kubernetes.io/managed-by: Helm
Expand All @@ -555,7 +551,6 @@ metadata:
annotations:
meta.helm.sh/release-name: security-profiles-operator
meta.helm.sh/release-namespace: '{{ .Release.Namespace }}'
creationTimestamp: null
labels:
app: security-profiles-operator
app.kubernetes.io/managed-by: Helm
Expand Down Expand Up @@ -655,7 +650,6 @@ metadata:
annotations:
meta.helm.sh/release-name: security-profiles-operator
meta.helm.sh/release-namespace: '{{ .Release.Namespace }}'
creationTimestamp: null
labels:
app: security-profiles-operator
app.kubernetes.io/managed-by: Helm
Expand Down
Loading

0 comments on commit f1bc4f3

Please sign in to comment.