public KubernetesStack() { var masterVersion = new Config().Get("masterVersion") ?? (Input <string>)Output.Create(Invokes.GetEngineVersions()) .Apply(v => v.LatestMasterVersion); var cluster = new Cluster("helloworld", new ClusterArgs { InitialNodeCount = 2, MinMasterVersion = masterVersion, NodeVersion = masterVersion, NodeConfig = new ClusterNodeConfigArgs { MachineType = "n1-standard-1", OauthScopes = { "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring" } } }); this.KubeConfig = Output.Tuple(cluster.Name, cluster.Endpoint, cluster.MasterAuth).Apply( t => GetKubeconfig(t.Item1, t.Item2, t.Item3) ); this.ClusterName = cluster.Name; }
static Task <int> Main() { return(Deployment.RunAsync(async() => { var name = "helloworld"; var config = new Config(); var latestMasterVersion = await Invokes.GetEngineVersions(new GetEngineVersionsArgs { }); var masterVersion = config.Get("masterVersion") ?? latestMasterVersion.LatestMasterVersion; var cluster = new Cluster(name, new ClusterArgs { InitialNodeCount = 2, MinMasterVersion = masterVersion, NodeVersion = masterVersion, NodeConfig = new ClusterNodeConfigArgs { MachineType = "n1-standard-1", OauthScopes = { "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring", }, } }); var kubeconfig = Output.Tuple <string, string, ClusterMasterAuth>(cluster.Name, cluster.Endpoint, cluster.MasterAuth).Apply( t => GetKubeconfig(t.Item1, t.Item2, t.Item3) ); return new Dictionary <string, object> { { "clusterName", cluster.Name }, { "kubeconfig", kubeconfig }, }; })); }