Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

implicitly detect secret types and set field accordingly #5

Merged
merged 2 commits into from
Apr 22, 2020
Merged

Conversation

captncraig
Copy link

Very simply assumes the type of the secret based on the fields present. Needs no additional config to work.

Note: Updating a secret that already exists of the wrong type will fail. It must be manually destroyed and re-created. This is expected.

Copy link
Member

@trotttrotttrott trotttrotttrott left a comment

Choose a reason for hiding this comment

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

LGTM. Just a bit of pedantry.

}

// same with .dockerconfigson
if k8sSecretData[v1.DockerConfigJsonKey] != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Why not else if or swich/case?

Copy link
Author

Choose a reason for hiding this comment

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

I started with that, and then started thinking about priority ordering, and both ways have opposite concerns. If/Else also doesn't solve the case when you have both fields. One is going to win unless we explicitly looks for that (not worth it).

I took it out of the else mostly so the comments lined up, and I thought it was a little more aesthetically pleasing. If you feel strongly one way or another I can change it.

@captncraig captncraig merged commit 082b058 into master Apr 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants