-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Use pullSecretPath
to set GOOGLE_APPLICATION_CREDENTIALS
#4147
Use pullSecretPath
to set GOOGLE_APPLICATION_CREDENTIALS
#4147
Conversation
…tegration test to test it. Add a warning message when default are used
/cc @yuwenma |
/cc @prary Would be able to try this branch? I want to make sure we don't break your existing workflow with this change. |
Hold off merging until @prary can verify. |
Codecov Report
@@ Coverage Diff @@
## master #4147 +/- ##
==========================================
+ Coverage 71.93% 71.95% +0.02%
==========================================
Files 322 322
Lines 12313 12328 +15
==========================================
+ Hits 8857 8871 +14
- Misses 2896 2897 +1
Partials 560 560
Continue to review full report at Codecov.
|
pkg/skaffold/build/cluster/secret.go
Outdated
return nil, fmt.Errorf("checking for existing kaniko secret: %w", err) | ||
if _, err := secrets.Get(b.PullSecretName, metav1.GetOptions{}); err != nil { | ||
color.Default.Fprintf(out, "Creating kaniko secret [%s/%s]...\n", b.Namespace, b.PullSecretName) | ||
if b.PullSecret == "" { |
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.
This looks like a bug to me - why don't we fall back to default pullsecret name?
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.
pullSecretName
and pullSecret
are two different configs
pullSecretName
is used to indicate the secret name. The default iskaniko-secret
and is only set ifpullSecret
is specified.pullSecret
refers to secret file path.
With this PR, pullSecret
is used for a dual purpose.
- To create a secret if it does not exist from the file specified in this value
- To set
GOOGLE_APPLICATION_CREDENTAILS
env variable to this path when secret exists.
A bunch of tekton users, create secrets one time using a command like below.
See Additional Information in linked issue
A way to specify which path the secret lies at when using a secret is created using command if secret already exists.
kubectl create secret generic kaniko-secret --from-file=/Users/tejaldesai/workspace/keys/my-key.json
If a secret already exists, we should set the GOOGLE_APPLICATION_CREDENTAILS
to path within the volume.
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.
It sounds like pullSecret should be renamed to pullSecretPath.
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.
done! Renamed pullSecret
to pullSecretPath
} | ||
if b.PullSecret == "" { | ||
// TODO: Remove the warning when pod health check can display pod failure errors. | ||
logrus.Warnf("Setting secret keyfile path to %s. If this is incorrect, please specify using config key `pullSecret`.\nSee https://skaffold.dev/docs/references/yaml/#build-cluster-pullSecret", defaultKanikoSecretPath) |
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.
do we really want a warning here? I think a debug level is sufficient, as the user should only see this when there is something wrong. For those users who have 100% right with the default value, this just adds extra noise.
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.
it does add to extra noise. However, it is not documented very well that skaffold expects the secret to be at path kaniko-secret
when creating a secret.
Untill, we can provide an actionable error, i feel the noise is fine.
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.
Should be pullSecretPath
(not pullSecret
) in the message, right?
Just a thought: I presume there's a history for the name |
fc23a32
to
51d02c1
Compare
will verify and update you guys asap. |
@prary ping! Can you please try this out? Let me know if i can help verify. Thanks |
Hi @tejal29 Thanks for informing about this PR. |
pkg/skaffold/build/cluster/secret.go
Outdated
return nil, fmt.Errorf("checking for existing kaniko secret: %w", err) | ||
if _, err := secrets.Get(b.PullSecretName, metav1.GetOptions{}); err != nil { | ||
color.Default.Fprintf(out, "Creating kaniko secret [%s/%s]...\n", b.Namespace, b.PullSecretName) | ||
if b.PullSecret == "" { |
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.
It sounds like pullSecret should be renamed to pullSecretPath.
Hi, There is one thing that we have been seeing for past few skaffold versions. |
Thanks @kiran0707 Will look into this. |
Code looks good. Please check the PR title and description for accuracy. |
pullSecret
to set GOOGLE_APPLICATION_CREDENTIALS or Warn with default setpullSecretPath
to set GOOGLE_APPLICATION_CREDENTIALS
done. Can you take a look again. |
Fixes #3828
In this PR,
pullSecret
topullSecretPath
pullSecretPath
specified in skaffold config to construct the GAC env variable.Output Changes
yes.
This could add to noise. We should follow it up when we add pod health check and determine kaniko pod failure.
Cases where, kaniko secret name
pullSecretName
is specified,pullSecretPath
which points to path with in the volume mounted secret or local path to create secret from is not specifiefpullSecretName
exists.pullSecretName
does not exist and nopullSecretPath
specified to create it frompullSecretName
.pullSecretPath
points to the path within the secret volume.skaffold.yaml
Skaffold logs
Kaniko Pod description