-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
replace commands/envcommand by DataSource in SecretGenerator #703
replace commands/envcommand by DataSource in SecretGenerator #703
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Liujingfang1 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
a few questions
looks reasonable overall, will defer to someone more familiar with the configmap generator for specifics of the wiring
docs/kustomization.yaml
Outdated
tls.crt: "cat secret/tls.cert" | ||
tls.key: "cat secret/tls.key" | ||
files: | ||
- tls.crt=./catsecret/tls.cert |
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.
is the leading ./ required?
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.
not required.
docs/kustomization.yaml
Outdated
# you can only specify one envCommand per secret. | ||
envCommand: printf \"DB_USERNAME=admin\nDB_PASSWORD=somepw\" | ||
env: ./env.txt |
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.
same question, is leading ./ required? if not, consider dropping it?
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.
Not required. Will drop it.
examples/combineConfigs.md
Outdated
tls.key: "cat tls.key" | ||
literals: | ||
tls.crt=./tls.cert | ||
tls.key=./tls.key |
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.
is this example correct? it looks like it would create secret keys with the contents ./tls.cert
, etc, which probably isn't what someone would want
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.
My bad, will change those literals to better examples. Those should be files instead of literals.
pkg/types/kustomization.go
Outdated
// TimeoutSeconds specifies the timeout for commands. | ||
TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty" yaml:"timeoutSeconds,omitempty"` | ||
// DataSources for secret. | ||
DataSources `json:",inline,omitempty" yaml:",inline,omitempty"` | ||
} | ||
|
||
// CommandSources contains some generic sources for secrets. |
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.
drop unused CommandSources?
f7d47de
to
6ad62f1
Compare
6ad62f1
to
2fa4a34
Compare
const ( | ||
defaultCommandTimeout = 5 * time.Second | ||
) | ||
|
||
// SecretFactory makes Secrets. | ||
type SecretFactory struct { | ||
fSys fs.FileSystem |
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.
fSys no longer needed.
It was there just to set a current working directory for the process.
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.
You are correct. fSys
is not needed. I removed it from both SecretGenerator
and ConfigMapGenerator
.
/lgtm Grepped through the docs, seems like everything that matters is captured here. Lets do this rather than #692 :) |
Is there a recommended way to generate secrets now? |
@sethpollack The secret data can be put into files by custom commands. Then those files can be added to SecretGenerator.
|
The change is a different approach for fixing #692. It changes
SecretGenerator
works the same way asConfigMapGenerator
, loading data from files or literals.