Skip to content

Commit

Permalink
Remove unused variables with ports
Browse files Browse the repository at this point in the history
  • Loading branch information
AMecea committed Feb 8, 2019
1 parent f85e674 commit e22cd16
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 45 deletions.
20 changes: 6 additions & 14 deletions pkg/controller/mysqlcluster/internal/syncer/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,20 @@ const (
// MysqlPort is the default mysql port.
MysqlPort = constants.MysqlPort

// HelperXtrabackupPortName is name of the port on which we take backups
HelperXtrabackupPortName = "xtrabackup"
// HelperXtrabackupPort is the port on which we serve backups
HelperXtrabackupPort = constants.HelperXtrabackupPort

// OrcTopologyDir path where orc conf secret is mounted
OrcTopologyDir = constants.OrcTopologyDir

// HelperServerPort represents the port on which http server will run
HelperServerPort = constants.HelperServerPort
// HelperServerProbePath the probe path
HelperServerProbePath = constants.HelperServerProbePath
// SidecarServerPortName name of the port
SidecarServerPortName = "xtrabackup"
// SidecarServerPort represents the port on which http server will run
SidecarServerPort = constants.SidecarServerPort
// SidecarServerProbePath the probe path
SidecarServerProbePath = constants.SidecarServerProbePath

// ExporterPort is the port that metrics will be exported
ExporterPort = constants.ExporterPort

//ExporterPortName the name of the metrics exporter port
ExporterPortName = "prometheus"

// ExporterPath is the path on which metrics are expose
ExporterPath = constants.ExporterPath

Expand All @@ -56,13 +51,10 @@ const (

// ConfVolumeMountPath is the path where mysql configs will be mounted
ConfVolumeMountPath = constants.ConfVolumeMountPath

// DataVolumeMountPath is the path to mysql data
DataVolumeMountPath = constants.DataVolumeMountPath

// ConfMapVolumeMountPath represents the temp config mount path in init containers
ConfMapVolumeMountPath = constants.ConfMapVolumeMountPath

// ConfDPath is the path to extra mysql configs dir
ConfDPath = constants.ConfDPath
)
Expand Down
29 changes: 10 additions & 19 deletions pkg/controller/mysqlcluster/internal/syncer/statefullset.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,6 @@ func NewStatefulSetSyncer(c client.Client, scheme *runtime.Scheme, cluster *mysq
func (s *sfsSyncer) SyncFn(in runtime.Object) error {
out := in.(*apps.StatefulSet)

if out.Status.ReadyReplicas == *s.cluster.Spec.Replicas {
s.cluster.UpdateStatusCondition(api.ClusterConditionReady,
core.ConditionTrue, "statefulset ready", "Cluster is ready.")
} else {
s.cluster.UpdateStatusCondition(api.ClusterConditionReady,
core.ConditionFalse, "statefulset not ready", "Cluster is not ready.")
}

s.cluster.Status.ReadyNodes = int(out.Status.ReadyReplicas)

out.Spec.Replicas = s.cluster.Spec.Replicas
Expand Down Expand Up @@ -356,21 +348,20 @@ func (s *sfsSyncer) ensureContainersSpec() []core.Container {
},
})

helper := s.ensureContainer(containerSidecarName,
// SIDECAR container
sidecar := s.ensureContainer(containerSidecarName,
s.opt.HelperImage,
[]string{"config-and-serve"},
)
helper.Ports = ensurePorts(core.ContainerPort{
Name: HelperXtrabackupPortName,
ContainerPort: HelperXtrabackupPort,
sidecar.Ports = ensurePorts(core.ContainerPort{
Name: SidecarServerPortName,
ContainerPort: SidecarServerPort,
})
helper.Resources = ensureResources(containerSidecarName)

// HELPER container
helper.ReadinessProbe = ensureProbe(30, 5, 5, core.Handler{
sidecar.Resources = ensureResources(containerSidecarName)
sidecar.ReadinessProbe = ensureProbe(30, 5, 5, core.Handler{
HTTPGet: &core.HTTPGetAction{
Path: HelperServerProbePath,
Port: intstr.FromInt(HelperServerPort),
Path: SidecarServerProbePath,
Port: intstr.FromInt(SidecarServerPort),
Scheme: core.URISchemeHTTP,
},
})
Expand Down Expand Up @@ -417,7 +408,7 @@ func (s *sfsSyncer) ensureContainersSpec() []core.Container {

containers := []core.Container{
mysql,
helper,
sidecar,
exporter,
heartbeat,
}
Expand Down
7 changes: 2 additions & 5 deletions pkg/sidecar/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ import (
var log = logf.Log.WithName("sidecar.util")

var (
// BackupPort is the port on which xtrabackup expose backups, 3306
BackupPort = strconv.Itoa(constants.HelperXtrabackupPort)

// MysqlPort represents port on which mysql works
MysqlPort = strconv.Itoa(constants.MysqlPort)

Expand Down Expand Up @@ -71,9 +68,9 @@ var (
OrcTopologyDir = constants.OrcTopologyDir

// ServerPort http server port
ServerPort = constants.HelperServerPort
ServerPort = constants.SidecarServerPort
// ServerProbeEndpoint is the http server endpoint for probe
ServerProbeEndpoint = constants.HelperServerProbePath
ServerProbeEndpoint = constants.SidecarServerProbePath
// ServerBackupEndpoint is the http server endpoint for backups
ServerBackupEndpoint = "/xbackup"
)
Expand Down
11 changes: 4 additions & 7 deletions pkg/util/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ const (
// MysqlPort is the default mysql port.
MysqlPort = 3306

// HelperXtrabackupPort is the port on which we serve backups
HelperXtrabackupPort = 3307

// OrcTopologyDir path where orc conf secret is mounted
OrcTopologyDir = "/var/run/orc-topology"

// HelperServerPort represents the port on which http server will run
HelperServerPort = 8088
// HelperServerProbePath the probe path
HelperServerProbePath = "/health"
// SidecarServerPort represents the port on which http server will run
SidecarServerPort = 8007
// SidecarServerProbePath the probe path
SidecarServerProbePath = "/health"

// ExporterPort is the port that metrics will be exported
ExporterPort = 9125
Expand Down

0 comments on commit e22cd16

Please sign in to comment.