Coder Social home page Coder Social logo

gitopsbuilder's Introduction

GitOps-Builder

GitOps-Builder is an innovative Kubernetes operator that shifts the paradigm of continuous integration processes from being event-driven to a GitOps-centric approach. It leverages the GitOps Toolkit from Flux to craft CI pipelines based on GitOps principles.

This tool primarily focuses on DockerBuild operations, enabling users to execute docker build and docker push commands within a repository hosting a Dockerfile.

Introduction

To get started with GitOps-Builder, ensure you have the GitOps Toolkit installed on your Kubernetes cluster. For those new to Flux, begin your journey at https://fluxcd.io/docs/get-started/ for a comprehensive guide.

Setting Up

IMPORTANT: Ensure Docker is running on your system to execute the controller locally.

Follow these steps to install Flux on your Kubernetes cluster:

flux install

Next, enable port forwarding to the source-controller artifacts server:

kubectl -n flux-system port-forward svc/source-controller 8080:80

Set the SOURCE_CONTROLLER_LOCALHOST environment variable:

export SOURCE_CONTROLLER_LOCALHOST=localhost:8080

To run GitOps-Builder locally, execute:

make install
make run

Quick Guide

Establish a DockerHub Repository

Initiate by creating a gitops-builder-example repository on DockerHub.

Configure a Git Repository Source

Define a source object linking to a Git repository that houses your application and a Dockerfile:

apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
  name: example
  namespace: default
spec:
  interval: 5m
  url: https://github.com/jash2105/GitOpsBuilder
  ref:
    branch: main

Docker Hub Secret Creation

Generate a Docker Hub secret with your DockerHub credentials and server address.

kubectl create secret generic dockerhub-credentials \
--from-literal=username=yourusername \
--from-literal=password=yourpassword \
--from-literal=server="https://index.docker.io/v1/"

Resulting Secret:

apiVersion: v1
data:
  password: cGFzc3dvcmQ=
  server: aHR0cHM6Ly9pbmRleC5kb2NrZXIuaW8vdjEv
  username: dXNlcm5hbWU=
kind: Secret
metadata:
  name: dockerhub-credentials
  namespace: default

Setting Up a DockerBuild

Establish a DockerBuild resource that refers to the previously configured GitRepository.

apiVersion: build.contrib.flux.io/v1alpha1
kind: DockerBuild
metadata:
  name: example
  namespace: default
spec:
  interval: 5m
  buildMode: buildPush
  sourceRef:
    kind: GitRepository
    name: example
  containerRegistry:
    repository: <yourusername>/gitops-builder-example
    tagStrategy: commitSHA
    authConfigRef:
      name: dockerhub-credentials
      namespace: default

Development Notes

To run make test, you must set DOCKERBUILD_USERNAME, DOCKERBUILD_PASSWORD, and DOCKERBUILD_SERVER as environment variables to perform docker push operations to an existing registry.

make DOCKERBUILD_USERNAME="yourusername" DOCKERBUILD_PASSWORD="yourtoken" DOCKERBUILD_SERVER="docker-server-address" test

gitopsbuilder's People

Contributors

jash2105 avatar

Watchers

 avatar

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.