2022-11-08 20:01:01 +08:00
2022-11-08 19:35:32 +08:00
2022-11-08 19:27:35 +08:00
2022-11-08 19:27:35 +08:00
2022-11-08 19:27:35 +08:00
2022-11-08 19:27:35 +08:00
2022-11-08 19:27:35 +08:00
2022-11-08 19:27:35 +08:00
2022-11-08 19:27:35 +08:00
2022-11-08 19:26:48 +08:00
2022-11-08 19:27:35 +08:00
2022-11-08 20:01:01 +08:00

drone-k8s-plugin

LICENSE GitHub Workflow Status

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

name required type description
kubernetes_server ✔️ string The address and port of the Kubernetes API server.
k8s_server string The same as kubernetes_server.
kubernetes_token ✔️ string Token from ServiceAccount for authentication to the API server.
k8s_token string The same as kubernetes_token.
kubernetes_ca_crt string Certificate from ServiceAccount for authentication to the API server.
k8s_ca_crt string The same as kubernetes_ca_crt.
kubernetes_skip_tls bool If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
k8s_skip_tls bool The same as kubernetes_skip_tls_verify.
init_templates []string Path to Kubernetes Resource yaml based definition file (e.g. ConfigMap, Deployment or others), used to initialize some resources.
templates []string Path to Kubernetes Resource yaml based definition file (e.g. ConfigMap, Deployment or others).
config_files []string Config 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 string Default namespace to use when namespace is not set.
debug bool Used 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: token
      k8s_skip_tls: true
      namespace: default
      config_files:
        - default:test-config:testdata/config.yaml
        - default:test-config:testdata/config.yaml:a.yaml
      templates:
        - testdata/deployment.yaml
        - testdata/service.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: token
      K8S_SKIP_TLS: true
      NAMESPACE: default
      TEMPLATES: testdata/deployment.yaml,testdata/service.yaml
      APP_NAME: ${DRONE_REPO_NAME}
S
Description
No description provided
Readme Apache-2.0 96 KiB
Languages
Go 96.8%
Dockerfile 2.4%
Makefile 0.8%