Skip to content

Commit

Permalink
Use constants from submariner projects
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
  • Loading branch information
tpantelis authored and openshift-merge-robot committed Jun 10, 2022
1 parent 4c8c6fb commit 52e84f4
Show file tree
Hide file tree
Showing 96 changed files with 6,692 additions and 8,510 deletions.
34 changes: 21 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/gophercloud/utils v0.0.0-20210909165623-d7085207ff6d
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.19.0
github.com/openshift/api v0.0.0-20210915110300-3cd8091317c4
github.com/openshift/api v0.0.0-20211201215911-5a82bae32e46
github.com/openshift/build-machinery-go v0.0.0-20220121085309-f94edc2d6874
github.com/openshift/library-go v0.0.0-20210916194400-ae21aab32431
github.com/operator-framework/api v0.5.2
Expand All @@ -18,21 +18,21 @@ require (
github.com/spf13/pflag v1.0.5
github.com/submariner-io/admiral v0.13.0-m2
github.com/submariner-io/cloud-prepare v0.13.0-m2
github.com/submariner-io/submariner v0.13.0-m2
github.com/submariner-io/submariner-operator v0.13.0-m2.0.20220608090053-600dbf9c25c3
github.com/submariner-io/submariner v0.13.0-m2.0.20220608112640-7f4a6a79da0d
github.com/submariner-io/submariner-operator v0.13.0-m2.0.20220610102059-d0e6ba625180
golang.org/x/oauth2 v0.0.0-20220524215830-622c5d57e401
google.golang.org/api v0.83.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.22.1
k8s.io/apiextensions-apiserver v0.22.1
k8s.io/apimachinery v0.22.1
k8s.io/api v0.23.5
k8s.io/apiextensions-apiserver v0.23.5
k8s.io/apimachinery v0.23.5
k8s.io/client-go v12.0.0+incompatible
k8s.io/code-generator v0.22.1
k8s.io/component-base v0.22.1
k8s.io/code-generator v0.23.5
k8s.io/component-base v0.23.5
k8s.io/klog/v2 v2.40.1
open-cluster-management.io/addon-framework v0.1.0
open-cluster-management.io/api v0.6.1-0.20220302050849-83dafb2a3afd
sigs.k8s.io/controller-runtime v0.9.7
sigs.k8s.io/controller-runtime v0.11.2
)

require (
Expand All @@ -59,12 +59,12 @@ require (
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
github.com/emicklei/go-restful v2.10.0+incompatible // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-logr/logr v1.2.0 // indirect
github.com/go-logr/zapr v0.4.0 // indirect
github.com/go-logr/logr v1.2.2 // indirect
github.com/go-logr/zapr v1.2.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
Expand Down Expand Up @@ -98,6 +98,7 @@ require (
github.com/prometheus/procfs v0.7.3 // indirect
github.com/robfig/cron v1.2.0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/afero v1.6.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.1 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.1 // indirect
go.etcd.io/etcd/client/v3 v3.5.0 // indirect
Expand Down Expand Up @@ -134,7 +135,7 @@ require (
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/apiserver v0.22.1 // indirect
k8s.io/apiserver v0.23.5 // indirect
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c // indirect
k8s.io/klog v1.0.0 // indirect
k8s.io/kube-aggregator v0.22.1 // indirect
Expand All @@ -148,7 +149,14 @@ require (

replace (
github.com/go-logr/logr => github.com/go-logr/logr v0.4.0
github.com/go-logr/zapr => github.com/go-logr/zapr v0.4.0
k8s.io/api => k8s.io/api v0.22.1
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.22.1
k8s.io/apimachinery => k8s.io/apimachinery v0.22.1
k8s.io/apiserver v0.23.5 => k8s.io/apiserver v0.22.1
k8s.io/client-go => k8s.io/client-go v0.22.1
k8s.io/code-generator => k8s.io/code-generator v0.22.1
k8s.io/component-base => k8s.io/component-base v0.22.1
k8s.io/klog/v2 => k8s.io/klog/v2 v2.9.0
sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.9.1
)
242 changes: 108 additions & 134 deletions go.sum

Large diffs are not rendered by default.

28 changes: 11 additions & 17 deletions pkg/spoke/submarineragent/deployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
"github.com/stolostron/submariner-addon/pkg/addon"
submarinerv1alpha1 "github.com/submariner-io/submariner-operator/api/submariner/v1alpha1"
"github.com/submariner-io/submariner-operator/pkg/names"
"github.com/submariner-io/submariner/pkg/cni"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -21,15 +23,7 @@ import (
)

const (
subscriptionName = "submariner"
operatorName = "submariner-operator"
gatewayName = "submariner-gateway"
routeAgentName = "submariner-routeagent"
globalnetName = "submariner-globalnet"
networkPluginSyncerName = "submariner-networkplugin-syncer"
lighthouseAgentName = "submariner-lighthouse-agent"
lighthouseCoreDNSName = "submariner-lighthouse-coredns"
networkPluginOVNKubernetes = "OVNKubernetes"
subscriptionName = "submariner"
)

const submarinerAgentDegraded = "SubmarinerAgentDegraded"
Expand Down Expand Up @@ -178,17 +172,17 @@ func (c *deploymentStatusController) checkDeployment(name, reasonName string, de
}

func (c *deploymentStatusController) checkDeployments(degradedConditionReasons, degradedConditionMessages *[]string) error {
err := c.checkDeployment(operatorName, "Operator", degradedConditionReasons, degradedConditionMessages)
err := c.checkDeployment(names.OperatorComponent, "Operator", degradedConditionReasons, degradedConditionMessages)
if err != nil {
return err
}

err = c.checkDeployment(lighthouseAgentName, "LighthouseAgent", degradedConditionReasons, degradedConditionMessages)
err = c.checkDeployment(names.ServiceDiscoveryComponent, "LighthouseAgent", degradedConditionReasons, degradedConditionMessages)
if err != nil {
return err
}

err = c.checkDeployment(lighthouseCoreDNSName, "LighthouseCoreDNS", degradedConditionReasons, degradedConditionMessages)
err = c.checkDeployment(names.LighthouseCoreDNSComponent, "LighthouseCoreDNS", degradedConditionReasons, degradedConditionMessages)
if err != nil {
return err
}
Expand All @@ -208,14 +202,14 @@ func (c *deploymentStatusController) checkOptionalDeployments(key string, degrad
}

if submariner.Spec.GlobalCIDR != "" {
err = c.checkDeployment(globalnetName, "Globalnet", degradedConditionReasons, degradedConditionMessages)
err = c.checkDeployment(names.GlobalnetComponent, "Globalnet", degradedConditionReasons, degradedConditionMessages)
if err != nil {
return err
}
}

if submariner.Status.NetworkPlugin == networkPluginOVNKubernetes {
err = c.checkDeployment(networkPluginSyncerName, "NetworkPluginSyncer", degradedConditionReasons, degradedConditionMessages)
if submariner.Status.NetworkPlugin == cni.OVNKubernetes {
err = c.checkDeployment(names.NetworkPluginSyncerComponent, "NetworkPluginSyncer", degradedConditionReasons, degradedConditionMessages)
if err != nil {
return err
}
Expand All @@ -225,7 +219,7 @@ func (c *deploymentStatusController) checkOptionalDeployments(key string, degrad
}

func (c *deploymentStatusController) checkGatewayDaemonSet(degradedConditionReasons, degradedConditionMessages *[]string) error {
gateways, err := c.daemonSetLister.DaemonSets(c.namespace).Get(gatewayName)
gateways, err := c.daemonSetLister.DaemonSets(c.namespace).Get(names.GatewayComponent)

switch {
case errors.IsNotFound(err):
Expand All @@ -250,7 +244,7 @@ func (c *deploymentStatusController) checkGatewayDaemonSet(degradedConditionReas
}

func (c *deploymentStatusController) checkRouteAgentDaemonSet(degradedConditionReasons, degradedConditionMessages *[]string) error {
routeAgent, err := c.daemonSetLister.DaemonSets(c.namespace).Get(routeAgentName)
routeAgent, err := c.daemonSetLister.DaemonSets(c.namespace).Get(names.RouteAgentComponent)

switch {
case errors.IsNotFound(err):
Expand Down
21 changes: 11 additions & 10 deletions pkg/spoke/submarineragent/deployment_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
fakereactor "github.com/submariner-io/admiral/pkg/fake"
"github.com/submariner-io/admiral/pkg/syncer/test"
submarinerv1alpha1 "github.com/submariner-io/submariner-operator/api/submariner/v1alpha1"
"github.com/submariner-io/submariner-operator/pkg/names"
"github.com/submariner-io/submariner/pkg/cni"
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/dynamic"
Expand All @@ -20,8 +22,7 @@ import (
)

const (
deploymentDegradedType = "SubmarinerAgentDegraded"
networkPluginOVNKubernetes = "OVNKubernetes"
deploymentDegradedType = "SubmarinerAgentDegraded"
)

var _ = Describe("Deployment Status Controller", func() {
Expand Down Expand Up @@ -258,7 +259,7 @@ var _ = Describe("Deployment Status Controller", func() {

When("network plugin is OVNKubernetes", func() {
BeforeEach(func() {
t.submariner.Status.NetworkPlugin = networkPluginOVNKubernetes
t.submariner.Status.NetworkPlugin = cni.OVNKubernetes
})

When("the network plugin syncer deployment doesn't initially exist", func() {
Expand Down Expand Up @@ -516,7 +517,7 @@ func newOperatorDeployment() *appsv1.Deployment {
return &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Namespace: submarinerNS,
Name: "submariner-operator",
Name: names.OperatorComponent,
},
Status: appsv1.DeploymentStatus{
AvailableReplicas: 1,
Expand All @@ -528,7 +529,7 @@ func newGatewayDaemonSet() *appsv1.DaemonSet {
return &appsv1.DaemonSet{
ObjectMeta: metav1.ObjectMeta{
Namespace: submarinerNS,
Name: "submariner-gateway",
Name: names.GatewayComponent,
},
Status: appsv1.DaemonSetStatus{
DesiredNumberScheduled: 1,
Expand All @@ -540,7 +541,7 @@ func newRouteAgentDaemonSet() *appsv1.DaemonSet {
return &appsv1.DaemonSet{
ObjectMeta: metav1.ObjectMeta{
Namespace: submarinerNS,
Name: "submariner-routeagent",
Name: names.RouteAgentComponent,
},
}
}
Expand All @@ -549,7 +550,7 @@ func newLighthouseAgentDeployment() *appsv1.Deployment {
return &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Namespace: submarinerNS,
Name: "submariner-lighthouse-agent",
Name: names.ServiceDiscoveryComponent,
},
Status: appsv1.DeploymentStatus{
AvailableReplicas: 1,
Expand All @@ -561,7 +562,7 @@ func newLighthouseCoreDNSDeployment() *appsv1.Deployment {
return &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Namespace: submarinerNS,
Name: "submariner-lighthouse-coredns",
Name: names.LighthouseCoreDNSComponent,
},
Status: appsv1.DeploymentStatus{
AvailableReplicas: 1,
Expand All @@ -573,7 +574,7 @@ func newGlobalnetDeployment() *appsv1.Deployment {
return &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Namespace: submarinerNS,
Name: "submariner-globalnet",
Name: names.GlobalnetComponent,
},
Status: appsv1.DeploymentStatus{
AvailableReplicas: 1,
Expand All @@ -585,7 +586,7 @@ func newNetworkPluginsyncerDeployment() *appsv1.Deployment {
return &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Namespace: submarinerNS,
Name: "submariner-networkplugin-syncer",
Name: names.NetworkPluginSyncerComponent,
},
Status: appsv1.DeploymentStatus{
AvailableReplicas: 1,
Expand Down
1 change: 1 addition & 0 deletions vendor/github.com/emicklei/go-restful/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions vendor/github.com/emicklei/go-restful/CHANGES.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/emicklei/go-restful/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions vendor/github.com/emicklei/go-restful/container.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions vendor/github.com/emicklei/go-restful/curly.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions vendor/github.com/emicklei/go-restful/custom_verb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions vendor/github.com/emicklei/go-restful/path_processor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 52e84f4

Please sign in to comment.