项目作者: kubecd

项目描述 :
Kubernetes Continuous Deployment Toolkit
高级语言: Go
项目地址: git://github.com/kubecd/kubecd.git
创建时间: 2018-04-12T07:16:28Z
项目社区:https://github.com/kubecd/kubecd

开源协议:Apache License 2.0

下载


Kubernetes Continuous Deployment Tool


Go Report Card

kubecd is a deployment tool for Kubernetes that lets you declare in Git what should be deployed in all your
environments, manage image upgrade strategies per service, and make it so. It supports any Kubernetes installation
with some help, but has direct support for GKE or Azure, minikube and Docker, and deployment using Helm or plain kubectl.

Goals

  • Provide a mechanism for defining “environments”, which are namespaces in clusters,
    where developers deploy their apps
  • Allow a layered config mechanism to share environment-specific values among
    Helm charts deployed in the environment (for things like Ingress domain)
  • Build as much as possible on top of existing mainstream tools (kubectl and helm)
  • Support a GitOps workflow by providing a tool with little opinion included,
    allowing you to assemble your pipeline to suit your needs.

Configuring Environments

All the deployable environments are configured in a file typically called
environments.yaml. The schema for this file
can be found here (check the KubeCDConfig struct).

This file must contain two sections/keys, clusters and environments. Each environments maps to one
namespace in one cluster, but the environment names must be unique within this file.

Example:

  1. helmRepos:
  2. - name: stable
  3. url: https://kubernetes-charts.storage.googleapis.com/
  4. clusters:
  5. - name: prod-cluster
  6. provider:
  7. gke:
  8. project: example-com-prod
  9. clusterName: prod-cluster
  10. zone: us-central1-c
  11. - name: test-cluster
  12. provider:
  13. gke:
  14. project: example-com-test
  15. clusterName: test-cluster
  16. zone: us-central1-c
  17. environments:
  18. - name: prod
  19. clusterName: prod-cluster
  20. kubeNamespace: default
  21. releasesFiles:
  22. - common/base-env.yaml
  23. - prod/releases.yaml
  24. defaultValues:
  25. - key: "image.prefix"
  26. value: "gcr.io/example-com-prod/"
  27. - key: "ingress.domain"
  28. value: "prod.example.com"
  29. - name: test
  30. clusterName: test-cluster
  31. kubeNamespace: default
  32. releasesFiles:
  33. - common/base-env.yaml
  34. - test/releases.yaml
  35. defaultValues:
  36. - key: "image.prefix"
  37. value: "gcr.io/example-com-test/"
  38. - key: "ingress.domain"
  39. value: "test.example.com"

Here, we have defined two environments, test and prod, each running in separate GKE clusters in
different GCP projects. We have also set some default helm chart values which will be automatically applied
to every chart deployed into those environments, so that if your chart uses the ingress.domain value to
construct the full Ingress host, you do not have to worry about specifying or overriding that domain part
in every single release/deployment.

Configuring Releases

Once you have your environments defined, you need to configure what should be deployed into each of them.
This is expressed as “releases” (term borrowed from Helm).

A “releases” file contains a list of releases, for example:

  1. releases:
  2. - name: ingress
  3. chart:
  4. reference: stable/nginx-ingress
  5. version: 1.15.0
  6. valuesFile: values-ingress.yaml

See more examples here: releases-common.yaml,
releases-prod.yaml, releases-test.yaml.

Installing and Running

To produce a kcd binary:

  1. make build

Contributing

When submitting PRs, please ensure your code passes gofmt, go vet and go test.

For bigger changes, please create an issue proposing the
change in advance.

Design Document

Can be found here.