Skip to content

Commit

Permalink
Merge pull request #505 from mm4tt/kubemark_internal_ip
Browse files Browse the repository at this point in the history
Pre-work to monitoring kubemark via internal IP.
  • Loading branch information
k8s-ci-robot committed Apr 18, 2019
2 parents 8db1165 + 237a873 commit df117a1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
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

0 comments on commit df117a1

Please sign in to comment.