fix deadlock of api-server resources when watch#313
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR removes custom watch loops to prevent deadlocks, unifies finalizer handling with controllerutil, refactors RSA key workflows into a shared pkg/crypto module, and updates CRDs and tooling configs.
- Eliminate watcher maps and goroutines in all controllers; use predicate filters and controllerutil finalizers instead
- Move RSA key generation/export into pkg/crypto and adapt apikey_client to use Spec.EncryptionKey
- Extend CRDs (
exportPlaintextToken,tlsAllowInsecureConnection) and update.licenserc.yaml
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/streamnativecloud/apikey_client.go | Drop internal key gen, convert Spec.EncryptionKey directly |
| pkg/crypto/rsa.go | Change PEM block Type from "RSA PUBLIC KEY" to "PUBLIC KEY" |
| controllers/workspace_controller.go | Remove watch logic, switch to controllerutil finalizers and predicate filter |
| controllers/serviceaccountbinding_controller.go | Remove watcher code, add readiness check, unify finalizer API |
| controllers/serviceaccount_controller.go | Eliminate watches, update finalizer handling and status/logging |
| controllers/secret_controller.go | Simplify data resolution, remove watchers, update CR with SecretRef |
| controllers/flinkdeployment_controller.go | Remove custom watches, update finalizer and cloud client usage |
| controllers/apikey_controller.go | Refactor encryption flow, sync cloud status, remove watches, reshape finalizer and requeue logic |
| config/crd/bases/resource.streamnative.io_*.yaml | Add exportPlaintextToken and tlsAllowInsecureConnection fields |
| .licenserc.yaml | Include testbin/** in ignore patterns |
Comments suppressed due to low confidence (2)
controllers/apikey_controller.go:118
- The alias
controllers2is not imported in this file, causing a compile failure. Add the appropriate import for the APIKey client package or update the alias to match existing imports.
apiKeyClient := controllers2.NewAPIKeyClient(apiConn, organization)
controllers/flinkdeployment_controller.go:112
- The alias
controllers2is not imported in this file, causing a compile error. Import the correct package (e.g.,github.com/streamnative/pulsar-resources-operator/pkg/streamnativecloudas controllers2) or use the existing alias.
deploymentClient, err := controllers2.NewFlinkDeploymentClient(conn, apiConnResource.Spec.Organization)
maxsxu
approved these changes
May 26, 2025
freeznet
added a commit
that referenced
this pull request
May 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(If this PR fixes a github issue, please add
Fixes #<xyz>.)Fixes #
(or if this PR is one task of a github issue, please add
Master Issue: #<xyz>to link to the master issue.)Master Issue: #
Motivation
Explain here the context, and why you're making that change. What is the problem you're trying to solve.
Modifications
Describe the modifications you've done.
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Documentation
Check the box below.
Need to update docs?
doc-required(If you need help on updating docs, create a doc issue)
no-need-doc(Please explain why)
doc(If this PR contains doc changes)