-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (extensions) : Add DSL for Open Virtual Networking
k8s.ovn.org
…
… API group resources Add client module to provide DSL for resources in `k8s.ovn.org` API group Signed-off-by: Rohan Kumar <[email protected]>
- Loading branch information
1 parent
0d8fc44
commit 9b67391
Showing
19 changed files
with
1,158 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<?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>kubernetes-client-project</artifactId> | ||
<version>6.11-SNAPSHOT</version> | ||
<relativePath>../../../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>open-virtual-networking-client</artifactId> | ||
|
||
<properties> | ||
<useIncrementalCompilation>false</useIncrementalCompilation> | ||
<osgi.require-capability> | ||
osgi.extender; | ||
filter:="(osgi.extender=osgi.serviceloader.registrar)" | ||
</osgi.require-capability> | ||
<osgi.provide-capability> | ||
osgi.serviceloader; | ||
osgi.serviceloader=io.fabric8.kubernetes.client.extension.ExtensionAdapter | ||
</osgi.provide-capability> | ||
<osgi.import> | ||
io.fabric8.kubernetes.api.builder, | ||
!io.fabric8.ovn.client.*, | ||
* | ||
</osgi.import> | ||
<osgi.export> | ||
io.fabric8.ovn.client.* | ||
</osgi.export> | ||
<osgi.include.resources> | ||
${osgi.include.resources.default}, | ||
/META-INF/services/io.fabric8.kubernetes.client.extension.ExtensionAdapter=target/classes/META-INF/services/io.fabric8.kubernetes.client.extension.ExtensionAdapter | ||
</osgi.include.resources> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>open-virtual-networking-model-v1</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-client-api</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>io.sundr</groupId> | ||
<artifactId>*</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-client</artifactId> | ||
<scope>runtime</scope> | ||
</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-params</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
49 changes: 49 additions & 0 deletions
49
...orking/client/src/main/java/io/fabric8/ovn/client/DefaultOpenVirtualNetworkingClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* 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.ovn.client; | ||
|
||
import io.fabric8.kubernetes.client.Client; | ||
import io.fabric8.kubernetes.client.RequestConfig; | ||
import io.fabric8.kubernetes.client.WithRequestCallable; | ||
import io.fabric8.kubernetes.client.dsl.FunctionCallable; | ||
import io.fabric8.kubernetes.client.extension.ExtensionRootClientAdapter; | ||
import io.fabric8.ovn.client.dsl.V1OpenVirtualNetworkingAPIGroupDSL; | ||
|
||
public class DefaultOpenVirtualNetworkingClient extends ExtensionRootClientAdapter<DefaultOpenVirtualNetworkingClient> | ||
implements NamespacedOpenVirtualNetworkingClient { | ||
public DefaultOpenVirtualNetworkingClient() { | ||
super(); | ||
} | ||
|
||
public DefaultOpenVirtualNetworkingClient(Client client) { | ||
super(client); | ||
} | ||
|
||
@Override | ||
public V1OpenVirtualNetworkingAPIGroupDSL v1() { | ||
return adapt(V1OpenVirtualNetworkingAPIGroupClient.class); | ||
} | ||
|
||
@Override | ||
protected DefaultOpenVirtualNetworkingClient newInstance(Client client) { | ||
return new DefaultOpenVirtualNetworkingClient(client); | ||
} | ||
|
||
@Override | ||
public FunctionCallable<NamespacedOpenVirtualNetworkingClient> withRequestConfig(RequestConfig requestConfig) { | ||
return new WithRequestCallable<>(this, requestConfig); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...orking/client/src/main/java/io/fabric8/ovn/client/GenericOpenVirtualNetworkingClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* 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.ovn.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 GenericOpenVirtualNetworkingClient<C extends Client> extends Client, OpenVirtualNetworkingClient, | ||
Namespaceable<C>, | ||
AnyNamespaceable<C>, | ||
RequestConfigurable<C> { | ||
} |
20 changes: 20 additions & 0 deletions
20
...ing/client/src/main/java/io/fabric8/ovn/client/NamespacedOpenVirtualNetworkingClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* 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.ovn.client; | ||
|
||
public interface NamespacedOpenVirtualNetworkingClient extends OpenVirtualNetworkingClient, | ||
GenericOpenVirtualNetworkingClient<NamespacedOpenVirtualNetworkingClient> { | ||
} |
28 changes: 28 additions & 0 deletions
28
...al-networking/client/src/main/java/io/fabric8/ovn/client/OpenVirtualNetworkingClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.ovn.client; | ||
|
||
import io.fabric8.kubernetes.client.Client; | ||
import io.fabric8.ovn.client.dsl.V1OpenVirtualNetworkingAPIGroupDSL; | ||
|
||
public interface OpenVirtualNetworkingClient extends Client { | ||
/** | ||
* DSL entrypoint for entrypoint for k8s.ovn.org/v1 resources | ||
* | ||
* @return {@link V1OpenVirtualNetworkingAPIGroupDSL} | ||
*/ | ||
V1OpenVirtualNetworkingAPIGroupDSL v1(); | ||
} |
41 changes: 41 additions & 0 deletions
41
...ing/client/src/main/java/io/fabric8/ovn/client/OpenVirtualNetworkingExtensionAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* 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.ovn.client; | ||
|
||
import io.fabric8.kubernetes.client.Client; | ||
import io.fabric8.kubernetes.client.extension.ExtensionAdapter; | ||
import io.fabric8.ovn.client.dsl.V1OpenVirtualNetworkingAPIGroupDSL; | ||
|
||
public class OpenVirtualNetworkingExtensionAdapter implements ExtensionAdapter<OpenVirtualNetworkingClient> { | ||
|
||
@Override | ||
public Class<OpenVirtualNetworkingClient> getExtensionType() { | ||
return OpenVirtualNetworkingClient.class; | ||
} | ||
|
||
@Override | ||
public OpenVirtualNetworkingClient adapt(Client client) { | ||
if (client.hasApiGroup("k8s.ovn.org", false)) { | ||
return new DefaultOpenVirtualNetworkingClient(client); | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public void registerClients(ClientFactory factory) { | ||
factory.register(V1OpenVirtualNetworkingAPIGroupDSL.class, new V1OpenVirtualNetworkingAPIGroupClient()); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
...ing/client/src/main/java/io/fabric8/ovn/client/V1OpenVirtualNetworkingAPIGroupClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* 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.ovn.client; | ||
|
||
import io.fabric8.kubernetes.api.model.ovn.v1.AdminPolicyBasedExternalRoute; | ||
import io.fabric8.kubernetes.api.model.ovn.v1.AdminPolicyBasedExternalRouteList; | ||
import io.fabric8.kubernetes.api.model.ovn.v1.EgressFirewall; | ||
import io.fabric8.kubernetes.api.model.ovn.v1.EgressFirewallList; | ||
import io.fabric8.kubernetes.api.model.ovn.v1.EgressIP; | ||
import io.fabric8.kubernetes.api.model.ovn.v1.EgressIPList; | ||
import io.fabric8.kubernetes.api.model.ovn.v1.EgressQoS; | ||
import io.fabric8.kubernetes.api.model.ovn.v1.EgressQoSList; | ||
import io.fabric8.kubernetes.api.model.ovn.v1.EgressService; | ||
import io.fabric8.kubernetes.api.model.ovn.v1.EgressServiceList; | ||
import io.fabric8.kubernetes.client.dsl.MixedOperation; | ||
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; | ||
import io.fabric8.kubernetes.client.dsl.Resource; | ||
import io.fabric8.kubernetes.client.extension.ClientAdapter; | ||
import io.fabric8.ovn.client.dsl.V1OpenVirtualNetworkingAPIGroupDSL; | ||
|
||
public class V1OpenVirtualNetworkingAPIGroupClient extends ClientAdapter<V1OpenVirtualNetworkingAPIGroupClient> | ||
implements V1OpenVirtualNetworkingAPIGroupDSL { | ||
@Override | ||
public NonNamespaceOperation<EgressIP, EgressIPList, Resource<EgressIP>> egressIps() { | ||
return resources(EgressIP.class, EgressIPList.class); | ||
} | ||
|
||
@Override | ||
public NonNamespaceOperation<AdminPolicyBasedExternalRoute, AdminPolicyBasedExternalRouteList, Resource<AdminPolicyBasedExternalRoute>> adminPolicyBasedExternalRoutes() { | ||
return resources(AdminPolicyBasedExternalRoute.class, AdminPolicyBasedExternalRouteList.class); | ||
} | ||
|
||
@Override | ||
public MixedOperation<EgressFirewall, EgressFirewallList, Resource<EgressFirewall>> egressFirewalls() { | ||
return resources(EgressFirewall.class, EgressFirewallList.class); | ||
} | ||
|
||
@Override | ||
public MixedOperation<EgressQoS, EgressQoSList, Resource<EgressQoS>> egressQoses() { | ||
return resources(EgressQoS.class, EgressQoSList.class); | ||
} | ||
|
||
@Override | ||
public MixedOperation<EgressService, EgressServiceList, Resource<EgressService>> egressServices() { | ||
return resources(EgressService.class, EgressServiceList.class); | ||
} | ||
|
||
@Override | ||
public V1OpenVirtualNetworkingAPIGroupClient newInstance() { | ||
return new V1OpenVirtualNetworkingAPIGroupClient(); | ||
} | ||
} |
Oops, something went wrong.