All Projects → hickeyma → Helm Mapkubeapis

hickeyma / Helm Mapkubeapis

Licence: apache-2.0
This is a Helm plugin which map deprecated or removed Kubernetes APIs in a release to supported APIs

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Helm Mapkubeapis

Microbean Helm
A Java API for Helm, the Kubernetes package manager.
Stars: ✭ 99 (-36.94%)
Mutual labels:  helm-charts, helm
Okteto
Develop your applications directly in your Kubernetes Cluster
Stars: ✭ 1,937 (+1133.76%)
Mutual labels:  hacktoberfest, helm
Quiz
Example real time quiz application with .NET Core, React, DDD, Event Sourcing, Docker and built-in infrastructure for CI/CD with k8s, jenkins and helm
Stars: ✭ 100 (-36.31%)
Mutual labels:  helm-charts, helm
Helm Elasticstack
Kubernetes Helm Charts and Tools to run Elastic Stack(ELK) on Azure Container Service(AKS)
Stars: ✭ 76 (-51.59%)
Mutual labels:  helm-charts, helm
Captain
A Helm 3 Controller
Stars: ✭ 129 (-17.83%)
Mutual labels:  helm-charts, helm
Helm Charts
Kubernetes Helm Charts for the Center for Open Science
Stars: ✭ 88 (-43.95%)
Mutual labels:  helm-charts, helm
Mattermost Helm
Mattermost Helm charts for Kubernetes
Stars: ✭ 107 (-31.85%)
Mutual labels:  helm-charts, hacktoberfest
Helm Charts
Prometheus community Helm charts
Stars: ✭ 962 (+512.74%)
Mutual labels:  helm-charts, helm
K8s
Kubernetes Helm Charts for the ORY ecosystem.
Stars: ✭ 127 (-19.11%)
Mutual labels:  helm-charts, helm
Helm Elasticsearch
An Elasticsearch cluster on top of Kubernetes, made easier, with Helm.
Stars: ✭ 124 (-21.02%)
Mutual labels:  helm-charts, helm
Video Transcode Queue
A sample video upload platform as a kubernetes cluster (WIP)
Stars: ✭ 66 (-57.96%)
Mutual labels:  helm-charts, helm
Aws Ssm
Populates Kubernetes Secrets from AWS Parameter Store
Stars: ✭ 150 (-4.46%)
Mutual labels:  helm-charts, helm
Helm Secrets
DEPRECATED A helm plugin that help manage secrets with Git workflow and store them anywhere
Stars: ✭ 1,129 (+619.11%)
Mutual labels:  helm-charts, helm
Helm Charts
Helm Charts for Jaeger backend
Stars: ✭ 94 (-40.13%)
Mutual labels:  helm-charts, helm
Kubelabs
Kubernetes - Beginners | Intermediate | Advanced
Stars: ✭ 1,115 (+610.19%)
Mutual labels:  hacktoberfest, helm
Unfork
Kubectl plugin to find forked Helm Charts and other K8s resources and unfork them with Kustomize
Stars: ✭ 106 (-32.48%)
Mutual labels:  helm-charts, helm
Stock Analysis Engine
Backtest 1000s of minute-by-minute trading algorithms for training AI with automated pricing data from: IEX, Tradier and FinViz. Datasets and trading performance automatically published to S3 for building AI training datasets for teaching DNNs how to trade. Runs on Kubernetes and docker-compose. >150 million trading history rows generated from +5000 algorithms. Heads up: Yahoo's Finance API was disabled on 2019-01-03 https://developer.yahoo.com/yql/
Stars: ✭ 605 (+285.35%)
Mutual labels:  helm-charts, helm
Helmsman
Helm Charts as Code
Stars: ✭ 854 (+443.95%)
Mutual labels:  helm-charts, helm
Helm Chart
A store of Helm chart tarballs for deploying JupyterHub and BinderHub on a Kubernetes cluster
Stars: ✭ 123 (-21.66%)
Mutual labels:  helm-charts, helm
Charts
JFrog official Helm Charts
Stars: ✭ 148 (-5.73%)
Mutual labels:  helm-charts, helm

Helm mapkubeapis Plugin

License Go Report Card CircleCI Release

mapkubeapis is a Helm v2/v3 plugin which updates in-place Helm release metadata that contains deprecated or removed Kubernetes APIs to a new instance with supported Kubernetes APIs. Jump to background to the issue for more details on the problem space that the plugin solves.

Note: Charts need to be updated also to supported Kubernetes APIs to avoid failure during deployment in a Kubernetes version. This is a separate task to the plugin.

Prerequisite

  • Helm client with mapkubeapis plugin installed on the same system
  • Access to the cluster(s) that Helm manages. This access is similar to kubectl access using kubeconfig files. The --kubeconfig, --kube-context and --namespace flags can be used to set the kubeconfig path, kube context and namespace context to override the environment configuration.
  • If you try and upgrade a release with unsupported APIs then the upgrade will fail. This is ok in Helm v3 as it will not generate a failed release for Helm. However, Helm v2 does produce a failed release. This needs to be removed before running the plugin on the release. The command to remove the failed release version is: kubectl delete configmap/secret <release_name>.v<latest_version_number> --namespace <tiller_namespace>
  • The plugin updates the lastest release version. The latest release version should be in a deployed state as you want to update a successful deployment. If it is not then you need to delete the latest release version. The command to remove a release version is:
    • Helm v2: kubectl delete configmap/secret <release_name>.v<latest_version_number> --namespace <tiller_namespace>
    • Helm v3: kubectl delete configmap/secret sh.helm.release.v1.<release_name>.v<latest_version_number> --namespace <release_namespace>

Install

Based on the version in plugin.yaml, release binary will be downloaded from GitHub:

$ helm plugin install https://github.com/hickeyma/helm-mapkubeapis
Downloading and installing helm-mapkubeapis v0.0.1 ...
https://github.com/hickeyma/helm-mapkubeapis/releases/download/v0.0.1/helm-mapkubeapis_0.0.1_darwin_amd64.tar.gz
Installed plugin: mapkubeapis

For Windows (using WSL)

Helm's plugin install hook system relies on /bin/sh, regardless of the operating system present. Windows users can work around this by using Helm under WSL.

$ wget https://get.helm.sh/helm-v3.0.0-linux-amd64.tar.gz
$ tar xzf helm-v3.0.0-linux-amd64.tar.gz
$ ./linux-amd64/helm plugin install https://github.com/hickeyma/helm-mapkubeapis

Usage

Map Helm deprecated or removed Kubernetes APIs

Map release deprecated or removed Kubernetes APIs in-place:

$ helm mapkubeapis [flags] RELEASE 

Flags:
      --dry-run                  simulate a command
  -h, --help                     help for mapkubeapis
      --kube-context string      name of the kubeconfig context to use
      --kubeconfig string        path to the kubeconfig file
      --mapfile string           path to the API mapping file (default "config/Map.yaml")
      --namespace string         namespace scope of the release. For Helm v2, this is the Tiller namespace (e.g. kube-system)
  -s, --release-storage string   for Helm v2 only - release storage type/object. It can be 'secrets' or 'configmaps'. This is only used with the 'tiller-out-cluster' flag (default "secrets")
      --tiller-out-cluster       for Helm v2 only - when Tiller is not running in the cluster e.g. Tillerless
      --v2                       run for Helm v2 release (default is Helm v3)

Example output:

$ helm mapkubeapis v2-oldapi --namespace kube-system --v2
2020/04/17 13:05:45 Release 'v2-oldapi' will be checked for deprecated or removed Kubernetes APIs and will be updated if necessary to supported API versions.
2020/04/17 13:05:45 Get release 'v2-oldapi' latest version.
2020/04/17 13:05:45 Check release 'v2-oldapi' for deprecated or removed APIs...
2020/04/17 13:05:45 Found deprecated or removed Kubernetes API:
"apiVersion: apps/v1beta1
kind: Deployment"
Supported API equivalent:
"apiVersion: apps/v1
kind: Deployment"
2020/04/17 13:05:45 Found deprecated or removed Kubernetes API:
"apiVersion: extensions/v1beta1
kind: Ingress"
Supported API equivalent:
"apiVersion: networking.k8s.io/v1beta1
kind: Ingress"
2020/04/17 13:05:45 Finished checking release 'v2-oldapi' for deprecated or removed APIs.
2020/04/17 13:05:45 Deprecated or removed APIs exist, updating release: v2-oldapi.
2020/04/17 13:05:45 Set status of release version 'v2-oldapi.v1' to 'superseded'.
2020/04/17 13:05:45 Release version 'v2-oldapi.v1' updated successfully.
2020/04/17 13:05:45 Add release version 'v2-oldapi.v2' with updated supported APIs.
2020/04/17 13:05:45 Release version 'v2-oldapi.v2' added successfully.
2020/04/17 13:05:45 Release 'v2-oldapi' with deprecated or removed APIs updated successfully to new version.
2020/04/17 13:05:45 Map of release 'v2-oldapi' deprecated or removed APIs to supported versions, completed successfully.

API Mapping

The mapping information of deprecated or removed APIs to supported APIs is configured in the Map.yaml file. The file is a list of entries similar to the following:

 - deprecatedAPI: "apiVersion: extensions/v1beta1\nkind: Deployment"
    newAPI: "apiVersion: apps/v1\nkind: Deployment"
    deprecatedInVersion: "v1.9"
    removedInVersion: "v1.16"

The plugin when performing update of a Helm release metadata first loads the map file from the config directory where the plugin is run from. If the map file is a different name or in a different location, you can use the --mapfile flag to specify the different mapping file.

The OOTB mapping file is configured as follows:

  • The search and replace strings are in order with apiVersion first and then kind. This should be changed if the Helm release metadata is rendered with different search/replace string.
  • The strings contain UNIX/Linux line feeds. This means that \n is used to signify line separation between properties in the strings. This should be changed if the Helm release metadata is rendered in Windows or Mac.
  • Each mapping contains the Kubernetes version that the API is deprecated and removed in. This information is important as the plugin checks that the deprecated version (uses removed if deprecated unset) is later than the Kubernetes version that it is running against. If it is then no mapping occurs for this API as it not yet deprecated in this Kubernetes version and hence the new API is not yet supported. Otherwise, the mapping can proceed.

Note: The Helm release metadata can be checked by following the steps in:

Background to the issue

For details on the background to this issue, it is recommended to read the docs appropriate to your Helm version. The docs can be accessed as follows:

The Helm documentation describes the problem when Helm releases that are already deployed with APIs that are no longer supported. If the Kubernetes cluster (containing such releases) is updated to a version where the APIs are removed, then Helm becomes unable to manage such releases anymore. It does not matter if the chart being passed in the upgrade contains the supported API versions or not.

This is what the mapkubeapis plugin resolves. It fixes the issue by mapping releases which contain deprecated or removed Kubernetes APIs to supported APIs. This is performed inline in the release metadata where the existing release is superseded and a new release (metadata only) is added. The deployed Kubernetes resources are updated automatically by Kubernetes during upgrade of its version. Once this operation is completed, you can then upgrade using the chart with supported APIs.

Developer (From Source) Install

If you would like to handle the build yourself, this is the recommended way to do it.

You must first have Go v1.13 installed, and then you run:

$ mkdir -p ${GOPATH}/src/github.com
$ cd $_
$ git clone [email protected]:hickeyma/helm-mapkubeapis.git
$ cd helm-mapkubeapis
$ make
$ export HELM_LINTER_PLUGIN_NO_INSTALL_HOOK=true
$ helm plugin install <your_path>/helm-mapkubeapis

That last command will use the binary that you built.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].