Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controllers: fix available crd #257

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

rewantsoni
Copy link
Member

@rewantsoni rewantsoni commented Oct 14, 2024

The PR does the following

  1. gcr.io/distroless/static:nonroot does not allow us to run
    bash scripts, since with available crd we are capturing the exit
    via a bash script, moving to use
    registry.access.redhat.com/ubi9/ubi-minimal as the base
  2. remove caching only storageCluster crd
  3. fix panic while logging

@rewantsoni
Copy link
Member Author

Testing:

[rewantsoni scripts] ko logs ocs-client-operator-controller-manager-c5564f548-gxckj
2024-10-14T09:37:31Z    INFO    setup   setting up webhook server
2024-10-14T09:37:31Z    INFO    setup   registering Subscription Channel validating webhook endpoint
2024-10-14T09:37:31Z    INFO    controller-runtime.webhook      Registering webhook     {"path": "/validate-subscription"}

@leelavg
Copy link
Contributor

leelavg commented Oct 14, 2024

just for posterity #253, #256 and #257 is part of single feature.

@leelavg
Copy link
Contributor

leelavg commented Oct 14, 2024

Testing:

  • did you check the functionality as well, like manager is restarted on specific exit and container is restarted for any other reasons?

@rewantsoni rewantsoni changed the title action: use a different base imgae controllers: fix available crd Oct 14, 2024
The PR does the following
1. gcr.io/distroless/static:nonroot does not allow us to run
bash scripts, since with available crd we are capturing the exit
via a bash script, moving to use
registry.access.redhat.com/ubi9/ubi-minimal as the base
2. remove caching only storageCluster crd
3. fix panic while logging

Signed-off-by: Rewant Soni <[email protected]>
@rewantsoni
Copy link
Member Author

Testing -

2024-10-14T12:31:20Z    INFO    CustomResourceDefinition was Created.        {"controller": "storageclaim", "controllerGroup": "ocs.openshift.io", "controllerKind": "StorageClaim", "StorageClaim": {"name":"ocs-storagecluster-cephfs"}, "namespace": "", "name": "ocs-storagecluster-cephfs", "reconcileID": "09dc1867-2802-4401-bc5b-f241de34a741", "StorageClaim": {"name":"ocs-storagecluster-cephfs"}, "CustomResourceDefinition": "drclusterconfigs.ramendr.openshift.io"}
2024-10-14T12:31:20Z    INFO    Reconciling StorageClaim.       {"controller": "storageclaim", "controllerGroup": "ocs.openshift.io", "controllerKind": "StorageClaim", "StorageClaim": {"name":"drclusterconfigs.ramendr.openshift.io"}, "namespace": "", "name": "drclusterconfigs.ramendr.openshift.io", "reconcileID": "1e416f5d-4e86-4b8a-974f-7a245fd2bb5b", "StorageClaim": {"name":"drclusterconfigs.ramendr.openshift.io"}}
2024-10-14T12:31:20Z    INFO    setup   setting up webhook server
2024-10-14T12:31:20Z    INFO    setup   registering Subscription Channel validating webhook endpoint
2024-10-14T12:31:20Z    INFO    controller-runtime.webhook      Registering webhook     {"path": "/validate-subscription"}
2024-10-14T12:31:20Z    INFO    setup   starting manager


2024-10-14T12:31:55Z    INFO    CustomResourceDefinition was Deleted.        {"controller": "storageclaim", "controllerGroup": "ocs.openshift.io", "controllerKind": "StorageClaim", "StorageClaim": {"name":"ocs-storagecluster-cephfs"}, "namespace": "", "name": "ocs-storagecluster-cephfs", "reconcileID": "58fb61d5-acae-4f8e-aeb8-95550aac63c4", "StorageClaim": {"name":"ocs-storagecluster-cephfs"}, "CustomResourceDefinition": "drclusterconfigs.ramendr.openshift.io"}
2024-10-14T12:31:55Z    INFO    Reconciling StorageClaim.       {"controller": "storageclaim", "controllerGroup": "ocs.openshift.io", "controllerKind": "StorageClaim", "StorageClaim": {"name":"drclusterconfigs.ramendr.openshift.io"}, "namespace": "", "name": "drclusterconfigs.ramendr.openshift.io", "reconcileID": "2c9c5a37-91e2-49ac-9f7d-bbe2559d48e3", "StorageClaim": {"name":"drclusterconfigs.ramendr.openshift.io"}}
2024-10-14T12:31:55Z    INFO    setup   setting up webhook server
2024-10-14T12:31:55Z    INFO    setup   registering Subscription Channel validating webhook endpoint
2024-10-14T12:31:55Z    INFO    controller-runtime.webhook      Registering webhook     {"path": "/validate-subscription"}
2024-10-14T12:31:55Z    INFO    setup   starting manager
2024-10-14T12:31:55Z    INFO    controller-runtime.metrics      Starting metrics server
2024-10-14T12:31:55Z    INFO    starting server {"name": "health probe", "addr": "[::]:8081"}


@rewantsoni
Copy link
Member Author

Testing:

  • did you check the functionality as well, like manager is restarted on specific exit and container is restarted for any other reasons?

Yes, I checked it for any other exitcode/panic it restarts the container. For the restart exit code it restarts the manager

@rewantsoni rewantsoni requested a review from leelavg October 14, 2024 12:50
Comment on lines -117 to -120
&extv1.CustomResourceDefinition{}: {
// only cache storagecluster crd
Field: storageclustersSelector,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this removal, was a corresponding watch added on this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I recall, this is used when we deploy CSI and it will be removed in 4.18. Do we need a watch on this?

Copy link
Contributor

@leelavg leelavg Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until we remove that we need this, is it effecting your feature?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if we specify the CRD to cache here, the operator will only be caching that particular CRD and we cannot have multiple resource names in the field Selector.
If needed, I can add StorageCluster CRD to how we are watching the CRD (with avail CRD feature). WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, that can be separate PR, when we get RC I'll be cleaning up lot of code, waiting for that.

Copy link

openshift-ci bot commented Oct 14, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: leelavg, rewantsoni

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 7d67155 into red-hat-storage:main Oct 14, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants