Repository: ballerina-platform/module-ballerina-c2c
Issue: Kubernetes port name generations are invalid

**Description:**
Building services with '/' in the base path will generate invalid port names in the k8s service.
```

import ballerina/http;
service / on new http:Listener(9090) {

    resource function get greeting() returns string {
        return "Hello, World!";
    }
}
```


```
spec:
  ports:
  - name: "svc-1--svc"
    port: 9090
    protocol: "TCP"
    targetPort: 9090
```

**Suggested Labels:**
<!-- Optional comma separated list of suggested labels. Non committers can’t assign labels to issues, so this will help issue creators who are not a committer to suggest possible labels-->

**Suggested Assignees:**
<!--Optional comma separated list of suggested team members who should attend the issue. Non committers can’t assign issues to assignees, so this will help issue creators who are not a committer to suggest possible assignees-->

**Affected Product Version:**

**OS, DB, other environment details and versions:**    

**Steps to reproduce:**


**Related Issues:**
<!-- Any related issues such as sub tasks, issues reported in other repositories (e.g component repositories), similar problems, etc. -->

Changed files:
c2c-extension/src/main/java/io/ballerina/c2c/utils/KubernetesUtils.java, c2c-extension-test/src/test/java/io/ballerina/c2c/test/samples/Sample2Test.java, c2c-extension/src/main/java/io/ballerina/c2c/handlers/ServiceHandler.java

diff --git a/c2c-extension-test/src/test/java/io/ballerina/c2c/test/samples/Sample2Test.java b/c2c-extension-test/src/test/java/io/ballerina/c2c/test/samples/Sample2Test.java
index 25ecef7..74067a6 100644
--- a/c2c-extension-test/src/test/java/io/ballerina/c2c/test/samples/Sample2Test.java
+++ b/c2c-extension-test/src/test/java/io/ballerina/c2c/test/samples/Sample2Test.java
@@ -112,7 +112,7 @@ public class Sample2Test extends SampleTest {
         Assert.assertEquals(9090, service.getSpec().getPorts().get(0).getPort().intValue());
         Assert.assertEquals(9090, service.getSpec().getPorts().get(0).getTargetPort().getIntVal().intValue());
         Assert.assertEquals("TCP", service.getSpec().getPorts().get(0).getProtocol());
-        Assert.assertEquals("svc-1-helloworl", service.getSpec().getPorts().get(0).getName());
+        Assert.assertEquals("port-1-hello-sv", service.getSpec().getPorts().get(0).getName());
     }
 
     @Test
diff --git a/c2c-extension/src/main/java/io/ballerina/c2c/handlers/ServiceHandler.java b/c2c-extension/src/main/java/io/ballerina/c2c/handlers/ServiceHandler.java
index 3de23db..263105b 100644
--- a/c2c-extension/src/main/java/io/ballerina/c2c/handlers/ServiceHandler.java
+++ b/c2c-extension/src/main/java/io/ballerina/c2c/handlers/ServiceHandler.java
@@ -64,7 +64,7 @@ public class ServiceHandler extends AbstractArtifactHandler {
         for (ServiceModel serviceModel : serviceModels) {
             count++;
             if (null == serviceModel.getPortName()) {
-                serviceModel.setPortName(KubernetesUtils.getValidName("svc-" + count + "-" + serviceModel.getName()));
+                serviceModel.setPortName(KubernetesUtils.getValidName("port-" + count + "-" + commonService.getName()));
             }
             ServicePortBuilder servicePortBuilder = new ServicePortBuilder()
                     .withName(serviceModel.getPortName())
diff --git a/c2c-extension/src/main/java/io/ballerina/c2c/utils/KubernetesUtils.java b/c2c-extension/src/main/java/io/ballerina/c2c/utils/KubernetesUtils.java
index 3f909b6..9c22b0b 100644
--- a/c2c-extension/src/main/java/io/ballerina/c2c/utils/KubernetesUtils.java
+++ b/c2c-extension/src/main/java/io/ballerina/c2c/utils/KubernetesUtils.java
@@ -317,7 +317,8 @@ public class KubernetesUtils {
             name = name.substring(1);
         }
         name = name.toLowerCase(Locale.getDefault()).replaceAll("[_.]", "-")
-                .replaceAll("[$]", "").replaceAll("/", "-");
+                .replaceAll("[$]", "").replaceAll("/", "-")
+                .replaceAll("--", "-");
         name = name.substring(0, Math.min(name.length(), 15));
         if (name.endsWith("-")) {
             return name.substring(0, name.length() - 1);