-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix skaffold debug
panic with nodejs
#3827
Conversation
Codecov Report
|
func rewriteNodeOptions(env map[string]string, spec inspectSpec) []v1.EnvVar { | ||
found := false | ||
var vars []v1.EnvVar | ||
for k, v := range env { |
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.
can we do something like
nodeOptions = spec.String()
if val, ok := env["NODE_OPTIONS"]; ok {
nodeOptions = v + " " + specString
}
env["NODE_OPTIONS"] = nodeOptions
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.
oh you have to transform the map...
@@ -96,8 +96,7 @@ func (t nodeTransformer) Apply(container *v1.Container, config imageConfiguratio | |||
container.Args = rewriteNpmCommandLine(config.arguments, *spec) | |||
|
|||
default: | |||
logrus.Warnf("Skipping %q as does not appear to invoke node", container.Name) | |||
return nil | |||
container.Env = rewriteNodeOptions(config.env, *spec) |
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.
Just curious, at this point, was there already some hint that this container was node? Could I be a clown and have a java application with a NODE_OPTIONS
?
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.
you know what never mind, I read the description of the PR... 😞
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 should be unusual (and discouraged) to have a mega-container with both a JVM and NodeJS application. In the k8s sphere, they should be separate containers within the same pod.
Fixes #3821
Description
The
nodejs
debug transformer'sIsApplicable()
used the presence ofNODE_VERSION
to indicate that the container image is NodeJS-based. But theApply()
only handles situations where there is anpm
ornode
invocation.User facing changes (remove if N/A)
Look ma, no more panics!
Follow-up Work (remove if N/A)
#2141 must be solved to allow running
examples/nodejs
for example.