Cloud Code is designed to help with editing Google Cloud and Kubernetes-related configuration files, including schema based validation, diagnostics, and quick documentation.
Supported YAML configuration files
- Anthos Config Management
- Cloud Build
- Config Connector
- Migrate for Anthos
Additionally, Cloud Code also supports popular Kubernetes CRDs, like Kubeflow, out-of-the-box.
Using custom schema
Additionally, with Cloud Code, you can provide your own CRD schema with IntelliJ settings (File > Settings > Tools > Cloud Code > Kubernetes or for Mac OS X, IntelliJ IDEA > Preferences > Tools > Cloud Code > Kubernetes and navigate to the CRD Schema Locations section).
You can point to either a local file or a URL. URLs pointing to
automatically converted to
Pulling schema from a cluster
When you switch to a cluster running Kubernetes v1.16 and above in the Kubernetes Explorer, Cloud Code automatically pulls the schema of all installed CRDs.
Additional Skaffold support
Skaffold is the underlying engine that powers Cloud Code, helping you build, push, and deploy your application as well as providing support for creating CI/CD pipelines.
Cloud Code comes with additional support for managing Skaffold configuration files. On opening a project, Cloud Code detects Skaffold schemas that aren't up-to-date and prompts you (via the Event Log) when a Skaffold schema version upgrade is available for your existing Skaffold YAML configuration files.
Alternatively, you can navigate to Tools > Cloud Code > Kubernetes and select Check for Skaffold Schemas Upgrades to check for available schema upgrades.
Configuring with snippets
Out-of-the-box snippets for common YAML schema (using
Ctrl+Space to view
options) make it easy to start a new YAML file or add to an existing one without
errors, while still following best practices. Additionally, it's easier to work
with repetitive fields; fill in one and Cloud Code fills out the
Currently, the following snippets are offered:
Cloud Build - Cloud Run deployment
Cloud Build - Docker container build
Cloud Build - GKE deployment
Cloud Build - GKE Skaffold deployment
Cloud Build - Go build
Cloud Build - Terraform plan + apply
Config Connector - BigQueryDataset
Config Connector - BigQueryTable
Config Connector - BigtableCluster
Config Connector - BigtableInstance
Config Connector - PubSubSubscription
Config Connector - PubSubTopic
Config Connector - RedisInstance
Config Connector - SpannerInstance
Kubernetes - ConfigMap
Kubernetes - Deployment
Kubernetes - Ingress
Kubernetes - Pod
Kubernetes - Service
Migrate for Anthos - Export
Migrate for Anthos - PersistentVolumeClaim
Migrate for Anthos - StatefulSet
Skaffold - Bazel
Skaffold - Getting-started
Skaffold - Helm deployment
Skaffold - Kaniko
Completing with context
Based on the current schema, Cloud Code will provide contextual completions to help you choose the right option.
Validating YAML schema
Cloud Code offers schema validation support by flagging invalid tags and values in your YAML files and suggesting fixes when possible.
Validating Skaffold YAML files
Cloud Code provides additional Skaffold configuration file editing
support and smart templates allowing you to easily validate your
skaffold.yaml files. Refer to
this guide on using an existing app with Cloud Code.
Completing Skaffold configuration files with context
Based on the current schema, Cloud Code will provide contextual completions and relevant docs to help you choose the right option.
Enabling Skaffold file sync and hot reloading
To improve the efficiency of your local development workflow and avoid having to rebuild, redeploy, and restart your pods, Skaffold supports copying changed files to a deployed container. This means that when you're making changes to static and source code files, you can see your changes take effect in a matter of seconds, making for an accelerated feedback loop!
For static files (like HTML and CSS files), this file copying behavior is called file syncing.
For source code files, this behavior is referred to as hot reloading and works for the following file types:
- Go: *.go
- Java: *.java, *.kt, *.scala, *.groovy, *.clj
- NodeJS: *.js, *.mjs, *.coffee, *.litcoffee, *.json
With hot reloading configured, Skaffold detects changes to supported files and syncs these changes to the running container on your cluster, bypassing the need for a cumbersome image rebuild and pod restart. Changes to other file types, however, trigger an image rebuild.
Automatic file-syncing and hot reloading are enabled by default when you're
working with Buildpacks as your preferred builder. For other builders like
Docker, you can specify a
sync section in your skaffold.yaml for the artifact
Your sync setting can be one of (in order of preference):
auto(only for Jib and Buildpacks artifacts)
If you were to specify a
manual sync to synchronize all
files to the
static folder in your container, your skaffold.yaml would
build: artifacts: - image: gcr.io/k8s-skaffold/node-example context: node sync: manual: - src: 'static-html/*.html' dest: static
For a detailed look at file syncing and specifying sync rules, refer to the Skaffold guide on file sync.
Discovering definitions via quick documentation
Cloud Code surfaces relevant documentation for a resource when you highlight a line in your configuration file and access View > Quick Documentation.
Linting YAML for structural and validity issues
Cloud Code provides linting support around common schema issues and provides descriptive errors.
Applying a YAML file
kubectl apply -f to apply a configuration change using the current
file, you can use the kubectl actions icon ,
available in the gutter of your IDE and select Apply. This brings
up a diff view for you to review changes before clicking Apply.
Diffing between YAML files
If you'd like to view the differences between a YAML file in source control and a deployed YAML file, you can use the kubectl actions icon available in the gutter of your editor. Choose the Diff option to bring up a diff view for you to compare and contrast two schema files.
Performing a dry-run of a YAML file
To perform a dry run of your file and check its validity, you can use
the kubectl actions icon ,
available in the gutter of your IDE, to select Dry-run on Server
or Dry-run on Client. This runs
kubectl apply -f dry-run=server
kubectl apply -f dry-run=client, for the Client option) and notifies you
if your file can successfully be created in your Terminal window.