-
Notifications
You must be signed in to change notification settings - Fork 122
WIP: poc: deploying upstream component #919
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,7 @@ import ( | |||||||||||||||||||||||||||||
| "context" | ||||||||||||||||||||||||||||||
| "encoding/json" | ||||||||||||||||||||||||||||||
| "fmt" | ||||||||||||||||||||||||||||||
| "os" | ||||||||||||||||||||||||||||||
| "regexp" | ||||||||||||||||||||||||||||||
| "strconv" | ||||||||||||||||||||||||||||||
| "strings" | ||||||||||||||||||||||||||||||
|
|
@@ -349,9 +350,20 @@ func (c *OAuthAPIServerWorkload) syncExternalOIDCDeployment(ctx context.Context, | |||||||||||||||||||||||||||||
| // log level verbosity is taken from the spec always | ||||||||||||||||||||||||||||||
| args["v"] = []string{loglevelToKlog(operatorSpec.LogLevel)} | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| imageToUse := c.targetImagePullSpec | ||||||||||||||||||||||||||||||
| klog.Info("UPSTREAM_OIDC_COMPONENT_IMAGE", os.Getenv("UPSTREAM_OIDC_COMPONENT_IMAGE")) | ||||||||||||||||||||||||||||||
| if upstreamImage := os.Getenv("UPSTREAM_OIDC_COMPONENT_IMAGE"); len(upstreamImage) > 0 { | ||||||||||||||||||||||||||||||
| imageToUse = upstreamImage | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| klog.Info("using UPSTREAM_OIDC_COMPONENT_IMAGE", os.Getenv("UPSTREAM_OIDC_COMPONENT_IMAGE")) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Comment on lines
+354
to
+359
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. Avoid logging raw Line 354 and Line 358 emit the full env value; this can leak internal registry hostnames (and potentially credential-bearing image refs) into logs. Suggested fix- klog.Info("UPSTREAM_OIDC_COMPONENT_IMAGE", os.Getenv("UPSTREAM_OIDC_COMPONENT_IMAGE"))
- if upstreamImage := os.Getenv("UPSTREAM_OIDC_COMPONENT_IMAGE"); len(upstreamImage) > 0 {
+ upstreamImage := os.Getenv("UPSTREAM_OIDC_COMPONENT_IMAGE")
+ if len(upstreamImage) > 0 {
imageToUse = upstreamImage
- klog.Info("using UPSTREAM_OIDC_COMPONENT_IMAGE", os.Getenv("UPSTREAM_OIDC_COMPONENT_IMAGE"))
+ klog.V(2).Info("using UPSTREAM_OIDC_COMPONENT_IMAGE override")
// configure the API endpoint on the upstream component
args["authenticate-path"] = []string{"/apis/oauth.openshift.io/v1/tokenreviews"}
}As per coding guidelines, "Flag logging that may expose ... internal hostnames ..." and "Never log secrets or credentials." 📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSource: Coding guidelines |
||||||||||||||||||||||||||||||
| // configure the API endpoint on the upstream component | ||||||||||||||||||||||||||||||
| args["authenticate-path"] = []string{"/apis/oauth.openshift.io/v1/tokenreviews"} | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
Comment on lines
+353
to
+362
Contributor
Author
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. Note: This isn't actually how we would do this, but this is sufficient for a PoC. How we would really do this is likely another image pull spec environment variable that is injected by the CVO and used as the ${IMAGE} replacement. |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // use string replacer for simple things | ||||||||||||||||||||||||||||||
| r := strings.NewReplacer( | ||||||||||||||||||||||||||||||
| "${IMAGE}", c.targetImagePullSpec, | ||||||||||||||||||||||||||||||
| "${IMAGE}", imageToUse, | ||||||||||||||||||||||||||||||
| "${REVISION}", strconv.Itoa(int(operatorStatus.LatestAvailableRevision)), | ||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
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.
Note: this change isn't actually necessary. Just helpful for PoC-ing.