Skip to content

Commit 09a2fce

Browse files
committed
Refactor CRD
1 parent 4be4fc8 commit 09a2fce

6 files changed

Lines changed: 129 additions & 74 deletions

File tree

src/main/kotlin/eu/openanalytics/shinyproxyoperator/components/ConfigMapFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ConfigMapFactory(private val kubeClient: KubernetesClient) {
2828
.withNewUid(shinyProxy.metadata.uid)
2929
.endOwnerReference()
3030
.endMetadata()
31-
.addToData("application-in.yml", mapper.writeValueAsString(shinyProxy.spec.applicationYaml))
31+
.addToData("application-in.yml", mapper.writeValueAsString(shinyProxy.spec))
3232
.build()
3333

3434
val createdConfigMap = kubeClient.configMaps().inNamespace(shinyProxy.metadata.namespace).create(configMapDefinition)
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package eu.openanalytics.shinyproxyoperator.crd
22

3+
import com.fasterxml.jackson.databind.JsonNode
34
import io.fabric8.kubernetes.client.CustomResource
45

56
class ShinyProxy : CustomResource() {
6-
lateinit var spec: ShinyProxySpec
7+
lateinit var spec: JsonNode
78
lateinit var status: ShinyProxyStatus
89
}

src/main/kotlin/eu/openanalytics/shinyproxyoperator/crd/ShinyProxySpec.kt

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/main/resources/cr.yaml

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,44 @@ kind: ShinyProxy
33
metadata:
44
name: example-shinyproxy
55
spec:
6-
application.yml:
7-
proxy:
8-
title: Open Analytics Shiny Proxy
9-
logo-url: http://www.openanalytics.eu/sites/www.openanalytics.eu/themes/oa/logo.png
10-
landing-page: /
11-
heartbeat-rate: 10000
12-
heartbeat-timeout: 60000
13-
port: 8080
14-
authentication: simple
15-
#admin-groups: scientists
16-
container-backend: kubernetes
17-
#kubernetes:
18-
#url: https://172.17.0.2:8443
19-
# Example: 'simple' authentication configuration
20-
users:
21-
- name: jack
22-
password: password
23-
groups: scientists
24-
- name: jeff
25-
password: password
26-
groups: mathematicians
27-
# Example: 'ldap' authentication configuration
28-
specs:
29-
- id: 01_hello
30-
display-name: Hello Application
31-
description: Application which demonstrates the basics of a Shiny app
32-
container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"]
33-
container-image: openanalytics/shinyproxy-demo
34-
#kubernetes-pod-patches: |
35-
#- op: replace
36-
#path: /metadata/namespace
37-
#value: my-namespace
38-
#- op: add
39-
#path: /spec/containers/0/resources
40-
#value:
41-
#requests:
42-
#cpu: "1"
43-
#limits:
44-
#cpu: "1"
45-
- id: 06_tabsets
46-
container-cmd: ["R", "-e", "shinyproxy::run_06_tabsets()"]
47-
container-image: openanalytics/shinyproxy-demo
48-
6+
proxy:
7+
title: Open Analytics Shiny Proxy
8+
logoUrl: http://www.openanalytics.eu/sites/www.openanalytics.eu/themes/oa/logo.png
9+
landingPage: /
10+
heartbeatRate: 10000
11+
heartbeatTimeout: 60000
12+
port: 8080
13+
authentication: simple
14+
#admin-groups: scientists
15+
containerBackend: kubernetes
16+
#kubernetes:
17+
#url: https://172.17.0.2:8443
18+
# Example: 'simple' authentication configuration
19+
users:
20+
- name: jack
21+
password: password
22+
groups: scientists
23+
- name: jeff
24+
password: password
25+
groups: mathematicians
26+
# Example: 'ldap' authentication configuration
27+
specs:
28+
- id: 01_hello
29+
displayName: Hello Application
30+
description: Application which demonstrates the basics of a Shiny app
31+
containerCmd: ["R", "-e", "shinyproxy::run_01_hello()"]
32+
containerImage: openanalytics/shinyproxy-demo
33+
#kubernetes-pod-patches: |
34+
#- op: replace
35+
#path: /metadata/namespace
36+
#value: my-namespace
37+
#- op: add
38+
#path: /spec/containers/0/resources
39+
#value:
40+
#requests:
41+
#cpu: "1"
42+
#limits:
43+
#cpu: "1"
44+
- id: 06_tabsets
45+
container-cmd: ["R", "-e", "shinyproxy::run_06_tabsets()"]
46+
container-image: openanalytics/shinyproxy-demo

src/main/resources/crd.yaml

Lines changed: 85 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ spec:
1313
validation:
1414
openAPIV3Schema:
1515
description: ShinyProxy
16+
type: object
1617
properties:
1718
apiVersion:
1819
description: 'APIVersion defines the versioned schema of this representation
@@ -26,21 +27,96 @@ spec:
2627
type: string
2728
metadata:
2829
type: object
30+
properties:
31+
name:
32+
type: string
33+
required:
34+
- name
2935
spec:
30-
description: ShinyProxySpec defines the desired state of ShinyProxy
36+
description: Specification of the ShinyProxy (i.e. application.yml)
3137
type: object
3238
properties:
33-
application.yml:
34-
type: object
39+
proxy:
40+
type: object
41+
properties:
42+
title:
43+
type: string
44+
logoUrl:
45+
type: string
46+
landingPage:
47+
type: string
48+
heartbeatRate:
49+
type: integer
50+
heartbeatTimeout:
51+
type: integer
52+
port:
53+
type: integer
54+
bindAddress:
55+
type: string
56+
templatePath:
57+
type: string
58+
adminGroups:
59+
type: array
60+
authentication:
61+
type: string
62+
enum:
63+
- ldap
64+
- kerberos
65+
- keycloak
66+
- openid
67+
- saml
68+
- social
69+
- simple
70+
- none
71+
containerWaitTime:
72+
type: integer
73+
hideNavbar:
74+
type: boolean
75+
containerBackend:
76+
type: string
77+
enum:
78+
- docker
79+
- docker-swarm
80+
- kubernetes
81+
specs:
82+
type: array
83+
properties:
84+
id:
85+
type: string
86+
displayName:
87+
type: string
88+
containerCmd:
89+
type: array
90+
containerImage:
91+
type: string
92+
containerPrivileged:
93+
type: boolean
94+
containerMemoryRequest:
95+
type: string
96+
containerMemoryLimit:
97+
type: string
98+
containerCpuRequest:
99+
type: string
100+
containerCpuLimit:
101+
type: string
102+
accessGroups:
103+
type: array
104+
containerDns:
105+
type: string
106+
containerEnv:
107+
type: object
108+
containerMemory:
109+
type: string
110+
containerNetwork:
111+
type: string
112+
containerVolumes:
113+
type: array
114+
required:
115+
- id
35116
required:
36-
- application.yml
117+
- proxy
37118
status:
38119
description: ShinyProxyStatus defines the observed state of ShinyProxy
39120
type: object
40121
properties:
41-
#backendImage:
42-
#type: string
43-
#frontendImage:
44-
#type: string
45-
type: object
46122

src/main/resources/second-cr.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)