Skip to content

Create, update and delete Digitalocean Kubernetes Clusters.

Installing

Use this resource by adding the following to the resource_types section of your pipeline config:

1
2
3
4
5
6
---
resource_types:
- name: kubernetes-resource
  type: docker-image
  source:
    repository: kdihalas/digitalocean-kubernetes-resource:v2

See concourse docs for more details on adding resource_types to a pipeline config.

Configuration (Check)

Check communicates with the Digitalocean API to make sure that your configuration is correct.

---
resources:
- name: cluster
  type: kubernetes-resource
  source:
    token: 17365b6cf3b3586b6a....
    region: lon1
    tags:
      - ci
    node_pools:
      - name: worker-pool
        size: "s-1vcpu-2gb"
        count: 1
        tags:
          - worker

Options

Option Required Description
token Digitalocean token with read/write access. You can read how to create one here.
region Set the region in which you want to deploy the kubernetes cluster.
tags A list of tags for the cluster.
skip Used only in get_params under Put
node_pools A list with the node pools you want to deploy for your cluster.

Node Pools options

Option Required Description
name Name of the node pool
size Size of the nodes in the node pool
count How many nodes will be in the pool
tags A list of tags for the nodes in the node pool

Get (In)

Provision a new cluster in Digitalocean and save the cluster ID and the cluster kubeconfig under the resource directory.

Generated artifacts:

  • cluster/cluster_id
  • cluster/kubeconfig
---
resources:
- name: cluster
  type: kubernetes-resource
  source:
    token: 17365b6cf3b3586b6a....
    region: lon1
    tags:
      - ci
    node_pools:
      - name: worker-pool
        size: "s-1vcpu-2gb"
        count: 1
        tags:
          - worker

jobs:
- name: create-cluster
  plan:
  - get: cluster
    params:
      name: cluster1
      version: 1.13.1-do.2

Params:

Option Required Description
name Name of the cluster
version Version Slug of kubernetes cluster to deploy,

Put (Out)

Update or delete a kubernetes cluster. Needs to be run after Get since it depends in some artifacts generated by it.

Delete

---
resources:
- name: cluster
  type: kubernetes-resource
  source:
    token: 17365b6cf3b3586b6a....
    region: lon1
    tags:
      - ci
    node_pools:
      - name: worker-pool
        size: "s-1vcpu-2gb"
        count: 1
        tags:
          - worker

jobs:
- name: delete-cluster
  plan:
  - put: cluster
    params:
      name: cluster1
      delete: true
    get_params:
      name: cluster1
      skip: true

Params:

Option Required Description
name Name of the cluster
delete If delete is true then the cluster will be deleted

Update

---
resources:
- name: cluster
  type: kubernetes-resource
  source:
    token: 17365b6cf3b3586b6a....
    region: lon1
    tags:
      - ci
    node_pools:
      - name: worker-pool
        size: "s-1vcpu-2gb"
        count: 1
        tags:
          - worker

jobs:
- name: scale-cluster
  plan:
  - put: cluster
    params:
      name: cluster1
      node_pools:
        - name: worker-pool
          count: 3
    get_params:
      name: cluster1
      skip: true

Params:

Option Required Description
name Name of the cluster
node_pools A list with the node pools you want to update

Node Pools options

Option Required Description
name Name of the node pool
count How many nodes will be in the pool

Container Verification

To verify the container signature you will need to install cosign and run

COSIGN_EXPERIMENTAL=1 cosign verify kdihalas/digitalocean-kubernetes-resource:v2