Jump to Content
Containers & Kubernetes

Cloud Code makes YAML easy for hundreds of popular Kubernetes CRDs

October 16, 2020
https://storage.googleapis.com/gweb-cloudblog-publish/images/GCP_Kubernetes_A.max-2600x2600.jpg
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.”

https://storage.googleapis.com/gweb-cloudblog-publish/original_images/1__Completions_provided_by_Cloud_Code.gif
Completions provided by Cloud Code for a Kubernetes deployment.yaml file
https://storage.googleapis.com/gweb-cloudblog-publish/original_images/2_Inline_documentation_provided_by_Cloud_Code.gif
Inline documentation provided by Cloud Code for a Kubernetes deployment.yaml file
https://storage.googleapis.com/gweb-cloudblog-publish/original_images/3_Schema_validation_provided_by_Cloud_Code.gif
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:

https://storage.googleapis.com/gweb-cloudblog-publish/original_images/4_Inline_documentation_completions_and_schema_validation.gif
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.

https://storage.googleapis.com/gweb-cloudblog-publish/images/5_The_CronTab_CRD_installed.max-900x900.jpg
The CronTab CRD installed on the active cluster in Cloud Code for VS Code’s Kubernetes Explorer
https://storage.googleapis.com/gweb-cloudblog-publish/original_images/6_Authoring_support_provided_by_Cloud_Code.gif
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.

https://storage.googleapis.com/gweb-cloudblog-publish/images/7_cloud_code.max-600x600.jpg
Specifying your own CRD in settings.json in VS Code
https://storage.googleapis.com/gweb-cloudblog-publish/images/8_crd_schema_locations.max-800x800.jpg
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