Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-work to monitoring kubemark via internal IP. #505

Merged
merged 1 commit into from
Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Pre-work to monitoring kubemark via internal IP.
Ref. #503
  • Loading branch information
mm4tt committed Apr 18, 2019
commit 237a8735c5dafc7ec5277f08c100f7341f3a646e
1 change: 1 addition & 0 deletions clusterloader2/cmd/clusterloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func initClusterFlags() {
flags.StringEnvVar(&clusterLoaderConfig.ClusterConfig.Provider, "provider", "PROVIDER", "", "Cluster provider")
flags.StringEnvVar(&clusterLoaderConfig.ClusterConfig.MasterName, "mastername", "MASTER_NAME", "", "Name of the masternode")
flags.StringEnvVar(&clusterLoaderConfig.ClusterConfig.MasterIP, "masterip", "MASTER_IP", "", "Hostname/IP of the masternode")
flags.StringEnvVar(&clusterLoaderConfig.ClusterConfig.MasterInternalIP, "master-internal-ip", "MASTER_INTERNAL_IP", "", "Cluster internal/private IP of the master vm")
flags.StringEnvVar(&clusterLoaderConfig.ClusterConfig.KubemarkRootKubeConfigPath, "kubemark-root-kubeconfig", "KUBEMARK_ROOT_KUBECONFIG", "",
"Path the to kubemark root kubeconfig file, i.e. kubeconfig of the cluster where kubemark cluster is run. Ignored if provider != kubemark")
}
Expand Down
1 change: 1 addition & 0 deletions clusterloader2/pkg/config/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type ClusterConfig struct {
Provider string `json: provider`
// TODO(krzysied): Add support for HA cluster with more than one master.
MasterIP string `json: masterIP`
MasterInternalIP string `json: masterInternalIP`
MasterName string `json: masterName`
KubemarkRootKubeConfigPath string `json: kubemarkRootKubeConfigPath`
}
13 changes: 12 additions & 1 deletion clusterloader2/pkg/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func NewPrometheusController(clusterLoaderConfig *config.ClusterLoaderConfig) (p
return nil, errList
}
if pc.isKubemark {
mapping["KubemarkMasterIp"] = clusterLoaderConfig.ClusterConfig.MasterIP
mapping["KubemarkMasterIp"] = getKubemarkMasterIp(clusterLoaderConfig.ClusterConfig)
}
pc.templateMapping = mapping

Expand Down Expand Up @@ -213,3 +213,14 @@ func dumpAdditionalLogsOnPrometheusSetupFailure(k8sClient kubernetes.Interface)
}
klog.Info(string(s))
}

func getKubemarkMasterIp(clusterConfig config.ClusterConfig) string {
if clusterConfig.MasterInternalIP != "" {
klog.Infof("Using internal master ip (%s) to monitor kubemark master", clusterConfig.MasterInternalIP)
return clusterConfig.MasterInternalIP
}
// TODO(https://github.com/kubernetes/perf-tests/issues/503): Eventually we should fail if we reach here.
klog.Warningf("Internal master ip not available! Using the public ip (%s) to monitor kubemark master. "+
"Prometheus stack may fail if proper firewall rules are not configured.", clusterConfig.MasterIP)
return clusterConfig.MasterIP
}
1 change: 1 addition & 0 deletions verify/verify-flags/known-flags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ metric-bind-address
ping-server-address
ping-server-bind-address
ping-sleep-duration
master-internal-ip