Coder Social home page Coder Social logo

vscode-kubernetes-tools / vscode-kubernetes-tools Goto Github PK

View Code? Open in Web Editor NEW
673.0 673.0 244.0 16.4 MB

Kubernetes extension for Visual Studio Code

Home Page: https://marketplace.visualstudio.com/items?itemName=ms-kubernetes-tools.vscode-kubernetes-tools

License: Apache License 2.0

TypeScript 92.06% Go 0.21% Smarty 0.02% JavaScript 2.34% CSS 0.76% HTML 1.29% SCSS 3.33%

vscode-kubernetes-tools's Introduction

Visual Studio Code Kubernetes Tools

Build Status

The extension for developers building applications to run in Kubernetes clusters and for DevOps staff troubleshooting Kubernetes applications.

Works with any Kubernetes anywhere (Azure, Minikube, AWS, GCP and more!).

Features include:

  • View your clusters in an explorer tree view, and drill into workloads, services, pods and nodes.
  • Browse Helm repos and install charts into your Kubernetes cluster.
  • Intellisense for Kubernetes resources and Helm charts and templates.
  • Edit Kubernetes resource manifests and apply them to your cluster.
  • Build and run containers in your cluster from Dockerfiles in your project.
  • View diffs of a resource's current state against the resource manifest in your Git repo
  • Easily check out the Git commit corresponding to a deployed application.
  • Run commands or start a shell within your application's pods.
  • Get or follow logs and events from your clusters.
  • Forward local ports to your application's pods.
  • Create Helm charts using scaffolding and snippets.
  • Watch resources in the cluster explorer and get live updates as they change

What's new in this version? See the change log to find out!

Getting started with the extension

Install

Open this extension in the Visual Studio Marketplace

Dependencies

The Kubernetes extension may need to invoke the following command line tools, depending on which features you use. You will need kubectl at minimum, and docker or buildah if you plan to use the extension to build applications rather than only browse.

  • kubectl
  • docker or buildah
  • helm

Optional tools:

  • az (Azure CLI - only if using the extension to create or register Azure clusters)
  • minikube (only if you want to use it)
  • git (only if using the 'sync working copy to repository' feature)
  • buildah (can be used as an alternative container image build tool)

We recommend you install these binaries on your system PATH before using the extension. If these binaries aren't on your system PATH, then some commands may not work. If the extension needs one of the core Kubernetes tools and it's missing, it will offer to install it for you.

Configuration settings for building and running applications

If you want to use the Kubernetes: Run and Kubernetes: Debug features then you need to configure a user and repository for your container images. This is required because these commands need pushing an image of your application for your cluster to run it. To do this, add the following to your VS Code preferences (File > Preferences):

{
  "vsdocker.imageUser": "<your-image-prefix-here>",
}

where <your-image-prefix-here> is something like docker.io/brendanburns.

That's it! You're good to go.

Working with kubeconfigs

By default, the extension uses the active kubeconfig file -- that is, the file to which the KUBECONFIG environment variable points, or the default kubeconfig if no KUBECONFIG environment variable exists. You can override this using the vs-kubernetes.kubeconfig setting in your user or workspace settings.

If you want to swap between multiple kubeconfig files, you can list them in the vs-kubernetes.knownKubeconfigs configuration setting and switch between them using the Set Kubeconfig command.

If you want to skip TLS verification for a particular cluster, you can edit your ~/.kube/config and set the insecure-skip-tls-verify: true flag under the proper cluster:

- cluster:
    insecure-skip-tls-verify: true
    server: https://my-insecure-cluster:443
    name: my-insecure-cluster:443

Commands and features

vs-kubernetes-tools supports a number of commands for interacting with Kubernetes; these are accessible via the command menu (Ctrl+Shift+P) and may be bound to keys in the normal way.

Kubernetes

General commands

  • Kubernetes: Load - Load a resource from the Kubernetes API and create a new editor window.
  • Kubernetes: Get - Get the status for a specific resource.
  • Kubernetes: Logs - Open a view with a set of options to display/follow logs.
  • Kubernetes: Follow Events - Follow events on a selected namespace.
  • Kubernetes: Show Events - Show events on a selected namespace.
  • Kubernetes: Watch - Watch a specific resource or all resources of that object type, and update the cluster explorer as they change
  • Kubernetes: Stop Watching - Stop watching the specific resource

Commands while viewing a Kubernetes manifest file

  • Kubernetes: Explain - Use the kubectl explain ... tool to annotate Kubernetes API objects
  • Kubernetes: Create - Create an object using the current document
  • Kubernetes: Delete - Delete an object contained in the current document.
  • Kubernetes: Apply - Apply changes to an object contained in the current document.
  • Kubernetes: Expose - Expose the object in the current document as a service.
  • Kubernetes: Describe - Describe the object in a terminal window.
  • Kubernetes: Diff - Show the difference between a local copy of the object, and that which is deployed to the cluster.

Commands for application directories

  • Kubernetes: Run - Run the current application as a Kubernetes Deployment
  • Kubernetes: Terminal - Open an interactive terminal session in a pod of the Kubernetes Deployment
  • Kubernetes: Exec - Run a command in a pod of the Kubernetes Deployment
  • Kubernetes: Debug (Launch) - Run the current application as a Kubernetes Deployment and attach a debugging session to it (currently works only for Java/Node.js deployments). See Debug support on Kubernetes cluster for more details.
  • Kubernetes: Debug (Attach) - Attach a debugging session to an existing Kubernetes Deployment (currently works only for Java deployments). See Debug support on Kubernetes cluster for more details.
  • Kubernetes: Remove Debug - Remove the deployment and/or service created for a Kubernetes Debug (Launch) session
  • Kubernetes: Sync Working Copy to Cluster - Checks out the version of the code that matches what is deployed in the cluster. (This relies on Docker image versions also being Git commit IDs, which the extension does if you use the Run command to build the container, but which typically doesn't work for containers/deployments done by other means.)

Cluster creation commands

  • Kubernetes: Create Cluster - Initiate the flow for creating a Kubernetes cluster with a selected cloud provider (eg: Azure), or creating a Minikube cluster locally.

Configuration commands

  • Kubernetes: Add Existing Cluster - Install and configure the Kubernetes command line tool (kubectl) from a cloud cluster, such as an Azure Container Service (ACS) or Azure Kubernetes Service (AKS) cluster
  • Kubernetes: Set as Current Cluster - Select from a list of configured clusters to set the "current" cluster. Used for searching, displaying, and deploying Kubernetes resources.
  • Kubernetes: Delete Context - Remove a cluster's configuration from the kubeconfig file.
  • Kubernetes: Set Kubeconfig - Select from a list of known kubeconfig files (for users who keep different kubeconfig files for different environments).
  • Kubernetes: Show Cluster Info - For a cluster, show the status of Kubernetes Components (API Server, etcd, KubeDNS, etc.) in a terminal window.
  • Kubernetes: Use Namespace - Select from a list of namespaces to set the "current" namespace. Used for searching, displaying, and deploying Kubernetes resources.

ConfigMap and Secret commands

  • Kubernetes: Add File - Adds a file as a ConfigMap or a Secret
  • Kubernetes: Delete File - Deletes a file from a ConfigMap or a Secret

Miscellaneous commands

  • Kubernetes: Open Dashboard - Opens the Kubernetes Dashboard in your browser.
  • Kubernetes: Port Forward - Prompts user for a local port and a remote port to bind to on a Pod.
  • Kubernetes: Select Pod - It allows to select a pod from a list of pods belonging to the "current" namespace. It can be invoked through command substitution ${command:extension.vsKubernetesSelectPod}. See Commands for debugging for more details.

Minikube

Minikube runs a local, single node Kubernetes cluster inside a VM. Support is currently experimental, and requires Minikube tools to be installed and available on your PATH.

  • Kubernetes: Start minikube - Starts Minikube
  • Kubernetes: Stop minikube - Stops Minikube

Helm

Helm is the package manager for Kubernetes and provides a way for you to define, install and upgrade applications using 'charts.' This extension provides a set of tools for creating and testing Helm charts:

  • Syntax highlighting for YAML + Helm Templates
  • Autocomplete for Helm, Sprig, and Go Tpl functions
  • Help text (on hover) for Helm, Sprig, and Go Tpl functions
  • Snippets for quickly scaffolding new charts and templates
  • Commands for...
    • Helm: Create Chart - Create a new chart
    • Helm: Get Release - Get a helm release from the cluster
    • Helm: Lint - Lint your chart
    • Helm: Preview Template - Open a preview window and preview how your template will render
    • Helm: Template - Run your chart through the template engine
    • Helm: Dry Run - Run a helm install --dry-run --debug on a remote cluster and get the results (NOTE: requires Tiller on the remote cluster)
    • Helm: Version - Get the Helm version
    • Helm: Insert Dependency - Insert a dependency YAML fragment
    • Helm: Dependency Update - Update a chart's dependencies
    • Helm: Package - Package a chart directory into a chart archive
    • Helm: Convert to Template - Create a template based on an existing resource or manifest
    • Helm: Convert to Template Parameter - Convert a fixed value in a template to a parameter in the values.yaml file
  • Code lenses for:
    • requirements.yaml (Add and update dependencies)
  • Right-click on a chart .tgz file, and choose inspect chart to preview all configurable chart values.

Extension Settings

The Kubernetes extension enables variable substitution for settings that require a path as a value. Variable substitution can be done using the ${variableName} syntax. You can find a list of the variables supported in the variables-reference documentation.

  • vs-kubernetes - Parent for Kubernetes-related extension settings
    • vs-kubernetes.namespace - The namespace to use for all commands
    • vs-kubernetes.kubectl-path (deprecated) - File path to the kubectl binary. Note this is the binary file itself, not just the directory containing the file. On Windows, this must contain the .exe extension. This is deprecated, please use vscode-kubernetes.kubectl-path instead.
    • vs-kubernetes.helm-path (deprecated) - File path to the helm binary. Note this is the binary file itself, not just the directory containing the file. On Windows, this must contain the .exe extension. This is deprecated, please use vscode-kubernetes.helm-path instead.
    • vs-kubernetes.minikube-path (deprecated) - File path to the minikube binary. Note this is the binary file itself, not just the directory containing the file. On Windows, this must contain the .exe extension. This is deprecated, please use vscode-kubernetes.minikube-path instead.
    • vs-kubernetes.kubectlVersioning - By default, the extension uses the kubectl binary you provide on the system PATH or in the vs-kubernetes.kubectl-path configuration setting. If you set this setting to infer, then for each cluster the extension will attempt to identify the cluster version and download a compatible kubectl binary. This improves compatibility if you have multiple Kubernetes versions in play, but may be slower. Note: this setting is checked only when the extension loads; if you change it, you must reload the extension.
    • vs-kubernetes.kubeconfig - File path to the kubeconfig file you want to use. This overrides both the default kubeconfig and the KUBECONFIG environment variable.
    • vs-kubernetes.knownKubeconfigs - An array of file paths of kubeconfig files that you want to be able to quickly switch between using the Set Kubeconfig command.
    • vs-kubernetes.autoCleanupOnDebugTerminate - The flag to control whether to auto cleanup the created deployment and associated pod by the command "Kubernetes: Debug (Launch)". The cleanup action occurs when it failed to start debug session or debug session terminated. If not specified, the extension will prompt for whether to clean up or not. You might choose not to clean up if you wanted to view pod logs, etc.
    • vs-kubernetes.outputFormat - The output format that you prefer to view Kubernetes manifests in. One of "yaml" or "json". Defaults to "yaml".
    • vs-kubernetes.resources-to-watch - List of resources to be watched. To identify a resource the extension uses the label displayed in the cluster explorer. E.g. ["Pods", "Services", "Namespaces"].
    • vscode-kubernetes.enable-snap-flag - Enables compatibility with instances of VS Code that were installed using snap.
    • vs-kubernetes.disable-context-info-status-bar - Disable displaying your current Kubernetes context in VS Code's status bar. When active, it can be used to switch context from the status bar.
    • vs-kubernetes.disable-namespace-info-status-bar - Disable displaying your current Kubernetes namespace in VS Code's status bar. When active, it can be used to switch namespace from the status bar.
    • vs-kubernetes.suppress-kubectl-not-found-alerts - Turns off the warning (and installation prompt) if kubectl was not found. You should not normally set this, as most of the extension depends on kubectl, but it can be useful if working primarily with Helm.
    • vs-kubernetes.suppress-helm-not-found-alerts - Turns off the warning (and installation prompt) if helm was not found.
    • vs-kubernetes.ignore-recommendations - Set to true to silence Kubernetes extension recommendation notifications.
    • vs-kubernetes.minikube-show-information-expiration - Set to valid expiration date for minikube install to show information dialog box to display.
    • vs-kubernetes.enable-minimal-workflow - Enables the minimal workflow for several actions (Get, Describe, Scale, Expose, Switch). By executing one of those commands the queries to the cluster are reduced at minimum and users are able to freely type the resource name to use.
  • vsdocker.imageUser - Image prefix for the container images e.g. 'docker.io/brendanburns'
  • checkForMinikubeUpgrade - On extension startup, notify if a minikube upgrade is available. Defaults to true.
  • disable-lint - Disable all linting of Kubernetes files
  • disable-linters - Disable specific linters by name
  • vscode-kubernetes.kubectl-path - File path to the kubectl binary. Note this is the binary file itself, not just the directory containing the file. On Windows, this must contain the .exe extension.
  • vscode-kubernetes.helm-path - File path to the helm binary. Note this is the binary file itself, not just the directory containing the file. On Windows, this must contain the .exe extension.
  • vscode-kubernetes.minikube-path - File path to the minikube binary. Note this is the binary file itself, not just the directory containing the file. On Windows, this must contain the .exe extension.
  • vscode-kubernetes.log-viewer.follow - Set to true to follow logs by default in the log viewer.
  • vscode-kubernetes.log-viewer.timestamp - Set to true to show timestamps by default in the log viewer.
  • vscode-kubernetes.log-viewer.since - How far back to fetch logs from in seconds by default. Set to -1 for all logs.
  • vscode-kubernetes.log-viewer.tail - The number of recent logs to display by default in the log viewer. Set to -1 for all log lines.
  • vscode-kubernetes.log-viewer.destination - Where to display logs, defaults to the dedicated Webview.
  • vscode-kubernetes.log-viewer.wrap - Set to true to wrap lines by default in the log viewer.
  • vscode-kubernetes.log-viewer.autorun - Set to true to automatically begin fetching logs once the log viewer is opened using the default settings.

Custom tool locations

For kubectl and helm, the binaries do not need to be on the system PATH. You can configure the extension by specifying the locations using the appropriate vscode-kubernetes.${tool}-path configuration setting. See Extension Settings below.

The extension can install kubectl and helm for you if they are missing - choose Install dependencies when you see an error notification for the missing tool. This will set kubectl-path and helm-path entries in your configuration for the current OS (see "Portable extension configuration" below) - the programs will not be installed on the system PATH, but this will be sufficient for them to work with the extension.

If you are working with Azure Container Services or Azure Kubernetes Services, then you can install and configure kubectl using the Kubernetes: Add Existing Cluster command.

Portable extension configuration

If you move your configuration file between machines with different OSes (and therefore different paths to binaries) you can override the following settings on a per-OS basis by appending .windows, .mac or .linux to the setting name:

  • vscode-kubernetes.kubectl-path
  • vscode-kubernetes.helm-path
  • vscode-kubernetes.minikube-path

For example, consider the following settings file:

{
  "vscode-kubernetes.kubectl-path": "/home/foo/kubernetes/bin/kubectl",
  "vscode-kubernetes.kubectl-path-windows": "c:\\Users\\foo\\kubernetes\\bin\\kubectl.exe"
}

The first path would be used when invoking kubectl on Mac or Linux machines. The second would be used when invoking kubectl on Windows machines.

Keybinding support

The following commands support arguments in keybindings:

  • Set Kubeconfig (command ID extension.vsKubernetesUseKubeconfig) - the keybinding can specify a string argument which is the kubeconfig file path to switch to. This allows you to set up specific keybindings for your favourite kubeconfigs.

Linters

The extension supports linting Kubernetes YAML files for potential problems or suggestions. Here are the various linters, you can enable or disable them individually using the disable-linters configuration value.

  • resource-limits: Warn when a Pod is missing resource limits
{
  "vs-kubernetes": {
    "disable-linters": [
      "resource-limits"
    ]
  }
}

YAML processing directives

You can customise how the extension processes a YAML file by putting a comment of the form # vscode-kubernetes-tools: ...directive(s)... at the top of the file. The comment must appear before any YAML elements (this saves us having to scan the whole of YAML files that could easily be tens of thousands of lines!). Other comments and blank lines are okay.

The following directives are supported:

  • exclude: Do not treat this file as a Kubernetes manifest. This is useful when you have files that look a lot like Kubernetes manifests but aren't, such as Kustomize patch files.

Extension data

This extension stores its associated files and data in $XDG_STATE_HOME/vs-kubernetes (at ~/.local/state/vs-kubernetes by default). However, if the legacy directory of ~/.vs-kubernetes still exists, then that will be used instead.

Known issues

  • Kubernetes: Debug command currently works only with Go, Node.js, Java, Python and .NET applications
  • For deeply nested Helm charts, template previews are generated against highest (umbrella) chart values (though for Helm: Template calls you can pick your chart)
  • When installing VS Code and/or kubectl through snap on a Linux system, you may face some permissions error which will prevent this extension to work correctly. As a workaround you can set up the vs-kubernetes.enable-snap-flag setting to true in your user or workspace settings.

Release notes

See the change log.

Telemetry

This extension collects telemetry data to help us build a better experience for building applications with Kubernetes and VS Code. We only collect the following data:

  • Which commands are executed, and whether they are executed against an Azure, Minikube or other type of cluster.
  • For the Create Cluster and Add Existing Cluster commands, the cluster type selected and the execution result (success/failure).

We do not collect any information about image names, paths, etc. We collect cluster type information only if the cluster is Azure or a local cluster such as Minikube. The extension respects the telemetry.enableTelemetry setting which you can learn more about in our FAQ.

Running from source

If you are building and running the extension from source, see CONTRIBUTING.md for prerequisites for the development environment.

Installing from VSIX

If you are installing the extension from its VSIX, note that the machine will still need to reach the Visual Studio Marketplace in order to download extension dependencies. If the machine cannot reach the Marketplace, you will need to install these dependencies manually using their VSIXes. The list of extension dependencies can be found in package.json, in the extensionDependencies section.

GitHub Pages Website

This project has a simple landing page website (visible at vscode-kubernetes-tools.github.io/vscode-kubernetes-tools) which is detailed here.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

See Code of Conduct for the standards by which we ask community members to abide.

For technical information about contributing, see CONTRIBUTING.md.

Acknowledgments

This extension was born from the vs-kubernetes extension by @brendandburns and the vs-helm extension by @technosophos.

The 'infer kubectl version' feature was inspired by @jakepearson's k utility (https://github.com/jakepearson/k), and some parts of the design were based on his implementation.

vscode-kubernetes-tools's People

Contributors

ahmadalli avatar amirschw avatar amsoedal avatar andxu avatar apupier avatar bnookala avatar brendandburns avatar carljmosca avatar ederst avatar evanlouie avatar evidolob avatar flowftw avatar flynnduism avatar itowlson avatar ivolzhevbt avatar kameshsampath avatar loligans avatar lstocchi avatar microsoftopensource avatar mikeseese avatar mostafahussein avatar pantosha avatar peterbom avatar remcohaszing avatar sergiogarciadev avatar sethfalco avatar sozercan avatar tatsinnit avatar testforstephen avatar yehiyam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-kubernetes-tools's Issues

UI for 'pick a resource or enter a resource ID'

We have numerous places in the extension where we ask the user to specify a resource in the cluster as the target of a command. At the moment this follows the following workflow:

  1. Is there an open YAML or JSON manifest? Use the ID from that. (Some commands skip this, or will do.)
  2. Display an input box inviting the user to enter a resource ID (e.g. deploy/nginx). If the user types something, use that. If the user leaves it blank, continue to:
  3. Display a pick list of resource types, then, when the user chooses one, display a pick list of resources of that type in the cluster. Use the one that the user chooses.

In Step 2, there is a magic incantation (leave the input box blank and hit Enter) to proceed to Step 3. This is not necessarily obvious. It's been proposed that we should swap Steps 2 and 3 around to avoid this, e.g.:

  1. As before.
  2. Display a pick list of resource types, with a special "Type a resource ID" value. If the user chooses a real resource type, display resources of that type as before. If the user chooses "Type a resource ID", continue to:
  3. Display an input box inviting the user to enter a resource ID (e.g. deploy/nginx) and use that.

The advantage of the proposed UI is that it's much more obvious what you need to do in Step 2 to go to Step 3. The disadvantage is that getting to Step 3 is much more laborious (finding a particular entry in a list, rather than just hitting Enter).

Kubernetes: Run failed with no further direction

Tried Kubernetes: Run and got the notification:
screen shot 2018-03-09 at 11 07 09 am

And here's the message in Output window:
screen shot 2018-03-09 at 11 06 10 am

It would be nice if we can provide further directions to resolve the problem. I could not tell the cause from the error message.

Debug: properly expose secrets to applications

Applications consume secretes differently. Here are two common ways:

  • Secrets as mounted files
  • Secrets as environment variables

The current debugging mechanism won't work for any of the scenarios above because the secrets are not exposed at all. When debugging, there should be a step to allow users to specify the way they want their secrets to be exposed to an application without modifying their app code/dockerfile. This includes:

  • Specify whether to use mounted files or environment variables
  • Specify the mapping between secret data entries and files/environment variables

And the settings should be persisted.

Sync command is hard to understand

The Sync command takes your local repo back to the commit corresponding to the version of the application in the cluster. This is really nice for debugging, hotfixing, etc. However, the command only works properly if the app was deployed using the extension (and therefore uses the magic image tagging convention implemented by the extension), and on failure displays unhelpful messages such as git checkout failed: 1. We should:

  • Review if Sync is the best name for this command
  • Document the broader workflow in which Sync is useful
  • Document the behaviour and the convention it relies on
  • Provide better error messages on failure

Fake error message "Error creating cluster"

When I tried to create a k8s cluster using the wizard:
image

I got the following error at the end:
image

But later I tried to see whether the new cluster is created using:
image

I successfully configured the cluster to my local registry. And I can operate on the nodes:
image

Not sure what the error message was about but seems like it should not be there.

Fix dependency on vscode.startDebug API

The 'debug in cluster' command relies on the vscode.startDebug command. This has been deprecated/removed in favour of a new debugging API. We need to use the new API (and probably change the minimum required version of VS Code to ensure we have the new API - check availability on Linux and Mac). (Ref microsoft/vscode#33795 for info.)

Run Kubernetes command in "TERMINAL" window in VS Code

Directly show and run that command in “TERMINAL” window. For example, I have a Kubernetes cluster which have 2 pods. I select one pod and click “Get”, the command “kubectl get pod/xxx -o wide” will be executed in “TERMINAL” window. And I also could see the output after this command is executed. Such an experience is also adopted by docker extension, maven extension, Ansible extension and others in VS Code.

1

draft up terminal closes without giving user a chance to review output

The extension Draft: Up command dates from an earlier, simpler age when draft up defaulted to watch mode. In this mode it remained running until explicitly terminated. So we could run draft up in a terminal, and the terminal would remain open (and would display activity in real time) until the user Ctrl+C-ed it.

Current releases of draft default to one-off mode, so they exit as soon as the upload has completed. The terminal closes as soon as the draft process exits, so the user never gets a chance to review the output. This makes the user sad.

We should correctly handle both watch and non-watch modes.

Use the azure-account extension when working with Azure

Currently when we need to talk to Azure (for Configure from Cluster and Create Cluster when the user chooses an ACS or AKS cluster), we call the Azure CLI. This requires the Azure CLI to be installed and logged in, and can affect global CLI state (active subscription) which might be different from the VS Code account state if the user is using the azure-account extension (https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account).

We should consider using the azure-account extension and Node.js client instead of the CLI. However, we need to consider the following issues:

  • Extension dependency. Currently we do not require users to install any Azure extensions, or the Azure CLI unless they are using Azure. Many Kubernetes users will be using GKE or their own cluster and will not want "this Azure crap" in their environments. Therefore, we would need to either win over these users (tough because this can be an emotive issue) or move the cloud-specific touchpoints out into a separate extension (requires architectural effort and makes it harder for users to discover the additional extension they need for their cloud).

  • Supported commands. Azure CLI includes commands for retrieving kubectl binaries and credentials from the service. It looks like the AKS REST API provides a way to retrieve credentials (what it calls 'access profiles'), though not as convenient as the CLI; the ACS REST API does not. Worse, neither of these services appears to be surfaced in the current Node.js SDK. So we incur some additional effort rewriting the CLI commands in Node.js.

Brigade support

Need to scope this, but would be good to support the k8s-facing parts of Brigade (not the scripting itself though? Presumably that would be handled by VS Code's existing JS support).

Improve DevEx for command "Kubernetes: Create"

  1. If I open a pom file (any file but not Kubernetes or helm yml file) in my current window, I will get error. It is because "Kubernetes: Create" directly executes against current file.
  2. If no any file in my current window, I will get "no active edtior".

-> Suggest guiding end user open a valid yml file to create corresponding Kubernetes resource

  1. If I open a Kubernetes deployment file, it runs correctly but no progress is shown. Sometimes it took 10 seconds, it is fine. Sometimes it took more than 15 seconds, I feel confused since I don't know what is happening.

-> Suggest showing progress somewhere

image

[Configure from cluster] Unable to connect to the server: net/http: TLS handshake timeout

Reproduce steps:

  1. Use create cluster command to create an aks cluster in east-us.
  2. Then invoke configure from cluster command to configure kubectl context. The configure command succeeded, but then call any kubectl command would get Unable to connect to the server: net/http: TLS handshake timeout.

The reason is that:

  1. create cluster command doesn't wait for the creating operation to finish.
  2. Even though aks cluster is not fully ready, configure from cluster wizard still could list the newly created cluster and execute az aks get-credentails operation. But actually kubectl command would throw errors.

Current extension doesn't provide any tool to help the user to query if the cluster is fully ready. The user needs to login to azure portal to view the status.

Expected: create cluster to wait for the completion of the create. Or before executing az aks get-credentails, calling az aks wait to wait for the cluster to be ready.

Prompt to save document is annoying

Each time I click on a resource node in the explorer, a json file is opened automatically. When I try to close the document, I'm always asked to save to document or not. This is pretty annoying. I actually didn't make any changes to the document. Suggest using ContentProvider to show such documents without asking users to save when closing.

screen shot 2018-03-09 at 11 32 50 am

[Feature] Kubernetes Manifest Authoring - code snippets

Code snippets are templates that make it easier to enter repeating code patterns, such as loops or conditional-statements. You could get an example from https://code.visualstudio.com/docs/editor/userdefinedsnippets.

This feature is to add code snippets for Kubernetes Manifest files.

API references are here - https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#types-kinds
More examples are here - https://github.com/kubernetes/kubernetes/tree/master/examples
HereI list examples for the file of kind:deployment.
Refer to https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/
Refer to https://github.com/egamma/todo-app-java-on-azure/blob/egamma/setup/doc/resources/fabric8/deployment.yml

"Kubernetes: Apply" does not do anything

I create new test deployment file like:

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: test
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
        - command:
            - sh
            - -c
            - while true; do sleep 86400; done
          image: busybox
          name: test
      terminationGracePeriodSeconds: 1

Next I run "Kubernetes: Apply" command and nothing is changed...
I expect deployment creation after this command or even error message.
I can manage my cluster (get logs, deployments, pods, etc.) through this extension so I think config is OK and kubectl is reachable.
Also I have try to open existing deployment, change it and run same command - same effect, nothing is changed.
Maybe I do something wrong?

Explorer not showing any workloads

  • Extension Name: vscode-kubernetes-tools
  • Extension Version: 0.1.3
  • OS Version: Windows_NT x64 10.0.16299
  • VSCode version: 1.19.3

We have written the needed data into your clipboard. Please paste:

{
	"activationTimes": {
		"startup": false,
		"codeLoadingTime": 798,
		"activateCallTime": 36,
		"activateResolvedTime": 0,
		"activationEvent": "onView:extension.vsKubernetesExplorer"
	}
}

The node is shown and the connection seems to work, but no workloads or pods are listed.
Kubernetes Version is:
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.6", GitCommit:"6260bb08c46c31eea6cb538b34a9ceb3e406689c", GitTreeState:"clean", BuildDate:"2017-12-21T06:34:11Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.0+coreos.0", GitCommit:"8031716957d697332f9234ddf85febb07ac6c3e3", GitTreeState:"clean", BuildDate:"2017-03-29T04:33:09Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}

Support kubectl proxy

Would be great to see support for the Kubernetes dashboard viakubectl proxy. I think the idealized behavior here would be:

  1. Invoke kubectl proxy
  2. Either open the user's default browser, or do an HTML preview pane with and navigate to the dashboard address: http://localhost:8001/api/v1/namespaces/kube-system/services/kubernetes-dashboard/proxy/
  3. If we open the preview pane, see if we can hook into a close event on the pane to shut down the proxy after the user is done with it.

Thoughts?

Java debug to support exec form entrypoint

The current Java debugging injects additional JVM parameters through $JAVA_OPTS env var. Environment variables won't be evaluated when users dockerfile is using the exec from ENTRYPOINT statement. Here are the two form s of ENTRYPOINT:

  • ENTRYPOINT ["executable", "param1", "param2"] (exec form, preferred)
  • ENTRYPOINT command param1 param2 (shell form)

Please support both. CMD statement can be used to specify extra parameters to ENTRYPOINT.

Add 'create cluster' command

Initially support AKS (and probably ACS until AKS is GA), but design to make it easy for other contributors to add GKE, EKS, etc. Prompt for location and configuration parameters and kick it off. Option to automatically configure VS Code extension to use the new cluster if that works with the spin-up time.

Please stop writing "WARNING: No active editor during save. Nothing saved." to the Helm output channel

Currently when ANY document is saved and there is no active editor, the extension logs WARNING: No active editor during save. Nothing saved. to the Helm output channel (and forces the output channel to show itself 😢)

This is causing issues with GitLens' new settings editor (since it is a previewHtml -- not an editor) and it saves settings which seems to cause vscode to fire an onDidSaveTextDocument event.

Here is the offending line:
https://github.com/Azure/vscode-kubernetes-tools/blob/43210bbc8edac9cb075a63f26fd51fb11ba3285f/src/extension.ts#L162

Also here is where it is forcing the output panel to show each time something is logged -- I hope this can be removed too.
https://github.com/Azure/vscode-kubernetes-tools/blob/43210bbc8edac9cb075a63f26fd51fb11ba3285f/src/logger.ts#L20

Preview Helm Template: could not resolve template path

Under Windows10 and VSCode 1.20.1 I receive the following error when trying to open the template preview:

Failed template call.Error: could not resolve template path: GetFileAttributesEx c:\Dev\XXXXXXX\deploy\helm\helm\templates\deployment.yaml: The system cannot find the path specified.

It seems that he is looking for the "helm" folder twice, although my templates are located in
c:\Dev\XXXXXXX\deploy\helm\templates\

Kubernetes logs should work for any pod

The current implementation of the kubernetes logs command will attempt to use the current working directory's name as a label selector when fetching pods to view logs from. This can fail if there is no pod that shares the same label as the directory name. See the following stack trace for details…

TypeError: Cannot read property 'metadata' of null
extension.js:492
	at selectPodForApp (/Users/bhargav/code/vscode-kubernetes-tools/out/src/extension.js:708:21)
	at findPodsForApp (/Users/bhargav/code/vscode-kubernetes-tools/out/src/extension.js:715:13)
	at kubectl.invoke (/Users/bhargav/code/vscode-kubernetes-tools/out/src/extension.js:489:13)
	at context.shell.exec.then (/Users/bhargav/code/vscode-kubernetes-tools/out/src/kubectl.js:77:72)
	at <anonymous>

Helm YAML Comments

It seems that this bug from the old 'vscode-helm' project has made it across.

The YAML commenting/uncommenting using the shortcut doesn't use the correct symbol.

[Feature] Helm charter authoring

End user could deploy app to ACS/AKS through helm.
This feature is to help developers write helm charter and validate it in VS Code.

Image published to docker hub without user consent

After running Kubernetes: Run, I found my image published to docker hub without asking. This makes private images public without users acknowledgment and can cause serious privacy issues. We need to ask users whether they agree to upload images to docker hub.

On the other hand, docker hub can be avoided. When minikube is used, local docker registry can be used to store the images without traveling all the way to docker hub.

[Discussion] Dev Experience for Kubernetes yaml recognition or auto-generation

From terminal, developers can run "kubectl create -f xxx.yaml".
Scenario 1: There are Kubernetes manifest files in current workspace
Then once the developer click or type "Kubernetes Create", he/she will see the box asking for the path (the files in current workspace will be listed as options for selection).

Scenario 2: No any Kubernetes manifest file in current workspace.
a. Use Draft, it will create helm charter in the workspace.
b. Select one docker image and let this extension help the developer auto-generate helm charter or manifest file.

Helm if/else snippet is wrong

if/else snippet is:

{{- if condition -}}
  
{{- elseif condition2 -}}
  
{{- else -}}
  
{{- end -}}

Should be:

{{- if condition -}}
  
{{- else if condition2 -}}
  
{{- else -}}
  
{{- end -}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.