Skip to content

Commit

Permalink
Remove networkplugin syncer bits
Browse files Browse the repository at this point in the history
...from gather, show, image override et al

Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
  • Loading branch information
tpantelis committed Aug 15, 2023
1 parent 42babd3 commit 9672da5
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 58 deletions.
19 changes: 7 additions & 12 deletions internal/gather/connectivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ import (
)

const (
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"
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"
)

func gatherGatewayPodLogs(info *Info) {
Expand All @@ -55,10 +54,6 @@ 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: 0 additions & 2 deletions internal/gather/gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ 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 @@ -239,7 +238,6 @@ 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: 0 additions & 4 deletions internal/gather/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ 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: 1 addition & 2 deletions internal/show/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ func Versions(clusterInfo *cluster.Info, _ string, status reporter.Interface) er
}

err = printDeploymentVersions(
clusterInfo, &printer, names.OperatorComponent, names.ServiceDiscoveryComponent, names.LighthouseCoreDNSComponent,
names.NetworkPluginSyncerComponent)
clusterInfo, &printer, names.OperatorComponent, names.ServiceDiscoveryComponent, names.LighthouseCoreDNSComponent)
if err != nil {
return status.Error(err, "Error retrieving Deployment versions")
}
Expand Down
1 change: 0 additions & 1 deletion pkg/cluster/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ var validOverrides = []string{
names.GatewayComponent,
names.RouteAgentComponent,
names.GlobalnetComponent,
names.NetworkPluginSyncerComponent,
names.ServiceDiscoveryComponent,
names.LighthouseCoreDNSComponent,
names.NettestComponent,
Expand Down
7 changes: 0 additions & 7 deletions pkg/diagnose/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ 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 @@ -135,12 +134,6 @@ 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: 0 additions & 5 deletions pkg/submariner/ensure.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ 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: 6 additions & 25 deletions pkg/submariner/serviceaccount/ensure.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ 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 @@ -82,15 +81,9 @@ 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 || createdNPSyncerSA || createdDiagnoseSA,
errors.Wrap(err, "error provisioning operator networkplugin syncer resource")
return createdSubmarinerSA || createdRouteAgentSA || createdGlobalnetSA || createdDiagnoseSA,
errors.Wrap(err, "error provisioning diagnose ServiceAccount resource")
}

func ensureClusterRoles(ctx context.Context, kubeClient kubernetes.Interface) (bool, error) {
Expand All @@ -110,17 +103,11 @@ 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")
}

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")
return createdSubmarinerCR || createdRouteAgentCR || createdGlobalnetCR || createdDiagnoseCR,
errors.Wrap(err, "error provisioning diagnose 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 @@ -142,15 +129,9 @@ 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 || createdNPSyncerCRB || createdDiagnoseCRB,
errors.Wrap(err, "error provisioning networkplugin syncer ClusterRoleBinding resource")
return createdSubmarinerCRB || createdRouteAgentCRB || createdGlobalnetCRB || createdDiagnoseCRB,
errors.Wrap(err, "error provisioning diagnose ClusterRoleBinding resource")
}

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

0 comments on commit 9672da5

Please sign in to comment.