rk

command module
v0.0.0-...-631245b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL