Al-assad commented on code in PR #3302:
URL:
https://github.com/apache/incubator-streampark/pull/3302#discussion_r1378374269
##########
streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/ingress/IngressStrategy.scala:
##########
@@ -47,11 +47,15 @@ trait IngressStrategy {
}
}
- def buildIngressAnnotations(clusterId: String): Map[String, String] = {
+ def buildIngressAnnotations(clusterId: String, namespace: String):
Map[String, String] = {
val annotations = Map(
"nginx.ingress.kubernetes.io/rewrite-target" -> "/$2",
"nginx.ingress.kubernetes.io/proxy-body-size" -> "1024m",
- "nginx.ingress.kubernetes.io/configuration-snippet" -> ("rewrite ^(/" +
clusterId + ")$ $1/ permanent;")
+ "nginx.ingress.kubernetes.io/configuration-snippet" -> ("rewrite ^(/" +
clusterId + ")$ $1/ permanent;" + String
+ .format(
Review Comment:
It can be made more concise by modifying it to:
```scala
"nginx.ingress.kubernetes.io/configuration-snippet" -> s"rewrite ^(/
$clusterId )$$ $$1/ permanent; sub_filter '<base href=\"./\">' '<base
href=\"/$namespace/$clusterId/\">'; sub_filter_once off;"
```
##########
streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/ingress/IngressStrategyV1.scala:
##########
@@ -55,11 +55,12 @@ class IngressStrategyV1 extends IngressStrategy {
val ingress = new IngressBuilder()
.withNewMetadata()
.withName(clusterId)
- .addToAnnotations(buildIngressAnnotations(clusterId).asJava)
+ .addToAnnotations(buildIngressAnnotations(clusterId,
nameSpace).asJava)
.addToLabels(buildIngressLabels(clusterId).asJava)
.addToOwnerReferences(ownerReference) // Add OwnerReference
.endMetadata()
.withNewSpec()
+ .withIngressClassName("nginx")
Review Comment:
I think there is no need to set the ingressClass forcibly. The default value
of ingressClass is "". Kubernetes will choose the default ingressClass, which
is "nginx" for many Kubernetes instances. However, there are also some special
cases, such as the default ingress provided by some cloud providers for
Kubernetes not being nginx.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]