Coder Social home page Coder Social logo

hasura / gitkube Goto Github PK

View Code? Open in Web Editor NEW
3.8K 102.0 204.0 36.37 MB

Build and deploy docker images to Kubernetes using git push

License: Apache License 2.0

Go 79.64% Shell 17.96% Makefile 1.07% Dockerfile 1.33%
kubernetes git docker continuous-deployment ci-cd k8s golang developer-tools

gitkube's People

Contributors

bparees avatar coco98 avatar goostleek avatar naseemkullah avatar nashid avatar prateekpandey14 avatar shahidhk avatar tinafanson avatar tirumaraiselvan avatar yld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gitkube's Issues

Who's using Gitkube?

Hi

Gitkube is a new project. We need active feedback. We also want to know who is using gitkube, where it's being used - side projects, inside organizations, some place else?

Please drop in a comment if you are using gitkube and provide any additional details. This will be very helpful!

Auto-detect base image to use if no Dockerfile is found

Summary

In layman's terms: It should be able to allow developers to git push to a gitkube-enabled cluster without a Dockerfile - or so called the "Heroku-style" deployment.

Intro

Heroku's architecture is composed of a dedicated builder for the source, where your project requires a Procfile to determine processes to execute, and a declarative app manifest that includes all the required dependencies and postinstall scripts that the builder will run.

Heroku builds an app using an approach called a Stack-Buildpack approach, whereas:

  • use a Base image that has all the dev dependencies.
  • use a Buildpack: a set of shell scripts that would automate the building and releasing of the code
  • trim dev dependencies from the container and release to the runtime environment.

But in the case for gitkube, we do not need to implement the same flow as Heroku since we can take advantage of the rich Docker ecosystem in Kubernetes.

Process flow

Once the remote recieves the source from the push, it should be able to detect the dockerfile and the manifest, but we should look on two situations:

  • Situation 1: Dockerfile found and manifest found.
    • Use the current flow to dpeloy app.
  • Situation 2: Dockerfile not found but manifest found
    • Try to find manifest (package.json, pom.xml, etc.).
    • Grab image that works for the specific app (package.json is found for example, then use nodejs:latest)
    • then run npm install, and deploy app.
    • run code using npm start or find app.js, index.js, etc.
      • if not found, declare an error and call a back off.

Conclusion

This is not intended to replace how gitkube currently works, rather, it is a enhancement on the current flow, and it allows migrating users from Heroku to their own provisioned Kubernetes cluster.

Feel free to extend this as well, as I only accounted for cases on migrating users from heroku.

Integrate with ECR

ECR currently does not automatically create repositories on push unlike docker hub. How (where) should we handle this logic ?

Support for secret type .dockerconfigjson

First push of gitkube-example on to my local cluster went through fine so I thought of pushing an update and realised that I need to setup the registry to get it working. So, I created a kube secret, with name regsecret, for docker following the instructions on the link in the README of gitkube-example and updated the registry of the example remote to be:

  registry:
    url: "docker.io/sdileep"
    credentials:
      secretKeyRef:
        name: regsecret
        key: .dockercfg

Now when I try to push to the example remote, I get the following error:

remote: WARNING: Error loading config file:/home/default-example/.dockercfg - Invalid Auth config file

So, I updated the registry to be:

  registry:
    url: "docker.io/sdileep"
    credentials:
      secretKeyRef:
        name: regsecret
        key: .dockerconfigjson

.dockerconfigjson field of the secret is the base64 representation of docker credentials - I presumed this is what goes in here.

Now when I try to push to the example remote, I get a timeout. Not sure what the correct config here should be, could you please help? Thanks.

ImageInspectError on installing gitkube (gitkube install) on minikube

Environment ?

minikube version
minikube version: v0.26.1
$ gitkube version
v0.2.0

What did I do?

gitkube install

What I Expected to see?

Gitkube running peacefully

What did I see instead?

$ k get po -n kube-system 
NAME                                    READY     STATUS              RESTARTS   AGE
default-http-backend-ddb2s              1/1       Running             2          2d
etcd-minikube                           1/1       Running             0          26m
gitkube-controller-cc586fcb-zfk8b       0/1       ImageInspectError   0          23m
gitkubed-6dc69968c5-zwqg5               1/1       Running             0          23m
kube-addon-manager-minikube             1/1       Running             2          2d
kube-apiserver-minikube                 1/1       Running             0          26m
kube-controller-manager-minikube        1/1       Running             0          26m
kube-dns-86f4d74b45-9qfxb               3/3       Running             7          2d
kube-proxy-kjncs                        1/1       Running             0          25m
kube-scheduler-minikube                 1/1       Running             2          2d
kubernetes-dashboard-5498ccf677-cxhrm   1/1       Running             6          2d
nginx-ingress-controller-csqzz          1/1       Running             4          2d
storage-provisioner                     1/1       Running             6          2d
tiller-deploy-5f789bd9f7-zmt8g          1/1       Running             2          2d

$ k describe po gitkube-controller-cc586fcb-zfk8b -n kube-system
....
....
Events:
  Type     Reason                 Age                From               Message
  ----     ------                 ----               ----               -------
  Normal   Scheduled              21m                default-scheduler  Successfully assigned gitkube-controller-cc586fcb-zfk8b to minikube
  Normal   SuccessfulMountVolume  21m                kubelet, minikube  MountVolume.SetUp succeeded for volume "gitkube-token-klm4g"
  Warning  Failed                 6m (x71 over 21m)  kubelet, minikube  Error: ImageInspectError
  Warning  InspectFailed          1m (x93 over 21m)  kubelet, minikube  Failed to inspect image "hasura/gitkube-controller:v0.2.0": rpc error: code = Unknown desc = Error response from daemon: readlink /var/lib/docker/overlay2: invalid argument
`

Slow the animated gif a little.

Its useful, but there are some parts that move very quickly. Perhaps its worth remaking/editing it to run a little slower so its easier to take in each of the steps.

Deployment Update Flow

Hey

Just wondering what the best workflow is for when i need to update a deployment without wiping out the image? Right now i need to call:

kubectl get deployment app -o yaml

Copy the whole image into into my deployment.yaml file, and then i can do kubectl apply

Basically my question is: is there a better way to handle all of this, and to make it play nice with gitkube?

Add install instructions for various K8s vendors/distributions

Gitkube runs on most Kubernetes distributions/vendors as per the install instructions in README. But in some cases, there may be more configuration required to correctly setup for e.g. exposing the gitkubed service may require configuring a Loadbalancer manually.

We need to document the instructions (docs/install.md) covering various vendors like GKE, Rancher, kops based installations, etc. In most cases, the instructions should be default instructions as provided in the README and in other cases the additional steps should be mentioned.

Please use this issue to mention any distribution which is not covered by the installation instructions.

Docs on how to update

Now that 0.2.0 is out, how do people upgrade?

I just uninstalled it and installed again, but that resulted in my LB ip changing.

Track latest build tag and patch when image changes for deployments

As mentioned in #71, sometimes a user might need to update the deployment (say kubectl apply) and when it happens, the image name is overwritten.

The controller needs to keep track of latest build tags for deployments in each remote.

When any of these deployments' image field gets updated, controller can patch it to the latest build tag.

So, whenever a new build happends, a relevent key should be updated in Remote.Status. Then controller can watch all the tracked deployments and patch when required.

Deploy to a different cluster

Currently, gitkube deploys to the same cluster where it is running. We should provide support for deploying it to a different cluster.

Sync gitkubed also

Currently, sync happens on remotes.

For consistency, we should sync gitkubed (service and deployment) also

change naming schema for the username and group

Hi,

It seems like naming a remote is subject to certain limitations as groupadd is executed (potentially 32chars?).

Example

apiVersion: gitkube.sh/v1alpha1
kind: Remote
metadata:
  name: app-remote
  namespace: my-really-really-really-long-ns
k logs po/gitkubed
Setting up git remotes
Configuring : my-really-really-really-long-ns-app-remote
Adding user `my-really-really-really-long-ns-app-remote' ...
Adding new group `my-really-really-really-long-ns-app-remote' (1000) ...
groupadd: 'my-really-really-really-long-ns-app-remote' is not a valid group name
adduser: `/usr/sbin/groupadd -g 1000 my-really-really-really-long-ns-app-remote' returned error code 3. Exiting.

Is there any way to overwrite the computed my-really-really-really-long-ns-app-remote identifier so groupadd can run through?

Expose gitkube as NodePort type

I'm trying to experiment with gitkube on a local cluster(not minikube) and hence exposed it as NodePort type service. After creating a remote as per example, I am not able to retrieve the remote URL using $ kubectl get remote example -o json | jq -r '.status.remoteUrl. Am I missing something?

ps: the example worked on GCE without any issues.

Improve e2e test

Currently, the e2e test fails when the following two resources already exist:

Error from server (AlreadyExists): error when creating "STDIN": customresourcedefinitions.apiextensions.k8s.io "remotes.gitkube.sh" already exists
Error from server (AlreadyExists): error when creating "STDIN": clusterrolebindings.rbac.authorization.k8s.io "gitkube" already exists

For the CRD, we just need to ignore the error and for clusterrolebindings we can just use the test namespace name.

Deploy Helm Apps

Requirement

  • Given a the deployment model, specify a Helm Application to be deployed.
  • "Any" application from https://hub.kubeapps.com/ should be deployed automatically.

Design

  • Specify the name of the Helm Chart to deploy
  • Identify the type of ingress instance the cluster contains
    • Use default ingress nginx
    • This provides a default ingress to the cloud provider
  • Identify if the cluster has tls secret
    • This provides HTTPS access to the service
  • Identify if the cluster has external-dns
    • This provides Route53 endpoint to the service

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.