GithubHelp home page GithubHelp logo

flanksource / konfigadm Goto Github PK

View Code? Open in Web Editor NEW
24.0 8.0 14.0 2.22 MB

konfigadm is a declarative configuration management tool and image builder focused on bootstrapping nodes for container-based environments.

Home Page: https://konfigadm.docs.flanksource.com

License: Apache License 2.0

Go 96.83% Shell 0.64% Makefile 1.55% Dockerfile 0.98%
kubernetes docker containers cloud-init containerd kubeadm

konfigadm's Introduction

InstallationKubernetesKey FeaturesCompatibilityDesignPrebuilt Images Full Documentation

konfigadm is a declarative configuration management tool and image builder focused on bootstrapping nodes for container based environments.

Usage

Usage:
  konfigadm [command]

Available Commands:
  apply       Apply the configuration to the local machine
  build-image Build a new image using the specified image and konfig
  cloud-init  Exports the configuration in cloud-init format
  help        Help about any command
  minify      Resolve all lookups and dependencies and export a single config file
  verify      Verify that the configuration has been applied and is in a healthy state
  version     Print the version of konfigadm

Flags:
  -c, --config strings   Config files in YAML or JSON format
  -d, --detect           Detect tags to use
  -h, --help             help for konfigadm
  -v, --loglevel count   Increase logging level
  -t, --tag strings      Runtime tags to use, valid tags: debian,ubuntu,redhat,rhel,fedora,redhat-like,debian-like,centos,aws,vmware
  -e, --var strings      Extra Variables to in key=value format

Installation

Binary

wget -O /usr/bin/konfigadm https://github.com/flanksource/konfigadm/releases/latest/download/konfigadm && chmod +x /usr/bin/konfigadm

Getting Started

Installing Kubernetes on the local machine

sudo konfigadm apply -c - <<-EOF
kubernetes:
  version: 1.21.2
container_runtime:
  type: docker
commands:
  - kubeadm init
EOF

asciicast

Building a kubernetes image

sudo konfigadm images build --image ubuntu1804 -c - <<-EOF
kubernetes:
  version: 1.21.2
container_runtime:
  type: docker
cleanup: true
EOF

Cloud Images are downloaded and then configured with --build-driver 2 drivers are supported:

  1. qemu (default) - Launches the image with KVM and attaches a cloud-init ISO to configure on boot
  2. libguestfs - Uses virt-customize to launch an appliance and chroot into the disk, does not require cloud-init in the image, but also cannot test/verify systemd based services due to the chroot.

asciicast

Features

  • Dependency Free and easily embeddable into an image builder.
  • Declarative, The order of operations cannot be changed, there are no implicit or explicit dependencies between items, no conditionals (besides for os/cloud tags) or control flows
  • Typed, can validate the configuration (e.g. docker image name is valid, systemd.unit file only includes valid keys, and the values are typed correctly)
  • Has built-in higher-order abstractions for kubernetes, containers, cri, cni, etc.
  • Supports multiple operating systems and package managers
  • Abstractions and many of the built-in elements are easily unit-testable due to the use of virtual filesystem and command execution list.
  • Automatic testing / verification based on intent, not just command success code
  • Generate cloud-init or shell scripts to be used by other systems

Compatibility

Compatibility is tested via the docker systemd images created by jrei, All example fixtures are first verified as false, applied, and then verified as true.

To run integration tests:

make ubuntu

TODO

  • Incremental mode
  • Merge duplicate command dependencies (e.g. installing curl)
  • Support templating everywhere (currently only supported in files)
  • Packer/QEMU/VirtualBox/Fusion drivers for building images
  • AMI/OVA Image upload
  • Multi-OS cleanup scripts for building images

konfigadm's People

Contributors

cuonglm avatar dependabot-preview[bot] avatar justinsb avatar karuppiah7890 avatar moshloop avatar paddatrapper avatar philipstaffordwood avatar teodor-pripoae avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

konfigadm's Issues

Dependabot can't resolve your Go dependency files

Dependabot can't resolve your Go dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

github.com/flanksource/konfigadm/cmd: cannot find module providing package github.com/flanksource/konfigadm/cmd

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't parse your go.mod

Dependabot couldn't parse the go.mod found at /go.mod.

The error Dependabot encountered was:

go: github.com/flanksource/[email protected] requires
	github.com/hairyhenderson/gomplate/[email protected] requires
	[email protected] requires
	github.com/Azure/[email protected] requires
	github.com/grpc-ecosystem/[email protected] requires
	gopkg.in/[email protected]: invalid version: git fetch --unshallow -f origin in /opt/go/gopath/pkg/mod/cache/vcs/748bced43cf7672b862fbc52430e98581510f4f2c34fb30c0064b7102a68ae2c: exit status 128:
	fatal: The remote end hung up unexpectedly

View the update logs.

Files: Support deferred loading of large go-getter resources

When generating a cloud-init file some platforms have a size limitation e.g. AWS of 16KB, so support not inlining the resources, but retrieving the resources at runtime using curl, git, aws etc..

runtimeFiles:
    /opt/deploy/: https://github.com/corp/deploy.git

Add kernel option

Essentially make:

kernel: 4.15.0-66

equivalent to

packages:
  - +linux-image-4.15.0-66-generic
  - +linux-headers-4.15.0-66-generic
commands:
   # Update the default boot kernel, ignoring any new kernels that are automatically installed/updated
  - sed 's/GRUB_DEFAULT=.*/GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 4.15.0-66-generic"/' -i /etc/default/grub
  - update-grub

Dependabot can't resolve your Go dependency files

Dependabot can't resolve your Go dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

github.com/flanksource/konfigadm/cmd: cannot find module providing package github.com/flanksource/konfigadm/cmd

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Files: add support for directories

Add support for copying an entire directory structure - Note the / in the path of the file:
Also needs to support #3

files:
    /opt/deploy/: https://github.com/corp/deploy.git

Potential collision and risk from indirect dependence "github.com/gotestyourself/gotestyourself"

Background

Repo flanksource/konfigadm used the old path to import gotestyourself indirectly.
This caused that github.com/gotestyourself/gotestyourself and gotest.tools coexist in this repo:
https://github.com/flanksource/konfigadm/blob/master/go.mod (Line 14 & 28)

github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
gotest.tools v2.2.0+incompatible // indirect 

That’s because the gotestyourself has already renamed it’s import path from "github.com/gotestyourself/gotestyourself" to "gotest.tools". When you use the old path "github.com/gotestyourself/gotestyourself" to import the gotestyourself, will reintroduces gotestyourself through the import statements "import gotest.tools" in the go source file of gotestyourself.

https://github.com/gotestyourself/gotest.tools/blob/v2.2.0/fs/example_test.go#L8

package fs_test
import (
	…
	"gotest.tools/assert"
	"gotest.tools/assert/cmp"
	"gotest.tools/fs"
	"gotest.tools/golden"
)

"github.com/gotestyourself/gotestyourself" and "gotest.tools" are the same repos. This will work in isolation, bring about potential risks and problems.

Solution

  1. Add replace statement in the go.mod file:
replace github.com/gotestyourself/gotestyourself => gotest.tools v2.3.0

Then clean the go.mod.

Verify by default

I think verifying changes by default is nice to do after applying to a "live" environment.
But it is probably a must after applying to an image, since that image is probably the beginning of a longer infrastructure deployment pipeline, and it's important to fail early.

Of course, having an escape hatch is a good idea. For that, I suggest --skip-verify=[true|false] flag.

Discrepancies in various package installation instructions.

There appears to be inconsistency in locating different package versions. e.g version below v0.4.14 appears to have various distros package published and available via the installation url in the README.md but versions above it do not have these packages published. This creates confusion for users trying to install the package as there are discrepancies between the installation instruction and what works. Maintaining the two liner installation steps looks better.

konfigadm apply overriding existing /etc/environment file

konfigadm apply is updating my existing /etc/environment file which is having my proxy info probably because of this

sys.Environment["KUBECONFIG"] = "/etc/kubernetes/admin.conf"

How to reproduce:
Setup /etc/environment with some dummy variables. then give konfigadm apply --config=/tmp/konfigadm.yml. After this cat the /etc/environment and check the variable if you still have dummy variables.

Expected:
konfigadm should append to existing /etc/environment file instead of replacing

Proposal: Remove docs target from all target in Makefile

Currently

$ make

fails due to no access to push docs to the https://github.com/flanksource/konfigadm . Considering many will not have access to the repo, and also, even if they have access, they are not supposed to host the docs by pushing from local, and that's why it's part of the Circle CI job. So, considering that, we could remove the docs target from all, and if anyone wants to run docs, they can use $ make docs

Proposal: Run only test and integration in all

fix circleci, travis-ci and codecov moshloop references

circleci and codecov, moshloop references in should be replaced by flanksource in README.md, index.md and syntax.md

"index.md" replacements required at the below locations:

  • Ln 1 [![CircleCI](https://circleci.com/gh/moshloop/konfigadm.svg?style=svg)](https://circleci.com/gh/moshloop/konfigadm)
  • Ln 2 [![codecov](https://codecov.io/gh/moshloop/konfigadm/branch/master/graph/badge.svg)](https://codecov.io/gh/moshloop/konfigadm)

"syntax.md" replacements required at the below locations:

  • Ln 1 [![Build Status](https://travis-ci.org/moshloop/konfigadm.svg?branch=master)](https://travis-ci.org/moshloop/konfigadm)
  • Ln 2 [![codecov](https://codecov.io/gh/moshloop/konfigadm/branch/master/graph/badge.svg)](https://codecov.io/gh/moshloop/konfigadm)

README.md replacements required at the below locations:

  • Ln 2 <a href="https://circleci.com/gh/moshloop/konfigadm"><img src="https://circleci.com/gh/moshloop/konfigadm.svg?style=svg"></a>
  • Ln 3 <a href="https://codecov.io/gh/moshloop/konfigadm"><img src="https://codecov.io/gh/moshloop/konfigadm/branch/master/graph/badge.svg"></a>

Documentation Error

The installation instruction appears to be missing .deb package. Package Not Found. This is a path issue pointing to moshloop for the requested repository which seemed to have moved to flanksource user.

replace "moshloop.com" reference in README

Add "Full Documentation" content to flanksource.com and update README href

Ln 15 In the README.md is currently <a href="https://www.moshloop.com/konfigadm"> Full Documentation </a>

pre_commands are ran twice

pre_commands:
  - "echo 'hello cloud-init'"
  - 'echo "#Disable root login" >> /etc/ssh/sshd_config'
  - 'echo "PermitRootLogin no" >> /etc/ssh/sshd_config'
  - 'service ssh restart'
$ cat /etc/ssh/sshd_config
...
#Disable root login
PermitRootLogin no
#Disable root login
PermitRootLogin no

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.