Sign inSign up

zc2638/drone-k8s-plugin

By zc2638

•Updated almost 4 years ago

Image
0

5.5K

zc2638/drone-k8s-plugin repository overview

⁠drone-k8s-plugin

LICENSE

Drone CI plugin for creating & updating K8s Resources.
This plugin supports all Kubernetes resources and also supports creating/updating Configmaps from config files.

⁠Usage

docker run --rm \
  -e PLUGIN_K8S_SERVER=https://localhost:6443 \
  -e PLUGIN_K8S_TOKEN=<your-token> \
  -e PLUGIN_K8S_SKIP_TLS_VERIFY=true \
  -e PLUGIN_TEMPLATES=testdata/deployment.yaml,testdata/service.yaml \
  -v <your-host-path>:/work/testdata
  zc2638/drone-k8s-plugin
⁠Environments
namerequiredtypedescription
kubernetes_server✔️stringThe address and port of the Kubernetes API server.
k8s_server️stringThe same as kubernetes_server.
kubernetes_token✔️stringToken from ServiceAccount for authentication to the API server. The value must be base64 encoded.
k8s_token️stringThe same as kubernetes_token.
kubernetes_ca_crt️stringCertificate from ServiceAccount for authentication to the API server. The value must be base64 encoded.
k8s_ca_crt️stringThe same as kubernetes_ca_crt.
kubernetes_skip_tls️boolIf true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
k8s_skip_tls️boolThe same as kubernetes_skip_tls_verify.
init_templates️[]stringPath to Kubernetes Resource yaml based definition file (e.g. ConfigMap, Deployment or others), used to initialize some resources.
templates️[]stringPath to Kubernetes Resource yaml based definition file (e.g. ConfigMap, Deployment or others).
config_files️[]stringConfig file paths for automatic creation/update of ConfigMap.The syntax is expressed as namespace:name:file_path:file_name or namespace:name:file_path, when file_name is not specified, it will default to the file name of file_path.
namespace️stringDefault namespace to use when namespace is not set.
debug️boolUsed to enable debug level logging.

⁠Drone Example

---
kind: pipeline
type: docker
name: drone-k8s-plugin-test

steps:
  - name: deploy
    image: zc2638/drone-k8s-plugin
    pull: if-not-exists
    settings:
      k8s_server: https://localhost:6443
      k8s_token:
        from_secret: k8s_token
      k8s_ca_crt:
        from_secret: k8s_ca_crt
      k8s_skip_tls: false
      namespace: default
      init_templates:
        - testdata/namespace.yaml
      config_files:
        - default:test-config:testdata/config.yaml
        - default:test-config:testdata/config.yaml:a.yaml
      templates:
        - testdata/deployment.yaml
        - testdata/service.yaml
        - testdata/*.yaml
      app_name: ${DRONE_REPO_NAME}

OR

kind: pipeline
type: docker
name: drone-k8s-plugin-test

steps:
  - name: deploy
    image: zc2638/drone-k8s-plugin
    pull: if-not-exists
    environment:
      K8S_SERVER: https://localhost:6443
      K8S_TOKEN:
        from_secret: k8s_token
      K8S_SKIP_TLS: true
      NAMESPACE: default
      TEMPLATES: testdata/deployment.yaml,testdata/service.yaml
      APP_NAME: ${DRONE_REPO_NAME}

Tag summary

Content type

Image

Digest

sha256:19b4e085f…

Size

13.3 MB

Last updated

almost 4 years ago

docker pull zc2638/drone-k8s-plugin