/janos

Janos K8s automatic migration tool

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Janos

Janos is a K8s migration tool that update your manifests in order to be compatible with newer versions. It does not work with Helm templates, just with pure yaml files.

License Contributor Covenant

TLDR; Have your Kuberenetes manifests up to date

Table of contents

Overview

Janos will convert all your manifest files, updating it inplace. If you pass a directory as a parameter, it will do a recursive search. All comments are removed, and the file formatting may change.

Installation

Build the image before running the script, because it will be executed inside the container.

# Build image
make build

# Copy entrypoint script to /usr/local/bin
make install

Usage

janos {-d|-f}
-f file       The file to be converted.
-d dir        The directory with the yaml files to be converted.

All the rules are in the file migration.js.

List of Changes

  • 1.16: for Kind: Deployment |Daemonset |Statefulset |ReplicaSet Replace: extensions/v1beta1 | apps/v1beta1 | apps/v1beta2 with apps/v1
  • 1.16: for Kind: Ingress. Replace: extensions/v1beta1 with networking.k8s.io/v1beta1
  • 1.16: for Kind: PodSecurityPolicy. Replace: extensions/v1beta1 |apps/v1beta2 with policy/v1beta1
  • 1.16: Generates the now required spec.selector for Kind Deployment |Daemonset |Statefulset |ReplicaSet (using matchLabels app name, you can read more about these here), only if it doesn't exist
  • 1.17: for Kinds:Role |ClusterRole |RoleBinding |ClusterRoleBinding: Replace rbac.authorization.k8s.io/v1alpha1 | rbac.authorization.k8s.io/v1beta1 with rbac.authorization.k8s.io/v1
  • 1.19: for Kind: HorizontalPodAutoscaler. Replace: autoscaling/v2beta1 with autoscaling/v2beta2
  • 1.21: for ValidatingWebhookConfiguration and MutatingWebhookConfiguration: Replace admissionregistration.k8s.io/v1beta1 with admissionregistration.k8s.io/v1
  • 1.21: for CustomResourceDefinition |TokenReview |SubjectAccessReview |LocalSubjectAccessReview |SelfSubjectAccessReview: Replace apiextensions.k8s.io/v1beta1 with apiextensions.k8s.io/v1
  • 1.21: for CertificateSigningRequest: Replace certificates.k8s.io/v1beta1 with certificates.k8s.io/v1
  • 1.21: for Lease: Replace coordination.k8s.io/v1beta1 with coordination.k8s.io/v1
  • 1.21: for Ingress: Replace extensions/v1beta1 |networking.k8s.io/v1beta1 with networking.k8s.io/v1
  • 1.21: for RBAC: Replace rbac.authorization.k8s.io/v1beta1 with rbac.authorization.k8s.io/v1
  • 1.21: for PriorityClasss: Replace scheduling.k8s.io/v1beta1 with scheduling.k8s.io/v1
  • 1.21: for CSIDriver, CSINode and StorageClass: Replace VolumeAttachmentstorage.k8s.io/v1beta1 with storage.k8s.io/v1

More Info

There is more information about other changes here :). Thanks https://marcincuber.medium.com/

Maintainers