Skip to content

Commit

Permalink
Revert "Remove networkplugin syncer bits"
Browse files Browse the repository at this point in the history
This reverts commit 9672da5, which
broke CI across the board. The changes will be restored once other
dependencies have been merged.

Signed-off-by: Stephen Kitt <[email protected]>
  • Loading branch information
skitt committed Aug 16, 2023
1 parent 60d047d commit 60d58cf
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 14 deletions.
19 changes: 12 additions & 7 deletions internal/gather/connectivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ import (
)

const (
gatewayPodLabel = "app=submariner-gateway"
routeagentPodLabel = "app=submariner-routeagent"
globalnetPodLabel = "app=submariner-globalnet"
metricsProxyPodLabel = "app=submariner-metrics-proxy"
addonPodLabel = "app=submariner-addon"
ovnMasterPodLabelOCP = "app=ovnkube-master"
ovnMasterPodLabelGeneric = "name=ovnkube-master"
gatewayPodLabel = "app=submariner-gateway"
routeagentPodLabel = "app=submariner-routeagent"
globalnetPodLabel = "app=submariner-globalnet"
metricsProxyPodLabel = "app=submariner-metrics-proxy"
networkpluginSyncerPodLabel = "app=submariner-networkplugin-syncer"
addonPodLabel = "app=submariner-addon"
ovnMasterPodLabelOCP = "app=ovnkube-master"
ovnMasterPodLabelGeneric = "name=ovnkube-master"
)

func gatherGatewayPodLogs(info *Info) {
Expand All @@ -54,6 +55,10 @@ func gatherGlobalnetPodLogs(info *Info) {
gatherPodLogs(globalnetPodLabel, info)
}

func gatherNetworkPluginSyncerPodLogs(info *Info) {
gatherPodLogs(networkpluginSyncerPodLabel, info)
}

func gatherAddonPodLogs(info *Info) {
gatherPodLogs(addonPodLabel, info)
}
Expand Down
2 changes: 2 additions & 0 deletions internal/gather/gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func gatherConnectivity(dataType string, info Info) bool {
gatherRouteAgentPodLogs(&info)
gatherMetricsProxyPodLogs(&info)
gatherGlobalnetPodLogs(&info)
gatherNetworkPluginSyncerPodLogs(&info)
gatherAddonPodLogs(&info)
case Resources:
gatherCNIResources(&info, info.Submariner.Status.NetworkPlugin)
Expand Down Expand Up @@ -238,6 +239,7 @@ func gatherOperator(dataType string, info Info) bool {
gatherMetricsPodDaemonSet(&info, info.OperatorNamespace())
gatherRouteAgentDaemonSet(&info, info.OperatorNamespace())
gatherGlobalnetDaemonSet(&info, info.OperatorNamespace())
gatherNetworkPluginSyncerDeployment(&info, info.OperatorNamespace())
gatherLighthouseAgentDeployment(&info, info.OperatorNamespace())
gatherLighthouseCoreDNSDeployment(&info, info.OperatorNamespace())
default:
Expand Down
4 changes: 4 additions & 0 deletions internal/gather/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ func gatherGlobalnetDaemonSet(info *Info, namespace string) {
gatherDaemonSet(info, namespace, metav1.ListOptions{LabelSelector: globalnetPodLabel})
}

func gatherNetworkPluginSyncerDeployment(info *Info, namespace string) {
gatherDeployment(info, namespace, metav1.ListOptions{LabelSelector: networkpluginSyncerPodLabel})
}

func gatherLighthouseAgentDeployment(info *Info, namespace string) {
gatherDeployment(info, namespace, metav1.ListOptions{LabelSelector: "app=submariner-lighthouse-agent"})
}
Expand Down
3 changes: 2 additions & 1 deletion internal/show/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ func Versions(clusterInfo *cluster.Info, _ string, status reporter.Interface) er
}

err = printDeploymentVersions(
clusterInfo, &printer, names.OperatorComponent, names.ServiceDiscoveryComponent, names.LighthouseCoreDNSComponent)
clusterInfo, &printer, names.OperatorComponent, names.ServiceDiscoveryComponent, names.LighthouseCoreDNSComponent,
names.NetworkPluginSyncerComponent)
if err != nil {
return status.Error(err, "Error retrieving Deployment versions")
}
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ var validOverrides = []string{
names.GatewayComponent,
names.RouteAgentComponent,
names.GlobalnetComponent,
names.NetworkPluginSyncerComponent,
names.ServiceDiscoveryComponent,
names.LighthouseCoreDNSComponent,
names.NettestComponent,
Expand Down
7 changes: 7 additions & 0 deletions pkg/diagnose/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/submariner-io/subctl/pkg/cluster"
submarinerv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1"
"github.com/submariner-io/submariner/pkg/cidr"
"github.com/submariner-io/submariner/pkg/cni"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -134,6 +135,12 @@ func checkPods(clusterInfo *cluster.Info, status reporter.Interface) error {
checkDaemonset(clusterInfo.ClientProducer.ForKubernetes(), constants.OperatorNamespace, "submariner-globalnet", tracker)
}

// check if networkplugin syncer components are deployed and running if enabled
if clusterInfo.Submariner.Status.NetworkPlugin == cni.OVNKubernetes {
checkDeployment(clusterInfo.ClientProducer.ForKubernetes(), constants.OperatorNamespace,
"submariner-networkplugin-syncer", tracker)
}

checkDaemonset(clusterInfo.ClientProducer.ForKubernetes(), clusterInfo.Submariner.Namespace, "submariner-metrics-proxy", tracker)
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/submariner/ensure.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ func Ensure(ctx context.Context, status reporter.Interface, kubeClient kubernete
ClusterRoleFile: embeddedyamls.Config_rbac_submariner_diagnose_ocp_cluster_role_yaml,
ClusterRoleBindingFile: embeddedyamls.Config_rbac_submariner_diagnose_ocp_cluster_role_binding_yaml,
},
{
ComponentName: names.NetworkPluginSyncerComponent,
ClusterRoleFile: embeddedyamls.Config_rbac_networkplugin_syncer_ocp_cluster_role_yaml,
ClusterRoleBindingFile: embeddedyamls.Config_rbac_networkplugin_syncer_ocp_cluster_role_binding_yaml,
},
}

if created, err := ocp.EnsureRBAC(ctx, dynClient, kubeClient, operatorNamespace, componentsRbac); err != nil {
Expand Down
31 changes: 25 additions & 6 deletions pkg/submariner/serviceaccount/ensure.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func Ensure(ctx context.Context, kubeClient kubernetes.Interface, namespace stri
return createdSA || createdRole || createdRB || createdCR || createdCRB, nil
}

//nolint:dupl // Similar code in ensureClusterRoleBindings, ensureRoles, ensureRoleBindings but not duplicated
func ensureServiceAccounts(ctx context.Context, kubeClient kubernetes.Interface, namespace string) (bool, error) {
createdSubmarinerSA, err := serviceaccount.EnsureFromYAML(ctx, kubeClient, namespace,
embeddedyamls.Config_rbac_submariner_gateway_service_account_yaml)
Expand All @@ -81,9 +82,15 @@ func ensureServiceAccounts(ctx context.Context, kubeClient kubernetes.Interface,

createdDiagnoseSA, err := serviceaccount.EnsureFromYAML(ctx, kubeClient, namespace,
embeddedyamls.Config_rbac_submariner_diagnose_service_account_yaml)
if err != nil {
return false, errors.Wrap(err, "error provisioning diagnose ServiceAccount resource")
}

createdNPSyncerSA, err := serviceaccount.EnsureFromYAML(ctx, kubeClient, namespace,
embeddedyamls.Config_rbac_networkplugin_syncer_service_account_yaml)

return createdSubmarinerSA || createdRouteAgentSA || createdGlobalnetSA || createdDiagnoseSA,
errors.Wrap(err, "error provisioning diagnose ServiceAccount resource")
return createdSubmarinerSA || createdRouteAgentSA || createdGlobalnetSA || createdNPSyncerSA || createdDiagnoseSA,
errors.Wrap(err, "error provisioning operator networkplugin syncer resource")
}

func ensureClusterRoles(ctx context.Context, kubeClient kubernetes.Interface) (bool, error) {
Expand All @@ -103,11 +110,17 @@ func ensureClusterRoles(ctx context.Context, kubeClient kubernetes.Interface) (b
}

createdDiagnoseCR, err := clusterrole.EnsureFromYAML(ctx, kubeClient, embeddedyamls.Config_rbac_submariner_diagnose_cluster_role_yaml)
if err != nil {
return false, errors.Wrap(err, "error provisioning diagnose ClusterRole resource")
}

return createdSubmarinerCR || createdRouteAgentCR || createdGlobalnetCR || createdDiagnoseCR,
errors.Wrap(err, "error provisioning diagnose ClusterRole resource")
createdNPSyncerCR, err := clusterrole.EnsureFromYAML(ctx, kubeClient, embeddedyamls.Config_rbac_networkplugin_syncer_cluster_role_yaml)

return createdSubmarinerCR || createdRouteAgentCR || createdGlobalnetCR || createdNPSyncerCR || createdDiagnoseCR,
errors.Wrap(err, "error provisioning networkplugin syncer ClusterRole resource")
}

//nolint:dupl // Similar code in ensureServiceAccounts, ensureRoles, ensureRoleBindings but not duplicated
func ensureClusterRoleBindings(ctx context.Context, kubeClient kubernetes.Interface, namespace string) (bool, error) {
createdSubmarinerCRB, err := clusterrolebinding.EnsureFromYAML(ctx, kubeClient, namespace,
embeddedyamls.Config_rbac_submariner_gateway_cluster_role_binding_yaml)
Expand All @@ -129,9 +142,15 @@ func ensureClusterRoleBindings(ctx context.Context, kubeClient kubernetes.Interf

createdDiagnoseCRB, err := clusterrolebinding.EnsureFromYAML(ctx, kubeClient, namespace,
embeddedyamls.Config_rbac_submariner_diagnose_cluster_role_binding_yaml)
if err != nil {
return false, errors.Wrap(err, "error provisioning diagnose ClusterRoleBinding resource")
}

createdNPSyncerCRB, err := clusterrolebinding.EnsureFromYAML(ctx, kubeClient, namespace,
embeddedyamls.Config_rbac_networkplugin_syncer_cluster_role_binding_yaml)

return createdSubmarinerCRB || createdRouteAgentCRB || createdGlobalnetCRB || createdDiagnoseCRB,
errors.Wrap(err, "error provisioning diagnose ClusterRoleBinding resource")
return createdSubmarinerCRB || createdRouteAgentCRB || createdGlobalnetCRB || createdNPSyncerCRB || createdDiagnoseCRB,
errors.Wrap(err, "error provisioning networkplugin syncer ClusterRoleBinding resource")
}

//nolint:dupl // Similar code in ensureServiceAccounts, ensureClusterRoleBindings, ensureRoleBindings but not duplicated
Expand Down

0 comments on commit 60d58cf

Please sign in to comment.