Write controller-runtime based k8s controllers that read/write to git, not k8s

Related tags

gitbacked-controller
Overview

Git Backed Controller

The basic idea is to write a k8s controller that runs against git and not k8s apiserver. So the controller is reading and writing objects to git and responding to changes in git. This is accomplished by creating a custom implemenation of the clients and caches in controller-runtime.

Status

This is totally hacked up and just proving an idea. There's most likely a lot of issues with this code. For one the RESTMapping logic is completely wrong as offline you have knowledge if a resource is namespaced or not.

Basic approach

You should just be able to write a controller as normal but in the setup just set the NewClient, NewCache, and MapperProvider to the git based ones.

	git, err := gitbacked.New(ctx, url, gitbacked.Options{
		Branch:       branch,
		SubDirectory: subdir,
		Interval:     interval,
	})
	defer git.Close()

	mgr, err := ctrl.NewManager(&rest.Config{}, ctrl.Options{
		Scheme:         scheme,
		NewClient:      git.NewClient,
		NewCache:       git.NewCache,
		MapperProvider: git.MapperProvider,
	})

Authentication

The controller will pull from and push to the same branch. Right now the code will just call git push so it is expect that that call will work with no user input (ssh keys or some agent based setup is in place).

Example

A more complete example is in the ./example folder.

Owner
Darren Shepherd
Darren Shepherd
A curated list of awesome Kubernetes tools and resources.

Awesome Kubernetes Resources A curated list of awesome Kubernetes tools and resources. Inspired by awesome list and donnemartin/awesome-aws. The Fiery

Tom Huang 881 Sep 22, 2021
go-zero 从零到 k8s 部署

启动: 注意事项: dockerfile 文件配置了 LOCAL_HOST 环境变量 1、项目目录下执行 ./docker.sh 脚本生成 rpc服务docker镜像 ./docker.sh 2、docker-compose-db 创建 mysql redis etcd 容器 执行命令

liukai 51 Sep 23, 2021
A Friendly SSH Jumper Bastion Fortress Server

Felix 中文 Thanks to 360 Total Security and 360-web-platform For Whom BackEnd Engineer Golang SQL RESTful APIs engineer DevOps Engineer People Heavily e

mojocn 610 Sep 20, 2021
Access your Kubernetes Deployment over the Internet

Kubexpose: Access your Kubernetes Deployment over the Internet Kubexpose makes it easy to access a Kubernetes Deployment over a public URL. It's a Kub

Abhishek Gupta 12 Sep 21, 2021
Write controller-runtime based k8s controllers that read/write to git, not k8s

Git Backed Controller The basic idea is to write a k8s controller that runs against git and not k8s apiserver. So the controller is reading and writin

Darren Shepherd 48 Sep 3, 2021
A fluxcd controller for managing remote manifests with kubecfg

kubecfg-operator A fluxcd controller for managing remote manifests with kubecfg This project is in very early stages proof-of-concept. Only latest ima

Pelotech 29 Sep 15, 2021
A k8s vault webhook is a Kubernetes webhook that can inject secrets into Kubernetes resources by connecting to multiple secret managers

k8s-vault-webhook is a Kubernetes admission webhook which listen for the events related to Kubernetes resources for injecting secret directly from sec

Opstree Container Kit 88 Sep 17, 2021
GitHub中文排行榜,帮助你发现高分优秀中文项目、更高效地吸收国人的优秀经验成果;榜单每周更新一次,敬请关注!

榜单设立目的 ???? GitHub中文排行榜,帮助你发现高分优秀中文项目; 各位开发者伙伴可以更高效地吸收国人的优秀经验、成果; 中文项目只能满足阶段性的需求,想要有进一步提升,还请多花时间学习高分神级英文项目; 榜单设立范围 设立1个总榜(所有语言项目汇总排名)、18个分榜(单个语言项目排名);

kon9chunkit 38.7k Sep 23, 2021
Kubernetes Operator for MySQL NDB Cluster.

MySQL NDB Operator The MySQL NDB Operator is a Kubernetes operator for managing a MySQL NDB Cluster setup inside a Kubernetes Cluster. This is in prev

MySQL 6 Sep 6, 2021
kubectl plugin for signing Kubernetes manifest YAML files with sigstore

k8s-manifest-sigstore kubectl plugin for signing Kubernetes manifest YAML files with sigstore ⚠️ Still under developement, not ready for production us

sigstore 16 Sep 16, 2021
ControllerMesh is a solution that helps developers manage their controllers/operators better.

ControllerMesh ControllerMesh is a solution that helps developers manage their controllers/operators better. Key Features Canary update: the controlle

OpenKruise 10 Sep 22, 2021
Lightweight, CRD based envoy control plane for kubernetes

Lighweight, CRD based Envoy control plane for Kubernetes: Implemented as a Kubernetes Operator Deploy and manage an Envoy xDS server using the Discove

null 36 Sep 18, 2021
the simplest testing framework for Kubernetes controller.

KET(Kind E2e Test framework) KET is the simplest testing framework for Kubernetes controller. KET is available as open source software, and we look fo

Riita 15 Sep 17, 2021
Hassle-free minimal CI/CD for git repositories with docker or docker-compose projects.

GIT-PIPE Hassle-free minimal CI/CD for git repos for docker-based projects. Features: zero configuration for repos by default automatic encrypted back

Aleksandr Baryshnikov 50 Sep 16, 2021
Annotated and kubez-autoscaler-controller will maintain the HPA automatically for kubernetes resources.

Kubez-autoscaler Overview kubez-autoscaler 通过为 deployment / statefulset 添加 annotations 的方式,自动维护对应 HorizontalPodAutoscaler 的生命周期. Prerequisites 在 kuber

null 78 Jul 23, 2021
Create diagrams from the Kubernetes API with go-diagrams.

Kubernetes diagrams k8s-diagrams creates diagrams from your kubernetes clusters. You just have to provide a namespace (or not), and you get a picture

Pierre Erraud 81 Aug 3, 2021
Production-Grade Container Scheduling and Management

Kubernetes (K8s) Kubernetes, also known as K8s, is an open source system for managing containerized applications across multiple hosts. It provides ba

Kubernetes 81.1k Sep 22, 2021
k8s-image-swapper Mirror images into your own registry and swap image references automatically.

k8s-image-swapper Mirror images into your own registry and swap image references automatically. k8s-image-swapper is a mutating webhook for Kubernetes

Enrico Stahn 253 Sep 23, 2021