Skip to content

Commit

Permalink
Fix fabric8io#3506: Add Extension for Open Cluster Management
Browse files Browse the repository at this point in the history
Signed-off-by: Rohan Kumar <[email protected]>
  • Loading branch information
rohanKanojia committed Jan 21, 2022
1 parent 37bdcb2 commit 3f002eb
Show file tree
Hide file tree
Showing 177 changed files with 28,378 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#### New Features
* Fix #3721: Add support for uploading file via InputStream
* Fix #3234: Allow specifying specific localhost while port-forwarding
* Fix #3506: Add support for Open Cluster Management extension

#### _**Note**_: Breaking changes in the API

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This client provides access to the full [Kubernetes](http://kubernetes.io/) &
| volumesnapshot-client | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.fabric8/volumesnapshot-client/badge.svg?color=blue)](https://maven-badges.herokuapp.com/maven-central/io.fabric8/volumesnapshot-client) | [![Javadocs](https://www.javadoc.io/badge/io.fabric8/volumesnapshot-client.svg?color=blue)](https://www.javadoc.io/doc/io.fabric8/volumesnapshot-client) |
| volcano-client | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.fabric8/volcano-client/badge.svg?color=blue)](https://maven-badges.herokuapp.com/maven-central/io.fabric8/volcano-client) | [![Javadocs](https://www.javadoc.io/badge/io.fabric8/volcano-client.svg?color=blue)](https://www.javadoc.io/doc/io.fabric8/volcano-client) |
| istio-client | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.fabric8/istio-client/badge.svg?color=blue)](https://maven-badges.herokuapp.com/maven-central/io.fabric8/istio-client) | [![Javadocs](https://www.javadoc.io/badge/io.fabric8/istio-client.svg?color=blue)](https://www.javadoc.io/doc/io.fabric8/istio-client) |
| open-cluster-management-client | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.fabric8/open-cluster-management-client/badge.svg?color=blue)](https://maven-badges.herokuapp.com/maven-central/io.fabric8/open-cluster-management-client) | [![Javadocs](https://www.javadoc.io/badge/io.fabric8/open-cluster-management-client.svg?color=blue)](https://www.javadoc.io/doc/io.fabric8/open-cluster-management-client) |

## Contents
- [Usage](#usage)
Expand Down Expand Up @@ -578,12 +579,12 @@ All the resource objects used here will be according to OpenShift 3.9.0 and Kub
## Who uses Kubernetes & OpenShift Java client?

Extensions:
- [Istio API](https://github.com/snowdrop/istio-java-api)
- [Service Catalog API](https://github.com/fabric8io/kubernetes-client/tree/master/extensions/service-catalog)
- [Knative](https://github.com/fabric8io/kubernetes-client/tree/master/extensions/knative)
- [Tekton](https://github.com/fabric8io/kubernetes-client/tree/master/extensions/tekton)
- [Volcano](https://github.com/fabric8io/kubernetes-client/tree/master/extensions/volcano)
- [Istio](https://github.com/fabric8io/kubernetes-client/tree/master/extensions/istio)
- [Open Cluster Management](https://github.com/fabric8io/kubernetes-client/tree/master/extensions/open-cluster-management)

Frameworks/Libraries/Tools:
- [Arquillian Cube](http://arquillian.org/arquillian-cube/)
Expand Down
133 changes: 133 additions & 0 deletions extensions/open-cluster-management/client/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2015 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.fabric8</groupId>
<artifactId>open-cluster-management</artifactId>
<version>5.12-SNAPSHOT</version>
</parent>

<artifactId>open-cluster-management-client</artifactId>
<packaging>bundle</packaging>
<name>Fabric8 :: Open Cluster Management :: Client</name>

<properties>
<useIncrementalCompilation>false</useIncrementalCompilation>
<osgi.require-capability>
osgi.extender;
filter:="(osgi.extender=osgi.serviceloader.registrar)"
</osgi.require-capability>
<osgi.import>
io.fabric8.kubernetes.api.builder,
!io.fabric8.openclustermanagement.client.*,
*
</osgi.import>
<osgi.export>
io.fabric8.openclustermanagement.client.*
</osgi.export>
<osgi.include.resources>
/META-INF/services/io.fabric8.kubernetes.client.ExtensionAdapter=target/classes/META-INF/services/io.fabric8.kubernetes.client.ExtensionAdapter
</osgi.include.resources>
</properties>

<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>open-cluster-management-apps-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>open-cluster-management-cluster-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>open-cluster-management-discovery-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>open-cluster-management-observability-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>open-cluster-management-operator-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>open-cluster-management-placementruleapps-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>open-cluster-management-policy-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>open-cluster-management-search-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>open-cluster-management-agent-model</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-client</artifactId>
<exclusions>
<exclusion>
<groupId>io.sundr</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>io.sundr</groupId>
<artifactId>builder-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-migrationsupport</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.openclustermanagement.client;

import io.fabric8.kubernetes.client.BaseClient;
import io.fabric8.kubernetes.client.ClientContext;
import io.fabric8.kubernetes.client.Config;
import io.fabric8.kubernetes.client.ConfigBuilder;
import io.fabric8.kubernetes.client.RequestConfig;
import io.fabric8.kubernetes.client.WithRequestCallable;
import io.fabric8.kubernetes.client.dsl.FunctionCallable;
import io.fabric8.openclustermanagement.client.dsl.OpenClusterManagementAgentAPIGroupDSL;
import io.fabric8.openclustermanagement.client.dsl.OpenClusterManagementAppsAPIGroupDSL;
import io.fabric8.openclustermanagement.client.dsl.OpenClusterManagementClustersAPIGroupDSL;
import io.fabric8.openclustermanagement.client.dsl.OpenClusterManagementDiscoveryAPIGroupDSL;
import io.fabric8.openclustermanagement.client.dsl.OpenClusterManagementOperatorAPIGroupDSL;
import io.fabric8.openclustermanagement.client.dsl.OpenClusterManagementPolicyAPIGroupDSL;
import io.fabric8.openclustermanagement.client.dsl.OpenClusterManagementSearchAPIGroupDSL;
import okhttp3.OkHttpClient;

public class DefaultOpenClusterManagementClient extends BaseClient implements NamespacedOpenClusterManagementClient {
public DefaultOpenClusterManagementClient() {
super();
}

public DefaultOpenClusterManagementClient(Config configuration) {
super(configuration);
}

public DefaultOpenClusterManagementClient(ClientContext clientContext) {
super(clientContext);
}

@Override
public NamespacedOpenClusterManagementClient inAnyNamespace() {
return inNamespace(null);
}

@Override
public NamespacedOpenClusterManagementClient inNamespace(String namespace) {
Config updated = new ConfigBuilder(getConfiguration())
.withNamespace(namespace)
.build();

return new DefaultOpenClusterManagementClient(newState(updated));
}

@Override
public FunctionCallable<NamespacedOpenClusterManagementClient> withRequestConfig(RequestConfig requestConfig) {
return new WithRequestCallable<>(this, requestConfig);
}

@Override
public OpenClusterManagementAppsAPIGroupDSL apps() {
return adapt(OpenClusterManagementAppsAPIGroupClient.class);
}

@Override
public OpenClusterManagementAgentAPIGroupDSL agents() {
return adapt(OpenClusterManagementAgentAPIGroupClient.class);
}

@Override
public OpenClusterManagementClustersAPIGroupDSL clusters() {
return adapt(OpenClusterManagementClustersAPIGroupClient.class);
}

@Override
public OpenClusterManagementDiscoveryAPIGroupDSL discovery() {
return adapt(OpenClusterManagementDiscoveryAPIGroupClient.class);
}

@Override
public OpenClusterManagementObservabilityAPIGroupClient observability() {
return adapt(OpenClusterManagementObservabilityAPIGroupClient.class);
}

@Override
public OpenClusterManagementOperatorAPIGroupDSL operator() {
return adapt(OpenClusterManagementOperatorAPIGroupClient.class);
}

@Override
public OpenClusterManagementPolicyAPIGroupDSL policy() {
return adapt(OpenClusterManagementPolicyAPIGroupClient.class);
}

@Override
public OpenClusterManagementSearchAPIGroupDSL search() {
return adapt(OpenClusterManagementSearchAPIGroupClient.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.openclustermanagement.client;

import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.client.dsl.AnyNamespaceable;
import io.fabric8.kubernetes.client.dsl.Namespaceable;
import io.fabric8.kubernetes.client.dsl.RequestConfigurable;

public interface GenericOpenClusterManagementClient<C extends Client> extends Client, OpenClusterManagementClient,
Namespaceable<C>,
AnyNamespaceable<C>,
RequestConfigurable<C> {
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.openclustermanagement.client;


public interface NamespacedOpenClusterManagementClient extends OpenClusterManagementClient,
GenericOpenClusterManagementClient<NamespacedOpenClusterManagementClient> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.openclustermanagement.client;

import io.fabric8.kubernetes.client.BaseClient;
import io.fabric8.kubernetes.client.ClientContext;
import io.fabric8.kubernetes.client.Config;
import io.fabric8.kubernetes.client.Handlers;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.openclustermanagement.api.model.agent.v1.KlusterletAddonConfig;
import io.fabric8.openclustermanagement.api.model.agent.v1.KlusterletAddonConfigList;
import io.fabric8.openclustermanagement.client.dsl.OpenClusterManagementAgentAPIGroupDSL;
import okhttp3.OkHttpClient;

public class OpenClusterManagementAgentAPIGroupClient extends BaseClient implements OpenClusterManagementAgentAPIGroupDSL {
public OpenClusterManagementAgentAPIGroupClient() {
super();
}

public OpenClusterManagementAgentAPIGroupClient(Config configuration) {
super(configuration);
}

public OpenClusterManagementAgentAPIGroupClient(ClientContext clientContext) {
super(clientContext);
}

@Override
public MixedOperation<KlusterletAddonConfig, KlusterletAddonConfigList, Resource<KlusterletAddonConfig>> klusterletAddonConfigs() {
return Handlers.getOperation(KlusterletAddonConfig.class, KlusterletAddonConfigList.class, this);
}
}
Loading

0 comments on commit 3f002eb

Please sign in to comment.