Skip to content

Commit

Permalink
Register OVN-IC APIs
Browse files Browse the repository at this point in the history
Epic: submariner-io/enhancements#186

Signed-off-by: Janki Chhatbar <[email protected]>
  • Loading branch information
Jaanki authored and sridhargaddam committed Jun 21, 2023
1 parent c81de14 commit 1822146
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/embeddedyamls/generators/yamls2go.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ var files = []string{
"deploy/submariner/crds/submariner.io_clusterglobalegressips.yaml",
"deploy/submariner/crds/submariner.io_globalegressips.yaml",
"deploy/submariner/crds/submariner.io_globalingressips.yaml",
"deploy/submariner/crds/submariner.io_gatewayroutes.yaml",
"deploy/submariner/crds/submariner.io_nongatewayroutes.yaml",
"deploy/mcsapi/crds/multicluster.x_k8s.io_serviceexports.yaml",
"deploy/mcsapi/crds/multicluster.x_k8s.io_serviceimports.yaml",
"config/broker/broker-admin/service_account.yaml",
Expand Down
112 changes: 112 additions & 0 deletions pkg/embeddedyamls/yamls.go
Original file line number Diff line number Diff line change
Expand Up @@ -1965,6 +1965,118 @@ spec:
storage: true
subresources:
status: {}
`
Deploy_submariner_crds_submariner_io_gatewayroutes_yaml = `---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
name: gatewayroutes.submariner.io
spec:
group: submariner.io
names:
kind: GatewayRoute
listKind: GatewayRouteList
plural: gatewayroutes
shortNames:
- gwrt
singular: gatewayroute
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
nextHops:
description: Specifies the next hops to reach the remote CIDRs
items:
type: string
type: array
remoteCIDRs:
description: Specifies the remote CIDRs available via the next hop
items:
type: string
type: array
required:
- nextHops
- remoteCIDRs
type: object
required:
- spec
type: object
served: true
storage: true
`
Deploy_submariner_crds_submariner_io_nongatewayroutes_yaml = `---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
name: nongatewayroutes.submariner.io
spec:
group: submariner.io
names:
kind: NonGatewayRoute
listKind: NonGatewayRouteList
plural: nongatewayroutes
shortNames:
- ngwrt
singular: nongatewayroute
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
nextHops:
description: Specifies the next hops to reach the remote CIDRs
items:
type: string
type: array
remoteCIDRs:
description: Specifies the remote CIDRs available via the next hop
items:
type: string
type: array
required:
- nextHops
- remoteCIDRs
type: object
required:
- spec
type: object
served: true
storage: true
`
Deploy_mcsapi_crds_multicluster_x_k8s_io_serviceexports_yaml = `apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
14 changes: 14 additions & 0 deletions pkg/gateway/crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import (

// Ensure ensures that the required resources are deployed on the target system.
// The resources handled here are the gateway CRDs: Cluster and Endpoint.
//
//nolint:gocyclo // No further refactors necessary
func Ensure(ctx context.Context, crdUpdater crd.Updater) error {
_, err := crdUpdater.CreateOrUpdateFromEmbedded(ctx,
embeddedyamls.Deploy_submariner_crds_submariner_io_clusters_yaml)
Expand Down Expand Up @@ -66,5 +68,17 @@ func Ensure(ctx context.Context, crdUpdater crd.Updater) error {
return errors.Wrap(err, "error provisioning the GlobalIngressIP CRD")
}

_, err = crdUpdater.CreateOrUpdateFromEmbedded(ctx,
embeddedyamls.Deploy_submariner_crds_submariner_io_gatewayroutes_yaml)
if err != nil && !apierrors.IsAlreadyExists(err) {
return errors.Wrap(err, "error getting Gateway routes")
}

_, err = crdUpdater.CreateOrUpdateFromEmbedded(ctx,
embeddedyamls.Deploy_submariner_crds_submariner_io_nongatewayroutes_yaml)
if err != nil && !apierrors.IsAlreadyExists(err) {
return errors.Wrap(err, "error getting non-Gateway routes")
}

return nil
}

0 comments on commit 1822146

Please sign in to comment.