Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
squash please
  • Loading branch information
vthapar committed Aug 29, 2022
1 parent 1df0e56 commit d39f841
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 19 deletions.
4 changes: 1 addition & 3 deletions controllers/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ limitations under the License.

package constants

const (
CleanupFinalizer = "controllers.submariner.io/cleanup"
)
const CleanupFinalizer = "controllers.submariner.io/cleanup"
10 changes: 4 additions & 6 deletions controllers/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ import (
controllerClient "sigs.k8s.io/controller-runtime/pkg/client"
)

func Setup(serviceName, namespace, applicationKey, applicationName string, owner metav1.Object, port int32,
client controllerClient.Client, config *rest.Config, scheme *runtime.Scheme,
reqLogger logr.Logger,
func Setup(serviceName, namespace, applicationKey, applicationName string, owner metav1.Object, port int32,
client controllerClient.Client, config *rest.Config, scheme *runtime.Scheme, reqLogger logr.Logger,
) error {
metricsService, err := helpers.ReconcileService(owner, newMetricsService(serviceName, namespace, applicationKey, applicationName, port), reqLogger,
client, scheme)

metricsService, err := helpers.ReconcileService(owner, newMetricsService(serviceName, namespace, applicationKey,
applicationName, port), reqLogger, client, scheme)
if err != nil {
return err // nolint:wrapcheck // No need to wrap here
}
Expand Down
2 changes: 0 additions & 2 deletions controllers/servicediscovery/servicediscovery_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,6 @@ func (r *Reconciler) ensureLightHouseAgent(instance *submarinerv1alpha1.ServiceD

err := metrics.Setup(names.ServiceDiscoveryComponent, instance.Namespace, "app", names.ServiceDiscoveryComponent,
instance, 8082, r.Client, r.RestConfig, r.Scheme, reqLogger)

if err != nil {
return errors.Wrap(err, "error setting up metrics")
}
Expand All @@ -731,7 +730,6 @@ func (r *Reconciler) ensureLighthouseCoreDNSDeployment(instance *submarinerv1alp

err := metrics.Setup(names.LighthouseCoreDNSComponent, instance.Namespace, "app", names.LighthouseCoreDNSComponent, instance,
9153, r.Client, r.RestConfig, r.Scheme, reqLogger)

if err != nil {
return errors.Wrap(err, "error setting up coredns metrics")
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/submariner/gateway_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func newGatewayPodTemplate(cr *v1alpha1.Submariner, name string, podSelectorLabe
{Name: "SUBMARINER_HEALTHCHECKENABLED", Value: strconv.FormatBool(healthCheckEnabled)},
{Name: "SUBMARINER_HEALTHCHECKINTERVAL", Value: strconv.FormatUint(healthCheckInterval, 10)},
{Name: "SUBMARINER_HEALTHCHECKMAXPACKETLOSSCOUNT", Value: strconv.FormatUint(healthCheckMaxPacketLossCount, 10)},
{Name: "SUBMARINER_GWMETRICSPORT", Value: gwMetricsServerPort},
{Name: "SUBMARINER_GWMETRICSPORT", Value: gatewayMetricsServerPort},
{Name: "NODE_NAME", ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{
FieldPath: "spec.nodeName",
Expand Down
6 changes: 3 additions & 3 deletions controllers/submariner/globalnet_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func (r *Reconciler) reconcileGlobalnetDaemonSet(instance *v1alpha1.Submariner,
return nil, err
}

err = metrics.Setup(names.GlobalnetComponent, instance.Namespace, "app", names.MetricsProxyComponent, instance, globalnetMetricsServicePort,
r.config.ScopedClient, r.config.RestConfig, r.config.Scheme, reqLogger)
err = metrics.Setup(names.GlobalnetComponent, instance.Namespace, "app", names.MetricsProxyComponent,
instance, globalnetMetricsServicePort, r.config.ScopedClient, r.config.RestConfig, r.config.Scheme, reqLogger)

return daemonSet, err
}
Expand Down Expand Up @@ -91,7 +91,7 @@ func newGlobalnetDaemonSet(cr *v1alpha1.Submariner, name string) *appsv1.DaemonS
{Name: "SUBMARINER_NAMESPACE", Value: cr.Spec.Namespace},
{Name: "SUBMARINER_CLUSTERID", Value: cr.Spec.ClusterID},
{Name: "SUBMARINER_EXCLUDENS", Value: "submariner-operator,kube-system,operators,openshift-monitoring,openshift-dns"},
{Name: "SUBMARINER_GNMETRICSPORT", Value: gnMetricsServerPort},
{Name: "SUBMARINER_GNMETRICSPORT", Value: globalnetMetricsServerPort},
{Name: "NODE_NAME", ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{
FieldPath: "spec.nodeName",
Expand Down
4 changes: 2 additions & 2 deletions controllers/submariner/metrics_proxy_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func newMetricsProxyDaemonSet(cr *v1alpha1.Submariner, name string) *appsv1.Daem
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{
*metricProxyContainer(cr, "gateway-metrics-proxy", fmt.Sprint(gatewayMetricsServicePort), gwMetricsServerPort),
*metricProxyContainer(cr, "gateway-metrics-proxy", fmt.Sprint(gatewayMetricsServicePort), gatewayMetricsServerPort),
},
NodeSelector: map[string]string{"submariner.io/gateway": "true"},
// The MetricsProxy Pod must be able to run on any flagged node, regardless of existing taints
Expand All @@ -72,7 +72,7 @@ func newMetricsProxyDaemonSet(cr *v1alpha1.Submariner, name string) *appsv1.Daem

if cr.Spec.GlobalCIDR != "" {
daemonSet.Spec.Template.Spec.Containers = append(daemonSet.Spec.Template.Spec.Containers,
*metricProxyContainer(cr, "globalnet-metrics-proxy", fmt.Sprint(globalnetMetricsServicePort), gnMetricsServerPort))
*metricProxyContainer(cr, "globalnet-metrics-proxy", fmt.Sprint(globalnetMetricsServicePort), globalnetMetricsServerPort))
}

return daemonSet
Expand Down
4 changes: 2 additions & 2 deletions controllers/submariner/submariner_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ import (
const (
gatewayMetricsServicePort = 8080
globalnetMetricsServicePort = 8081
gwMetricsServerPort = "32780"
gnMetricsServerPort = "32781"
gatewayMetricsServerPort = "32780"
globalnetMetricsServerPort = "32781"
)

var log = logf.Log.WithName("controller_submariner")
Expand Down

0 comments on commit d39f841

Please sign in to comment.