Following some notes regards some tests in order to get the cluster IP and protocol by ks8 client-go:
The following works when the project is executed with the command "make run-local" which will use the local code and execute it with " export OPERATOR_NAME=mobile-security-service-operator" and "- operator-sdk up local --namespace=mobile-security-service-operator". However, but not when the operator is deployed by the image, using the command "make create-all" the IP returned is not the master one.
{code:java} func getClusterProtocol() string { cfg, _:= config.GetConfig() cfgHost := cfg.Host cfgHost = strings.Replace(cfgHost, "//", "", 2) host := strings.Split(cfgHost, ":")
return host[0] }
func getHostIP() string { cfg, _:= config.GetConfig() cfgHost := cfg.Host cfgHost = strings.Replace(cfgHost, "//", "", 2) host := strings.Split(cfgHost, ":")
return host[1] }
{code}
|
|