Giter Club home page Giter Club logo

flux-gitlab-controller's Introduction

Flux gitlab controller

This repository implements a simple controller for watching Secrets created by gitlab and calling the API to update the deploy keys the specified repo

Note: go-get or vendor this package as github.com/topfreegames/flux-gitlab-controller.

Details

The sample controller uses client-go library extensively.

Running

Prerequisite: Since the controller uses apps/v1 deployments, the Kubernetes cluster version should be greater than 1.9.

# assumes you have a working kubeconfig, not required if operating in-cluster
go build
./flux-gitlab-controller -gitlab-token $TOKEN -kubeconfig=$HOME/.kube/config

# create a flux secret with the corresponding `fluxcd.io/git-url` and `fluxcd.io/sync-gc-mark` marks
kubectl create -f artifacts/examples/flux_secret.yaml

# Check that the fluxcd.io/deployKeyId has been created in the secret and that the repo contains
# the associated deployment key
kubectl get secret -o yaml flux-git-deploy

You can also set the gitlab-token through the GITLAB_TOKEN env variable if you need an extra layer of security on provisioning secrets to the controller

What happens if someone removes the deployment key from the application repo?

In that case, this controller won't re-create the key as we're not constantly checking for deleted keys to avoid putting too much pressure to the gitlab api.

In order for flux to re-create the key, the fluxcd.io/deployKeyId annotation needs to be removed from the secret so flux realizes that the secret is not synched and will recreate the appropriate key

flux-gitlab-controller's People

Contributors

jvitor03 avatar marcosnils avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jvitor03

flux-gitlab-controller's Issues

Add README

Add README explaining what this project does and how it needs to be configured.

Add tests

As you may have noticed, this repo doesn't have any tests.

Would be awesome to have them :)

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.