GithubHelp home page GithubHelp logo

clarkezone / rk Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 153 KB

Simple tool to refactor a Kubernetes manifest into kustomize format

License: Apache License 2.0

Go 92.87% Makefile 6.44% Shell 0.69%

rk's Introduction

rk

Coverage Status

Simple tool to refactor a Kubernetes manifest set into kustomize format structured for dev, prod, release.

This is WIP. Very WIP!

HELLOWORLD: minimal golang app with tests that compiles

  • go package setup with folder structure, main, module init
  • makefile, gitignore, dockerignore, editorconfig
  • dummy refactor command using cobra including unit test
  • github actions for tests / linting targeting PR's
  • enable coverage in VSCode UI
  • go linting
  • all other linting
  • coveralls badge
  • Precommit

Scenario: take a non-kustomize manifest set and create a version using bases and overlays for dev, prod, staging in a namespace with an app set using crosscutting fields that renders correctly with kubectl kustomize -k

  1. rk -makeoverlay dev, staging, prod -source .
  2. Create basic folder structure
  3. move existing yaml files
  4. add missing kustomize files using golang templates

Goal: Inner loop

  • setup .exe to point at actual thing we're trying to solve hard coded
  • setup input test dir
  • setup build command in make file
  • setup UT infra: empty test, prep/clean, dirs
  • build dir creation logic
  • integration test that calls kubectl kustomize ./
  • build manifest templated add logic
  • verify against jekyll project
  • verify on mac (switch to local)

Scenario: createlayers functionality

  • Goal: make UT pass for DoMakeOverlay

  • Goal: Make command get it's stuff from cmdline to call DoMakeOverlay

    • Add Cobra root command
    • Add version command
      • Fix version string
    • Add layers create with flags and help
      • Fix output flag
      • create output dir if doesn't exist
      • ignore it if inside source
      • Support no output flag passed in with absolute sourcedir
      • Support . for sourcedir
      • source should have at least 1 k8s manifest.. if none do not create output folders
      • updateoutput with confirm
      • test for updateoutput
    • Make command to install with version
  • Goal: fix CI official build based on tags

    • Investigate dyff releaser
    • Add missing badges
  • Goal: add suggestions to make authoring overrides easier in overlay layer

    • Add commented out reference in respective overlay folder
    • Refactor writeOverlayKustTemplate so that path concatenation is inside function
    • write patch file into overlay directory (increase replicas)
    • write patch file into overlay directory (set memory for all containers)
    • update integration test to test overlays - [x] Helper to call dyff library using source and dest path for single file compare - [x] Helper to recurse of tree calling above
    • implement functions to get deployment name and container names from manifests
      • get deployment name using kyaml
      • get container names using kyaml
      • write unit test for function to get deployment and container names
  • Scenario: add kustomize to bare manifests Scenario: prep MVP release

  • Goal: get CD using same matrixed build versions. Hook up download counter to build

  • Goal: BadgeApp clean

  • Goal: write documentation for initial scenarios

  • handle different log levels

  • gate on codecoverage thresholds

  • converge CI build with make script

  • show build badges ()

Blocking bugs

  1. prompting output exists when it doesn't
  2. presense of a config folder with items with .yaml causes error
  3. if manifests are not name deployment.yaml, service.yaml etc breaks

figure out

  1. how to test multiple cobra commands / switch structures
  2. how to run integration test in GA or circleci

Backlog: Scenario: implement function to strip ?hard-coded app name/namespaces from original manifests write unit test for namespace stripping with yaml comparison with known failure case Scenario: kubectl create deployement then clean write integration test for MakeOverlay that compares output with known good yaml that runs in prod to test functional correctness command to add a kustomization.yaml and populate with all validd manifests. If one exists, update manifest list based on what's in dir Add colorization to output Output shows treestructure that was created If there is a namespace file used to create namespace, patch that with passed in namespace If there is no namespace file, createone CLEANUP existing manifests: strip redundant namespace fields Enable limits optionally via flag.

rk's People

Contributors

clarkezone avatar

Watchers

 avatar  avatar

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.