Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Configuration Syntax #18

Closed
rhuss opened this issue Apr 12, 2016 · 1 comment
Closed

Configuration Syntax #18

rhuss opened this issue Apr 12, 2016 · 1 comment
Labels
cat/feature Feature request status/stale Issue/PR considered to be stale target/4.0 PR for targeted to 4.0.x

Comments

@rhuss
Copy link
Contributor

rhuss commented Apr 12, 2016

This is a first shot of the new configuration syntax.

The synergy / overlap with d-m-p currently is:

  • Docker Image name is shared
  • More then one container per pod easily possible: Each d-m-p image with a <build> sections is automatically picked up for the pod template.
  • A fabric8:build can create a plain docker image (for Kuberenets) or all what is needed for an OpenShift Build, depending on the operational mode ( Binary Build Source for fabric8:build #12 )

You might wonder what this enricher stuff is: It's a mean to decouple linkage to other fabric8 projects (like the icon generation for fabric8-console, the secrets handling for fabric8-devops, metrics exposure for prometheus) so that this can be easily switched on / off. It is also meant to complement (or maybe replace in the long run ?) the APT based generation of additional or customised resource objects with the Kubernetes builder). Custom enricher can be added as dependencies (and will be picked up from the compile classpath), much like spring-boot-starters. They have the advantage to be not coupled to the compile step and need no intermediate data file (which could be stale). Its also easy to combine the enrichers with resource object templates from src/main/fabric8.

Here's now the suggestion:

<configuration>
  <!-- Standard d-m-p configuration which defines how images are build, i.e. how the docker.tar is created -->
  <images>
    <image>
      <name>${image.user}/${project.artifactId}:${project.version}</name>
      <!-- "alias" is used to correlate to the containers in the pod spec -->
      <alias>camel-service</alias>
      <build>
        <from>fabric8/java</from>
        <assembly>
          <basedir>/deployments</basedir>
          <descriptorRef>artifact-with-dependencies</descriptorRef>
        </assembly>
        <env>
          <JAVA_LIB_DIR>/deployments</JAVA_LIB_DIR>
          <JAVA_MAIN_CLASS>org.apache.camel.cdi.Main</JAVA_MAIN_CLASS>
        </env>
      </build>
    </image>
  </images>
   <!-- Instead of "kubernetes", "openshift" can be used to switch on openshift mode (create templates,
       use image stream, use binary builds). When "openshift" is used, it has additional configuration to switch
       off openshift features, too) -->
  <kubernetes>
    <!-- Resource directory from where to pick up k8s resource templates which are filled in with
         maven properties and enriched by 'enrichers'-->
    <resourceDir>src/main/fabric8</resourceDir>
    <!-- Labels that are applied to all created objects -->
    <labels>
      <group>quickstarts</group>
    </labels>
    <!-- Configuration of enrichers, which can be switched off with `<skip>true</skip>`-->
    <enricher>
      <!-- Default enrichers for adding labels, annos, etc. are provided by the plugin but
           can be switched off, too -->
      <project-info>
        <skip>false</skip>
      </project-info>
    </enricher>
    <!-- Definition of the ReplicationController / ReplicaSet. Any better name than "containers" ? -->
    <replicaSet>
      <!-- Name of the replication controller, which will have a sane default (container alisa, mvn coords, ..) -->
      <name>${project.artifactId}</name>
      <!-- Replica count-->
      <replicas>1</replicas>
      <!-- Container to include in the POD template. By default all with a "build" section in the
           "images" configuration will be add to the POD. However, they can be configured separately, too.
          -->
      <containers>
        <container>
          <!-- Alias name correlating with the same named "image" configuration above. Can be ommitted
               if there is only a single image added -->
          <alias>camel-service</alias>
          <ports>
            <!-- Ports to ex[ose in the pod specs -->
            <port>8778</port>
          </ports>
          <mounts>
            <scratch>/var/scratch</scratch>
          </mounts>
        </container>
      </containers>
      <!-- Volumes used in the replicaSet -->
      <volumes>
        <volume>
          <name>scratch</name>
          <type>emptyDir</type>
        </volume>
      </volumes>
    </replicaSet>
    <!-- Dedicated section for (multiple) services to define -->
    <services>
      <service>
        <name>${project.artifactId}</name>
        <headless>true</headless>
      </service>
    </services>
  </kubernetes>
</configuration>
@rhuss rhuss added the cat/feature Feature request label Apr 12, 2016
@rhuss rhuss added the FTG label Feb 2, 2017
rohanKanojia added a commit to rohanKanojia/fabric8-maven-plugin that referenced this issue Jan 8, 2018
rohanKanojia added a commit to rohanKanojia/fabric8-maven-plugin that referenced this issue Jan 15, 2018
rohanKanojia added a commit to rohanKanojia/fabric8-maven-plugin that referenced this issue Jan 16, 2018
rohanKanojia added a commit to rohanKanojia/fabric8-maven-plugin that referenced this issue Jan 16, 2018
rohanKanojia added a commit to rohanKanojia/fabric8-maven-plugin that referenced this issue Jan 17, 2018
rohanKanojia added a commit to rohanKanojia/fabric8-maven-plugin that referenced this issue Jan 21, 2018
@rhuss rhuss removed the FITG label Jul 23, 2018
@rhuss rhuss added the target/4.0 PR for targeted to 4.0.x label Sep 12, 2018
@stale
Copy link

stale bot commented Dec 11, 2018

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

@stale stale bot added the status/stale Issue/PR considered to be stale label Dec 11, 2018
@stale stale bot closed this as completed Dec 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cat/feature Feature request status/stale Issue/PR considered to be stale target/4.0 PR for targeted to 4.0.x
Projects
None yet
Development

No branches or pull requests

1 participant