-
Notifications
You must be signed in to change notification settings - Fork 14
/
code-server-openshift-template.yaml
176 lines (169 loc) · 4.44 KB
/
code-server-openshift-template.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#
# How to run it:
# $ oc new-app -f code-server-openshift-template.yaml -p URL=vscode.example.com -p CODER_PASSWORD=welcome2vscode
#
# OR
#
# $ oc process -f code-server-openshift-template.yaml -p URL=vscode.example.com -p CODER_PASSWORD=welcome2vscode | oc create -f -
#
####### </ Jeffery Bagirimvano >
apiVersion: v1
kind: Template
metadata:
name: vscode-template
annotations:
openshift.io/display-name: "Visual Studio Code in browser"
description: "A distribution of Coder's Visual Studio Code in browser designed to work for CNCF-compliant orchestators."
tags: "coder,code,vscode"
openshift.io/provider-display-name: "Code Server"
openshift.io/documentation-url: "https://github.com/jefferyb/code-server-openshift"
parameters:
- name: NAME
description: Name of your application
value: code-server
required: true
- name: CONTAINER_HOSTNAME
description: Hostname of your container
value: coder
- name: DOCKER_IMAGE
description: Docker image to use
value: jefferyb/code-server:latest
# value: chinodesuuu/coder:openshift
required: true
- name: URL
description: Name of your application
required: true
- name: CODER_ENABLE_AUTH
description: Enable auth
value: "true"
- name: CODER_PASSWORD
description: Provide your own password, else, it defaults to "coder"
- name: PVC_STORAGE
description: Persistent Volume Claim Storage space
value: 10Gi
objects:
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: ${NAME}
labels:
app: ${NAME}
spec:
lookupPolicy:
local: false
tags:
- annotations:
openshift.io/imported-from: ${DOCKER_IMAGE}
from:
kind: DockerImage
name: ${DOCKER_IMAGE}
importPolicy:
scheduled: true
name: latest
referencePolicy:
type: Source
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ${NAME}-projects
labels:
app: ${NAME}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: ${PVC_STORAGE}
- apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
name: ${NAME}
labels:
app: ${NAME}
spec:
replicas: 1
selector:
app: ${NAME}
deploymentconfig: ${NAME}
template:
metadata:
labels:
app: ${NAME}
deploymentconfig: ${NAME}
spec:
hostname: ${CONTAINER_HOSTNAME}
containers:
- name: ${NAME}
image: ' '
imagePullPolicy: IfNotPresent
env:
- name: CODER_ENABLE_AUTH
value: "${CODER_ENABLE_AUTH}"
- name: CODER_PASSWORD
value: ${CODER_PASSWORD}
ports:
- containerPort: 9000
protocol: TCP
resources: {}
volumeMounts:
- mountPath: /home/coder/certs
name: ${NAME}-certs
- mountPath: /home/coder/projects
name: ${NAME}-projects
dnsPolicy: ClusterFirst
restartPolicy: Always
securityContext: {}
volumes:
- emptyDir: {}
name: ${NAME}-certs
- name: ${NAME}-projects
persistentVolumeClaim:
claimName: ${NAME}-projects
test: false
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- ${NAME}
from:
kind: ImageStreamTag
name: ${NAME}:latest
- apiVersion: v1
kind: Service
metadata:
name: ${NAME}
labels:
app: ${NAME}
spec:
ports:
- name: 9000-tcp
port: 9000
protocol: TCP
targetPort: 9000
selector:
app: ${NAME}
deploymentconfig: ${NAME}
type: ClusterIP
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: ${NAME}
labels:
app: ${NAME}
spec:
host: ${URL}
port:
targetPort: 9000-tcp
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
to:
kind: Service
name: ${NAME}
weight: 100
wildcardPolicy: None
labels:
app: "${NAME}"
template: "vscode-template"