Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/naorlivne/drone-kubernetes-apply
Run kubernetes apply as a drone plugin with variables injection built into the kubernetes YAML file
https://github.com/naorlivne/drone-kubernetes-apply
ci ci-cd drone drone-ci drone-plugin kube kubectl kubernetes kubernetes-deployment python python3
Last synced: about 1 month ago
JSON representation
Run kubernetes apply as a drone plugin with variables injection built into the kubernetes YAML file
- Host: GitHub
- URL: https://github.com/naorlivne/drone-kubernetes-apply
- Owner: naorlivne
- License: lgpl-3.0
- Created: 2020-02-11T09:17:37.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-27T10:57:18.000Z (over 1 year ago)
- Last Synced: 2023-03-04T05:09:23.945Z (over 1 year ago)
- Topics: ci, ci-cd, drone, drone-ci, drone-plugin, kube, kubectl, kubernetes, kubernetes-deployment, python, python3
- Language: Python
- Homepage:
- Size: 234 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
> **Warning**
> Drone cloud stopped working for months and as the developers of Drone seemed to stop caring I'm no longer able to fully test this nor will I longer have any use of it, as a result I'm stopping all development of this plugin.# drone-kubernetes-apply
CI/CD build status: [![Build Status](https://cloud.drone.io/api/badges/naorlivne/drone-kubernetes-apply/status.svg)](https://cloud.drone.io/naorlivne/drone-kubernetes-apply)
Code coverage: [![codecov](https://codecov.io/gh/naorlivne/drone-kubernetes-apply/branch/master/graph/badge.svg)](https://codecov.io/gh/naorlivne/drone-kubernetes-apply)
Drone plugin for deploying to [kubernetes](https://kubernetes.io/) that allows injecting variables into the kubernetes YAML files & supports everything kubectl supports inside said YAML by running `kubectl apply` for you.
## Usage
This plugin can be used to deploy applications to a Kubernetes cluster, it will create\update the given kubernetes deployments/cron jobs/pods/etc as needed.
The below pipeline configuration demonstrates simple usage:
> In addition to the `.drone.yml` file you will need to create a `injected_deployment.yaml` file that contains the kubernetes configuration you want to deploy.
```yaml
kind: pipeline
type: docker
name: defaultsteps:
- name: kubernetes_deploy
image: naorlivne/drone-kubernetes-apply
settings:
kubernetes_token: my...vary...long...kube...token
kubernetes_api_host: https://mykubecluster.example.com
kubernetes_yaml_file: injected_deployment.yaml
```### Value substitution
Example configuration with values substitution:
```yaml
kind: pipeline
type: docker
name: defaultsteps:
- name: kubernetes_deploy
image: naorlivne/drone-kubernetes-apply
settings:
kubernetes_token: my...vary...long...kube...token
kubernetes_api_host: https://mykubecluster.example.com
kubernetes_yaml_file: injected_deployment.yaml
my_image_tag: my_dynamic_image
```In the `injected_deployment.yaml` file (please note the $ before the PLUGIN_MY_IMAGE_TAG key):
```yaml
{
...
"image": "myrepo/myimage:$PLUGIN_MY_IMAGE_TAG",
...
}
```will result in:
```yaml
{
...
"image": "myrepo/myimage:my_dynamic_image",
...
}
```## Parameter Reference
#### kubernetes_api_host
The kubernetes API server URL (no trailing slash should be used), alternately mount a kubeconfig into the container `/root/.kube/config`
#### kubernetes_token
The token used to auth against the kubernetes API, alternately mount a kubeconfig into the container `/root/.kube/config`
#### kubernetes_yaml_file
The kubernetes deployment configuration file location relative to the root folder of the repo, defaults to `injected_deployment.yaml`