You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by GitBox <gi...@apache.org> on 2022/03/22 15:42:22 UTC

[GitHub] [flink-kubernetes-operator] wangyang0918 commented on a change in pull request #93: [FLINK-26706] Introduce Ingress URL templating

wangyang0918 commented on a change in pull request #93:
URL: https://github.com/apache/flink-kubernetes-operator/pull/93#discussion_r832341172



##########
File path: flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/IngressUtils.java
##########
@@ -122,4 +154,27 @@ public static void setOwnerReference(HasMetadata owner, List<HasMetadata> resour
                         resource.getMetadata()
                                 .setOwnerReferences(Collections.singletonList(ownerReference)));
     }
+
+    public static URL getIngressUrl(String ingressTemplate, String name, String namespace) {
+        String template = addProtocol(ingressTemplate);
+        template = NAME_PTN.matcher(template).replaceAll(name);
+        template = NAMESPACE_PTN.matcher(template).replaceAll(namespace);
+        try {
+            return new URL(template);
+        } catch (MalformedURLException e) {
+            LOG.error(e.getMessage());
+            throw new ReconciliationException(
+                    String.format(
+                            "Unable to process the Ingress template(%s). Error: %s",
+                            ingressTemplate, e.getMessage()));
+        }
+    }
+
+    private static String addProtocol(String url) {

Review comment:
       It seems we do not use the protocol when creating the ingress. Why do we need this?




-- 
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: commits-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org