Code Monkey home page Code Monkey logo

fabric8-maven-plugin's Introduction

Deprecation Note:

This project has been moved to https://github.com/eclipse/jkube . All new features would be implemented there and support for FMP would be eventually dropped.

fabric8-maven-plugin

Maven Central Circle CI Coverage Technical Debt Dependency Status

fabric8 logo

Watch the full asciicast

Introduction

This Maven plugin is a one-stop-shop for building and deploying Java applications for Docker, Kubernetes and OpenShift. It brings your Java applications on to Kubernetes and OpenShift. It provides a tight integration into maven and benefits from the build configuration already provided. It focuses on three tasks:

  • Building Docker images
  • Creating OpenShift and Kubernetes resources
  • Deploy application on Kubernetes and OpenShift

Usage

To enable fabric8 maven plugin on your project just add this to the plugins sections of your pom.xml:

      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>fabric8-maven-plugin</artifactId>
        <version>${fmp.version}</version>
      </plugin>

Want to get started fast? Check out the Blogpost for Getting Started with Fabric8 Maven Plugin.

The full documentation can be found in the User Manual [PDF]. It supports the following goals:

Goal Description
fabric8:resource Create Kubernetes and OpenShift resource descriptors
fabric8:build Build Docker images
fabric8:push Push Docker images to a registry
fabric8:deploy Deploy Kubernetes / OpenShift resource objects to a cluster
fabric8:watch Watch for doing rebuilds and restarts

Features

  • Includes docker-maven-plugin for dealing with Docker images and hence inherits its flexible and powerful configuration.
  • Supports both Kubernetes and OpenShift descriptors
  • OpenShift Docker builds with a binary source (as an alternative to a direct image build against a Docker daemon)
  • Various configuration styles:
    • Zero Configuration for a quick ramp-up where opinionated defaults will be pre-selected.
    • Inline Configuration within the plugin configuration in an XML syntax.
    • External Configuration templates of the real deployment descriptors which are enriched by the plugin.
  • Flexible customization:
    • Generators analyze the Maven build and generated automatic Docker image configurations for certain systems (spring-boot, plain java, karaf ...)
    • Enrichers extend the Kubernetes / OpenShift resource descriptors by extra information like SCM labels and can add default objects like Services.
    • Generators and Enrichers can be individually configured and combined into profiles

OpenShift and Kubernetes Compatibility

โœ”๏ธ : Supported, all available features can be used

โŒ : Not supported at all

๐Ÿ”ต : Supported, but not all features can be used

OpenShift
FMP Openshift 4.2.0 Openshift 4.1.0 OpenShift 3.11.0 OpenShift 3.10.0 OpenShift 3.9.0 OpenShift 3.7.0 OpenShift 3.6.0
FMP 4.4.2 โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 4.3.1 โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 4.3.0 โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 4.2.0 โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 4.1.0 โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 4.0.0 ๐Ÿ”ต ๐Ÿ”ต โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 4.0.0-M1 ๐Ÿ”ต ๐Ÿ”ต ๐Ÿ”ต ๐Ÿ”ต โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 4.0.0-M2 ๐Ÿ”ต ๐Ÿ”ต ๐Ÿ”ต ๐Ÿ”ต โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 3.5.42 โŒ โŒ โŒ ๐Ÿ”ต โœ”๏ธ โœ”๏ธ
FMP 3.5.41 โŒ โŒ โŒ ๐Ÿ”ต โœ”๏ธ โœ”๏ธ
FMP 3.5.40 โŒ โŒ โŒ ๐Ÿ”ต โœ”๏ธ โœ”๏ธ
FMP 3.5.39 โŒ โŒ โŒ โŒ โœ”๏ธ โœ”๏ธ
FMP 3.5.38 โŒ โŒ โŒ โŒ โœ”๏ธ โœ”๏ธ
FMP 3.5.37 โŒ โŒ โŒ โŒ โœ”๏ธ โœ”๏ธ
FMP 3.5.35 โŒ โŒ โŒ โŒ โœ”๏ธ โœ”๏ธ
FMP 3.5.34 โŒ โŒ โŒ โŒ โœ”๏ธ โœ”๏ธ
FMP 3.5.33 โŒ โŒ โŒ โŒ โœ”๏ธ โœ”๏ธ
FMP 3.5.32 โŒ โŒ โŒ โŒ โœ”๏ธ โœ”๏ธ
Kubernetes
FMP Kubernetes 1.15.3 Kubernetes 1.14.2 Kubernetes 1.12.0 Kubernetes 1.11.0 Kubernetes 1.10.0 Kubernetes 1.9.0 Kubernetes 1.8.0 Kubernetes 1.7.0 Kubernetes 1.6.0 Kubernetes 1.5.1 Kubernetes 1.4.0
FMP 4.4.2 โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โŒ โŒ
FMP 4.3.1 โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โŒ โŒ
FMP 4.3.0 โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โŒ โŒ
FMP 4.2.0 โŒ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โŒ โŒ
FMP 4.1.0 โŒ โŒ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โŒ โŒ
FMP 4.0.0 โŒ โŒ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โŒ โŒ
FMP 4.0.0-M2 โŒ โŒ ๐Ÿ”ต ๐Ÿ”ต ๐Ÿ”ต โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โŒ โŒ
FMP 4.0.0-M1 โŒ โŒ ๐Ÿ”ต ๐Ÿ”ต ๐Ÿ”ต โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โŒ โŒ
FMP 3.5.42 โŒ โŒ ๐Ÿ”ต ๐Ÿ”ต ๐Ÿ”ต ๐Ÿ”ต โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 3.5.41 โŒ โŒ โŒ โŒ โŒ ๐Ÿ”ต โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 3.5.40 โŒ โŒ โŒ โŒ โŒ ๐Ÿ”ต โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 3.5.39 โŒ โŒ โŒ โŒ โŒ โŒ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 3.5.38 โŒ โŒ โŒ โŒ โŒ โŒ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 3.5.37 โŒ โŒ โŒ โŒ โŒ โŒ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 3.5.35 โŒ โŒ โŒ โŒ โŒ โŒ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 3.5.34 โŒ โŒ โŒ โŒ โŒ โŒ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 3.5.33 โŒ โŒ โŒ โŒ โŒ โŒ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
FMP 3.5.32 โŒ โŒ โŒ โŒ โŒ โŒ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ

Documentation and Support

  • User Manual [PDF]
  • Examples are in the samples directory
  • Many fabric8 Quickstarts use this plugin and are good showcases, too.
  • You'll find us in the fabric8 community and on IRC freenode in channel #fabric8 and we are happy to answer any questions.
  • Contributions are highly appreciated and encouraged. Please send us Pull Requests.

fabric8-maven-plugin 3 vs. 2

This is a complete rewrite of the former fabric8-maven plugin. It does not share the same configuration syntax, but migration should be straight forward - please use the fabric8:migrate goal from 2.x of the plugin.

fabric8-maven-plugin's People

Contributors

apupier avatar bohmber avatar cescoffier avatar chirino avatar christian-posta avatar davsclaus avatar devang-gaur avatar dhirajsb avatar erikgb avatar fusesource-ci avatar hrishin avatar iocanel avatar jamesnetherton avatar jimmidyson avatar jstrachan avatar kameshsampath avatar ladicek avatar lburgazzoli avatar lordofthejars avatar manusa avatar nicolaferraro avatar oscerd avatar oweise avatar piyush-garg avatar rawlingsj avatar rhuss avatar rohankanojia avatar theexplorist avatar ucosty avatar yuwzho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fabric8-maven-plugin's Issues

Pickup and enrichment of external YAML / JSON files

In the fabric8 directory src/main/fabric8 it should be possible to handcraft resource descriptors which then can be enriched the same way as the descriptors defined within the plugin. Also, a set of properties for templating should be predefined (like the image name).

The boundary is not yet clear and needs to be evaluated.

This is the issue for fabric8io/fabric8#5861

OpenShift Templates

At the moment on plain Kubernetes objects are created. When running in
OpenShift mode the template handling should be introduced.

In contrast to the old implementation where the template is created
first and then, if pure Kubernetes objects are requested, the template
is applied locally and objects from non-Kubernetes packages are
removed, the discrimination template yes/no should be done from the
very beginning.

Also it could make sense that even for OpenShift non-template can be
created.

The idea is to have an OpenShiftConfiguration object, inherited from
KubernetesKonfiguration and stored in a member openshift, so that
the discrimnation happens based on the top-level configuration tag

<kubernetes>
  <services> ...
  ...
</kubernetes>

vs

<openshift>
  <useTemplates>true</useTemplates>

<openshift>

with useTemplates == true being the default. (useTemplates is then
also only available for <openshift>

when building a docker image with a SNAPSHOT version, it would be nice to replace "1.0-SNAPSHOT" with a timestamp in docker

if you use 1.0-SNAPSHOT as the docker image name, then deploy it with mvn fabric8:deploy then the second time you build you often get docker failures due to the image label being in use.

it'd be nice if OOTB the plugin was smarter & defaulted the docker label to a timestamp label if the ${project.version} ends with SNAPSHOT; so that the same timestamp is exposed in the kubernetes resource as is created via fabric8:build

it might be nice to generate a YML file for each resource generated/enriched?

Its kinda hard to read a kubernetes list when there's a bunch of resources inside (SA / Service / RC et al).

Its much easier to just look at individual files. I wonder if by default we should generate individual files from the kubernetes.yml so that if you're looking at the generation of, say, foo-rc.yml then you can look at target/fabric8/kubernetes/foo-rc.yml to see the fully enriched generated file?

Icon handling

The icon handling via annotations needs to be readded in a dedicated enricher, enabled by default.

the spring-boot sample doesn't get any labels or selectors generated

e.g. after a local build:

cd sample/spring-boot
mvn clean compile
cat target/classes/META-INF/fabric8/spring-boot-web-rs.yml

generates

---
apiVersion: "extensions/v1beta1"
kind: "ReplicaSet"
metadata:
  name: "spring-boot-web"
spec:
  replicas: 1
  template:
    metadata: {}
    spec:
      containers:
      - env:
        - name: "KUBERNETES_NAMESPACE"
          valueFrom:
            fieldRef:
              fieldPath: "metadata.namespace"
        image: "fabric8/spring-boot-web:3.0-SNAPSHOT"
        imagePullPolicy: "IfNotPresent"
        name: "fabric8-spring-boot-web"
        ports:
        - containerPort: 8080
          protocol: "TCP"
        securityContext:
          privileged: false

convention for running locally (spring-boot:run) versus on kubernetes/openshift (mvn install fabric8:deploy)

I wonder if we should have a goal mvn fabric8:run that's the cluster equivalant of mvn spring-boot:run for locally running things which also ensured that the install goal was run?

I've been setting the <defaultGoal/> for funktion stuff to be spring-boot:run for local stuff; wonder if we should add a profile to act as a simple alias for mvn install fabric8:deploy as its quite a mouthful to type.

Not sure of a concise catchy name yet though ;). Any good suggestions?

How about:

mvn -Pf8

looks like the generated openshift.yml has duplicate resources

I get 2 Service and 2 DC objects:


---
apiVersion: "v1"
items:
- apiVersion: "v1"
  kind: "Service"
  metadata:
    annotations:
      fabric8.io/iconUrl: "data:text/plain;charset=UTF-8;base64,cm91dGVzLnhtbAo="
      prometheus.io/scrape: "true"
      prometheus.io/port: "9779"
    labels:
      project: "springboot-camel-xml"
      provider: "fabric8"
      version: "1.0-SNAPSHOT"
      group: "io.fabric8.quickstarts"
    name: "springboot-camel-xml"
  spec:
    ports:
    - port: 8080
      protocol: "TCP"
      targetPort: 8080
    selector:
      project: "springboot-camel-xml"
      provider: "fabric8"
      group: "io.fabric8.quickstarts"
- apiVersion: "v1"
  kind: "Service"
  metadata:
    annotations:
      fabric8.io/iconUrl: "data:text/plain;charset=UTF-8;base64,cm91dGVzLnhtbAo="
      prometheus.io/scrape: "true"
      prometheus.io/port: "9779"
    labels:
      project: "springboot-camel-xml"
      provider: "fabric8"
      version: "1.0-SNAPSHOT"
      group: "io.fabric8.quickstarts"
    name: "springboot-camel-xml"
  spec:
    ports:
    - port: 8080
      protocol: "TCP"
      targetPort: 8080
    selector:
      project: "springboot-camel-xml"
      provider: "fabric8"
      group: "io.fabric8.quickstarts"
- apiVersion: "v1"
  kind: "DeploymentConfig"
  metadata:
    annotations:
      fabric8.io/iconUrl: "img/icons/camel.svg"
      fabric8.io/metrics-path: "dashboard/file/camel-routes.json/?var-project=springboot-camel-xml&var-version=1.0-SNAPSHOT"
    labels:
      project: "springboot-camel-xml"
      provider: "fabric8"
      version: "1.0-SNAPSHOT"
      group: "io.fabric8.quickstarts"
    name: "springboot-camel-xml"
  spec:
    replicas: 1
    selector:
      project: "springboot-camel-xml"
      provider: "fabric8"
      group: "io.fabric8.quickstarts"
    template:
      metadata:
        labels:
          project: "springboot-camel-xml"
          provider: "fabric8"
          version: "1.0-SNAPSHOT"
          group: "io.fabric8.quickstarts"
      spec:
        containers:
        - env:
          - name: "KUBERNETES_NAMESPACE"
            valueFrom:
              fieldRef:
                fieldPath: "metadata.namespace"
          image: "quickstarts/springboot-camel-xml:latest"
          imagePullPolicy: "IfNotPresent"
          livenessProbe:
            httpGet:
              path: "/health"
              port: 8081
            initialDelaySeconds: 180
          name: "springboot"
          ports:
          - containerPort: 8080
            protocol: "TCP"
          - containerPort: 9779
            protocol: "TCP"
          - containerPort: 8778
            protocol: "TCP"
          readinessProbe:
            httpGet:
              path: "/health"
              port: 8081
            initialDelaySeconds: 10
          securityContext:
            privileged: false
    triggers:
    - type: "ConfigChange"
- apiVersion: "v1"
  kind: "DeploymentConfig"
  metadata:
    annotations:
      fabric8.io/iconUrl: "img/icons/camel.svg"
      fabric8.io/metrics-path: "dashboard/file/camel-routes.json/?var-project=springboot-camel-xml&var-version=1.0-SNAPSHOT"
    labels:
      project: "springboot-camel-xml"
      provider: "fabric8"
      version: "1.0-SNAPSHOT"
      group: "io.fabric8.quickstarts"
    name: "springboot-camel-xml"
  spec:
    replicas: 1
    selector:
      project: "springboot-camel-xml"
      provider: "fabric8"
      group: "io.fabric8.quickstarts"
    template:
      metadata:
        annotations:
          fabric8.io/iconUrl: "img/icons/camel.svg"
          fabric8.io/metrics-path: "dashboard/file/camel-routes.json/?var-project=springboot-camel-xml&var-version=1.0-SNAPSHOT"
        labels:
          project: "springboot-camel-xml"
          provider: "fabric8"
          version: "1.0-SNAPSHOT"
          group: "io.fabric8.quickstarts"
      spec:
        containers:
        - env:
          - name: "KUBERNETES_NAMESPACE"
            valueFrom:
              fieldRef:
                fieldPath: "metadata.namespace"
          image: "quickstarts/springboot-camel-xml:latest"
          imagePullPolicy: "IfNotPresent"
          livenessProbe:
            httpGet:
              path: "/health"
              port: 8081
            initialDelaySeconds: 180
          name: "springboot"
          ports:
          - containerPort: 8080
            protocol: "TCP"
          - containerPort: 9779
            protocol: "TCP"
          - containerPort: 8778
            protocol: "TCP"
          readinessProbe:
            httpGet:
              path: "/health"
              port: 8081
            initialDelaySeconds: 10
          securityContext:
            privileged: false
    triggers:
    - type: "ConfigChange"
kind: "List"

Custom service selector

It should be possible to define the service selector in a more
flexible way. Currently the only possibility is to remove the version
label, however one should possibly either configure the kind of labels
which should be able to remove.

Configuration Syntax

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 ( #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>

Add automatic healthchecks

In the zero config case, detect if spring-actuator-starter is configured and automatically add health checks to the generated Kubernetes descriptors.

Configuration syntax

Current the configuration is quite simplistic, reusing <build> from the docker configuration and the portmapping from <run>.

Especially the latter probably doesnt make much sense.
Also the question is, whether annotation and label configuration should be done in more nested way. Also, label config is currently global for all objects (as in v2) but could be more fine granular and different for RC, Pods, Services ....

The profile new in the cdi-sample is are some first thoughts about a possible structure. Need still a night :)

fabric8:deploy

... should apply the resource descriptor to the OpenShift API server.

More or less the same as the V2 fabric8:apply.

Binary Build Source for `fabric8:build`

Depending on whether OpenShift is enabled and the build strategy is binary build source then instead of creating a Docker image via the docker daemon the plugin should create

  • A docker.tar (like for docker:build or docker:source)
  • A BuildConfig object for OpenShift.
  • Apply the BuildConfig by contacting API servcer
  • Create a Build object, feeding in the docker.tar
  • Wait until the build is finished.

The resulting ImageStream should be referenced from within resource descriptors created with fabric8:resource

Use DeploymentConfigs

In the old code there is a section dealing with DeploymentConfigs
however, this was never active. When using openshift mode, it should
be able to use DCs

default to port 80 for exposed service ports for targetPort 8080?

we currently generate services like this for spring boot:

---
apiVersion: "v1"
kind: "Service"
metadata:
  name: "spring-boot-web"
spec:
  ports:
  - port: 8080
    protocol: "TCP"
    targetPort: 8080

if we have only 1 port its > 1000 and there's no explicit configuration I wonder if we should assume port 80? Or at least we can assume 8080 should be exposed as port 80 by default

improve the output artifacts / formats

right now we create a single json / yaml file which typically is an OpenShift Template or a kubernetes List.

To make things easier to consume we should probably always have a vanilla k8s yaml folks can run.

There are a few options though:

  • deliver a few yaml files for each resource (RC / service / SA etc)
  • create a zip of the yaml files (easier for integration into things like helm or putting into git repos - uber yaml files are harder to reason about)
  • a single k8s yaml file thats easier to install (with things sorted nicely so services are first etc) - using ConfigMaps if we are using parameterisation
  • a single OpenShift template yaml file for folks who wanna parameterise things on install time
  • a 'Catalog yaml file' when folks want to install the app into a Catalog (think like an App store - like installing an OpenShift Template but so it works on any k8s environmment - we could encode the app inside a Config Map).

I wonder if we should do all of the above by default; coming up with standard maven archetype classifiers so folks can easily consume the things they need; a k8s yaml, an OpenShift Template, individual files or a zip of the files or the Catalog yaml etc?

Catalog resources

Right now we use OpenShift templates as a way of installing a resource into k8s we can then use from the Fabric8 console to run apps via the Run... button. Its just a way of storing a blob of YAML inside k8s for running it later.

Going forward we want to support non-OpenShift templates (some things don't need parameterisation). Plus we wanna support vanilla kubernetes - also there's ConfigMap where there's no OpenShift Template and the parameterisation is done by a separate ConfigMap entry.

So we could maybe use ConfigMap as an alternative to OpenShift templates for the 'catalog' of apps folks could choose to run.

e.g. an app could be turned into this...

apiVersion: v1
kind: ConfigMap
metadata:
  name: myapp
  labels:
     kind: catalog
data:
  service-foo.yml: |
    apiVerison: v1
    kind: Service
    ...
  rc.yml: |
    apiVerison: v1
    kind: Service
    ...

i.e. we create a ConfigMap instead of an OpenShift Template to store all the resources individually (with each file stored inside the config map as a data entry)

The Fabric8 Console's Run... button can then view all the Templates and ConfigMaps in a system to let folks run apps

validate generated resources

it would be nice to generate nice validation error messages if the generated resources are not invalid in any way - linking to the individual generated files in target/classes/META-INF/fabric8/ so that folks can easily see whats wrong. e.g. missing name / image or bad names for services or whatever

Exception when using server authentication from settings.xml when building an image

Caused by: java.lang.NoClassDefFoundError: org/sonatype/plexus/components/sec/dispatcher/SecDispatcher
    at io.fabric8.maven.docker.util.AuthConfigFactory.decrypt(AuthConfigFactory.java:352)
    at io.fabric8.maven.docker.util.AuthConfigFactory.createAuthConfigFromServer(AuthConfigFactory.java:365)
    at io.fabric8.maven.docker.util.AuthConfigFactory.getAuthConfigFromSettings(AuthConfigFactory.java:216)
    at io.fabric8.maven.docker.util.AuthConfigFactory.createAuthConfig(AuthConfigFactory.java:119)
    at io.fabric8.maven.docker.AbstractDockerMojo.prepareAuthConfig(AbstractDockerMojo.java:312)
    at io.fabric8.maven.docker.AbstractDockerMojo.checkImageWithAutoPull(AbstractDockerMojo.java:356)
    at io.fabric8.maven.docker.AbstractBuildSupportMojo.autoPullBaseImage(AbstractBuildSupportMojo.java:107)
    at io.fabric8.maven.docker.AbstractBuildSupportMojo.buildImage(AbstractBuildSupportMojo.java:68)
    at io.fabric8.maven.docker.BuildMojo.buildAndTag(BuildMojo.java:46)
    at io.fabric8.maven.docker.BuildMojo.executeInternal(BuildMojo.java:38)
    at io.fabric8.maven.plugin.docker.BuildMojo.executeInternal(BuildMojo.java:56)
    at io.fabric8.maven.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:176)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)

Its probably a gotcha when embedding d-m-p into f-m-p.

lets not limit the yml files to a naming convention

I'm trying to create a ServiceAccount; there will be all kinds of k8s resources over time. (Ingress, Deployment, ConfigMap and many others).

Right now I get

resource failed: Unknown type 'sa'. Must be one of : svc, rc, rs, service

Lets use the naming convention of files purely to default the kind. Otherwise lets read any other files and assume they must include a kind: Foo statement.

Though we could add sa and cm / configmap as other extensions too I guess; along with deployment

Metric handling

The hooks for metrics handling must added in an enricher, possibly using the full customize() method.

Composition of JSON / YAML

The compositon of various YAML files created e.g. by annotation processors needs to be added.

Still not sure, where and wehn this should happen. Probably as a post processing step directly from within the ResourceMojos

icon post processor

the old fabric8:json goal used to try detect a file called icon.(jpg|jpeg|png|svg|gif) in src/main/fabric8 and if so annotate the generated Template. The original motivation was to try use data URLs for icons so we could embed them inside the templates. We soon found a single template (e.g. cd-pipeline) could require lots of icons (jenkins / gogs / nexus etc) so soon backed away from embedded data urls to just regular URLs.

As we move away from OS Template as the default output to being either a kubernetes zip of resources; a single kubernetes List or an OpenShift List/Template then we should avoid relying on an OpenShift Template being present to give the icon annotation. Instead we should annotate ServiceAccount / Service / Deployment / ReplicationController / ReplicaSet resources with the icon annotation.

Then it doesn't matter how folks run things; the icons will be preserved. Right now we actually try to find the Template for a Service / RC to find the icon in the console :)

allow pod templates to be combined?

in terms of post processing of the rc.yml I can imagine folks wanting to add custom sidecar containers.

One specific example that just came up; there's an Infinispan Server RC.yaml which can be deployed as a remote service. However being a cache you often wanna colocate it inside a pod. So it might be nice to embed the infinispan server RC.yaml inside your apps pod template as another container. (i.e. it just copies the containers across and any volumes or secret annotations etc).

So might be nice to have some way to declaratively describe this operation; or maybe its a custom DSL builder thingy operation to merge in a sidecar container from some other RC yaml (described via mvn coordinates maybe?)

fabric8:attach

Mojo for attaching the resource descriptor to the build as artefact with classifier

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.