Subject:- Canary support for istio multi cluster

Body:-
If applied this commit will resolve the following reported issue https://github.com/weaveworks/flagger/issues/437
Have added support for consuming kubeconfig of istio host cluster where istio
resources will be created.
This commit is contained in:
Vidit Mathur
2020-02-18 12:07:59 +05:30
parent 0801576dcf
commit 2cb6ce4697
2 changed files with 12 additions and 1 deletions

View File

@@ -58,6 +58,7 @@ var (
leaderElectionNamespace string
enableConfigTracking bool
ver bool
kubeconfigHost string
)
func init() {
@@ -83,6 +84,7 @@ func init() {
flag.StringVar(&leaderElectionNamespace, "leader-election-namespace", "kube-system", "Namespace used to create the leader election config map.")
flag.BoolVar(&enableConfigTracking, "enable-config-tracking", true, "Enable secrets and configmaps tracking.")
flag.BoolVar(&ver, "version", false, "Print version")
flag.StringVar(&kubeconfigHost, "kubeconfig-host", "", "Path to a kubeconfig for host cluster. Only required if cluster has a host cluster.")
}
func main() {
@@ -117,7 +119,16 @@ func main() {
logger.Fatalf("Error building kubernetes clientset: %v", err)
}
meshClient, err := clientset.NewForConfig(cfg)
// if host kube config is there than this should be spawned with host kubeconfig
cfgHost, err := cfg, nil
if kubeconfigHost != "" {
cfgHost, err = clientcmd.BuildConfigFromFlags(masterURL, kubeconfigHost)
if err != nil {
logger.Fatalf("Error building host kubeconfig: %v", err)
}
}
meshClient, err := clientset.NewForConfig(cfgHost)
if err != nil {
logger.Fatalf("Error building mesh clientset: %v", err)
}