Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

In progress proof of concept using secret library#1

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
hsmatulis wants to merge2 commits intomain
base:main
Choose a base branch
Loading
fromhsmatulis-merge

Conversation

@hsmatulis
Copy link
Owner

No description provided.

Copy link

@bwplotkabwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nice! Good progress. Should we switch main PR discussion to this one?

Nevertheless, I see the point for "hydration", it's for some validation and _file compat. Why not adding another method to secret for setting raw config and if it's set already we fail?

Generally I like theprometheus#797, but the test and code wouldn't work on this common flow because we don't usePrepareSecrets etc. I think it's a good time to iterate to get to a green state ofprometheus#797!

secretField*Field,filePathstring)error {
ifh.manager==nil||h.manager.hydrating==false {
panic("OrFromFile can only be called during PrepareSecrets;the manager has not yet started hydration")
panic("secret field is sealed bythe manager; call this from PrepareSecrets")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We already return error, so we could use it. For deeply imported libraries ideally we have panic-less flows.

returnerr
}
returnc.Validate()
func (c*TLSConfig)PrepareSecrets(h secrets.Hydrator)error {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Where do we use this? I can't see any use of this 🤔

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ah, so this is for compatibility with _file. Do you think we could bake this intoUnmarshalYAML? Maybesecret.Field would need to have extra method for saving this info instead? Likefield.SetRawConfig?

returnnil
}

func (m*Manager)HydrateConfig(configinterface{})error {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hydrate is odd, like it does not tell much. Maybe reload is clearer?

Suggested change
func (m*Manager)HydrateConfig(configinterface{})error {
func (m*Manager)ReloadConfig(configinterface{})error {

//
// This method should be called before accessing any secret values to ensure
// that they are available.
func (m*Manager)SecretsReady(configinterface{}) (bool,error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Let's remove indeed

path:=h.fields.paths[*secretField]
ifcount(secretField!=nil,len(filePath)>0)==2 {
path:=h.fields[secretField]
returnfmt.Errorf("at most one of %s & %s_file must be configured",path,path)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can we validate this on reload? OrOrFromFile and the whole Hydrator should be done on reload? Seems the whole thing is not used inprometheus/prometheus#17648? 🤔

//
// Returning an error here is FATAL. It indicates the configuration
// is structurally unsound and the Manager should exit immediately.
typeSecretPreparerinterface {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Not a fan it seems we replaceSecretsReady with some new stuff doing the same.

Why not just do this onReloadConfig (you called itHydrateConfig)?

// VerifySecrets() error
// }
typeSecretVerifierinterface {
VerifySecrets()error

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

What's this, I can't find use of this method. Should we remove?

VerifySecrets()error
}

typeHydratorstruct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Perhaps:

Suggested change
typeHydratorstruct {
typeReloaderstruct {

// file:
// path: /path/to/password.txt
typeFieldstruct {
rawConfigany

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
rawConfigany
visibilitybool

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotAwaiting requested review from CopilotCopilot will automatically review once the pull request is marked ready for review

1 more reviewer

@bwplotkabwplotkabwplotka left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@hsmatulis@bwplotka

[8]ページ先頭

©2009-2025 Movatter.jp