package io.fabric8.app.gerrit;

import io.fabric8.kubernetes.generator.annotation.KubernetesModelProcessor;
import io.fabric8.openshift.api.model.template.TemplateBuilder;

@KubernetesModelProcessor
public class GerritModelProcessor {

    public void onList(TemplateBuilder builder) {
        builder.addNewServiceObject()
                .withNewMetadata()
                  .withName("gerrit-http-service")
                  .addToLabels("component", "gerrit")
                  .addToLabels("provider", "fabric8")
                .endMetadata()
                .withNewSpec()
                  .addNewPort()
/*                    .withProtocol("HTTP")*/
                    .withPort(80)
                      .withNewTargetPort(8080)
                    .endPort()
                    .addToSelector("component", "gerrit")
                    .addToSelector("provider", "fabric8")
                .endSpec()
                .endServiceObject()
                // Second service
                .addNewServiceObject()
                .withNewMetadata()
                  .withName("gerrit-ssh-service")
                  .addToLabels("component", "gerrit")
                  .addToLabels("provider", "fabric8")
                .endMetadata()
                .withNewSpec()
                  .addNewPort()
/*                    .withProtocol("SSH")*/
                    .withPort(29418)
                      .withNewTargetPort(29418)
                    .endPort()
                    .addToSelector("component", "gerrit")
                    .addToSelector("provider", "fabric8")
                .endSpec()
                .endServiceObject()
                .build();
    }
}

@@ -597,34 +597,32 @@
   .addNewPort()%0A
-/*
                 
@@ -644,16 +644,13 @@
 ol(%22
-HT
 T
+C
 P%22)
-*/
 %0A   
@@ -1301,10 +1301,8 @@
 t()%0A
-/*
     
@@ -1336,15 +1336,13 @@
 ol(%22
-SSH%22)*/
+TCP%22)
 %0A   

Fix issue with error spec[0].protocol. The protocol to be used is TCP