Skip to content

Commit

Permalink
Merge pull request #257 from rewantsoni/dockerfile
Browse files Browse the repository at this point in the history
controllers: fix available crd
  • Loading branch information
openshift-merge-bot[bot] authored Oct 14, 2024
2 parents a38421d + a580d05 commit 7d67155
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN make go-build

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
FROM registry.access.redhat.com/ubi9/ubi-minimal
WORKDIR /
COPY --from=builder /workspace/bin/manager .
COPY --from=builder /workspace/bin/status-reporter .
Expand Down
13 changes: 12 additions & 1 deletion bundle/manifests/ocs-client-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
categories: Storage
console.openshift.io/plugins: '["odf-client-console"]'
containerImage: quay.io/ocs-dev/ocs-client-operator:latest
createdAt: "2024-10-07T10:43:06Z"
createdAt: "2024-10-14T12:21:27Z"
description: OpenShift Data Foundation client operator enables consumption of
storage services from a remote centralized OpenShift Data Foundation provider
cluster.
Expand Down Expand Up @@ -326,6 +326,17 @@ spec:
- list
- update
- watch
- apiGroups:
- ramendr.openshift.io
resources:
- drclusterconfigs
verbs:
- create
- delete
- get
- list
- update
- watch
- apiGroups:
- security.openshift.io
resources:
Expand Down
5 changes: 0 additions & 5 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ func main() {

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

storageclustersSelector := fields.SelectorFromSet(fields.Set{"metadata.name": "storageclusters.ocs.openshift.io"})
subscriptionwebhookSelector := fields.SelectorFromSet(fields.Set{"metadata.name": templates.SubscriptionWebhookName})
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Expand All @@ -114,10 +113,6 @@ func main() {
LeaderElectionID: "7cb6f2e5.ocs.openshift.io",
Cache: cache.Options{
ByObject: map[client.Object]cache.ByObject{
&extv1.CustomResourceDefinition{}: {
// only cache storagecluster crd
Field: storageclustersSelector,
},
&admrv1.ValidatingWebhookConfiguration{}: {
// only cache our validation webhook
Field: subscriptionwebhookSelector,
Expand Down
11 changes: 11 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,17 @@ rules:
- list
- update
- watch
- apiGroups:
- ramendr.openshift.io
resources:
- drclusterconfigs
verbs:
- create
- delete
- get
- list
- update
- watch
- apiGroups:
- security.openshift.io
resources:
Expand Down
1 change: 1 addition & 0 deletions internal/controller/storageclaim_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func (r *StorageClaimReconciler) SetupWithManager(mgr ctrl.Manager) error {
//+kubebuilder:rbac:groups=core,resources=persistentvolumes,verbs=get;list;watch
//+kubebuilder:rbac:groups=snapshot.storage.k8s.io,resources=volumesnapshotcontents,verbs=get;list;watch
//+kubebuilder:rbac:groups=csi.ceph.io,resources=clientprofiles,verbs=get;list;update;create;watch;delete
//+kubebuilder:rbac:groups=ramendr.openshift.io,resources=drclusterconfigs,verbs=get;list;update;create;watch;delete

// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
Expand Down
4 changes: 2 additions & 2 deletions pkg/utils/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ func CrdCreateAndDeletePredicate(log *logr.Logger, crdName string, crdExists boo
return predicate.Funcs{
CreateFunc: func(_ event.CreateEvent) bool {
if !crdExists {
log.Info("CustomResourceDefinition %s was Created.", crdName)
log.Info("CustomResourceDefinition was Created.", "CustomResourceDefinition", crdName)
}
return !crdExists
},
DeleteFunc: func(_ event.DeleteEvent) bool {
if crdExists {
log.Info("CustomResourceDefinition %s was Deleted.", crdName)
log.Info("CustomResourceDefinition was Deleted.", "CustomResourceDefinition", crdName)
}
return crdExists
},
Expand Down

0 comments on commit 7d67155

Please sign in to comment.