-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request juju#17993 from ycliuhw/fix-k8s-secret-backend-config
juju#17993 This PR addresses two issues related to the secret backend configuration: - Juju was incorrectly using the controller's Kubernetes credential for all Kubernetes models, even when the model was associated with a non-controller Kubernetes secret backend (e.g., one added via `add-k8s`). - The `list-secret-backend` command did not display the correct Kubernetes credentials. Additionally, the method for fetching the Kubernetes secret backend credential has been moved from the secret backend service, where it used domain cloud and credential state helper functions, to the secret backend state package. Drive-by: Removed some unused service methods in the secret backend package. ## Checklist - [x] Code style: imports ordered, good names, simple structure, etc - [x] Comments saying why design decisions were made - [x] Go unit tests, with comments saying what you're testing - [ ] ~[Integration tests](https://github.com/juju/juju/tree/main/tests), with comments saying what you're testing~ - [ ] ~[doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages~ ## QA steps ``` juju add-secret-backend myvault1 vault --config ./vault.yaml juju list-secret-backends --reveal --format yaml internal: backend: controller secrets: 0 status: active myvault1: backend: vault config: endpoint: http://10.245.248.1:8200 token: root secrets: 0 status: active juju add-model t1 juju add-secret foo token=1 secret:cr838jvmp25c79sm7m40 juju update-secret foo token=2 juju add-model t2 gke juju add-secret foo token=1 secret:cr838rfmp25c79sm7m4g juju list-secret-backends --reveal --format yaml internal: backend: controller secrets: 0 status: active myvault1: backend: vault config: endpoint: http://10.245.248.1:8200 token: root secrets: 0 status: active t1-local: backend: kubernetes config: ca-certs: - | -----BEGIN CERTIFICATE----- ... bA0lqx9IWOu1NiegK5PMz7x2SQ== -----END CERTIFICATE----- credential: '{"auth-type":"oauth2","Attributes":{"Token":"eyJhbGciOiJSUzI1NiIsImtpZCI6Ik...w-m8cdoGDshHTxIKqgtPu8wg"}}' endpoint: https://127.0.0.1:16443 is-controller-cloud: true secrets: 2 status: active t2-local: backend: kubernetes config: ca-certs: - | -----BEGIN CERTIFICATE----- ... X16beckVwn5MA6ngWmUrJnrmO042rKwttaJ8jV22IBV9uC8IzMfL026vUfcdvodH EZkziVJR0/uOH+TJqV7eyQ== -----END CERTIFICATE----- credential: '{"auth-type":"oauth2","Attributes":{"Token":"eyJhbGciOiJSUzI1N...CJMEw","rbac-id":"c38321b5"}}' endpoint: https://34.87.147.130 is-controller-cloud: false secrets: 1 status: active ``` ## Documentation changes No ## Links **Jira card:** [JUJU-6561](https://warthogs.atlassian.net/browse/JUJU-6561) [JUJU-6561]: https://warthogs.atlassian.net/browse/JUJU-6561?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
- Loading branch information
Showing
11 changed files
with
503 additions
and
818 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.