{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/comments/178602051","pull_request_review_id":108684122,"id":178602051,"diff_hunk":"@@ -0,0 +1,209 @@\n+package main\n+\n+import (\n+\t\"encoding/json\"\n+\t\"flag\"\n+\t\"fmt\"\n+\t\"os\"\n+\n+\t\"github.com/automationbroker/bundle-lib/apb\"\n+\t\"github.com/automationbroker/bundle-lib/clients\"\n+\tcrd \"github.com/openshift/ansible-service-broker/pkg/dao/crd\"\n+\tetcd \"github.com/openshift/ansible-service-broker/pkg/dao/etcd\"\n+\t\"github.com/sirupsen/logrus\"\n+\tmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+)\n+\n+var options struct {\n+\tEtcdHost           string\n+\tEtcdCAFile         string\n+\tEtcdClientCert     string\n+\tEtcdClientKey      string\n+\tEtcdPort           int\n+\tMigrationNamespace string\n+}\n+\n+func init() {\n+\tflag.IntVar(&options.EtcdPort, \"port\", 2379, \"user '--port' option to specify the port to connect to etcd\")\n+\tflag.StringVar(&options.EtcdHost, \"host\", \"\", \"host to connect to etcd server\")\n+\tflag.StringVar(&options.EtcdCAFile, \"ca-file\", \"\", \"CA certificate file path to be used to connect over TLS with etcd server\")\n+\tflag.StringVar(&options.EtcdClientCert, \"client-cert\", \"\", \"client cert file path to authenticate to etcd server. If used must also use client-key\")\n+\tflag.StringVar(&options.EtcdClientKey, \"client-key\", \"\", \"client key file path to authenticate to etcd server. If used must also use client-cert\")\n+\tflag.StringVar(&options.MigrationNamespace, \"namespace\", \"\", \"namepsace that the migration should run in\")\n+\tflag.Parse()\n+}\n+\n+var crdDao *crd.Dao\n+var etcdDao *etcd.Dao\n+\n+func main() {\n+\tcon := clients.EtcdConfig{\n+\t\tEtcdHost:       options.EtcdHost,\n+\t\tEtcdPort:       options.EtcdPort,\n+\t\tEtcdCaFile:     options.EtcdCAFile,\n+\t\tEtcdClientKey:  options.EtcdClientKey,\n+\t\tEtcdClientCert: options.EtcdClientCert,\n+\t}\n+\tlogrus.SetLevel(logrus.DebugLevel)\n+\tclients.InitEtcdConfig(con)\n+\tlogrus.Infof(\"etcd configuration: %v\", con)\n+\tvar err error\n+\tetcdDao, err = etcd.NewDao()\n+\tif err != nil {\n+\t\tpanic(fmt.Sprintf(\"Unable to connect to etcd - %v\", err))\n+\t}\n+\tcrdDao, err = crd.NewDao(options.MigrationNamespace)\n+\tif err != nil {\n+\t\tpanic(fmt.Sprintf(\"Unable to connect to crd - %v\", err))","path":"cmd/migration/main.go","position":57,"original_position":57,"commit_id":"11b100561dc09b374a2a76aef5e99a0364e77b8d","original_commit_id":"11b100561dc09b374a2a76aef5e99a0364e77b8d","user":{"login":"shawn-hurley","id":1891063,"avatar_url":"https://avatars3.githubusercontent.com/u/1891063?v=4","gravatar_id":"","url":"https://api.github.com/users/shawn-hurley","html_url":"https://github.com/shawn-hurley","followers_url":"https://api.github.com/users/shawn-hurley/followers","following_url":"https://api.github.com/users/shawn-hurley/following{/other_user}","gists_url":"https://api.github.com/users/shawn-hurley/gists{/gist_id}","starred_url":"https://api.github.com/users/shawn-hurley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawn-hurley/subscriptions","organizations_url":"https://api.github.com/users/shawn-hurley/orgs","repos_url":"https://api.github.com/users/shawn-hurley/repos","events_url":"https://api.github.com/users/shawn-hurley/events{/privacy}","received_events_url":"https://api.github.com/users/shawn-hurley/received_events","type":"User","site_admin":false},"body":"Waiting on more reviews before updating this one","created_at":"2018-04-02T17:48:37Z","updated_at":"2018-04-02T17:48:37Z","html_url":"https://github.com/openshift/ansible-service-broker/pull/870#discussion_r178602051","pull_request_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/870","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/comments/178602051"},"html":{"href":"https://github.com/openshift/ansible-service-broker/pull/870#discussion_r178602051"},"pull_request":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/870"}},"in_reply_to_id":178594741},"pull_request":{"url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/870","id":178873476,"html_url":"https://github.com/openshift/ansible-service-broker/pull/870","diff_url":"https://github.com/openshift/ansible-service-broker/pull/870.diff","patch_url":"https://github.com/openshift/ansible-service-broker/pull/870.patch","issue_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues/870","number":870,"state":"open","locked":false,"title":"Add migration command","user":{"login":"shawn-hurley","id":1891063,"avatar_url":"https://avatars3.githubusercontent.com/u/1891063?v=4","gravatar_id":"","url":"https://api.github.com/users/shawn-hurley","html_url":"https://github.com/shawn-hurley","followers_url":"https://api.github.com/users/shawn-hurley/followers","following_url":"https://api.github.com/users/shawn-hurley/following{/other_user}","gists_url":"https://api.github.com/users/shawn-hurley/gists{/gist_id}","starred_url":"https://api.github.com/users/shawn-hurley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawn-hurley/subscriptions","organizations_url":"https://api.github.com/users/shawn-hurley/orgs","repos_url":"https://api.github.com/users/shawn-hurley/repos","events_url":"https://api.github.com/users/shawn-hurley/events{/privacy}","received_events_url":"https://api.github.com/users/shawn-hurley/received_events","type":"User","site_admin":false},"body":"#### Describe what this PR does and why we need it:\r\nWe need a way to migrate from ETCD to CRD for openshift ansible\r\n#### Changes proposed in this pull request\r\n - create a new command and add to RPM and Images\r\n - connects to etcd and crd dao's and will convert etcd to crd\r\n\r\nTrello: https://trello.com/c/KlFLeFI0\r\n\r\nexample job.yaml:\r\n\r\n```yaml\r\n---\r\napiVersion: batch/v1\r\nkind: Job\r\nmetadata:\r\n  name: asb-etcd-migration\r\nspec:\r\n  parallelism: 1\r\n  completions: 1\r\n  template:\r\n    metadata:\r\n      name: asb-etcd-migration\r\n    spec:\r\n      containers:\r\n        - name: asb\r\n          image: 'docker.io/shurley/origin-ansible-service-broker:migration'\r\n          imagePullPolicy: Always\r\n          # TODO: Need to update to proper entrypoint once it exists\r\n          command:\r\n            - '/usr/bin/migration'\r\n          args:\r\n            - '-host=asb-etcd.ansible-service-broker.svc'\r\n            - '-ca-file=/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt'\r\n            - '-client-cert=/var/run/asb-etcd-auth/client.crt'\r\n            - '-client-key=/var/run/asb-etcd-auth/client.key'\r\n            - '-namespace=ansible-service-broker'\r\n          volumeMounts:\r\n          - name: config-volume\r\n            mountPath: /etc/ansible-service-broker\r\n          - name: asb-tls\r\n            mountPath: /etc/tls/private\r\n          - name: asb-etcd-auth\r\n            mountPath: /var/run/asb-etcd-auth\r\n          env:\r\n            - name: BROKER_CONFIG\r\n              value: /etc/ansible-service-broker/config.yaml\r\n            - name: HTTP_PROXY\r\n              value: \"\"\r\n            - name: HTTPS_PROXY\r\n              value: \"\"\r\n      volumes:\r\n        - name: config-volume\r\n          configMap:\r\n            name: broker-config\r\n            items:\r\n              - key: broker-config\r\n                path: config.yaml\r\n        - name: asb-tls\r\n          secret:\r\n            secretName: asb-tls\r\n        - name: asb-etcd-auth\r\n          secret:\r\n            defaultMode: 420\r\n            secretName: broker-etcd-auth-secret\r\n      restartPolicy: Never\r\n      serviceAccount: asb\r\n      serviceAccountName: asb\r\n```","created_at":"2018-04-02T16:27:09Z","updated_at":"2018-04-02T17:48:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62f8943b5e7d42aa7c8ed42dd92d6d3f4db3fbe9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":711534248,"url":"https://api.github.com/repos/openshift/ansible-service-broker/labels/size/L","name":"size/L","color":"ee9900","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/870/commits","review_comments_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/870/comments","review_comment_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues/870/comments","statuses_url":"https://api.github.com/repos/openshift/ansible-service-broker/statuses/11b100561dc09b374a2a76aef5e99a0364e77b8d","head":{"label":"shawn-hurley:add-migration-command","ref":"add-migration-command","sha":"11b100561dc09b374a2a76aef5e99a0364e77b8d","user":{"login":"shawn-hurley","id":1891063,"avatar_url":"https://avatars3.githubusercontent.com/u/1891063?v=4","gravatar_id":"","url":"https://api.github.com/users/shawn-hurley","html_url":"https://github.com/shawn-hurley","followers_url":"https://api.github.com/users/shawn-hurley/followers","following_url":"https://api.github.com/users/shawn-hurley/following{/other_user}","gists_url":"https://api.github.com/users/shawn-hurley/gists{/gist_id}","starred_url":"https://api.github.com/users/shawn-hurley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawn-hurley/subscriptions","organizations_url":"https://api.github.com/users/shawn-hurley/orgs","repos_url":"https://api.github.com/users/shawn-hurley/repos","events_url":"https://api.github.com/users/shawn-hurley/events{/privacy}","received_events_url":"https://api.github.com/users/shawn-hurley/received_events","type":"User","site_admin":false},"repo":{"id":94127278,"name":"ansible-service-broker","full_name":"shawn-hurley/ansible-service-broker","owner":{"login":"shawn-hurley","id":1891063,"avatar_url":"https://avatars3.githubusercontent.com/u/1891063?v=4","gravatar_id":"","url":"https://api.github.com/users/shawn-hurley","html_url":"https://github.com/shawn-hurley","followers_url":"https://api.github.com/users/shawn-hurley/followers","following_url":"https://api.github.com/users/shawn-hurley/following{/other_user}","gists_url":"https://api.github.com/users/shawn-hurley/gists{/gist_id}","starred_url":"https://api.github.com/users/shawn-hurley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawn-hurley/subscriptions","organizations_url":"https://api.github.com/users/shawn-hurley/orgs","repos_url":"https://api.github.com/users/shawn-hurley/repos","events_url":"https://api.github.com/users/shawn-hurley/events{/privacy}","received_events_url":"https://api.github.com/users/shawn-hurley/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shawn-hurley/ansible-service-broker","description":"Ansible Service Broker","fork":true,"url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker","forks_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/forks","keys_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/teams","hooks_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/hooks","issue_events_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/issues/events{/number}","events_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/events","assignees_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/assignees{/user}","branches_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/branches{/branch}","tags_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/tags","blobs_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/git/refs{/sha}","trees_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/statuses/{sha}","languages_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/languages","stargazers_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/stargazers","contributors_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/contributors","subscribers_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/subscribers","subscription_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/subscription","commits_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/commits{/sha}","git_commits_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/git/commits{/sha}","comments_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/comments{/number}","issue_comment_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/issues/comments{/number}","contents_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/contents/{+path}","compare_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/merges","archive_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/downloads","issues_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/issues{/number}","pulls_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/pulls{/number}","milestones_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/milestones{/number}","notifications_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/labels{/name}","releases_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/releases{/id}","deployments_url":"https://api.github.com/repos/shawn-hurley/ansible-service-broker/deployments","created_at":"2017-06-12T18:22:54Z","updated_at":"2017-06-12T18:22:55Z","pushed_at":"2018-04-02T16:24:49Z","git_url":"git://github.com/shawn-hurley/ansible-service-broker.git","ssh_url":"git@github.com:shawn-hurley/ansible-service-broker.git","clone_url":"https://github.com/shawn-hurley/ansible-service-broker.git","svn_url":"https://github.com/shawn-hurley/ansible-service-broker","homepage":null,"size":95139,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"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":"openshift:master","ref":"master","sha":"8d5e7743f43fb7ea63e9506e3761287d4d5ce255","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars3.githubusercontent.com/u/792337?v=4","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":79371528,"name":"ansible-service-broker","full_name":"openshift/ansible-service-broker","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars3.githubusercontent.com/u/792337?v=4","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/ansible-service-broker","description":"Ansible Service Broker","fork":false,"url":"https://api.github.com/repos/openshift/ansible-service-broker","forks_url":"https://api.github.com/repos/openshift/ansible-service-broker/forks","keys_url":"https://api.github.com/repos/openshift/ansible-service-broker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/ansible-service-broker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/ansible-service-broker/teams","hooks_url":"https://api.github.com/repos/openshift/ansible-service-broker/hooks","issue_events_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/ansible-service-broker/events","assignees_url":"https://api.github.com/repos/openshift/ansible-service-broker/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/ansible-service-broker/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/ansible-service-broker/tags","blobs_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/ansible-service-broker/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/ansible-service-broker/languages","stargazers_url":"https://api.github.com/repos/openshift/ansible-service-broker/stargazers","contributors_url":"https://api.github.com/repos/openshift/ansible-service-broker/contributors","subscribers_url":"https://api.github.com/repos/openshift/ansible-service-broker/subscribers","subscription_url":"https://api.github.com/repos/openshift/ansible-service-broker/subscription","commits_url":"https://api.github.com/repos/openshift/ansible-service-broker/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/ansible-service-broker/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/ansible-service-broker/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/ansible-service-broker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/ansible-service-broker/merges","archive_url":"https://api.github.com/repos/openshift/ansible-service-broker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/ansible-service-broker/downloads","issues_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/ansible-service-broker/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/ansible-service-broker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/ansible-service-broker/labels{/name}","releases_url":"https://api.github.com/repos/openshift/ansible-service-broker/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/ansible-service-broker/deployments","created_at":"2017-01-18T18:40:49Z","updated_at":"2018-03-31T06:43:51Z","pushed_at":"2018-04-02T16:27:10Z","git_url":"git://github.com/openshift/ansible-service-broker.git","ssh_url":"git@github.com:openshift/ansible-service-broker.git","clone_url":"https://github.com/openshift/ansible-service-broker.git","svn_url":"https://github.com/openshift/ansible-service-broker","homepage":null,"size":93287,"stargazers_count":104,"watchers_count":104,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":51,"mirror_url":null,"archived":false,"open_issues_count":47,"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":51,"open_issues":47,"watchers":104,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/870"},"html":{"href":"https://github.com/openshift/ansible-service-broker/pull/870"},"issue":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/issues/870"},"comments":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/issues/870/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/870/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/870/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/statuses/11b100561dc09b374a2a76aef5e99a0364e77b8d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"shawn-hurley"}}