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: passthrough additional env vars to provider bin #188

Conversation

bavarianbidi
Copy link
Contributor

@bavarianbidi bavarianbidi commented Nov 30, 2023

as some provider binaries probably need additional environment variables set (e.g kubernetes as client-go depends on KUBERNETES_SERVICE_ vars) it should be possible to define a list of environment variables which should get bypassed into the provider binary execution

tested with our kubernetes-provider binary where i want to bypass the KUBERNETES_ variables into the binary execution call

[[provider]]
name = "kubernetes_external"
description = "kubernetes provider"
provider_type = "external"
[provider.external]
config_file = "/home/mb/bin/garm/garm-provider-k8s-config.yaml"
provider_executable = "/home/mb/bin/garm/garm-provider-k8s"
environment_variables = [
  "KUBERNETES_SERVICE_PORT",
  "KUBERNETES_SERVICE_HOST",
  "KUBERNETES_",
]

Fixes #187

@bavarianbidi bavarianbidi force-pushed the bypass_additional_environment_variables branch from ea0fb33 to b307900 Compare December 1, 2023 07:17
@bavarianbidi bavarianbidi marked this pull request as ready for review December 1, 2023 07:17
@bavarianbidi bavarianbidi changed the title feat: bypass additional env vars to provider bin feat: passthrough additional env vars to provider bin Dec 1, 2023
Copy link
Member

@gabriel-samfira gabriel-samfira left a comment

Choose a reason for hiding this comment

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

This looks great! Just one meaningful comment in regards to skipping any pattern that starts with GARM, to protect the variables that should be set by GARM itself when calling the external provider binary.

config/external.go Outdated Show resolved Hide resolved
runner/providers/external/external.go Show resolved Hide resolved
config/external.go Outdated Show resolved Hide resolved
as some provider binaries probably need additional environment variables
set (e.g kubernetes as client-go depends on KUBERNETES_SERVICE_ vars) it
should be possible to define a list of environment variables which
should get bypassed into the provider binary execution
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
@gabriel-samfira gabriel-samfira merged commit 0e36eb7 into cloudbase:main Dec 1, 2023
4 checks passed
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.

external Provider: allow external provider configuration via environment variables
2 participants