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

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

Closed
lherman-vd opened this issue Dec 6, 2023 · 7 comments · Fixed by #5724
Closed

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

lherman-vd opened this issue Dec 6, 2023 · 7 comments · Fixed by #5724
Assignees
Labels
component/openshift-model Deals with Red Hat OpenShift Model
Milestone

Comments

@lherman-vd
Copy link

Is your enhancement related to a problem? Please describe

Since OpenShift switched their recommended networking API to the OVN stack (meaning they removed the old network.openshift.io/v1 endpoints like network.openshift.io/v1/NetNamespaces and network.openshift.io/v1/EgressFirewall) we can't use the provided DSL methods from openshift-client anymore in the clusters that have migrated to the new stack.

Describe the solution you'd like

It'd be nice to add the k8s.ovn.org/v1 APIs to the built-in DSL for openshift-client so that we can reference to either APIs depending on the cluster version and capabilities.

Describe alternatives you've considered

I'm using the typeless API for now but it's verbose and hard to maintain.

Additional context

API docs for OVN:

@rohanKanojia
Copy link
Member

Is this OVN API enabled in OpenShift by default? Do I have to install some operator to add these resources? I'm not able to access these on OpenShift 4.13.12 (CRC).

@lherman-vd
Copy link
Author

Our OpenShift rep recommended us to directly enable the OVN api when we starting building a new cluster, I think the migration process for existing clusters is detailed here: https://docs.openshift.com/container-platform/4.12/networking/ovn_kubernetes_network_provider/migrate-from-openshift-sdn.html

@rohanKanojia
Copy link
Member

I see. We would need to add support for these resources.

As a workaround, you can try generating POJOs for OVN CRDs using Fabric8 Java Generator

@manusa manusa added the component/openshift-model Deals with Red Hat OpenShift Model label Dec 19, 2023
@manusa
Copy link
Member

manusa commented Dec 19, 2023

Is this OVN API enabled in OpenShift by default? Do I have to install some operator to add these resources? I'm not able to access these on OpenShift 4.13.12 (CRC).

Could you please verify if by using the cluster bot to start an OVN variant cluster these types are enabled?

manusa pushed a commit to manusa/kubernetes-client that referenced this issue Dec 20, 2023
closes: fabric8io#5636

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
@rohanKanojia
Copy link
Member

Umm, yes I can see OVN types when I create a cluster using cluster bot:

adminpolicybasedexternalroutes        apbexternalroute    k8s.ovn.org/v1                                false        AdminPolicyBasedExternalRoute
egressfirewalls                                           k8s.ovn.org/v1                                true         EgressFirewall
egressips                             eip                 k8s.ovn.org/v1                                false        EgressIP
egressqoses                                               k8s.ovn.org/v1                                true         EgressQoS
egressservices                                            k8s.ovn.org/v1                                true         EgressService

@rohanKanojia
Copy link
Member

@lherman-vd : It would be nice if you could provide some early feedback now that the functionality has been merged. I've created a demo project showcasing OVN networking extension.

After the nightly SNAPSHOT build, you should be able to access k8s.ovn.org/v1 resources by adding this dependency . You would need to configure your project to use SNAPSHOTs.
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");
    }

@lherman-vd
Copy link
Author

Apologies, I was on holiday the past few weeks.
Thank you for working on it 🎉 , I'll test the integration in our project asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/openshift-model Deals with Red Hat OpenShift Model
Projects
None yet
3 participants