-
Notifications
You must be signed in to change notification settings - Fork 582
/
Copy pathkubeconfig-creator.yaml
86 lines (84 loc) · 3.11 KB
/
kubeconfig-creator.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: kubeconfig-creator
labels:
app.kubernetes.io/version: "0.1"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/categories: Deployment, Kubernetes
tekton.dev/tags: deploy
tekton.dev/displayName: "kubeconfig creator"
tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le"
spec:
description: >-
This Task do a similar job to the Cluster PipelineResource and
are intended as its replacement.
This task creates a kubeconfig file that can be used to configure access
to the different clusters. A common use case for this task is to deploy your
application/function on different clusters. The task will use the kubeconfigwriter
image and the provided parameters to create a kubeconfig file that can be used by
other tasks in the pipeline to access the target cluster.
params:
- name: name
description: name of the cluster
type: string
- name: url
description: address of the cluster
type: string
- name: username
description: username for basic authentication to the cluster
type: string
- name: password
description: password for basic authentication to the cluster
type: string
default: ""
- name: cadata
description: contains PEM-encoded certificate authority certificates
type: string
default: ""
- name: clientKeyData
description: contains PEM-encoded data from a client key file for TLS
type: string
default: ""
- name: clientCertificateData
description: contains PEM-encoded data from a client cert file for TLS
type: string
default: ""
- name: namespace
description: default namespace to use on unspecified requests
type: string
default: ""
- name: token
description: bearer token for authentication to the cluster
type: string
default: ""
- name: insecure
description: to indicate server should be accessed without verifying the TLS certificate
type: string
default: "false"
workspaces:
- name: output
steps:
- name: write
image: gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/kubeconfigwriter@sha256:b2c6d0962cda88fb3095128b6202da9b0e6c9c0df3ef6cf7863505ffd25072fd #tag: v0.20.1
command: ["/ko-app/kubeconfigwriter"]
args:
# passing the required json in the form of string to generate the kubeconfig file.
#
- -clusterConfig
- '{
"name":"$(params.name)",
"url":"$(params.url)",
"username":"$(params.username)",
"password":"$(params.password)",
"cadata":"$(params.cadata)",
"clientKeyData":"$(params.clientKeyData)",
"clientCertificateData":"$(params.clientCertificateData)",
"namespace":"$(params.namespace)",
"token":"$(params.token)",
"Insecure":$(params.insecure)
}'
# path to the destination directory, where kubeconfig file will be stored.
- -destinationDir
- '$(workspaces.output.path)'