Skip to content

weaveworks/vscode-gitops-tools

Repository files navigation

GitOps Tools for Visual Studio Code

VSCode Marketplace Link Install Counter

Weaveworks GitOps Tools Extension provides an intuitive way to manage, troubleshoot and operate your Kubernetes environment following the GitOps operating model. GitOps accelerates your development lifecycle and simplifies your continuous delivery pipelines. The extension is built on Flux (a CNCF open source project). To learn more about the Flux GitOps toolkit, visit fluxcd.io

Use this extension to visualize, configure and debug Flux objects (sources and workloads) needed for GitOps workflows. For example, with this extension you can create a Flux GitRepository source object that tracks a Git repository containing Kubernetes manifests for your application. Then add a Kustomization workload object that periodically applies (reconciles) the manifests from the repository to your cluster. Now your Kubernetes changes are managed through git!

Your feedback is very important to us! Please help us by submitting issues for bugs, enhancements and share with us how you are using the extension.

This extension is under active development with rolling beta release cycle and stable releases. Breaking changes remain a possibility.

Getting Started

Requirements

There are a few requirements before installing and using the extension:

  • Install the kubectl command-line tool
  • You must have a working cluster selected in the kubectl config. A kind or Docker Desktop cluster is an easy way to get started. More information about kubeconfigs is available here
  • The flux tool is required and can be installed from this extension
  • Additional dependencies for Weave GitOps Enterprise and Azure users

Once you have satisfied these requirements you can find and install GitOps Tools in the Extension Marketplace by searching for "fluxcd" or "gitops".

kubectl proxy

This extension uses two different methods to get information from the Kubernetes cluster. It preferentially will run kubectl proxy -p 0 for your selected cluster and will use the proxy with a javascript client for faster performance and real-time updates. This also requires watch RBAC for Flux resources. If the proxy client connection can't be established the extension will fall back to kubectl get for querying the cluster.

Features

  • Configure, visualize and manage Flux resources
  • Tree views for Clusters, Sources, and Workloads
  • Observe Flux resource updates in the cluster in real-time
  • Select clusters and examine installed GitOps Toolkit components
  • Enable and Disable GitOps (install/uninstall Flux) on clusters
  • Create, view and edit sources (git, OCI, Helm and Bucket), and workloads (Kustomization and HelmRelease)
  • Reconcile sources and workloads on demand
  • Pause and resume scheduled reconciliation
  • Create GitRepository and Kustomization objects from folders opened in vscode
  • Clone GitRepository source to user machine and open them in the editor
  • Preview sources, workloads and other objects information with tooltips
  • Open remote resources as .yaml files in the editor
  • Open and edit the kubeconfig file
  • Trace Kubernetes objects created by workloads
  • Watch Flux controller logs and flux CLI commands for diagnostics
  • Documentation links for Flux and Weave GitOps embedded in the extension

Video / Demo

GitOps Deployments from VS Code with little to no Kubernetes Knowledge

We presented Flux and the GitOps Tools extension to our widest audience yet, the VSCode Live Stream! Follow this video link to learn about a new feature integration we built into the extension: Weave GitOps Enterprise Templates.

GUI

Tree Views and Resources

VSCode GitOps Tools

(Clusters, Sources and Workflows tree views; Kustomization tooltip and HelmRepository YAML view)

Configure GitOps View

VSCode GitOps Tools Context Menu

(Configure GitOps view is used to create sources and workloads)

Context Menus

VSCode GitOps Tools Context Menu

(Right clicking in the Explorer view to create Flux objects from folders)

GitOps Commands

You can access GitOps tools check, CLI dependendency versions, Clusters, Sources and Workloads views Focus, Refresh and other commands by typing GitOps in View -> Command Palette... menu prompt:

VSCode GitOps Commands

Dependencies

The extension uses several CLI commands that must be installed and available in your system PATH.

You will need the kubectl CLI tool to use this extension.

flux is also required but can be installed by the extension:

VSCode GitOps Tools

For users running clusters in Azure including AKS and Arc clusters, the az command line tool is also required.

Tool Description Installation
kubectl The kubectl command line tool lets you control Kubernetes clusters. Install Kubectl
flux Flux is a set of continuous and progressive delivery solutions for Kubernetes. Install Flux CLI
git Git is a free and open source distributed version control system. Install git

Optional tools:

Tool Description Installation
gitops Weave GitOps Enterprise (WGE) CLI (required for Templates feature) Install WGE CLI
az Azure CLI. (only if using the extension to create or register Azure clusters) Install az
docker Docker is an open platform for developing, shipping, and running applications. Install Docker

If the extension needs one of the core Kubernetes tools and they are missing, it will prompt you to install them.

The GitOps Tools Extension depends on the Kubernetes Tools extension, which will be installed automatically if you don't already have it.

Azure recommendations

  • Make sure you have successfully authenticated on your az CLI and have access to the correct subscription for your AKS or ARC cluster.
  • The easiest way to get your AKS or Arc cluster visible by the GitOps and Kubernetes Extensions, is to use the az CLI to merge the kubeconfig for accessing your cluster onto the default kubectl config. Use get-credentials as shown in the official CLI documentation. In order to enable GitOps in a cluster you will likely need the --admin credentials.

Weave GitOps Enterprise (WGE) Integration

WGE users can access GitOpsTemplates directly from this extensions. WGE integration adds another treeview that shows GitOpsTemplate, Canary, Pipeline, and GitOpsSet resources and adds new interactions to each type of resource. All WGE resources have a right-click action to open them in WGE portal.

GitOpsTemplates are provided by cluster administrators (Platform Teams) and can be used to quickly create cluster and configure applications with GitOps. Flagger Canaries status can be visualized and their progress tracked. Pipelines are listed with their targets and each GitopsCluster attached to a Pipeline can be set as the current selected cluster for quick navigation between clusters.

WGE integration is an opt-in feature that must be enabled in settings:

Enable WGE Features

Weave GitOps Treeview

Create GitOps Template

WGE Configuration

For the integration to work, this extension needs a ConfigMap that provides WGE information and settings:

`kubectl create configmap weave-gitops-interop --from-literal=portalUrl='https://WGE-CLUSTER-HOST' --from-literal=wgeClusterName='WGE-CLUSTER-NAME' -n flux-system``

apiVersion: v1
kind: ConfigMap
metadata:
  namespace: flux-system
  name: weave-gitops-interop
data:
  portalUrl: https://mccp.howard.moomboo.space
  wgeClusterName: howard-moomboo-space

Common Issues

There are no clusters showing in my Clusters pane

We rely on the Kubernetes extension to discover and connect to clusters. If you are having issues accessing or viewing your cluster, follow the documentation provided by the Kubernetes extension.

Confirm that your configuration context shows in a terminal running kubectl config get-contexts

Switching from an unreachable cluster context to a working cluster

Unreachable or laggy clusters can create long running that cluster resource queries that finish after switching to a working cluster context. This can lead to the slow cluster data overwriting the current cluster treeview. Clusters -> Refresh button will reinitialize the views with current data. Timeout settings can be adjusted under GitOps section in VSCode Settings.

Timeouts and flux check warnings

The extension has timeout options that can make be adjusted in VSCode settings to match your cluster network constraints. The default timeout for any data query operation is 60 seconds.

flux check command can also be disabled in the settings. This will stop flux check warnings about old versions but will disable Flux controller status icons in the the Clusters treeview.

Data and Telemetry

The GitOps Tools Extension for Visual Studio Code collects usage data and sends it to Weaveworks to help improve our products and services. Read our privacy statement to learn more. This extension respects the telemetry.enableTelemetry setting.

Installation Options

VSCodium

VSCodium user can search and install from the VSCodium Open-VSX extension registry.

Manual Installation

  1. Download the latest vsix artifact version from our Releases page.
  2. Run code --install-extension gitops-tools-$VERSION.vsix