public void on(TemplateBuilder builder) {
    String version = System.getProperty("project.version");
    String versionPostfix = "";
    if (version != null && version.length() > 0 && !version.endsWith("SNAPSHOT")) {
      versionPostfix = ":" + version;
    }

    builder
        .addNewServiceObject()
        .withNewMetadata()
        // The name of the service is referenced by the client image.
        .withName("jenkins")
        .addToLabels("project", "jenkins")
        .addToLabels("provider", "fabric8")
        .endMetadata()
        .withNewSpec()
        .withType("LoadBalancer")
        .addNewPort()
        .withName("http")
        .withProtocol("TCP")
        .withPort(80)
        .withNewTargetPort(8080)
        .endPort()
        .addNewPort()
        .withName("agent")
        .withProtocol("TCP")
        .withPort(50000)
        .withNewTargetPort(50000)
        .endPort()
        .addToSelector("project", "jenkins")
        .addToSelector("provider", "fabric8")
        .endSpec()
        .endServiceObject()
        .build();
  }
 public void withPersistentVolumeClaim(TemplateBuilder builder) {
   builder
       .addNewPersistentVolumeClaimObject()
       .withNewMetadata()
       .withName("rider-auto-file-pvc")
       .addToLabels("provider", "fabric8")
       .addToLabels("project", "rider-auto-file")
       .addToLabels("component", "rider-auto-file")
       .addToLabels("group", "rider-auto")
       .endMetadata()
       .withNewSpec()
       .withAccessModes("ReadWriteOnce")
       .withResources(getResourceRequirement())
       .endSpec()
       .endPersistentVolumeClaimObject()
       .build();
 }
 public void onTemplate(TemplateBuilder builder) {
   builder
       .addNewServiceObject()
       .withNewMetadata()
       .withName("elasticsearch-cluster")
       .endMetadata()
       .withNewSpec()
       .withClusterIP("None")
       .addNewPort()
       .withName("")
       .withProtocol("TCP")
       .withPort(9300)
       .withNewTargetPort(9300)
       .endPort()
       .addToSelector("component", "elasticsearch")
       .addToSelector("provider", "fabric8")
       .endSpec()
       .and()
       .build();
 }