Jump to Content
Containers & Kubernetes

Cloud Code makes YAML easy for hundreds of popular Kubernetes CRDs

October 16, 2020
Russell Wolf

Product Manager

When developing a service to deploy on Kubernetes, do you sometimes feel like you’re more focused on your YAML files than on your application? When working with YAML, do you find it hard to detect errors early in the development process? We created Cloud Code to let you spend more time writing code and less time configuring your application, including authoring support features such as inline documentation, completions, and schema validation, a.k.a.  “linting.”

Completions provided by Cloud Code for a Kubernetes deployment.yaml file
Inline documentation provided by Cloud Code for a Kubernetes deployment.yaml file
Schema validation provided by Cloud Code for a Kubernetes deployment.yaml file

But over the years, working with Kubernetes YAML has become increasingly complex.  As Kubernetes has grown more popular, many developers have extended the Kubernetes API with new Operators and Custom Resource Definitions (CRDs).  These new Operators and CRDs expanded the Kubernetes ecosystem with new functionality such as continuous integration and delivery, machine learning, and network security.Today, we’re excited to share authoring support for a broad set of Kubernetes CRDs, including: 

  • Over 400 popular Kubernetes CRDs out of the box—up from just a handful

  • Any existing CRDs in your Kubernetes cluster

  • Any CRDs you add from your local machine or a URL 

Cloud Code is a set of plugins for the VS Code and JetBrains Integrated Development Environments (IDEs), and provides everything you need to write, debug, and deploy your cloud-native applications. Now, its authoring support makes it easier to write, understand, and see errors in the YAML for a wide range of Kubernetes CRDs.

Cloud Code’s enhanced authoring support lets you leverage this custom Kubernetes functionality by creating a resource file that conforms to the CRD. For example, you might want to distribute your TensorFlow jobs across multiple pods in a cluster. You can do this by authoring a TFJob resource based on the TFJob CRD and applying it to the cluster where the KubeFlow operator can act on it. 

Expanding built-in support 

Cloud Code has expanded authoring support for over 400 of the most popular Kubernetes CRDs, including those used by Google Cloud and Anthos. This includes a wide variety of CRDs such as:

Inline documentation, completions, and schema validation for the Agones GameServer CRD provided by Cloud Code.

Works with your cluster’s CRDs

While Cloud Code now supports a breadth of popular public, Google Cloud, and Anthos CRDs, you may have your own private CRDs installed on a cluster. When you set a cluster running Kubernetes v1.16 or above as the active context in Cloud Code's Kubernetes Explorer, Cloud Code automatically provides authoring support from the schema of all CRDs installed on the cluster.

The CronTab CRD installed on the active cluster in Cloud Code for VS Code’s Kubernetes Explorer
Authoring support provided by Cloud Code for the CronTab CRD installed on the active cluster

Add your own CRDs 

Despite the breadth of existing CRDs, you may find that there isn’t one that meets your needs. The solution here is to define your own CRD. For example, if you’re running your in-house CI system on Kubernetes, you could define your CRD schemas and allow developers to easily point Cloud Code to copies of those CRD schema files, to get authoring assistance for the resources in their IDEs. 

To add a CRD to Cloud Code, just point Cloud Code to a local path or remote URL to a file defining the custom resource. The remote URL can be as simple as a direct link to a file in GitHub. If you want to learn more about custom resource definitions or create your own, take a look at this documentation page. Once configured, you get the same great inline documentation, completions, and linting from Cloud Code when editing that CRDs YAML files—and it’s super easy to set up in both VS Code and JetBrains IDEs.

Specifying your own CRD in settings.json in VS Code
Preferences > Other Settings > Cloud Code > Kubernetes in IntelliJ

Get started today

To see how Cloud Code can help you simplify your Kubernetes development, we invite you to try out the expanded Kubernetes CRD authoring support. To get started, simply install Cloud Code from the VS Code or JetBrains extension marketplaces, open a CRD’s YAML file, and start editing. 

Once you have Cloud Code installed, you can also try Cloud Code’s fast, iterative development and debugging capabilities for your Kubernetes projects. Beyond Kubernetes, Cloud Code can also help you add Google Cloud APIs to your project or start developing a Cloud Run service with the Cloud Run Emulator.

Posted in