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 committed Jun 21, 2023
1 parent 118a230 commit dec31f3
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 6 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ require (
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.65.2
github.com/prometheus-operator/prometheus-operator/pkg/client v0.65.2
github.com/prometheus/client_golang v1.15.1
github.com/submariner-io/admiral v0.16.0-m0
github.com/submariner-io/admiral v0.16.0-m0.0.20230602131053-613bd96ec5a2
github.com/submariner-io/shipyard v0.16.0-m0
github.com/submariner-io/submariner v0.16.0-m0
github.com/submariner-io/submariner v0.16.0-m0.0.20230605130356-a1fab90349ca
github.com/uw-labs/lichen v0.1.7
golang.org/x/text v0.9.0
k8s.io/api v0.27.2
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1364,12 +1364,12 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/submariner-io/admiral v0.16.0-m0 h1:WVzyoaE6zkPzkhUBiEoS3twK6ccXHDHkRNJ1O81VI/w=
github.com/submariner-io/admiral v0.16.0-m0/go.mod h1:42+8VT+tHo03Cgt8mYh69AJrS3pptKSU5BRckONw+vE=
github.com/submariner-io/admiral v0.16.0-m0.0.20230602131053-613bd96ec5a2 h1:3Z3EoAK+07Ro6UW9RTpB3aehzz4U2dwTh9rq1s/Vg30=
github.com/submariner-io/admiral v0.16.0-m0.0.20230602131053-613bd96ec5a2/go.mod h1:42+8VT+tHo03Cgt8mYh69AJrS3pptKSU5BRckONw+vE=
github.com/submariner-io/shipyard v0.16.0-m0 h1:5pw0gTYVGqCLLe3zSEikmqDRScaOriwTcWwYh+HWsZg=
github.com/submariner-io/shipyard v0.16.0-m0/go.mod h1:wgnJxga0mr5ujphMnTK6dfz0w0OCqbRVe/fwO+wu2C0=
github.com/submariner-io/submariner v0.16.0-m0 h1:IgP61+RyIDOT4+nSJhDZC4XHx3TSlKDJKci7h33iW7M=
github.com/submariner-io/submariner v0.16.0-m0/go.mod h1:bP/nwcqZLy0dscCW+lN2AOUo39MstjEHicmnkTemDCg=
github.com/submariner-io/submariner v0.16.0-m0.0.20230605130356-a1fab90349ca h1:bdC9W+A3T9p2/ToslHlvlK5MpPr9IUEAPViw6cPMPPo=
github.com/submariner-io/submariner v0.16.0-m0.0.20230605130356-a1fab90349ca/go.mod h1:5KF3Dx6qfOuVK++Plz/W1u/5+kd9Rq7PInZI9IKEtDk=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
Expand Down
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 dec31f3

Please sign in to comment.