All Projects → mfojtik → k8s-trigger-controller

mfojtik / k8s-trigger-controller

Licence: other
External controller that trigger Kubernetes Deployments on ConfigMap or Secret changes

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to k8s-trigger-controller

Origin
Conformance test suite for OpenShift
Stars: ✭ 8,046 (+17019.15%)
Mutual labels:  openshift, continuous-deployment
Ingressmonitorcontroller
A Kubernetes controller to watch ingresses and create liveness alerts for your apps/microservices in UptimeRobot, StatusCake, Pingdom, etc. – [✩Star] if you're using it!
Stars: ✭ 306 (+551.06%)
Mutual labels:  openshift, controller
hookah
Deploying apps directly from a git push
Stars: ✭ 36 (-23.4%)
Mutual labels:  continuous-deployment
rudder
Application releases based on helm
Stars: ✭ 19 (-59.57%)
Mutual labels:  controller
ControllerAutowire
[DEPRECATED] Use Controller autowiring by default since Symfony 3.3
Stars: ✭ 24 (-48.94%)
Mutual labels:  controller
sharenlearn
A Common File/Resource Sharing Platform for Students & Faculties built using HTML, CSS, Javascript, & Django.
Stars: ✭ 44 (-6.38%)
Mutual labels:  continuous-deployment
webkit-input-range-fill-lower
Customize/styles the native HTML input range controls like the ::-ms-fill-lower property on IE - Pure JS
Stars: ✭ 17 (-63.83%)
Mutual labels:  controller
citadel
Turn an arbitrary command into a Kubernetes Key Management Service GRPC server
Stars: ✭ 15 (-68.09%)
Mutual labels:  openshift
ibm-spectrum-scale-csi-driver
Repository has been moved to: https://github.com/IBM/ibm-spectrum-scale-csi
Stars: ✭ 21 (-55.32%)
Mutual labels:  openshift
SwitchXBOXController
Turn your Nintendo Switch into an XBOX360 controller to play on your Windows computer
Stars: ✭ 46 (-2.13%)
Mutual labels:  controller
Android-CICD
This repo demonstrates how to work on CI/CD for Mobile Apps 📱 using Github Actions 💊 + Firebase Distribution 🎉
Stars: ✭ 37 (-21.28%)
Mutual labels:  continuous-deployment
CodeDroneDIY
The most simple, but working, quadricopter flight controller from scratch, using Arduino Uno/Nano.
Stars: ✭ 68 (+44.68%)
Mutual labels:  controller
docker-openshift-grafana
Grafana Docker Image for use with Red Hat OpenShift
Stars: ✭ 22 (-53.19%)
Mutual labels:  openshift
chuck-norris-streams
Kafka, Debezium and Fuse demonstration based on Chuck Norris movies!
Stars: ✭ 25 (-46.81%)
Mutual labels:  openshift
ProxyInjector
A Kubernetes controller to inject an authentication proxy container to relevant pods - [✩Star] if you're using it!
Stars: ✭ 77 (+63.83%)
Mutual labels:  openshift
ovirt-openshift-extensions
Implementation of flexvolume driver and provisioner for oVirt
Stars: ✭ 32 (-31.91%)
Mutual labels:  openshift
VGamepad
Server-Side Installer & Instructions
Stars: ✭ 19 (-59.57%)
Mutual labels:  controller
repl.deploy
Automatically deploy from GitHub to Replit, lightning fast ⚡️
Stars: ✭ 63 (+34.04%)
Mutual labels:  continuous-deployment
redux-saga-controller
A tool to simplify work with react, redux and redux-saga
Stars: ✭ 18 (-61.7%)
Mutual labels:  controller
kubernetes-conjur-deploy
Scripts for deploying DAP followers to Kubernetes and OpenShift given an existing DAP master cluster
Stars: ✭ 14 (-70.21%)
Mutual labels:  openshift

Travis Licensed under Apache License version 2.0 Docker Automated Build

k8s-trigger-controller

This Kubernetes controller, when installed will let users to configure Secret or ConfigMap names on Deployments that should trigger a rollout of this Deployment when the data inside the Secret or ConfigMap change.

Demo: https://youtu.be/SRDsRZwAdlA

Installation

On Kubernetes, you can run the controller image:

$ kubectl run trigger-controller --image=docker.io/mfojtik/k8s-trigger-controller:latest --generator=deployment/apps.v1beta1

On OpenShift, you have to grant the controller permissions to work properly:

# Create special project and role
$ oc new-project k8s-trigger-controller
$ oc create clusterrole trigger-controller --verb=get,list,update,watch --resource=secrets,configmaps,deployments
$ oc adm policy add-cluster-role-to-user trigger-controller system:serviceaccount:k8s-trigger-controller:default

$ kubectl run trigger-controller --image=docker.io/mfojtik/k8s-trigger-controller:latest --generator=deployment/apps.v1beta1 -n k8s-trigger-controller

Usage

First create Deployment:

$ kubectl run sleeper --image=docker.io/centos:7 --generator=deployment/apps.v1beta1 --command -- /bin/bash -c "sleep infinity"

Create Secret:

$ kubectl create secret generic top-secret --from-literal=foo=bar

Add the Secret into Deployment as a volume (in Kubernetes, edit the Deployment resource)

$ oc volume deployment/sleeper --add --secret-name=top-secret -m /secret

Now, once the trigger controller is running, you can annotate the Deployment to indicate that you want to automatically rollout when the top-secret Secret is changed:

$ kubectl annotate deployment/sleeper trigger.k8s.io/triggering-secrets='top-secret'

You can specify multiple Secrets separated by comma. For ConfigMaps, just use '-configMaps' in the annotation.

Now, when you change the content of the Secret top-secret (kubectl edit secret/top-secret) and change the value of the 'foo' key and save, you should see that a new rollout is triggered automatically.

How it works

When the controller observe Deployment with trigger.k8s.io/triggering-secrets annotation, it will automatically calculate hash of the Secret 'data' field and store it inside the Secret trigger.k8s.io/data-hash annotation.

The it look up the Deployment and check if the ReplicaSet template embedded inside Deployment contain the trigger.k8s.io/[secret|configMap]-NAME-last-hash annotation. This annotation value represents the last observed hash. If the hash differs or the annotation is not present, the controller update the template with the current Secret or ConfigMap hash. Updating the Deployment template will cause the Deployment to rollout new version.

Limitations && TODO

  • Currently only Deployments are supported, StatefulSets and DaemonSets is TBD
  • If secrets or configMaps are updated in bulk, the controller might trigger rollout for every update (you should pause the Deployment in that case)
  • The hash calculation should be more efficient
  • Versioning of ConfigMaps and Secrets is out of scope for this controller

License

k8s-trigger-controller is licensed under the Apache License, Version 2.0.

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].