All Projects → tumblr → K8s Config Projector

tumblr / K8s Config Projector

Licence: apache-2.0
Create Kubernetes ConfigMaps from configuration files

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to K8s Config Projector

tichi
TiChi ☯️ contains the tidb community collaboration automation basic framework and tool set.
Stars: ✭ 36 (-40.98%)
Mutual labels:  ci, cd, k8s
awesome
A curated list of delightful developers resources.
Stars: ✭ 13 (-78.69%)
Mutual labels:  ci, cd, k8s
Opendevops
CODO是一款为用户提供企业多混合云、一站式DevOps、自动化运维、完全开源的云管理平台、自动化运维平台
Stars: ✭ 2,990 (+4801.64%)
Mutual labels:  ci, cd, k8s
github-task-manager
receive github hook, notify agent, receive task results, notify github
Stars: ✭ 13 (-78.69%)
Mutual labels:  ci, cd, k8s
Awx Container
Ansible Container project that manages the lifecycle of AWX on Docker.
Stars: ✭ 294 (+381.97%)
Mutual labels:  ci, cd
Nvwa Io
Nvwa-io is a open source DevOps CI/CD auto-build and auto-deploy system(女娲 - 开源 DevOps CI/CD 自动构建和自动部署系统). http://nvwa-io.com
Stars: ✭ 283 (+363.93%)
Mutual labels:  ci, cd
Teamvision
Teamvision软件工程协作工具
Stars: ✭ 380 (+522.95%)
Mutual labels:  ci, cd
Github Actions Golang
GitHub Actions as CI for Go
Stars: ✭ 672 (+1001.64%)
Mutual labels:  ci, cd
Gitlab Ci Pipeline Php
☕️ Docker images for test PHP applications with Gitlab CI (or any other CI platform!)
Stars: ✭ 451 (+639.34%)
Mutual labels:  ci, cd
Abstruse
Abstruse is a free and open-source CI/CD platform that tests your models and code.
Stars: ✭ 704 (+1054.1%)
Mutual labels:  ci, cd
Metac
It is metacontroller and more
Stars: ✭ 50 (-18.03%)
Mutual labels:  ci, cd
Ultima
An open source, Infrastructure-as-Code cloud platform with built-in CI and local development environment.
Stars: ✭ 18 (-70.49%)
Mutual labels:  ci, cd
Abs cd
CI/CD for the Arch build system with webinterface.
Stars: ✭ 48 (-21.31%)
Mutual labels:  ci, cd
bx-docker
Tutorial on how to build Docker Images for the IAR Build Tools on Linux hosts. The IAR Build Tools on Linux are available for Arm, RISC-V and Renesas (RH850, RL78 and RX).
Stars: ✭ 28 (-54.1%)
Mutual labels:  ci, cd
Horusec
Horusec is an open source tool that improves identification of vulnerabilities in your project with just one command.
Stars: ✭ 311 (+409.84%)
Mutual labels:  ci, cd
rust-azure-pipelines
Collection of azure pipelines templates for rust
Stars: ✭ 43 (-29.51%)
Mutual labels:  ci, cd
Lambdacd
a library to define a continuous delivery pipeline in code
Stars: ✭ 655 (+973.77%)
Mutual labels:  ci, cd
Cimonitor
Displays CI statuses on a dashboard and triggers fun modules representing the status!
Stars: ✭ 34 (-44.26%)
Mutual labels:  ci, cd
changie
Automated changelog tool for preparing releases with lots of customization options
Stars: ✭ 180 (+195.08%)
Mutual labels:  ci, cd
makes
A DevSecOps framework powered by Nix.
Stars: ✭ 158 (+159.02%)
Mutual labels:  ci, cd

k8s-config-projector

Turn configuration files on disk into structured Kubernetes ConfigMaps

GitHub release Travis (.org) Docker Automated build Docker Build Status MicroBadger Size Docker Pulls Docker Stars Godoc

What is this?

At Tumblr, we have many sources for logical configuration data that defines how deployed services operate. Some of these sources are rapidly changing, some are updated automatically, and some are changed by humans. Because we always strive to limit complexity in our stack, we wanted to come up with a way that applications can be made aware of these changes as they happen, without becoming tightly coupled to our internal processes. Additionally, because there are many configuration sources (git repos, bots, cronjobs, tools like Collins, etc), and we wanted to write tools to manipulate this configuration data after being generated, we generate intermediary representations in a config git repo. However, because each application has very unique needs for what data it requires to run (eg TLS certs, comma separated lists of host names, env vars, specifically formatted JSON or YAML), we needed a method to transform the common configuration files into formats each application could consume or further process, without hardcoding configuration into our images, or requiring a rebuild/redeploy of the app each time configuration data changes. To accomplish this task, we built the k8s-config-projector.

In a nutshell

The k8s-config-projector is a program to project config files from disk into Kubernetes ConfigMaps through Continuous Integration (CI). The ConfigMaps can be applied to a k8s cluster with kubectl apply -f <filename> (or create+replace) during Continuous Delivery (CD). These ConfigMaps can then be consumed by applications in Kubernetes, by mounting them as volumes or environment variables inside pods.

This is quite useful to inform applications in Kubernetes about changing configuration. For example, this can be used to discover the nodes participating in a memcached ring, configure an application with feature flags, etc.

To use this tool, it is expected that:

  1. You have some configuration data (YAML/JSON/raw files) you want to get into your pods without baking them into the Docker images
  2. That configuration data comes from some files on disk (we call this the "config repo").
  3. The files are either binary blobs, or YAML/JSON structured data
  4. You have some CI/CD mechanism you want to hook up to, so ConfigMaps are automatically generated and updated when you merge changes to your config repo

If you want to use this to manage secrets, you should check out k8s-secret-projector instead!

+--------------------------+
|                          |
| Projection Mappings Repo +-------------+ YAML Projection
| (--manifests)            |             | Manifests
|                          |             |
+--------------------------+             |
                                         |
                                         |
+-----------------+                  +---v--------------------+                       +------------------+
|                 |  config sources  |                        |                       |                  |
| Config Repo     +------------------>                        | generates configmaps  | Output Directory |
| (--config-repo) |                  |  k8s-config-projector  +-----------------------> (--output)       |
|                 |                  |                        |                       |                  |
+-----------------+                  |                        |                       +---------+--------+
                                     +------------------------+                                 |
                                                                                                |
                                                                                                |
                                                                                                | creates ConfigMaps
                                                        +----------------------+                | in Kubernetes
                                                        |                      |                |
                                                        |  kubectl create -f   <----------------+
                                                        |                      |
                                                        +----------------------+

Functionality

The projector can:

  • Take raw files and stuff them into a ConfigMap
  • Glob files in your config repo, and stuff ALL of them in your configmap
  • Extract fields from your structured data (yaml/json)
  • Create new structured outputs from a subset of a yaml/json source by pulling out some fields and dropping others
  • Translate back and forth between JSON and YAML (convert a YAML source to a JSON output, etc)
  • Support for extracting complex fields like objects+arrays from sources, and not just scalars!

Documentation

You should get started by checking out some example projection manifests.

Hacking

Check out hacking.md for how to build this!

Run

Requirements

  1. Have your --config-repo checked out, and location in ${CONFIG_REPO}
  2. Have your path to your projection mappings (--manifests) in ${MANIFESTS_REPO}
  3. Create an ${OUTPUT_DIR} to keep the generated manifests the tool spits out

Running with Docker

$ docker run -it --rm \
    -v "${OUTPUT_DIR}:/output" \
    -v "${MANIFESTS_REPO}:/manifests:ro" \
    -v "${CONFIG_REPO}:/config:ro" \
    tumblr/k8s-config-projector:latest

Collect your generated ConfigMaps in ${OUTPUT_DIR}!

Running from binary

$ make && ./bin/k8s-config-projector --debug --manifests=${MANIFESTS_REPO} --config-repo=${CONFIG_REPO}  --output=${OUTPUT_DIR}
...

Collect your generated ConfigMaps in ${OUTPUT_DIR}!

How to use ConfigMap in a pod

Example config map:

apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: test-config-1
  namespace: foo-bar
data:
  test_config.txt: |
    this is a config file with a whole bunch of stuff
    to show that configs can be any form
    blah
    blah
    blah

Example pod config:

apiVersion: v1
kind: Pod
metadata:
  name: test-pod1
  namespace: mynamespace
spec:
  containers:
    - name: busybox-test
      image: k8s.gcr.io/busybox
      command: [ "/bin/sh", "-c", "cat /etc/config/test-config.txt" ]
      volumeMounts:
      - name: config-volume
        mountPath: /etc/config
  volumes:
    - name: config-volume
      configMap:
        name: test-config-1
        items:
        - key: test_config.txt
          path: test-config.txt
  restartPolicy: Never

Limitations

There are a few things to note when using the Config Projector. They are actually limits of Kubernetes/etcd, but it still is useful to be aware of them.

  • ConfigMaps cannot be over 1M. Because ConfigMaps are stored in Kubernetes API, the ConfigMaps are backed by etcd. This has a 1M limit of each object stored.
  • Internally, kubectl apply creates annotations, which has a size limit of 256K. This translates to a ConfigMap that can't be over ~512K. If you want to avoid this, use kubectl create instead.

For reference, these are size limits discussions:

License

Apache 2.0

Copyright 2019, Tumblr, Inc.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].