Work with Google Cloud and Kubernetes YAML files in Cloud Code for IntelliJ

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

Cloud Code also supports popular Kubernetes CRDs, like Kubeflow, out-of-the-box.

Enable or disable YAML support

To enable or disable YAML support, navigate to File > Settings > Tools > Gemini Google Cloud Code > Kubernetes (for Windows and Linux) or IntelliJ IDEA > Settings > Tools > Gemini Google Cloud Code > Kubernetes (for macOS) and select or clear the Enable YAML support checkbox to enable or disable the feature.

Use custom schema

With Cloud Code, you can provide your own CRD schema with IntelliJ settings by navigating to File > Settings > Tools > Gemini Google Cloud Code > Kubernetes (For Windows and Linux) or IntelliJ IDEA > Settings > Tools > Gemini Google Cloud Code > Kubernetes (for macOS) and then refer to the CRD schema locations section.

You can point to either a local file or a URL. URLs pointing to github.com are automatically converted to raw.githubusercontent.com.

Pull schema from a cluster

When you switch to a cluster running Kubernetes v1.16 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. When you open a project, Cloud Code detects Skaffold schemas that aren't up-to-date and prompts you (through the Event Log) when a Skaffold schema version upgrade is available for your existing Skaffold YAML configuration files.

Notification in the Event log prompting user to upgrade their Skaffold schema version because their existing Skaffold YAML files are not of the latest version

Alternatively, you can navigate to Tools > Gemini Cloud Code > Kubernetes > Check for Skaffold Schemas Upgrades to check for available schema upgrades.

Configure with snippets

Out-of-the-box snippets for common YAML schema (using Ctrl Space to view options) allow you 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 remaining instances.

Using snippets with repetitive fields

Cloud Code offers the following snippets:

  • 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 to Containers - Export
  • Migrate to Containers - PersistentVolumeClaim
  • Migrate to Containers - StatefulSet
  • Skaffold - Bazel
  • Skaffold - Getting-started
  • Skaffold - Helm deployment
  • Skaffold - Kaniko

Complete with context

Based on the current schema, Cloud Code provides contextual completions to help you choose the right option.

Context completions for Kubernetes schema

Validate YAML schema

Cloud Code offers schema validation support by flagging invalid tags and values in your YAML files and suggesting fixes when possible.

Value of name field red-underlined to highlight an invalid value of 1234; hover text states: Incorrect type. Expected string.

Validate Skaffold YAML files

Cloud Code provides additional Skaffold configuration file editing support and smart templates which allow you to validate your skaffold.yaml files. Refer to this guide on using an existing app with Cloud Code.

Skaffold yaml templates

Complete Skaffold configuration files with context

Based on the current schema, Cloud Code provides contextual completions and relevant documentation to help you choose the right option.

Skaffold completions

Discover definitions using quick documentation

Cloud Code surfaces relevant documentation for a resource when you highlight a line in your configuration file and navigate to View > Quick Documentation.

Quick documentation

Lint YAML for structural and validity issues

Cloud Code provides linting support around common schema issues and provides descriptive errors.

Linting YAML files

Apply a YAML file

To run kubectl apply -f to apply a configuration change using the current file, you can use the kubectl actions icon 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.

Apply option highlighted in the kubectl action list

Diff between YAML files

To view the differences between a YAML file in source control and a deployed YAML file, you can use the kubectl actions icon kubectl actions icon available in the gutter of your editor. Select the Diff option to see a diff view for you to compare and contrast two schema files.

Diff option highlighted in the kubectl action list

Perform 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 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 (or kubectl apply -f dry-run=client, for the Client option) and notifies you if your file can successfully be created in your Terminal window.

Dry-run on Server option highlighted in the kubectl action list

What's next

Get support

To submit feedback or report an issue in your IntelliJ IDE, go to Tools > Cloud Code > Help / About > Submit feedback or report an issue to report an issue on GitHub, or ask a question on Stack Overflow.