Snowdrop :: Application CRD

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

License

License

GroupId

GroupId

me.snowdrop
ArtifactId

ArtifactId

application-crd-project
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

pom
Description

Description

Snowdrop :: Application CRD
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Project URL

Project URL

http://fabric8.io/
Project Organization

Project Organization

Red Hat
Source Code Management

Source Code Management

http://github.com/snowdrop/application-crd-client/

Download application-crd-project

How to add to project

<!-- https://jarcasting.com/artifacts/me.snowdrop/application-crd-project/ -->
<dependency>
    <groupId>me.snowdrop</groupId>
    <artifactId>application-crd-project</artifactId>
    <version>1.1.1</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/me.snowdrop/application-crd-project/
implementation 'me.snowdrop:application-crd-project:1.1.1'
// https://jarcasting.com/artifacts/me.snowdrop/application-crd-project/
implementation ("me.snowdrop:application-crd-project:1.1.1")
'me.snowdrop:application-crd-project:pom:1.1.1'
<dependency org="me.snowdrop" name="application-crd-project" rev="1.1.1">
  <artifact name="application-crd-project" type="pom" />
</dependency>
@Grapes(
@Grab(group='me.snowdrop', module='application-crd-project', version='1.1.1')
)
libraryDependencies += "me.snowdrop" % "application-crd-project" % "1.1.1"
[me.snowdrop/application-crd-project "1.1.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • annotator
  • model
  • client

Application CRD Client


Features

  • Java DSL that provides access to Application CRD resources
  • Works on top of the fabric8 kubernetes-client

Usage

Throughout the usage section code samples will be provided. The code samples are going to use the following naming conventions:

  • ac The Application CRD client instance
  • kc The Fabric8 Kubernetes client instance

Configuring the client

There are two ways of creating an instance of the service catalog client.

  • adapting from an existing instance of KubernetesClient
  • manual configuration and instantiation

Adapting

When the Application CRD API is provided by the same API server as the Kubernetes API (both APIs are proxied together), you can easily adapt an existing KubernetesClient instance.

KubernetesClient kc = new DefaultKubernetesClient();
Application ac = kc.adapt(ApplicationClient.class);

This approach is pretty easy, but it can only work if the topology requirements explained above are satisfied. If not, the client needs to be configured manually.

Manual Configuration

To manually instantiate the client, you just need to create a configuration object, that specifies at least the url of the api server and a way to authenticate to it. These may be specified:

  • explicitly
    • via the io.fabric8io.kubernetes.client.Config DSL
  • implicitly
    • using system properties
    • using env variables
    • using ~/.kube/confg
Using the Config DSL
  import io.fabric8.kubernetes.client.Config;
  import io.fabric8.kubernetes.client.ConfigBuilder;
  
  ...
  
  Config config = new ConfigBuilder().withMasterUrl("https://url.to.api.server")
      .withOautToken("sometoken")
      .build();
      
  ApplicationClient app = new DefaultApplicationClient(config);

Manipulating Resources

Application

In order to create an Application:

    Application app = ac.applications().createNew()
            .withNewMetadata()
                .withName("wordpress-01")
                .addToLabels("app/kubernetes.io/name", "wordpress-01")
                .addToLabels("app/kubernetes.io/version", "3")
            .endMetadata()
            .withNewSpec()
            .withNewSelector()
                .addToMatchLabels("app.kubernetes.io/name", "wordpress-01")
            .endSelector()
            .addNewComponentKind("core" ,"Service")
            .addNewComponentKind("apps" ,"Deployment")
            .addNewComponentKind("apps" ,"StatefulSet")
            .withAssemblyPhase("Pending")
            .withNewDescriptor()
            .withVersion("4.9.4")
            .withDescription("WordPress is open source software you can use to create a beautiful website, blog, or app.")
            .addNewIcon()
                .withSrc("https://example.com/wordpress.png")
                .withType("image/png")
            .endIcon()
            .addNewMaintainer()
                .withName("Kenneth Owens")
                .withEmail("[email protected]")
            .endMaintainer()
            .addNewLink("About", "https://wordpress.org/")
            .endDescriptor()
            .endSpec()
            .done();
me.snowdrop

Snowdrop

Home of Snowdrop

Versions

Version
1.1.1
1.1.0
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4