Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (extensions) : Add DSL for Open Virtual Networking k8s.ovn.org API group resources #5724

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

rohanKanojia
Copy link
Member

@rohanKanojia rohanKanojia commented Jan 23, 2024

Description

Fix #5636

Add OpenVirtualNetworkingClient with entrypoint v1() which will expose the following resources:

  • ovnClient.v1().egressIps()
  • ovnClient.v1().egressQoses()
  • ovnClient.v1().egressFirewalls()
  • ovnClient.v1().egressServices()
  • ovnClient.v1().adminPolicyBasedExternalRoutes()

User would need to add this dependency in order to use this extension:

    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>open-virtual-networking-client</artifactId>
      <version>${fabric8.version}</version>
    </dependency>

Here is an example of sample usage:

    try (OpenVirtualNetworkingClient ovnClient = new KubernetesClientBuilder().build().adapt(OpenVirtualNetworkingClient.class)) {
      EgressFirewall egressFirewall = new EgressFirewallBuilder()
          .withNewMetadata()
          .withName("default")
          // ...
          .build();
      egressFirewall = ovnClient.v1().egressFirewalls().resource(egressFirewall).serverSideApply();

      egressFirewall = ovnClient.v1().egressFirewalls().resource(egressFirewall).get();
      System.out.println(egressFirewall.getMetadata().getName() + " Created");
    }

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

@rohanKanojia rohanKanojia marked this pull request as ready for review January 23, 2024 18:15
Copy link
Member

@manusa manusa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good.
However, I don't understand why the model is in kubernetes-model-ovn while the DSL is declared in the OpenShiftClient

@manusa manusa added this to the 6.11.0 milestone Jan 24, 2024
@rohanKanojia
Copy link
Member Author

rohanKanojia commented Jan 24, 2024

I named the module kubernetes-model-ovn because of k8s.ovn.org API group. These resources are CRDs that are not available in vanilla Kubernetes Clusters.

User requested to add DSL in openshift client in #5636 (comment). We can also have it as an extension.

@manusa
Copy link
Member

manusa commented Jan 24, 2024

User requested to add DSL in openshift client in #5636 (comment). We can also have it as an extension.

I understand the user requested it in the scope of the OpenShift recommendation. However, these resources aren't exclusive to OpenShift, it would be weird to have a Kubernetes Cluster with OVN enabled and having to access this API through client.adapt(OpenShiftClient.class) plus requiring the OpenShift client module.

For me it's either making it accessible through the standard KubernetesClient DSL or creating an extension.

@rohanKanojia
Copy link
Member Author

rohanKanojia commented Jan 24, 2024

I would prefer having it as an extension. If you agree I can create PR to migrate model to extensions/

rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this pull request Feb 1, 2024
…vn` to `extensions/open-virtual-networking`

As discussed in
fabric8io#5724 (comment)
it's better to have Open Virtual Networking types available as a
separate extension.

Move previously added `kubernetes-model-generator/kubernetes-model-ovn`
to `extensions/open-virtual-networking/model-v1`

Signed-off-by: Rohan Kumar <[email protected]>
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this pull request Feb 1, 2024
…vn` to `extensions/open-virtual-networking`

As discussed in
fabric8io#5724 (comment)
it's better to have Open Virtual Networking types available as a
separate extension.

Move previously added `kubernetes-model-generator/kubernetes-model-ovn`
to `extensions/open-virtual-networking/model-v1`

Signed-off-by: Rohan Kumar <[email protected]>
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this pull request Feb 1, 2024
…vn` to `extensions/open-virtual-networking`

As discussed in
fabric8io#5724 (comment)
it's better to have Open Virtual Networking types available as a
separate extension.

Move previously added `kubernetes-model-generator/kubernetes-model-ovn`
to `extensions/open-virtual-networking/model-v1`

Signed-off-by: Rohan Kumar <[email protected]>
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this pull request Feb 1, 2024
…vn` to `extensions/open-virtual-networking`

As discussed in
fabric8io#5724 (comment)
it's better to have Open Virtual Networking types available as a
separate extension.

Move previously added `kubernetes-model-generator/kubernetes-model-ovn`
to `extensions/open-virtual-networking/model-v1`

Signed-off-by: Rohan Kumar <[email protected]>
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this pull request Feb 1, 2024
…vn` to `extensions/open-virtual-networking`

As discussed in
fabric8io#5724 (comment)
it's better to have Open Virtual Networking types available as a
separate extension.

Move previously added `kubernetes-model-generator/kubernetes-model-ovn`
to `extensions/open-virtual-networking/model-v1`

Signed-off-by: Rohan Kumar <[email protected]>
@rohanKanojia rohanKanojia force-pushed the pr/issue5636-openshift-dsl branch from e1ef913 to 9b67391 Compare February 1, 2024 14:58
@rohanKanojia rohanKanojia changed the title feat (openshift-client-api) : Add Open Virtual Networking DSL to OpenShiftClient feat (extensions) : Add DSL for Open Virtual Networking k8s.ovn.org API group resources Feb 1, 2024
manusa pushed a commit that referenced this pull request Feb 1, 2024
…vn` to `extensions/open-virtual-networking`

As discussed in
#5724 (comment)
it's better to have Open Virtual Networking types available as a
separate extension.

Move previously added `kubernetes-model-generator/kubernetes-model-ovn`
to `extensions/open-virtual-networking/model-v1`

Signed-off-by: Rohan Kumar <[email protected]>
… API group resources

Add client module to provide DSL for resources in `k8s.ovn.org` API
group

Signed-off-by: Rohan Kumar <[email protected]>
@rohanKanojia rohanKanojia force-pushed the pr/issue5636-openshift-dsl branch from 9b67391 to bc20219 Compare February 1, 2024 16:05
Copy link

sonarqubecloud bot commented Feb 1, 2024

Quality Gate Failed Quality Gate failed

Failed conditions

52.2% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@manusa manusa merged commit 43180a9 into fabric8io:main Feb 2, 2024
16 of 19 checks passed
@rohanKanojia rohanKanojia deleted the pr/issue5636-openshift-dsl branch February 2, 2024 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for OVN networking API (k8s.ovn.org/v1) for Openshift 4.12+
4 participants