{ "info": { "author": "Phivos Stylianides", "author_email": "stphivos@gmail.com", "bugtrack_url": null, "classifiers": [], "description": ".. image:: https://img.shields.io/pypi/v/bg-kube.svg\n :target: https://pypi.python.org/pypi/bg-kube\n\n.. image:: https://travis-ci.org/stphivos/bg-kube.svg\n :target: https://travis-ci.org/stphivos/bg-kube\n\n.. image:: https://codecov.io/github/stphivos/bg-kube/coverage.svg\n :target: https://codecov.io/github/stphivos/bg-kube\n\n*******\nbg-kube\n*******\nAn interface for automating blue-green deployments on a Kubernetes cluster.\n\n**Please note that this project is in initial development and it's not ready for production use yet.\nUse with caution in a test/staging environment.**\n\nFeatures\n========\n* Publish/Rollback functions.\n* Dynamic variables in YAML configuration files.\n* Smoke tests for health checking before promoting a new environment.\n* Easily extensible to support multiple cloud providers (other than just GKE and AWS/kops).\n* Minimal setup/resources - does not live in the cloud and can be invoked from a CI service like Travis.\n\nWorkflow\n========\n1. Builds and tags a container image from a Dockerfile using ``docker build`` command.\n2. Pushes the tagged image to the container registry (GCR and ECR only at this point).\n3. Creates a ``Job`` workload for the database migrations (Optional - should be backwards compatible).\n4. Creates a ``Deployment`` workload using the new image.\n5. Creates a ``Service`` for health checking which runs the specified smoke tests command (Optional).\n * If the tests were successful, it updates the public ``Service`` workload to point to the new deployment.\n * If the tests have failed, the public service remains unaffected.\n\nInstallation\n============\n::\n\n $ pip install bg-kube\n\nPrerequisites\n=============\n\n* `Docker `_\n* `Kubernetes command-line tool `_\n\nGoogle Kubernetes Engine\n------------\n* `Create project `_\n* `Create cluster `_\n* `Install SDK `_\n* Login using ``gcloud init``\n* Select project using ``gcloud config set project ``\n\nAWS using kops\n--------------\n* `Install AWS CLI `_\n* `Install kops CLI `_\n* `Setup environment `_\n\nMinimal configurations example\n==============================\n\nService Config - Public\n-----------------------\n.. code-block:: yaml\n\n apiVersion: v1\n kind: Service\n metadata:\n annotations:\n external-dns.alpha.kubernetes.io/hostname: $DOMAIN_NAME.\n labels:\n run: $SERVICE_RUN_LABEL\n name: $SERVICE_NAME\n namespace: default\n spec:\n ports:\n - protocol: TCP\n port: $SERVICE_PORT\n targetPort: $CONTAINER_PORT\n selector:\n run: $SERVICE_RUN_LABEL\n color: $COLOR\n type: pod\n type: LoadBalancer\n\n\nService Config - Health Checks\n------------------------------\n.. code-block:: yaml\n\n apiVersion: v1\n kind: Service\n metadata:\n labels:\n run: $SERVICE_RUN_LABEL\n name: $SMOKE_SERVICE_NAME\n namespace: default\n spec:\n ports:\n - protocol: TCP\n port: $SERVICE_PORT\n targetPort: $CONTAINER_PORT\n selector:\n run: $SERVICE_RUN_LABEL\n color: $COLOR\n type: pod\n type: LoadBalancer\n\n\nDeployment Config\n-----------------\n.. code-block:: yaml\n\n apiVersion: extensions/v1beta1\n kind: Deployment\n metadata:\n labels:\n color: $COLOR\n run: $SERVICE_RUN_LABEL\n name: $DEPLOYMENT_NAME-$COLOR\n namespace: default\n spec:\n replicas: 2\n selector:\n matchLabels:\n color: $COLOR\n run: $SERVICE_RUN_LABEL\n template:\n metadata:\n labels:\n run: $SERVICE_RUN_LABEL\n color: $COLOR\n tag: \"$TAG\"\n type: pod\n spec:\n containers:\n - command: [\"gunicorn\", \"django_app.wsgi\", \"--name\", \"todoapp\", \"-b\", \":$CONTAINER_PORT\"]\n env:\n - name: ENV\n value: $ENV\n - name: DB_URL\n value: $DB_URL\n image: $IMAGE_NAME:$TAG\n name: $CONTAINER_NAME\n ports:\n - containerPort: $CONTAINER_PORT\n protocol: TCP\n\nenv\n---\n::\n\n ENV=prod\n DB_URL=postgres://user:pass@1.2.3.4:5432/todoapp\n\n IMAGE_NAME=gcr.io/todoapp-12345/todo-api\n CONTAINER_PORT=8000\n CONTAINER_NAME=cnt-todo-api\n\n PROJECT_NAME=todoapp-12345\n CLUSTER_NAME=todoapp-cluster\n CLUSTER_ZONE=us-central1-a\n DOMAIN_NAME=todoapp.example.com\n\n SERVICE_PORT=80\n SERVICE_NAME=svc-todo-api\n SERVICE_CONFIG=./config/service.yaml\n SERVICE_RUN_LABEL=todo-api\n\n DEPLOYMENT_NAME=dep-todo-api\n DEPLOYMENT_CONFIG=./config/deployment.yaml\n\nPublish using\n-------------\n::\n\n $ bg-kube --env-file .env.prod publish\n\nArguments\n---------\n::\n\n positional arguments:\n {publish,rollback,build,push}\n command_args\n\n optional arguments:\n -h, --help: show this help message and exit\n -e ENV_FILE, --env-file ENV_FILE: .env file for the options below and application vars in the configs\n -c CLUSTER_NAME, --cluster-name CLUSTER_NAME: unique name of the cluster\n -z CLUSTER_ZONE, --cluster-zone CLUSTER_ZONE: zone name of the cluster location\n -m DOCKER_MACHINE_NAME, --docker-machine-name DOCKER_MACHINE_NAME: name of the docker machine if applicable\n --docker-build-args DOCKER_BUILD_ARGS arguments supplied to docker build command separated with spaces\n -i IMAGE_NAME, --image-name IMAGE_NAME: name of the container image to build using docker\n -s SERVICE_NAME, --service-name SERVICE_NAME: name of the main service intended to serve clients\n --service-config SERVICE_CONFIG: config of the main service\n --service-timeout SERVICE_TIMEOUT timeout secs to wait for healthy state or return an error\n --deployment-config DEPLOYMENT_CONFIG config of the deployment containing the main service pods\n --deployment-timeout DEPLOYMENT_TIMEOUT timeout secs to wait for healthy state or return an error\n -x CONTEXT, --context CONTEXT: docker context path used to build the container image\n -d DOCKERFILE, --dockerfile DOCKERFILE: Dockerfile path\n --smoke-service-config SMOKE_SERVICE_CONFIG config of the smoke service lb exposed for health checks\n --smoke-tests-command SMOKE_TESTS_COMMAND: shell command to run health checks against the smoke service\n --db-migrations-job-config-seed DB_MIGRATIONS_JOB_CONFIG_SEED: job config to populate the database with initial data\n --db-migrations-job-timeout DB_MIGRATIONS_JOB_TIMEOUT timeout secs to wait for healthy state or return an error\n --db-migrations-status-command DB_MIGRATIONS_STATUS_COMMAND: shell command executed on any of the running deployment pods to return the current migrations status\n --db-migrations-apply-command DB_MIGRATIONS_APPLY_COMMAND: shell command executed on any of the running deployment pods to apply the latest migrations generated in the current image\n --db-migrations-rollback-command DB_MIGRATIONS_ROLLBACK_COMMAND: shell command executed on any of the running deployment pods with the migrations status command stdout as argument - retrieved before applying migrations, to perform a rollback to that state\n --kops-state-store KOPS_STATE_STORE: aws cluster state storage bucket name\n --container-registry CONTAINER_REGISTRY: container registry alias or implementation class \n\nFuture Improvements\n===================\n* Checks to enforce database migrations are backwards compatible\n* Support for more cloud providers\n* Better test coverage\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/stphivos/bg-kube", "keywords": "Kubernetes microservices blue-green GKE AWS Kops CI/CD Continuous integration delivery deployment", "license": "", "maintainer": "", "maintainer_email": "", "name": "bg-kube", "package_url": "https://pypi.org/project/bg-kube/", "platform": "", "project_url": "https://pypi.org/project/bg-kube/", "project_urls": { "Homepage": "https://github.com/stphivos/bg-kube" }, "release_url": "https://pypi.org/project/bg-kube/0.0.14/", "requires_dist": null, "requires_python": "", "summary": "An interface for automating blue-green deployments using Kubernetes", "version": "0.0.14" }, "last_serial": 3573293, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "57df366c3ad5a08a771cc7a511907050", "sha256": "e64fa41f9744aa2f70c9e876ea12dcc1cd852a150d4259856de77aa89d2b9240" }, "downloads": -1, "filename": "bg-kube-0.0.1.tar.gz", "has_sig": false, "md5_digest": "57df366c3ad5a08a771cc7a511907050", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4451, "upload_time": "2017-11-09T19:14:25", "url": "https://files.pythonhosted.org/packages/86/6f/e14970694fbc4c0eb34a5db2dee4b458527dbefc7c8f0f7489aa961c5f2e/bg-kube-0.0.1.tar.gz" } ], "0.0.10": [ { "comment_text": "", "digests": { "md5": "b0b67a6a82a523050455bccec673fc29", "sha256": "bd60a8ab43835722e47ccd9d53e9b26c48a2fc8667ca1d07ddf6a475ab988b3b" }, "downloads": -1, "filename": "bg-kube-0.0.10.tar.gz", "has_sig": false, "md5_digest": "b0b67a6a82a523050455bccec673fc29", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9940, "upload_time": "2017-11-18T18:12:43", "url": "https://files.pythonhosted.org/packages/44/06/1bbac7d8b9a602edb1bd9c706012a0084378cde0d288dfb642ab85d250dc/bg-kube-0.0.10.tar.gz" } ], "0.0.11": [ { "comment_text": "", "digests": { "md5": "5bb33dc3eb64bf2a82003f6382216a11", "sha256": "4646f2302da6cccb812e35b21f46349bdfd3b35d892e8e87ae2a3805c7caa7dc" }, "downloads": -1, "filename": "bg-kube-0.0.11.tar.gz", "has_sig": false, "md5_digest": "5bb33dc3eb64bf2a82003f6382216a11", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9966, "upload_time": "2017-11-22T03:51:10", "url": "https://files.pythonhosted.org/packages/1b/3f/69a35761e722ad86a630c6bf77bb3a2b24063ea922cd0e062a36622a1f97/bg-kube-0.0.11.tar.gz" } ], "0.0.12": [ { "comment_text": "", "digests": { "md5": "53013c517b52a5b89384983f3c2d6eeb", "sha256": "2fa9e5fa900dc335f2176a7db82f988428fa9d3348d1c5bcc4b0d54fcc665845" }, "downloads": -1, "filename": "bg-kube-0.0.12.tar.gz", "has_sig": false, "md5_digest": "53013c517b52a5b89384983f3c2d6eeb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11232, "upload_time": "2017-11-30T16:00:25", "url": "https://files.pythonhosted.org/packages/21/59/a5ff4222f24463bd07dc2c84f67ac37551be85d29e89cd480f7b1dc43cee/bg-kube-0.0.12.tar.gz" } ], "0.0.13": [ { "comment_text": "", "digests": { "md5": "dffcee6fcc23d1580596934a632a317e", "sha256": "1c67dd59b9dc5f3a9a840d010d99f675db18a8d5e4670453b1c49fa9d72455dc" }, "downloads": -1, "filename": "bg-kube-0.0.13.tar.gz", "has_sig": false, "md5_digest": "dffcee6fcc23d1580596934a632a317e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13006, "upload_time": "2018-02-08T16:43:59", "url": "https://files.pythonhosted.org/packages/99/8c/0aff22b192eeb16d2ee5663ccd35f546ed2f09ce43116e71985a5318ddef/bg-kube-0.0.13.tar.gz" } ], "0.0.14": [ { "comment_text": "", "digests": { "md5": "9e3098129905bad10f159fd2a1226d87", "sha256": "2cfdd7eba0e5a6c441e6c4104a5f7def6cb780e2948d469db850833a91db57ec" }, "downloads": -1, "filename": "bg-kube-0.0.14.tar.gz", "has_sig": false, "md5_digest": "9e3098129905bad10f159fd2a1226d87", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12998, "upload_time": "2018-02-12T01:57:50", "url": "https://files.pythonhosted.org/packages/94/46/afed37550cd272170d951ca121d182eabf8951db9a209df0078693a6e8cb/bg-kube-0.0.14.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "f5e1a0a12a14554bccdbc3cc822dc6fa", "sha256": "38084d9c239351d2f6da6d66b73c2b9e6f57377fce8dfa0bd4f37217225c32ff" }, "downloads": -1, "filename": "bg-kube-0.0.2.tar.gz", "has_sig": false, "md5_digest": "f5e1a0a12a14554bccdbc3cc822dc6fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4527, "upload_time": "2017-11-10T01:32:25", "url": "https://files.pythonhosted.org/packages/43/4a/1f8de43158c7c38882ad8197bd9c5ce13ee944c7ffba8dfdd72a02c92954/bg-kube-0.0.2.tar.gz" } ], "0.0.2.1": [ { "comment_text": "", "digests": { "md5": "206618ce10264eb82839fcb64962be96", "sha256": "cb0d06e15f8fde32950ed4f0a2fcf4f97db1b137ec139e949b701a001cbf777e" }, "downloads": -1, "filename": "bg-kube-0.0.2.1.tar.gz", "has_sig": false, "md5_digest": "206618ce10264eb82839fcb64962be96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4566, "upload_time": "2017-11-10T01:33:35", "url": "https://files.pythonhosted.org/packages/98/ae/1fbb206e9b3f0219c03919116ee242e27a244ce3b7afe62a76ef484f6756/bg-kube-0.0.2.1.tar.gz" } ], "0.0.2.2": [ { "comment_text": "", "digests": { "md5": "0ea6bdfc106217b0778719173e83871c", "sha256": "2129092e2386c9af21d9a06793fbcf22d4895d8b94190c037fe55d41be083da1" }, "downloads": -1, "filename": "bg-kube-0.0.2.2.tar.gz", "has_sig": false, "md5_digest": "0ea6bdfc106217b0778719173e83871c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5250, "upload_time": "2017-11-10T01:37:57", "url": "https://files.pythonhosted.org/packages/ef/c9/a301056597ed133feff792454c1f707d6fee203abd22588263546ef022b1/bg-kube-0.0.2.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "2646ad0c995031150c7adfb4a92207bc", "sha256": "b3941575d29fc0cad3ef16941f6d391524eb8478a1d606b5ce17ff4ad0847d45" }, "downloads": -1, "filename": "bg-kube-0.0.3.tar.gz", "has_sig": false, "md5_digest": "2646ad0c995031150c7adfb4a92207bc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5245, "upload_time": "2017-11-10T01:42:05", "url": "https://files.pythonhosted.org/packages/c0/3d/d8e80f5a7fe8472aff9d2bba22bea257dd5fbbfb204fba46727ee75d6136/bg-kube-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "1607c5b2b264daf8826ca8ac60b57019", "sha256": "abdc1edf2861c9f43a8d6fdfdcb31add3ccd181883cd734d69d3487b73061da4" }, "downloads": -1, "filename": "bg-kube-0.0.4.tar.gz", "has_sig": false, "md5_digest": "1607c5b2b264daf8826ca8ac60b57019", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5395, "upload_time": "2017-11-10T01:47:59", "url": "https://files.pythonhosted.org/packages/db/31/c386f737127f5f6821cb52deddaa04b057c5511a7837be354ba08ff8865b/bg-kube-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "8952c06c969c38a94de634e1467d3b3c", "sha256": "d9d860ad1ff69a3a0fbcd247f66590dd5cbaf8e6f35a2c6d50656d3713530e5c" }, "downloads": -1, "filename": "bg-kube-0.0.5.tar.gz", "has_sig": false, "md5_digest": "8952c06c969c38a94de634e1467d3b3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5781, "upload_time": "2017-11-10T17:01:16", "url": "https://files.pythonhosted.org/packages/8c/ae/4a02a4b3cca05f706e81896da654b3e63bee7e7ad7476123577abdcd7b33/bg-kube-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "15bbb50fcbe4243a7790ba3057850ce0", "sha256": "a92729cb0e397279b4c3f8a9fac687baf67640c4bd358d437da8d60269630652" }, "downloads": -1, "filename": "bg-kube-0.0.6.tar.gz", "has_sig": false, "md5_digest": "15bbb50fcbe4243a7790ba3057850ce0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5828, "upload_time": "2017-11-11T00:04:14", "url": "https://files.pythonhosted.org/packages/fe/10/88939496cd08acc9f4a651e241cbab4d8c1bebc06db759304bbe59e2b09a/bg-kube-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "48e919437fc90cfe3dc2a09a91cc384a", "sha256": "3919bb7965fe39e12a3a2d484d2056e2ec77e44c20e1b06bf78858ba21195e78" }, "downloads": -1, "filename": "bg-kube-0.0.7.tar.gz", "has_sig": false, "md5_digest": "48e919437fc90cfe3dc2a09a91cc384a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7311, "upload_time": "2017-11-11T03:40:47", "url": "https://files.pythonhosted.org/packages/d9/21/518910f323466977bf16960edd9c935661672d4a0599ea41463ce9fac1f5/bg-kube-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "2b6f17f4d7816850010d08287ff70508", "sha256": "ef45d980c566231fea5866dc9bb1b38e23121e5a730522f6c76a6649c393276a" }, "downloads": -1, "filename": "bg-kube-0.0.8.tar.gz", "has_sig": false, "md5_digest": "2b6f17f4d7816850010d08287ff70508", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7367, "upload_time": "2017-11-13T18:13:01", "url": "https://files.pythonhosted.org/packages/1a/8b/15c1643b89259fe93f8dd6a83f4e1668881b66451f6d0137206472020cec/bg-kube-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "2a42f283279e1877732e20623d7d1ac2", "sha256": "f344454112081e6a488995b575d8a7ca24b24b1714ce81977226618f88956855" }, "downloads": -1, "filename": "bg-kube-0.0.9.tar.gz", "has_sig": false, "md5_digest": "2a42f283279e1877732e20623d7d1ac2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8373, "upload_time": "2017-11-16T17:10:17", "url": "https://files.pythonhosted.org/packages/53/e5/e95ac276392871a1113b7dc4555b94fbc5a513035ba492a66f0d04dbf069/bg-kube-0.0.9.tar.gz" } ], "0.0.9.1": [ { "comment_text": "", "digests": { "md5": "45469acd6188cd0bf76e82ac63e1f424", "sha256": "24f896d8d11734c0a671afafcf48a49c53de6004536cbd6b21ebd22d642dacc8" }, "downloads": -1, "filename": "bg-kube-0.0.9.1.tar.gz", "has_sig": false, "md5_digest": "45469acd6188cd0bf76e82ac63e1f424", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9485, "upload_time": "2017-11-18T17:58:58", "url": "https://files.pythonhosted.org/packages/d2/d9/66e33e4b1f83b8b5bc6d19ab6e5e92a65abba5319aaf716c8d984ce4d912/bg-kube-0.0.9.1.tar.gz" } ], "0.0.9.2": [ { "comment_text": "", "digests": { "md5": "58c1a4d78278e84df0e579a76c762355", "sha256": "9260049d54bce008c39aa09d2370e86d15d7caac10a4e272fb7452666c86dadb" }, "downloads": -1, "filename": "bg-kube-0.0.9.2.tar.gz", "has_sig": false, "md5_digest": "58c1a4d78278e84df0e579a76c762355", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9948, "upload_time": "2017-11-18T18:10:08", "url": "https://files.pythonhosted.org/packages/03/de/fbdaf5a5e0dd281a8cbf28aa654dd0e9726c2379b195bca99e837f8b3639/bg-kube-0.0.9.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9e3098129905bad10f159fd2a1226d87", "sha256": "2cfdd7eba0e5a6c441e6c4104a5f7def6cb780e2948d469db850833a91db57ec" }, "downloads": -1, "filename": "bg-kube-0.0.14.tar.gz", "has_sig": false, "md5_digest": "9e3098129905bad10f159fd2a1226d87", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12998, "upload_time": "2018-02-12T01:57:50", "url": "https://files.pythonhosted.org/packages/94/46/afed37550cd272170d951ca121d182eabf8951db9a209df0078693a6e8cb/bg-kube-0.0.14.tar.gz" } ] }