Skip to content

Commit eebd359

Browse files
committed
Fix #30945: add nginx.org/websocket-services
1 parent 386bca2 commit eebd359

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class IngressFactory(private val kubeClient: KubernetesClient) {
5454
.withNewMetadata()
5555
.withName(ResourceNameFactory.createNameForIngress(shinyProxy))
5656
.withLabels<String, String>(labels)
57+
.withAnnotations<String, String>(mapOf("nginx.org/websocket-services" to ResourceNameFactory.createNameForService(shinyProxy)))
5758
.addNewOwnerReference()
5859
.withController(true)
5960
.withKind("ShinyProxy")

src/test/kotlin/eu/openanalytics/shinyproxyoperator/MainIntegrationTest.kt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,14 +1153,34 @@ class MainIntegrationTest : IntegrationTestBase() {
11531153
spTestInstance.waitForOneReconcile()
11541154

11551155
// 4. assert correctness
1156-
spTestInstance.assertInstanceIsCorrect()
11571156
val sp = spTestInstance.retrieveInstance()
1157+
assertNotNull(sp)
1158+
val instance = sp.status.instances[0]
1159+
assertNotNull(instance)
1160+
assertTrue(instance.isLatestInstance)
1161+
1162+
// check configmap
1163+
spTestInstance.assertConfigMapIsCorrect(sp)
1164+
1165+
// check replicaset
1166+
spTestInstance.assertReplicaSetIsCorrect(sp)
11581167

1168+
// check service
1169+
spTestInstance.assertServiceIsCorrect(spTestInstance.retrieveInstance())
1170+
1171+
// check ingress
11591172
val allIngresses = namespacedClient.network().v1().ingresses().list().items
11601173
assertEquals(1, allIngresses.size)
11611174
val ingress = allIngresses.firstOrNull { it.metadata.name == "sp-${sp.metadata.name}-ing".take(63) }
11621175
assertNotNull(ingress)
11631176

1177+
assertEquals(mapOf(
1178+
LabelFactory.APP_LABEL to LabelFactory.APP_LABEL_VALUE,
1179+
LabelFactory.REALM_ID_LABEL to sp.realmId,
1180+
LabelFactory.LATEST_INSTANCE_LABEL to sp.status.latestInstance()!!.hashOfSpec
1181+
), ingress.metadata.labels)
1182+
1183+
// nginx.org annotation was replaced
11641184
assertEquals(mapOf(
11651185
"nginx.ingress.kubernetes.io/proxy-buffer-size" to "128k",
11661186
"nginx.ingress.kubernetes.io/ssl-redirect" to "true",

src/test/kotlin/eu/openanalytics/shinyproxyoperator/helpers/ShinyProxyTestInstance.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ class ShinyProxyTestInstance(private val namespace: String,
127127
LabelFactory.LATEST_INSTANCE_LABEL to sp.status.latestInstance()!!.hashOfSpec
128128
), ingress.metadata.labels)
129129

130+
assertEquals(mapOf(
131+
"nginx.org/websocket-services" to "sp-${sp.metadata.name}-svc".take(63),
132+
),
133+
ingress.metadata.annotations
134+
)
135+
130136
assertOwnerReferenceIsCorrect(ingress, sp)
131137

132138
assertEquals(1, ingress.spec.rules.size)

0 commit comments

Comments
 (0)