-
Notifications
You must be signed in to change notification settings - Fork 264
feat: support using internal certs for the local auth endpoint #1626
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
Open
banschikovde
wants to merge
5
commits into
rancher:main
Choose a base branch
from
banschikovde:feature/add-use_internal_ca_certs-for-local-auth-endpoint-
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+217
−34
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bcefafe
feat(cluster_v2): add use_internal_ca_certs option for local_auth_end…
banschikovde 9bf954e
chore(cluster_v2): run gofmt on local_auth_endpoint files
banschikovde 8d68546
fix(cluster_v2): correct use_internal_ca_certs schema and update tests
banschikovde e9b9727
chore(cluster_v2): decode internal CA certs for local auth endpoint
banschikovde 4a7e500
fix(cluster_v2): mark ca_certs field as computed
banschikovde File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really appreciate the test additions, thank you! |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package rancher2 | ||
|
|
||
| import "encoding/base64" | ||
|
|
||
| func decodeCACertIfBase64(cert string) string { | ||
| if cert == "" { | ||
| return cert | ||
| } | ||
| if b, err := base64.StdEncoding.DecodeString(cert); err == nil { | ||
| return string(b) | ||
| } | ||
| return cert | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package rancher2 | ||
|
|
||
| import ( | ||
| "encoding/base64" | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestDecodeCACertIfBase64(t *testing.T) { | ||
| pem := "-----BEGIN CERTIFICATE-----\nFAKE\n-----END CERTIFICATE-----\n" | ||
| encoded := base64.StdEncoding.EncodeToString([]byte(pem)) | ||
| if got := decodeCACertIfBase64(encoded); got != pem { | ||
| t.Fatalf("expected decoded cert, got %q", got) | ||
| } | ||
| if got := decodeCACertIfBase64(pem); got != pem { | ||
| t.Fatalf("expected unchanged cert, got %q", got) | ||
| } | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe I am missing something, but why are we cutting out the flattener here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flattenClusterV2LocalAuthEndpoint serializes only API fields (ca_certs, enabled, fqdn) and does not include the Terraform-only use_internal_ca_certs flag. If we used the flattener here in CustomizeDiff, that flag would be stripped from the planned object. By passing newObj directly (which already is []interface{} from d.GetChange()), we preserve it.