Skip to content
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

feat: add support for --secret #60

Merged
merged 6 commits into from
Jul 25, 2024
Merged

feat: add support for --secret #60

merged 6 commits into from
Jul 25, 2024

Conversation

colesnodgrass
Copy link
Member

@colesnodgrass colesnodgrass commented Jul 24, 2024

  • add support for creating secrets via the --secret flag
    abctl local install --secret=/path/to/secrets.yml
    
    # secrets.yml
    apiVersion: v1
    kind: Secret
    metadata:
      name: secret-name
    stringData:
      key: value
    • multiple --secret flags can be provided
      abctl local install --secret=/path/to/secret-a.yml --secret=/path/to/secret-b.yml
      
  • update error messages for consistency

@killthekitten
Copy link

@bgroff @colesnodgrass does this support providing multiple secrets files? In our case we only need one (the external DB) but in some of the docs I saw other examples of secrets. Basic Auth password or S3 api key come to mind

@colesnodgrass
Copy link
Member Author

@bgroff @colesnodgrass does this support providing multiple secrets files? In our case we only need one (the external DB) but in some of the docs I saw other examples of secrets. Basic Auth password or S3 api key come to mind

@killthekitten
Currently no, but I'm planning to add this in one of two ways:

  1. enable the --secrets flag to support a file with multiple secrets (separated by ---)
  2. rename this to --secret and allow you to pass it multiple times, each pointing to a different file

@colesnodgrass colesnodgrass changed the title feat: add support for --secrets feat: add support for --secret Jul 25, 2024
@colesnodgrass
Copy link
Member Author

Updated to use --secret, which now can be provided multiple times for multiple secrets.

@colesnodgrass colesnodgrass marked this pull request as ready for review July 25, 2024 03:35
Copy link
Collaborator

@perangel perangel left a comment

Choose a reason for hiding this comment

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

Looks good 👍🏼

data := map[string][]byte{"auth": []byte(fmt.Sprintf("%s:%s", user, hashedPass))}
if err := c.k8s.SecretCreateOrUpdate(ctx, corev1.SecretTypeOpaque, airbyteNamespace, "basic-auth", data); err != nil {
pterm.Error.Println("Could not create Basic-Auth secret")
secret := corev1.Secret{
Copy link
Collaborator

Choose a reason for hiding this comment

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

For a later refactor: we can add a util for instantiating a secret object as we continue to add more cases.

if env := os.Getenv(envDockerEmail); env != "" {
opts.DockerEmail = env
}
envOverride(&opts.BasicAuthUser, envBasicAuthUser)
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍🏼 nice, much cleaner

@colesnodgrass colesnodgrass merged commit f2a6d28 into main Jul 25, 2024
3 checks passed
@colesnodgrass colesnodgrass deleted the cole/secrets branch July 25, 2024 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants