Skip to content

Commit

Permalink
Revert "Add kubernetesServicePatches to shinyproxy definition"
Browse files Browse the repository at this point in the history
  • Loading branch information
LEDfan authored Feb 16, 2024
1 parent 9f56f66 commit fe23e3b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ class ServiceFactory(private val serviceClient: MixedOperation<Service, ServiceL

private val logger = KotlinLogging.logger {}

private val servicePatcher = ServicePatcher()

fun create(shinyProxy: ShinyProxy, latestShinyProxyInstance: ShinyProxyInstance) {
val labels = LabelFactory.labelsForShinyProxy(shinyProxy).toMutableMap()
labels[LabelFactory.LATEST_INSTANCE_LABEL] = latestShinyProxyInstance.hashOfSpec

//@formatter:off
val serviceDefinition: Service = ServiceBuilder()
.withNewMetadata()
Expand All @@ -65,8 +63,7 @@ class ServiceFactory(private val serviceClient: MixedOperation<Service, ServiceL
.build()
//@formatter:on

val patchedService = servicePatcher.patch(serviceDefinition, shinyProxy.parsedServicePatches)
val createdService = serviceClient.inNamespace(shinyProxy.metadata.namespace).resource(patchedService).createOrReplace()
val createdService = serviceClient.inNamespace(shinyProxy.metadata.namespace).resource(serviceDefinition).createOrReplace()
logger.debug { "${shinyProxy.logPrefix(latestShinyProxyInstance)} [Component/Service] Created ${createdService.metadata.name}" }
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,6 @@ class ShinyProxy : CustomResource<JsonNode, ShinyProxyStatus>(), Namespaced {
return@lazy null
}

@get:JsonIgnore
val parsedServicePatches: JsonPatch? by lazy {
if (spec.get("kubernetesServicePatches")?.isTextual == true) {
try {
// convert the raw YAML string into a JsonPatch
val yamlReader = ObjectMapper(YAMLFactory())
yamlReader.registerModule(JSR353Module())
return@lazy yamlReader.readValue(spec.get("kubernetesServicePatches").textValue(), JsonPatch::class.java)
} catch (exception: Exception) {
exception.printStackTrace() // log the exception for easier debugging
throw exception
}

}
return@lazy null
}

@get:JsonIgnore
val subPath: String by lazy {
if (spec.get("server")?.get("servlet")?.get("context-path")?.isTextual == true) {
Expand Down

0 comments on commit fe23e3b

Please sign in to comment.