-
Notifications
You must be signed in to change notification settings - Fork 301
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
kubernetes-exec is now a flag #2814
Conversation
972efcc
to
e163007
Compare
e163007
to
33e5aa2
Compare
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.
I have one question. But the rest looks good 👍🏿 .
agent/tags.go
Outdated
@@ -78,7 +77,7 @@ type tagFetcher struct { | |||
func (t *tagFetcher) Fetch(ctx context.Context, l logger.Logger, conf FetchTagsConfig) []string { | |||
tags := conf.Tags | |||
|
|||
if experiments.IsEnabled(ctx, experiments.KubernetesExec) { | |||
if t.k8s != nil { |
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 line right? the t.k8s
seems to be set always?
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.
Good point, on one hand this is defensive in case we set t.k8s
optionally, on the other YAGNI.
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.
I changed it so that it used the same logic as before (only run t.k8s
to create tags if kubernetes-exec
is enabled).
@@ -488,6 +494,10 @@ func (r *JobRunner) createEnvironment(ctx context.Context) ([]string, error) { | |||
env["BUILDKITE_STRICT_SINGLE_HOOKS"] = fmt.Sprintf("%t", r.conf.AgentConfiguration.StrictSingleHooks) | |||
env["BUILDKITE_SIGNAL_GRACE_PERIOD_SECONDS"] = fmt.Sprintf("%d", int(r.conf.AgentConfiguration.SignalGracePeriod/time.Second)) | |||
|
|||
if r.conf.KubernetesExec { | |||
env["BUILDKITE_KUBERNETES_EXEC"] = "true" |
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.
This seems to be new. Just for my curiosity, what is this impacting?
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.
Previously, if kubernetes-exec
were enabled (as an experiment), it would be passed down to the subprocess via the BUILDKITE_AGENT_EXPERIMENTS
variable. Now it could be set in the parent process via a flag, we should ensure that if enabled it should be passed to the subprocess.
But we'll make the k8s controller set this anyway, so it's probably unnecessary.
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.
it's so good. it's so so good.
@@ -165,6 +165,7 @@ type AgentStartConfig struct { | |||
Experiments []string `cli:"experiment" normalize:"list"` | |||
Profile string `cli:"profile"` | |||
StrictSingleHooks bool `cli:"strict-single-hooks"` | |||
KuberentesExec bool `cli:"kubernetes-exec"` |
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.
Heads up there's a typo here Kuberen
tesExec
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.
lol, whoops. i've just put a PR in to fix it, but there should be no impact
Description
Replaces the
kubernetes-exec
"experiment" with a proper flag, environment variable, etc.Context
The
kubernetes-exec
"experiment" was not really an experiment, but rather misused the experiments system as a way to pass a Boolean flag into various parts of the agent without setting up a flag, environment variable, etc.Testing
go test ./...
). Buildkite employees may check this if the pipeline has run automatically.go fmt ./...
)