cloud-code-intellij icon indicating copy to clipboard operation
cloud-code-intellij copied to clipboard

Better Helm support in Cloud Code

Open zeppelinux opened this issue 5 years ago • 7 comments

  • Cloud Code for IntelliJ version: 19.7.2
  • OS: Windows 10

What did you do? Installed the Cloud Code plugin in my Intellij IDEA (2019.2.1) I have a project with Docker file and Helm in the src directory that require some processing (done during the build). The result is valid Docker file and Helm Charts folder in the target directory.

What did you expect to see? Kubernetes support is added to my project

What did you see instead? the message: 'Please add a Dockerfile and Kubernetes resources in order to use the project with Cloud Code Kubernetes features'

How to make the Cloud Code Plugin aware of the Docker file and Helm charts in the target directory?

image

zeppelinux avatar Aug 22 '19 21:08 zeppelinux

hi @zeppelinux thanks for reporting.

Did you see that message on project load, or did you go to Tools > Cloud Code > Kubernetes > Add Kubernetes Support. If it was the former, could you try using that tools menu short cut and report what happens please?

If the plugin is unable to detect the Dockerfile in your project then it may be a bug.

etanshaul avatar Aug 22 '19 21:08 etanshaul

And regarding Helm. We have plans to automate much of this, but currently in order to deploy your project via Helm, you would need to manually configure Helm in your skaffold.yaml (which would be automatically created for you, if not for the above issue with not detecting your Dockerfile).

In the meantime, for guidance on how to manually create a skaffold.yaml configuration you can follow these steps:

  1. Create a skaffold.yaml config file: https://cloud.google.com/code/docs/intellij/using-a-k8-existing-app (the "Manually creating .." section)

  2. Update the configuration to use Helm as a deployer: https://skaffold.dev/docs/how-tos/deployers/#deploying-with-helm https://github.com/GoogleContainerTools/skaffold/tree/master/examples (see the 2 Helm samples here)

Example deploy configuration in skaffold.yaml:

deploy:
  helm:
    releases:
    - name: skaffold-helm
      chartPath: skaffold-helm
      values:
        image: gcr.io/k8s-skaffold/skaffold-helm

As mentioned, we have plans to automate creating the Helm configuration for you, but that will be in a future release.

etanshaul avatar Aug 22 '19 22:08 etanshaul

Update to my first comment:

The reason you are seeing that message is because our automatic bootstrapping works only if you have a Dockerfile and Kubernetes manifests. But since you are using Helm charts it doesn't work yet unfortunately.

So you will have to follow the steps in my second comment to manually create the skaffold.yaml config file.

Sorry about that. We are prioritizing improving the Helm experience.

etanshaul avatar Aug 22 '19 22:08 etanshaul

@etanshaul It was not clear that Helm is not supported yet, makes sense now.

I will wait for this to be supported out of the box. Thanks!

ps. I'm deploying Helm charts using Rancher (not Helm)

zeppelinux avatar Aug 23 '19 00:08 zeppelinux

@zeppelinux I see.

Regarding deploying via Rancher - just curious to hear about your workflow and how Cloud Code can help integrate with it. Cloud Code uses Skaffold under the hood to simplify deployments to k8s clusters. This includes image building, tagging, deployment, and cleanup. In “Continuous Dev” mode it also watches for changes in your source and surfaces them to the cluster.

etanshaul avatar Aug 23 '19 22:08 etanshaul

@etanshaul The workflow is pretty standard:

  1. Use local process (TomEE in my case) to develop and test you code, but you can deploy to the cluster anytime you want
  2. Build Docker image and Helm chart, than deploy one to the Docker registry and another to the Charts Museum using Maven (when you want to deploy to the cluster)
  3. Use Rancher to deploy the updated version (literally two clicks and can be automated in CI/CD using Rancher API) and see it's logs + full monitoring data
  4. Rinse and repeat if any problem

It's all good and pretty fast, but i missed one thing - the sensible configuration management (as a code). So I built some JSF App (the main component is Primefaces Horizontal Tree) that bridges the Git and Config Maps/Secrets providing some editing and validation in between. I found .groovy is very powerful to express some complex config structures like collections of collections (or maps) and being not so verbose as json and not so fragile as yaml. So, the app connects to the Git repo that contains .groovy file(s) with config data for the whole environment.
With one of these (we call it kuber-config, thinking about open sourcing it actually:) running in every environment you have complete control and traceability with rollbacks and tagging supported by the Git and integration with the cluster by the Kubernetes API server itself. Rancher makes it all very easy because of a lot thing it takes care of, including awesome Helm integration. It actually extends it using their own questions.yaml without breaking anything and making highly usable through UI. You can see I'm a big fan of it, so let me know if you need some more info.

What I'm missing right now is the ability of IDEA to automatically execute kubectl port-forward, so if i want to debug some service in the cluster i don't have to run it in terminal.

zeppelinux avatar Aug 23 '19 23:08 zeppelinux

Kamino cloned this issue to GoogleCloudPlatform/cloud-code-intellij-internal

jmah-cc avatar Dec 03 '20 16:12 jmah-cc