Skip to content

Commit dcc1520

Browse files
committed
Ref #34608: add option to specify DNS server
1 parent 6dc3c75 commit dcc1520

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/main/kotlin/eu/openanalytics/shinyproxyoperator/impl/docker/DockerOrchestrator.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ class DockerOrchestrator(channel: Channel<ShinyProxyEvent>,
247247
.memory(memoryToBytes(shinyProxy.memoryLimit))
248248
.cpuPeriod(cpuPeriod)
249249
.cpuQuota(cpuQuota)
250+
.dns(shinyProxy.dns)
250251

251252
if (monitoringConfig.isEnabled()) {
252253
hostConfigBuilder.logConfig(LogConfig.builder()

src/main/kotlin/eu/openanalytics/shinyproxyoperator/impl/kubernetes/components/PodTemplateSpecFactory.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ class PodTemplateSpecFactory(config: Config) {
142142
.endStartupProbe()
143143
.withTerminationMessagePolicy("FallbackToLogsOnError")
144144
.endContainer()
145+
.withNewDnsConfig()
146+
.addToNameservers(*shinyProxy.dns.toTypedArray())
147+
.endDnsConfig()
145148
.withAffinity(createAffinity(shinyProxy, shinyProxyInstance))
146149
.withVolumes(VolumeBuilder()
147150
.withName("config-volume")

src/main/kotlin/eu/openanalytics/shinyproxyoperator/model/ShinyProxy.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ class ShinyProxy(private val spec: JsonNode, val name: String, val namespace: St
120120
return@lazy spec.getTextValueOrNull("cpu-limit") ?: spec.getTextValueOrNull("cpuLimit")
121121
}
122122

123+
@get:JsonIgnore
124+
val dns: List<String> by lazy {
125+
if (spec.get("dns")?.isArray == true) {
126+
return@lazy spec.get("dns").elements().asSequence().map { it.textValue() }.toList()
127+
}
128+
return@lazy listOf()
129+
}
130+
123131
fun getSpec(): JsonNode {
124132
return spec
125133
}

0 commit comments

Comments
 (0)