/pluto

A cli tool to help discover deprecated apiVersions in Kubernetes

Primary LanguageGoApache License 2.0Apache-2.0

Pluto

Pluto Logo

Find Kubernetes resources that have been deprecated

GitHub release (latest SemVer) GitHub go.mod Go version CircleCI Code Coverage Go Report Card

This is a very simple utility to help users find deprecated Kubernetes apiVersions in their code repositories and their helm releases.

Want to learn more? Reach out on the Slack channel (request invite), send an email to opensource@fairwinds.com, or join us for office hours on Zoom

Purpose

Kubernetes sometimes deprecates apiVersions. Most notably, a large number of deprecations happened in the 1.16 release. This is fine, and it's a fairly easy thing to deal with. However, it can be difficult to find all the places where you might have used a version that will be deprecated in your next upgrade.

You might think, "I'll just ask the api-server to tell me!", but this is fraught with danger. If you ask the api-server to give you deployments.v1.apps, and the deployment was deployed as deployments.v1beta1.extensions, the api-server will quite happily convert the api version and return a manifest with apps/v1. This is fairly well outlined in the discussion in this issue.

So, long story short, finding the places where you have deployed a deprecated apiVersion can be challenging. This is where pluto comes in. You can use pluto to check a couple different places where you might have placed a deprecated version:

  • Infrastructure-as-Code repos: Pluto can check both static manifests and Helm charts for deprecated apiVersions
  • Live Helm releases: Pluto can check both Helm 2 and Helm 3 releases running in your cluster for deprecated apiVersions

Installation

asdf

We have an asdf plugin here. You can install with:

asdf plugin-add pluto
asdf list-all pluto
asdf install pluto <latest version>

Binary

Install the binary from our releases page.

Homebrew Tap

brew install FairwindsOps/tap/pluto

QuickStart

First, follow the install instructions to install pluto.

File Detection in a Directory

Run pluto detect-files -d <DIRECTORY YOU WANT TO SCAN>

You should see an output something like:

$ pluto detect-files -d pkg/finder/testdata
KIND         VERSION              DEPRECATED   DEPRECATED IN   RESOURCE NAME
Deployment   extensions/v1beta1   true         v1.16.0         utilities
Deployment   extensions/v1beta1   true         v1.16.0         utilities

This indicates that we have two files in our directory that have deprecated apiVersions. This will need to be fixed prior to a 1.16 upgrade.

Helm Detection (in-cluster)

$ pluto detect-helm --helm-version 3
KIND          VERSION        DEPRECATED   DEPRECATED IN   RESOURCE NAME
StatefulSet   apps/v1beta1   true         v1.16.0         audit-dashboard-prod-rabbitmq-ha

This indicates that the StatefulSet audit-dashboard-prod-rabbitmq-ha was deployed with apps/v1beta1 which is deprecated in 1.16

You can also use Pluto with helm 2:

$ pluto detect-helm --helm-version=2 -A
KIND         VERSION              DEPRECATED   DEPRECATED IN   RESOURCE NAME
Deployment   extensions/v1beta1   true         v1.16.0         invincible-zebu-metrics-server
Deployment   apps/v1              false        n/a             lunging-bat-metrics-server

Helm Chart Checking (local files)

You can run helm template <chart-dir> | pluto detect --show-all -

This will output something like so:

$ helm template e2e/tests/assets/helm3chart | pluto detect --show-all -
KIND         VERSION              DEPRECATED   DEPRECATED IN   RESOURCE NAME
Deployment   extensions/v1beta1   true         v1.16.0         RELEASE-NAME-helm3chart-v1beta1
Deployment   apps/v1              false        n/a             RELEASE-NAME-helm3chart

Other Usage Options

CI Pipelines

Pluto will exit with a non-zero code if there are any deprecations detected. This can be used in a CI pipeline to make sure no deprecated versions are introduced into your code.

Target Versions

By default, Pluto was designed with deprecations related to Kubernetes v1.16.0. However, as more deprecations are introduced, we will try to keep it updated.

You can target the version you are concerned with by using the --target-version or -t flag. For example:

$ pluto detect-helm --target-version "v1.15.0" --show-all
KIND                VERSION          DEPRECATED   DEPRECATED IN   RESOURCE NAME
StatefulSet         apps/v1beta1     false        v1.16.0         audit-dashboard-prod-rabbitmq-ha

$ echo $?
0

Notice that there is a deprecated version, but it was reported as non-deprecated because it has not yet been deprecated in v1.15.0. This particular run exited 0.