forked from redhat-developer-demos/knative-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevfile.yaml
87 lines (87 loc) · 3.08 KB
/
devfile.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
87
apiVersion: 1.0.0
metadata:
name: knative-tutorial
projects:
- name: knative-tutorial
source:
type: git
location: 'https://github.com/redhat-developer-demos/knative-tutorial.git'
branch: "staging"
components:
- id: redhat/vscode-yaml/latest
type: chePlugin
- id: redhat/vscode-xml/latest
type: chePlugin
- alias: tools
type: kubernetes
mountSources: true
referenceContent: |
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: Pod
metadata:
name: tutorial-tools
labels:
app: tools
spec:
serviceAccountName: tutorial-tools
initContainers:
- name: kubeconfiger
image: quay.io/rhdevelopers/clients
imagePullPolicy: IfNotPresent
workingDir: /workspace/kubeconfig
volumeMounts:
- name: kubeconfig-tpl
mountPath: /tmp/kubeconfig
- name: kubeconfig
mountPath: /workspace/kubeconfig
securityContext:
privileged: false
runAsUser: 10001
command:
- bash
- -ce
- |
echo "Preparing Kube Config"
cp /tmp/kubeconfig/config config
KUBE_API_SERVER_URL="$(kubectl cluster-info | awk 'NR==1{print $6}'|sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g')"
echo "Using Kube API Server form $KUBE_API_SERVER_URL"
kubectl config --kubeconfig=config set-cluster knativetutorial \
--server=$KUBE_API_SERVER_URL \
--certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
kubectl config --kubeconfig=config set-credentials tutorial-tools --token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
kubectl config --kubeconfig=config set-context knativetutorial --cluster=knativetutorial --namespace=knativetutorial --user=tutorial-tools
kubectl config --kubeconfig=config use-context knativetutorial
echo "Done."
containers:
- name: tutorial-tools
image: quay.io/rhdevelopers/clients
imagePullPolicy: IfNotPresent
env:
- name: TUTORIAL_HOME
value: /projects/knative-tutorial
securityContext:
privileged: false
runAsUser: 10001
resources:
limits:
cpu: "1000m"
memory: 1Gi
requests:
cpu: "512m"
memory: "512Mi"
workingDir: /opt/developer
volumeMounts:
- name: kubeconfig
mountPath: /opt/developer/.kube
volumes:
- name: kubeconfig
emptyDir: {}
- name: kubeconfig-tpl
configMap:
name: tutorial-tools-kubeconfig
items:
- key: config
path: config