Skip to content

Conversation

drakshakhan
Copy link

@drakshakhan drakshakhan commented Aug 4, 2025

This PR ensures that deleting a ClusterDeployment with the finalizer certificaterequests.certman.managed.openshift.io automatically deletes the associated CertificateRequest and primary-cert-bundle-secret. The deletion process has been verified to work as expected.

To run the test case, you need to export the below environment variable:
DISABLE_JUNIT_REPORT=false

To run the test:
go test -tags=osde2e ./test/e2e -v

output -
output.txt
output2.txt

Copy link
Contributor

openshift-ci bot commented Aug 4, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 4, 2025
Copy link
Contributor

openshift-ci bot commented Aug 4, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: drakshakhan
Once this PR has been reviewed and has the lgtm label, please assign sam-nguyen7 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@drakshakhan
Copy link
Author

/label tide/merge-method-squash

@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Aug 4, 2025
@drakshakhan drakshakhan changed the title SREP1216: Added E2E Test - Delete the ClusterDeployment SREP-1216: Added E2E Test - Delete the ClusterDeployment Aug 4, 2025
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 4, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Aug 4, 2025

@drakshakhan: This pull request references SREP-1216 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.20.0" version, but no target version was set.

In response to this:

This PR ensures that deleting a ClusterDeployment with the finalizer certificaterequests.certman.managed.openshift.io automatically deletes the associated CertificateRequest and primary-cert-bundle-secret. The deletion process has been verified to work as expected.

To run the test case, you need to export two environment variables:
DISABLE_JUNIT_REPORT=false
CLUSTER_NAME=cluster-name

To run the test:
go test -tags=osde2e ./test/e2e -v

output -
output.txt
output2.txt

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Aug 5, 2025

@drakshakhan: This pull request references SREP-1216 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.20.0" version, but no target version was set.

In response to this:

This PR ensures that deleting a ClusterDeployment with the finalizer certificaterequests.certman.managed.openshift.io automatically deletes the associated CertificateRequest and primary-cert-bundle-secret. The deletion process has been verified to work as expected.

To run the test case, you need to export the below environment variable:
DISABLE_JUNIT_REPORT=false

To run the test:
go test -tags=osde2e ./test/e2e -v

output -
output.txt
output2.txt

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@drakshakhan drakshakhan marked this pull request as ready for review August 11, 2025 06:35
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 11, 2025
}, pollingDuration, 30*time.Second).Should(BeTrue(), "Certificate secret should be applied to apiserver object")
})

It("Delete the Cluster Deployment", func(ctx context.Context) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete clusterdeployment is not part of the functionality of the certman-operator.

So we should not test like this. Instead, we can update it like following test scenarios.

- certman-opreator finalizer should not block clusterdeployment being deleted
- certificaterequest should be deleted when the clusterdeployment being deleted
- primary-cert-bundle-secret should be deleted accordingly when the clusterdeployment being deleted


Eventually(func() bool {
logger.Info("Checking if ClusterDeployment exist or not")
cdList, err := dynamicClient.Resource(clusterDeploymentGVR).Namespace("certman-operator").List(ctx, metav1.ListOptions{})
Copy link
Contributor

Choose a reason for hiding this comment

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

As we discussed in the sync meet, please try to create the clusterdeployment is a separated namespace rather than the certman-operator

if len(finalizers) > 0 {
logger.Info("CertificateRequest not deleted due to finalizers. Removing finalizers", "name", crName)
cr.SetFinalizers([]string{})
_, err := dynamicClient.Resource(certRequestGVR).Namespace("certman-operator").Update(ctx, &cr, metav1.UpdateOptions{})
Copy link
Contributor

Choose a reason for hiding this comment

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

we should not remove the finalizer manually here. It needs to be handled by the operator/controller.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 12, 2025
Copy link
Contributor

openshift-ci bot commented Aug 28, 2025

@drakshakhan: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Copy link

codecov bot commented Aug 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.87%. Comparing base (ab78e63) to head (6d11506).
⚠️ Report is 32 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #368      +/-   ##
==========================================
+ Coverage   49.00%   51.87%   +2.86%     
==========================================
  Files          29       29              
  Lines        2116     2138      +22     
==========================================
+ Hits         1037     1109      +72     
+ Misses        973      922      -51     
- Partials      106      107       +1     

see 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants