{"action":"created","comment":{"url":"https://api.github.com/repos/istio/istio/pulls/comments/157622590","pull_request_review_id":84295757,"id":157622590,"diff_hunk":"@@ -0,0 +1,147 @@\n+// Copyright 2017 Istio Authors.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package controlplane\n+\n+import (\n+\t\"fmt\"\n+\t\"os\"\n+\t\"strings\"\n+\n+\t\"github.com/spf13/cobra\"\n+)\n+\n+// Command returns the \"control-plane\" subcommand for istioctl.\n+func Command(istioNamespaceFlag *string) *cobra.Command {\n+\tvar (\n+\t\tfeatures          *[]string\n+\t\tout               string\n+\t\thelmChartLocation string\n+\t)\n+\n+\tm := defaultModel()\n+\tcmd := &cobra.Command{\n+\t\tUse:   \"control-plane\",\n+\t\tShort: \"Generates the configuration for Istio's control plane.\",\n+\t\tLong: \"istioctl control-plane produces deployment files to run the minimum Istio control for the set of \" +\n+\t\t\t\"features requested by the --feature flag. If no features are provided, we create deployments for the \" +\n+\t\t\t\"default control plane: Pilot, Mixer, CA, an initializer for automatic side-car injection, and Ingress \" +\n+\t\t\t\"Proxies, with mTLS enabled.\",\n+\t\tExample: `istioctl control-plane --features routing,policy,initializer -o helm`,\n+\t\tRunE: func(c *cobra.Command, args []string) error {\n+\t\t\tm.setFeatures(*features)\n+\t\t\tm.Namespace = *istioNamespaceFlag\n+\t\t\tswitch strings.ToLower(out) {\n+\t\t\tcase \"helm\":\n+\t\t\t\t_, err := fmt.Fprint(os.Stdout, valuesFromModel(m))\n+\t\t\t\treturn err\n+\t\t\tcase \"yaml\":\n+\t\t\t\trendered, err := yamlFromModel(m, helmChartLocation)\n+\t\t\t\tif err != nil {\n+\t\t\t\t\treturn err\n+\t\t\t\t}\n+\t\t\t\t_, err = fmt.Fprint(os.Stdout, rendered)\n+\t\t\t\treturn err\n+\t\t\tdefault:\n+\t\t\t\treturn fmt.Errorf(\"unsupported output %q\", out)\n+\t\t\t}\n+\t\t},\n+\t}\n+\n+\tfeatures = cmd.PersistentFlags().StringArrayP(\"features\", \"f\", []string{},\n+\t\t`List of Istio features to enable. Accepts any combination of \"mtls\", \"telemetry\", \"routing\", \"ingress\", \"policy\", \"initializer\".`)\n+\tcmd.PersistentFlags().StringVar(&m.Hub, \"hub\", \"gcr.io/istio-testing\", \"The container registry to pull Istio images from\")\n+\tcmd.PersistentFlags().StringVar(&m.MixerTag, \"mixer-tag\", \"latest\", \"The tag to use to pull the `mixer` container\")\n+\tcmd.PersistentFlags().StringVar(&m.PilotTag, \"pilot-tag\", \"latest\", \"The tag to use to pull the `pilot-discovery` container\")\n+\tcmd.PersistentFlags().StringVar(&m.CaTag, \"ca-tag\", \"latest\", \"The tag to use to pull the `ca` container\")\n+\tcmd.PersistentFlags().StringVar(&m.ProxyTag, \"proxy-tag\", \"latest\", \"The tag to use to pull the `proxy` container\")\n+\tcmd.PersistentFlags().BoolVar(&m.Debug, \"debug\", false, \"If true, uses debug images instead of release images\")\n+\tcmd.PersistentFlags().Uint16Var(&m.NodePort, \"ingress-node-port\", 0,\n+\t\t\"If provided, Istio ingress proxies will run as a NodePort service mapped to the port provided by this flag. \"+\n+\t\t\t\"Note that this flag is ignored unless the \\\"ingress\\\" feature flag is provided too.\")\n+\tcmd.PersistentFlags().StringVarP(&out, \"out\", \"o\", \"helm\", `Output format. Acceptable values are:\n+\t\t\t\t\t\"helm\": produces contents of values.yaml\n+\t\t\t\t\t\"yaml\": produces Kubernetes deployments`)\n+\n+\t// TODO: figure out how we want to package up the charts with the binary to make this easy\n+\tcmd.PersistentFlags().StringVar(&helmChartLocation, \"helm-chart-dir\", \".\",\n+\t\t\"The directory to find the helm charts used to render Istio deployments. -o yaml uses these to render the helm chart locally.\")\n+\n+\t_ = cmd.PersistentFlags().MarkHidden(\"hub\")\n+\t_ = cmd.PersistentFlags().MarkHidden(\"mixer-tag\")\n+\t_ = cmd.PersistentFlags().MarkHidden(\"pilot-tag\")\n+\t_ = cmd.PersistentFlags().MarkHidden(\"ca-tag\")\n+\t_ = cmd.PersistentFlags().MarkHidden(\"proxy-tag\")\n+\treturn cmd\n+}\n+\n+type model struct {","path":"pilot/cmd/istioctl/controlplane/cmd.go","position":null,"original_position":89,"commit_id":"1f1ea706bf1dba99b1e9a26baf4defe749733875","original_commit_id":"c0c81345dd3dd17a2afaba8b097db70ca273294b","user":{"login":"ZackButcher","id":1923135,"avatar_url":"https://avatars2.githubusercontent.com/u/1923135?v=4","gravatar_id":"","url":"https://api.github.com/users/ZackButcher","html_url":"https://github.com/ZackButcher","followers_url":"https://api.github.com/users/ZackButcher/followers","following_url":"https://api.github.com/users/ZackButcher/following{/other_user}","gists_url":"https://api.github.com/users/ZackButcher/gists{/gist_id}","starred_url":"https://api.github.com/users/ZackButcher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZackButcher/subscriptions","organizations_url":"https://api.github.com/users/ZackButcher/orgs","repos_url":"https://api.github.com/users/ZackButcher/repos","events_url":"https://api.github.com/users/ZackButcher/events{/privacy}","received_events_url":"https://api.github.com/users/ZackButcher/received_events","type":"User","site_admin":false},"body":"Right now the only two options in `values.yaml` that we don't have flags for is using the default config, and using a demo version of the CA.\r\n\r\nI plan to rewrite the helm charts as a follow on to this PR, so can we punt till later?","created_at":"2017-12-18T22:50:55Z","updated_at":"2017-12-18T22:50:55Z","html_url":"https://github.com/istio/istio/pull/2141#discussion_r157622590","pull_request_url":"https://api.github.com/repos/istio/istio/pulls/2141","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/istio/istio/pulls/comments/157622590"},"html":{"href":"https://github.com/istio/istio/pull/2141#discussion_r157622590"},"pull_request":{"href":"https://api.github.com/repos/istio/istio/pulls/2141"}},"in_reply_to_id":157606725},"pull_request":{"url":"https://api.github.com/repos/istio/istio/pulls/2141","id":158224356,"html_url":"https://github.com/istio/istio/pull/2141","diff_url":"https://github.com/istio/istio/pull/2141.diff","patch_url":"https://github.com/istio/istio/pull/2141.patch","issue_url":"https://api.github.com/repos/istio/istio/issues/2141","number":2141,"state":"open","locked":false,"title":"[WIP] istioctl subcommand to produce Istio control plane deployments","user":{"login":"ZackButcher","id":1923135,"avatar_url":"https://avatars2.githubusercontent.com/u/1923135?v=4","gravatar_id":"","url":"https://api.github.com/users/ZackButcher","html_url":"https://github.com/ZackButcher","followers_url":"https://api.github.com/users/ZackButcher/followers","following_url":"https://api.github.com/users/ZackButcher/following{/other_user}","gists_url":"https://api.github.com/users/ZackButcher/gists{/gist_id}","starred_url":"https://api.github.com/users/ZackButcher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZackButcher/subscriptions","organizations_url":"https://api.github.com/users/ZackButcher/orgs","repos_url":"https://api.github.com/users/ZackButcher/repos","events_url":"https://api.github.com/users/ZackButcher/events{/privacy}","received_events_url":"https://api.github.com/users/ZackButcher/received_events","type":"User","site_admin":false},"body":"**What this PR does / why we need it**: This PR adds a new sub-command to the `istioctl` binary which produces a deployment of an Istio control plane based on a set of features the user wants in their cluster.\r\n\r\nThis tool does not interact with a live deployment, perform upgrades of existing control plane deployments, or anything to that effect. It strictly produces a set of deployment files (or a `values.yaml` file for Helm) of a control plane deployment.\r\n\r\nThe primary benefit is two-fold:\r\n 1. It provides a higher level abstraction for users attempting to adopt Istio (i.e. it talks about Istio in terms of features the operator wants, not in terms of Istio's own implementation)\r\n2. It allows us to standardize on a single SoT for templated YAMLs for creating various versions of Istio for installation (Helm charts). The goal is that we can use this tool to produce all of the Istio installations we currently package in our releases.\r\n\r\n**Which issue this PR fixes**: #2087\r\n\r\n**Special notes for your reviewer**:\r\n\r\n**Release note**:\r\n<!--  Steps to write your release note:\r\n1. Use the release-note-* labels to set the release note state (if you have access)\r\n2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`.\r\n-->\r\n```release-note\r\nNew `istioctl` subcommand to produce deployment files for an Istio control plane given a set of features desired in the Mesh.\r\n```\r\n\r\ncc @andraxylia @ayj @costinm @kyessenov @ldemailly \r\n","created_at":"2017-12-13T22:40:55Z","updated_at":"2017-12-18T22:50:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4762fce21b10680a62be3f33db741f0bdd7d4c4f","assignee":null,"assignees":[],"requested_reviewers":[{"login":"gyliu513","id":4461983,"avatar_url":"https://avatars1.githubusercontent.com/u/4461983?v=4","gravatar_id":"","url":"https://api.github.com/users/gyliu513","html_url":"https://github.com/gyliu513","followers_url":"https://api.github.com/users/gyliu513/followers","following_url":"https://api.github.com/users/gyliu513/following{/other_user}","gists_url":"https://api.github.com/users/gyliu513/gists{/gist_id}","starred_url":"https://api.github.com/users/gyliu513/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gyliu513/subscriptions","organizations_url":"https://api.github.com/users/gyliu513/orgs","repos_url":"https://api.github.com/users/gyliu513/repos","events_url":"https://api.github.com/users/gyliu513/events{/privacy}","received_events_url":"https://api.github.com/users/gyliu513/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/istio/istio/pulls/2141/commits","review_comments_url":"https://api.github.com/repos/istio/istio/pulls/2141/comments","review_comment_url":"https://api.github.com/repos/istio/istio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/istio/istio/issues/2141/comments","statuses_url":"https://api.github.com/repos/istio/istio/statuses/1f1ea706bf1dba99b1e9a26baf4defe749733875","head":{"label":"ZackButcher:istioctl","ref":"istioctl","sha":"1f1ea706bf1dba99b1e9a26baf4defe749733875","user":{"login":"ZackButcher","id":1923135,"avatar_url":"https://avatars2.githubusercontent.com/u/1923135?v=4","gravatar_id":"","url":"https://api.github.com/users/ZackButcher","html_url":"https://github.com/ZackButcher","followers_url":"https://api.github.com/users/ZackButcher/followers","following_url":"https://api.github.com/users/ZackButcher/following{/other_user}","gists_url":"https://api.github.com/users/ZackButcher/gists{/gist_id}","starred_url":"https://api.github.com/users/ZackButcher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZackButcher/subscriptions","organizations_url":"https://api.github.com/users/ZackButcher/orgs","repos_url":"https://api.github.com/users/ZackButcher/repos","events_url":"https://api.github.com/users/ZackButcher/events{/privacy}","received_events_url":"https://api.github.com/users/ZackButcher/received_events","type":"User","site_admin":false},"repo":{"id":85734399,"name":"istio","full_name":"ZackButcher/istio","owner":{"login":"ZackButcher","id":1923135,"avatar_url":"https://avatars2.githubusercontent.com/u/1923135?v=4","gravatar_id":"","url":"https://api.github.com/users/ZackButcher","html_url":"https://github.com/ZackButcher","followers_url":"https://api.github.com/users/ZackButcher/followers","following_url":"https://api.github.com/users/ZackButcher/following{/other_user}","gists_url":"https://api.github.com/users/ZackButcher/gists{/gist_id}","starred_url":"https://api.github.com/users/ZackButcher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZackButcher/subscriptions","organizations_url":"https://api.github.com/users/ZackButcher/orgs","repos_url":"https://api.github.com/users/ZackButcher/repos","events_url":"https://api.github.com/users/ZackButcher/events{/privacy}","received_events_url":"https://api.github.com/users/ZackButcher/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ZackButcher/istio","description":"A service mesh for polyglot microservices","fork":true,"url":"https://api.github.com/repos/ZackButcher/istio","forks_url":"https://api.github.com/repos/ZackButcher/istio/forks","keys_url":"https://api.github.com/repos/ZackButcher/istio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ZackButcher/istio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ZackButcher/istio/teams","hooks_url":"https://api.github.com/repos/ZackButcher/istio/hooks","issue_events_url":"https://api.github.com/repos/ZackButcher/istio/issues/events{/number}","events_url":"https://api.github.com/repos/ZackButcher/istio/events","assignees_url":"https://api.github.com/repos/ZackButcher/istio/assignees{/user}","branches_url":"https://api.github.com/repos/ZackButcher/istio/branches{/branch}","tags_url":"https://api.github.com/repos/ZackButcher/istio/tags","blobs_url":"https://api.github.com/repos/ZackButcher/istio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ZackButcher/istio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ZackButcher/istio/git/refs{/sha}","trees_url":"https://api.github.com/repos/ZackButcher/istio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ZackButcher/istio/statuses/{sha}","languages_url":"https://api.github.com/repos/ZackButcher/istio/languages","stargazers_url":"https://api.github.com/repos/ZackButcher/istio/stargazers","contributors_url":"https://api.github.com/repos/ZackButcher/istio/contributors","subscribers_url":"https://api.github.com/repos/ZackButcher/istio/subscribers","subscription_url":"https://api.github.com/repos/ZackButcher/istio/subscription","commits_url":"https://api.github.com/repos/ZackButcher/istio/commits{/sha}","git_commits_url":"https://api.github.com/repos/ZackButcher/istio/git/commits{/sha}","comments_url":"https://api.github.com/repos/ZackButcher/istio/comments{/number}","issue_comment_url":"https://api.github.com/repos/ZackButcher/istio/issues/comments{/number}","contents_url":"https://api.github.com/repos/ZackButcher/istio/contents/{+path}","compare_url":"https://api.github.com/repos/ZackButcher/istio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ZackButcher/istio/merges","archive_url":"https://api.github.com/repos/ZackButcher/istio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ZackButcher/istio/downloads","issues_url":"https://api.github.com/repos/ZackButcher/istio/issues{/number}","pulls_url":"https://api.github.com/repos/ZackButcher/istio/pulls{/number}","milestones_url":"https://api.github.com/repos/ZackButcher/istio/milestones{/number}","notifications_url":"https://api.github.com/repos/ZackButcher/istio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ZackButcher/istio/labels{/name}","releases_url":"https://api.github.com/repos/ZackButcher/istio/releases{/id}","deployments_url":"https://api.github.com/repos/ZackButcher/istio/deployments","created_at":"2017-03-21T17:43:30Z","updated_at":"2017-07-19T22:48:55Z","pushed_at":"2017-12-18T22:49:02Z","git_url":"git://github.com/ZackButcher/istio.git","ssh_url":"git@github.com:ZackButcher/istio.git","clone_url":"https://github.com/ZackButcher/istio.git","svn_url":"https://github.com/ZackButcher/istio","homepage":"","size":10743,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"istio:master","ref":"master","sha":"dc43d71fce77a787748f8aaa8194b1dfd4271d6d","user":{"login":"istio","id":23534644,"avatar_url":"https://avatars1.githubusercontent.com/u/23534644?v=4","gravatar_id":"","url":"https://api.github.com/users/istio","html_url":"https://github.com/istio","followers_url":"https://api.github.com/users/istio/followers","following_url":"https://api.github.com/users/istio/following{/other_user}","gists_url":"https://api.github.com/users/istio/gists{/gist_id}","starred_url":"https://api.github.com/users/istio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/istio/subscriptions","organizations_url":"https://api.github.com/users/istio/orgs","repos_url":"https://api.github.com/users/istio/repos","events_url":"https://api.github.com/users/istio/events{/privacy}","received_events_url":"https://api.github.com/users/istio/received_events","type":"Organization","site_admin":false},"repo":{"id":74175805,"name":"istio","full_name":"istio/istio","owner":{"login":"istio","id":23534644,"avatar_url":"https://avatars1.githubusercontent.com/u/23534644?v=4","gravatar_id":"","url":"https://api.github.com/users/istio","html_url":"https://github.com/istio","followers_url":"https://api.github.com/users/istio/followers","following_url":"https://api.github.com/users/istio/following{/other_user}","gists_url":"https://api.github.com/users/istio/gists{/gist_id}","starred_url":"https://api.github.com/users/istio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/istio/subscriptions","organizations_url":"https://api.github.com/users/istio/orgs","repos_url":"https://api.github.com/users/istio/repos","events_url":"https://api.github.com/users/istio/events{/privacy}","received_events_url":"https://api.github.com/users/istio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/istio/istio","description":"An open platform to connect, manage, and secure microservices.","fork":false,"url":"https://api.github.com/repos/istio/istio","forks_url":"https://api.github.com/repos/istio/istio/forks","keys_url":"https://api.github.com/repos/istio/istio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/istio/istio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/istio/istio/teams","hooks_url":"https://api.github.com/repos/istio/istio/hooks","issue_events_url":"https://api.github.com/repos/istio/istio/issues/events{/number}","events_url":"https://api.github.com/repos/istio/istio/events","assignees_url":"https://api.github.com/repos/istio/istio/assignees{/user}","branches_url":"https://api.github.com/repos/istio/istio/branches{/branch}","tags_url":"https://api.github.com/repos/istio/istio/tags","blobs_url":"https://api.github.com/repos/istio/istio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/istio/istio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/istio/istio/git/refs{/sha}","trees_url":"https://api.github.com/repos/istio/istio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/istio/istio/statuses/{sha}","languages_url":"https://api.github.com/repos/istio/istio/languages","stargazers_url":"https://api.github.com/repos/istio/istio/stargazers","contributors_url":"https://api.github.com/repos/istio/istio/contributors","subscribers_url":"https://api.github.com/repos/istio/istio/subscribers","subscription_url":"https://api.github.com/repos/istio/istio/subscription","commits_url":"https://api.github.com/repos/istio/istio/commits{/sha}","git_commits_url":"https://api.github.com/repos/istio/istio/git/commits{/sha}","comments_url":"https://api.github.com/repos/istio/istio/comments{/number}","issue_comment_url":"https://api.github.com/repos/istio/istio/issues/comments{/number}","contents_url":"https://api.github.com/repos/istio/istio/contents/{+path}","compare_url":"https://api.github.com/repos/istio/istio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/istio/istio/merges","archive_url":"https://api.github.com/repos/istio/istio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/istio/istio/downloads","issues_url":"https://api.github.com/repos/istio/istio/issues{/number}","pulls_url":"https://api.github.com/repos/istio/istio/pulls{/number}","milestones_url":"https://api.github.com/repos/istio/istio/milestones{/number}","notifications_url":"https://api.github.com/repos/istio/istio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/istio/istio/labels{/name}","releases_url":"https://api.github.com/repos/istio/istio/releases{/id}","deployments_url":"https://api.github.com/repos/istio/istio/deployments","created_at":"2016-11-18T23:57:21Z","updated_at":"2017-12-18T21:58:19Z","pushed_at":"2017-12-18T22:49:03Z","git_url":"git://github.com/istio/istio.git","ssh_url":"git@github.com:istio/istio.git","clone_url":"https://github.com/istio/istio.git","svn_url":"https://github.com/istio/istio","homepage":"https://istio.io","size":11471,"stargazers_count":4498,"watchers_count":4498,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":548,"mirror_url":null,"archived":false,"open_issues_count":425,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":548,"open_issues":425,"watchers":4498,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/istio/istio/pulls/2141"},"html":{"href":"https://github.com/istio/istio/pull/2141"},"issue":{"href":"https://api.github.com/repos/istio/istio/issues/2141"},"comments":{"href":"https://api.github.com/repos/istio/istio/issues/2141/comments"},"review_comments":{"href":"https://api.github.com/repos/istio/istio/pulls/2141/comments"},"review_comment":{"href":"https://api.github.com/repos/istio/istio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/istio/istio/pulls/2141/commits"},"statuses":{"href":"https://api.github.com/repos/istio/istio/statuses/1f1ea706bf1dba99b1e9a26baf4defe749733875"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"ZackButcher"}}