-
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
Provide mechanism to indicate language runtime type for an artifact #2203
Comments
Sounds like a good idea. Some thoughts:
Maybe you should also involve the IDE people here. They may have preferences and ideas how this can best work together with CloudCode. |
Environment variables are on a per-artifact basis (well, per-container really), so that's not really a concern. |
I think I also interpreted it like @corneliusweig, where the env var would be set on the Skaffold process. Whereas I think here you mean to set it in the k8s config. |
My intuition is that adding this to The easiest solution from an IDE perspective would be to have this as a command flag - but given that it needs to be on a per artifact basis, it's probably infeasible? @iantalarico for comment as well |
Ah sorry. I meant either Dockerfile ENV or k8s container env flags. I think a command-line flag can be done, and
|
ah right. that would work. Just to be explicit, even though it was probably clear - this would be the easiest option from the IDE perspective because it wouldn't involve modifying any configuration. Instead we could just pass this "runtime type" at command execution time. Side question: if a runtime type isn't supplied, and |
I haven't looked into how to hook into the events yet, but I figured I'd just return a map of artifact → debug configuration (runtime-type + debug ports). And indeterminate artifacts would be a null mapping. |
That makes perfectly sense. Do you think it's worth adding a note to your original issue post? I think the standard way to identify an artifact in Skaffold is to use the image name and not the path. That has the advantage of being stable wrt. refactorings (unless the image name is changed :/), so what do you think about:
|
While looking at #2184 I just had another idea how the runtime type could be specified elegantly on the cmdline: the switch to enable debugging could also be used to specify the runtime
This would save typing/pasting of the image name and is equally expressive (the separator may be up to debate). One drawback: it will no longer be possible to specify the runtime without restricting the debugged artifacts. |
Jumping in a little late but I agree that passing the information to skaffold would be the easiest from the IDE side. |
You're right @corneliusweig the image tag is better since several artifacts can be mapped to the same location, as happens with Jib multi-module projects. |
using the image tag should work fine from the IDE perspective. |
That works. Having it return a null mapping, but still have the artifact information, will be helpful for the client. |
Just rephrasing so that I understand: We need to enrich the heuristics in runtimes/artifacts so that skaffold can detect what language runtime an artifact is using, so that Another way I would phrase this: With this direction we prescribe a set of standard mechanisms to make a runtime image Skaffold Debuggable
+1 on env vars. I think this is a natural fit with the rest of the heuristics and eventually can become a standard thing across Dockerhub images as well, if we wanted to make an effort - we could raise a PR for all of them to include this ;)
I'm okay with this, but not convinced. One benefit I see, is that the Dockerfile doesn't have to change for the image. But that also means that if we'd ever inject a skaffold utility inside the container, it wouldn't know about the runtime. What is your thinking around the benefits for this mechanism?
I wouldn't expose this as part of the manifests. It is redundant, and also kind-of-in-the-middle: We are talking about images to be connected to skaffold. It is redundant because with env vars you can simulate this even in a pod spec. It is in the middle: on the image end we can use env vars to define runtimes, on the skaffold end in the artifact config directly.
Big plus on this one. As I mentioned, this feature connects images to skaffold. Having the ability to define it/override it in skaffold.yaml makes sense to me. I'm luke warm on the ability to pass it in as a flag - it would be useful for IDEs as then you could override things without touching the yaml - however the IDE would need to store it somewhere...so why not just create a debug profile that has the override? |
A crazy idea: we could have a set of known image names -> runtimes mapping themselves listed explicitly somewhere as well as another source of heuristics. |
This could be a good way to allow specifying an Alpine-based Delve image (GoogleContainerTools/container-debug-support#30). |
It also seems to me that |
I'm going to add an |
v2beta2 is published, but is identical to v2beta1 😁. Will this be in v2beta3? |
yes hopefully so. the PR is still in draft, but we don't have any other config changes in the works to my knowledge, so it should go out with the next config bump. however, that isn't tied to our next release necessarily. in any case, stay tuned and we'll get this shipped ASAP. |
@briandealwis going through quarterly scrub and just wanted to make sure if this is still a priority. |
This would be a very nice addition to debug mode. Currently debug is very inflexible, I'd even say borderline unusable. Also I wouldn't stop at just specifying the runtime, it would be very useful to disable debug for certain artifacts as well. I like this solution from a different issue: #2184 (comment) |
@akostic-kostile we'd appreciate some examples of where you're being blocked! |
@briandealwis Sure thing, I have a perfect example for you. reporting-app (file cut for brevity, I just pasted parts that are important for local dev):
Highcharts-export-server (only thing that gets installed with
And finally skaffold.yml:
Now, what happens when I do Lets take a look at pod annotations:
For highcharts container runtime was correctly identified, but the problem is I don't care about debugging Highcharts export server. Is there a way to tell Skaffold not to debug that container? The only way I know of is to manually set pod level annotation to Leaving that aside for now, lets take a look at what Skaffold detected for a second container. Hm, runtime jvm?! Must be because I have a variable inside Dockerfile called JAVA_VERSION. I'm installing Java so SonarQube scanner would work correctly, and JAVA_VERSION is one of the special variables Skaffold uses to detect runtime. However in this case it completely misses the mark. Can I change the variable name to something else? Sure I can, but I created this Dockerfile before I started working with To conclude this long post there should definitely be some way to set these things from skaffold.yml, at the very least to enable/disable debugging on container level and a way to specify runtime so correct debug tools would be installed. At version 1.32 debug is very rough around the edges. |
Created issue #6713 from above comment |
I'm using Amazon Corretto along with a maven wrapper command, and unfortunately this also fails the heuristics for determining a java runtime. Being able to explicitly tell skaffold what we want would be fantastic. As a workaround, would it be possible for skaffold to key off of Since openjdk images are officially deprecated, it would be nice for this to work with others. |
Another issue I hit that would be solved with the support here would be this: Running with the java spring boot plugin is quite common in order to get hot class reloading. The current process for skaffold to automatically add debug port forwarding conflicts with this setup. I'm not sure how much this crosses the boundary between skaffold and cloud code, but in order to use the extension, I had to do the following workaround:
Where I had to
If there was a flag I could add to the skaffold.yaml file that says "add java debug ports", I could replace these three steps with just one. |
skaffold debug
currently uses a set of heuristics to guess the language runtime used in a container image:These heuristics fail for Go and C++ programs. Although Go does have some runtime environment variables, they aren't always used. And these heuristics may result in false-positives for mixed-runtime images. We need a way to define the language runtime for a particular artifact.
Proposal
SKAFFOLD_RUNTIME
?skaffold.dev/debug/runtime
skaffold.dev/debug/runtime
skaffold.yaml
:The text was updated successfully, but these errors were encountered: