{"action":"created","comment":{"url":"https://api.github.com/repos/ceph/ceph-docker/pulls/comments/33122312","id":33122312,"diff_hunk":"@@ -28,6 +32,89 @@ if [[ ! -e /etc/ceph/${CLUSTER}.conf ]]; then\n fi\n }\n \n+function create_mon_ceph_config_from_kv {\n+\n+  CLUSTER_PATH=ceph-config/${CLUSTER}\n+\n+  echo \"Adding Mon Host - ${MON_NAME}\"\n+  kviator --kvstore=${KV_TYPE} --client=${KV_IP}:${KV_PORT} cas mon_host/${MON_NAME} ${MON_IP} > /dev/null 2>&1\n+\n+  # Acquire lock to not run into race conditions with parallel bootstraps\n+  until kviator --kvstore=${KV_TYPE} --client=${KV_IP}:${KV_PORT} cas ${CLUSTER_PATH}/lock $MON_NAME > /dev/null 2>&1 ; do\n+    echo \"Configuration is locked by another host. Waiting.\"\n+    sleep 1\n+  done\n+\n+  # Update config after initial mon creation\n+  if kviator --kvstore=${KV_TYPE} --client=${KV_IP}:${KV_PORT} get ${CLUSTER_PATH}/monSetupComplete > /dev/null 2>&1 ; then\n+    echo \"Configuration found for cluster ${CLUSTER}. Writing to disk.\"\n+\n+\n+    until ./confd -onetime -backend ${KV_TYPE} -node ${KV_IP}:${KV_PORT} -prefix=\"/${CLUSTER_PATH}/\" -confdir=\"./conf.d\" ; do\n+      echo \"Waiting for confd to update templates...\"\n+      sleep 1\n+    done\n+\n+    echo \"Adding Keyrings\"\n+    kviator --kvstore=${KV_TYPE} --client=${KV_IP}:${KV_PORT} get ${CLUSTER_PATH}/monKeyring > /etc/ceph/ceph.mon.keyring\n+    kviator --kvstore=${KV_TYPE} --client=${KV_IP}:${KV_PORT} get ${CLUSTER_PATH}/adminKeyring > /etc/ceph/ceph.client.admin.keyring\n+\n+    if [ ! -f /etc/ceph/monmap ]; then\n+      echo \"Monmap is missing. Adding initial monmap...\"\n+      kviator --kvstore=${KV_TYPE} --client=${KV_IP}:${KV_PORT} get ${CLUSTER_PATH}/monmap > /etc/ceph/monmap\n+      ceph mon getmap -o /etc/ceph/monmap\n+    fi\n+\n+  else\n+    # Create initial Mon, keyring\n+    echo \"No configuration found for cluster ${CLUSTER}. Generating.\"\n+\n+    FSID=$(uuidgen)\n+    kviator --kvstore=${KV_TYPE} --client=${KV_IP}:${KV_PORT} put common/fsid \"$FSID\"\n+\n+    until ./confd -onetime -backend ${KV_TYPE} -node ${KV_IP}:${KV_PORT} -prefix=\"/${CLUSTER_PATH}/\" -confdir=\"./conf.d\" ; do\n+      echo \"Waiting for confd to write initial templates...\"\n+      sleep 1\n+    done\n+\n+    echo \"Creating Keyrings\"\n+    ceph-authtool /etc/ceph/ceph.client.admin.keyring --create-keyring --gen-key -n client.admin --set-uid=0 --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow'\n+    ceph-authtool /etc/ceph/ceph.mon.keyring --create-keyring --gen-key -n mon. --cap mon 'allow *'\n+\n+    echo \"Creating Monmap\"\n+    monmaptool --create --add ${MON_NAME} ${MON_IP} --fsid ${FSID} /etc/ceph/monmap\n+\n+    echo \"Importing Keyrings and Monmap to KV\"\n+    MONKEYRING=$(cat /etc/ceph/ceph.mon.keyring)","path":"daemon/entrypoint.sh","position":68,"original_position":68,"commit_id":"6c5184ccf1c6f198db222a3a573158a8c3624e90","original_commit_id":"dbc42a6bbf8bec74c33cd98521cc1a5e3e8f30c1","user":{"login":"hunter","id":898,"avatar_url":"https://avatars.githubusercontent.com/u/898?v=3","gravatar_id":"","url":"https://api.github.com/users/hunter","html_url":"https://github.com/hunter","followers_url":"https://api.github.com/users/hunter/followers","following_url":"https://api.github.com/users/hunter/following{/other_user}","gists_url":"https://api.github.com/users/hunter/gists{/gist_id}","starred_url":"https://api.github.com/users/hunter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hunter/subscriptions","organizations_url":"https://api.github.com/users/hunter/orgs","repos_url":"https://api.github.com/users/hunter/repos","events_url":"https://api.github.com/users/hunter/events{/privacy}","received_events_url":"https://api.github.com/users/hunter/received_events","type":"User","site_admin":false},"body":"Not yet. We're just about to add support for stdin","created_at":"2015-06-24T07:11:47Z","updated_at":"2015-06-24T07:11:47Z","html_url":"https://github.com/ceph/ceph-docker/pull/103#discussion_r33122312","pull_request_url":"https://api.github.com/repos/ceph/ceph-docker/pulls/103","_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph-docker/pulls/comments/33122312"},"html":{"href":"https://github.com/ceph/ceph-docker/pull/103#discussion_r33122312"},"pull_request":{"href":"https://api.github.com/repos/ceph/ceph-docker/pulls/103"}}},"pull_request":{"url":"https://api.github.com/repos/ceph/ceph-docker/pulls/103","id":38308676,"html_url":"https://github.com/ceph/ceph-docker/pull/103","diff_url":"https://github.com/ceph/ceph-docker/pull/103.diff","patch_url":"https://github.com/ceph/ceph-docker/pull/103.patch","issue_url":"https://api.github.com/repos/ceph/ceph-docker/issues/103","number":103,"state":"open","locked":false,"title":"KV Backend","user":{"login":"hunter","id":898,"avatar_url":"https://avatars.githubusercontent.com/u/898?v=3","gravatar_id":"","url":"https://api.github.com/users/hunter","html_url":"https://github.com/hunter","followers_url":"https://api.github.com/users/hunter/followers","following_url":"https://api.github.com/users/hunter/following{/other_user}","gists_url":"https://api.github.com/users/hunter/gists{/gist_id}","starred_url":"https://api.github.com/users/hunter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hunter/subscriptions","organizations_url":"https://api.github.com/users/hunter/orgs","repos_url":"https://api.github.com/users/hunter/repos","events_url":"https://api.github.com/users/hunter/events{/privacy}","received_events_url":"https://api.github.com/users/hunter/received_events","type":"User","site_admin":false},"body":"Following from the discussion kicked off in #34 I have started working on a KV storage for config storage. I thought I'd open a PR early so that we can discuss and make improvements as we go along.\r\n\r\nThe initial work has added confd and a simple tool - kviator to manage keys in different backends (consul and etcd). Populating the KV is currently handled by a shell script but could be moved to a config parameter or image.\r\n\r\nThe daemon entrypoint has basic support for mon configs (although is lacking the latest bootstrap keyring changes). Still needs some cleanup and testing in a container. Following that the next step is the OSD config.","created_at":"2015-06-23T07:38:40Z","updated_at":"2015-06-24T07:11:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ceph/ceph-docker/pulls/103/commits","review_comments_url":"https://api.github.com/repos/ceph/ceph-docker/pulls/103/comments","review_comment_url":"https://api.github.com/repos/ceph/ceph-docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ceph/ceph-docker/issues/103/comments","statuses_url":"https://api.github.com/repos/ceph/ceph-docker/statuses/6c5184ccf1c6f198db222a3a573158a8c3624e90","head":{"label":"AcalephStorage:confd","ref":"confd","sha":"6c5184ccf1c6f198db222a3a573158a8c3624e90","user":{"login":"AcalephStorage","id":3954932,"avatar_url":"https://avatars.githubusercontent.com/u/3954932?v=3","gravatar_id":"","url":"https://api.github.com/users/AcalephStorage","html_url":"https://github.com/AcalephStorage","followers_url":"https://api.github.com/users/AcalephStorage/followers","following_url":"https://api.github.com/users/AcalephStorage/following{/other_user}","gists_url":"https://api.github.com/users/AcalephStorage/gists{/gist_id}","starred_url":"https://api.github.com/users/AcalephStorage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AcalephStorage/subscriptions","organizations_url":"https://api.github.com/users/AcalephStorage/orgs","repos_url":"https://api.github.com/users/AcalephStorage/repos","events_url":"https://api.github.com/users/AcalephStorage/events{/privacy}","received_events_url":"https://api.github.com/users/AcalephStorage/received_events","type":"Organization","site_admin":false},"repo":{"id":30396059,"name":"ceph-docker","full_name":"AcalephStorage/ceph-docker","owner":{"login":"AcalephStorage","id":3954932,"avatar_url":"https://avatars.githubusercontent.com/u/3954932?v=3","gravatar_id":"","url":"https://api.github.com/users/AcalephStorage","html_url":"https://github.com/AcalephStorage","followers_url":"https://api.github.com/users/AcalephStorage/followers","following_url":"https://api.github.com/users/AcalephStorage/following{/other_user}","gists_url":"https://api.github.com/users/AcalephStorage/gists{/gist_id}","starred_url":"https://api.github.com/users/AcalephStorage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AcalephStorage/subscriptions","organizations_url":"https://api.github.com/users/AcalephStorage/orgs","repos_url":"https://api.github.com/users/AcalephStorage/repos","events_url":"https://api.github.com/users/AcalephStorage/events{/privacy}","received_events_url":"https://api.github.com/users/AcalephStorage/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AcalephStorage/ceph-docker","description":"Docker files and images to run Ceph in containers","fork":true,"url":"https://api.github.com/repos/AcalephStorage/ceph-docker","forks_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/forks","keys_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/teams","hooks_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/hooks","issue_events_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/issues/events{/number}","events_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/events","assignees_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/assignees{/user}","branches_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/branches{/branch}","tags_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/tags","blobs_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/statuses/{sha}","languages_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/languages","stargazers_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/stargazers","contributors_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/contributors","subscribers_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/subscribers","subscription_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/subscription","commits_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/contents/{+path}","compare_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/merges","archive_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/downloads","issues_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/issues{/number}","pulls_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/pulls{/number}","milestones_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/milestones{/number}","notifications_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/labels{/name}","releases_url":"https://api.github.com/repos/AcalephStorage/ceph-docker/releases{/id}","created_at":"2015-02-06T05:03:25Z","updated_at":"2015-02-24T20:09:59Z","pushed_at":"2015-06-23T10:46:13Z","git_url":"git://github.com/AcalephStorage/ceph-docker.git","ssh_url":"git@github.com:AcalephStorage/ceph-docker.git","clone_url":"https://github.com/AcalephStorage/ceph-docker.git","svn_url":"https://github.com/AcalephStorage/ceph-docker","homepage":null,"size":5752,"stargazers_count":1,"watchers_count":1,"language":"Shell","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"ceph:master","ref":"master","sha":"46be5a1daa39c8c6de4288d8e02588633a32fe3f","user":{"login":"ceph","id":1015767,"avatar_url":"https://avatars.githubusercontent.com/u/1015767?v=3","gravatar_id":"","url":"https://api.github.com/users/ceph","html_url":"https://github.com/ceph","followers_url":"https://api.github.com/users/ceph/followers","following_url":"https://api.github.com/users/ceph/following{/other_user}","gists_url":"https://api.github.com/users/ceph/gists{/gist_id}","starred_url":"https://api.github.com/users/ceph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceph/subscriptions","organizations_url":"https://api.github.com/users/ceph/orgs","repos_url":"https://api.github.com/users/ceph/repos","events_url":"https://api.github.com/users/ceph/events{/privacy}","received_events_url":"https://api.github.com/users/ceph/received_events","type":"Organization","site_admin":false},"repo":{"id":29601598,"name":"ceph-docker","full_name":"ceph/ceph-docker","owner":{"login":"ceph","id":1015767,"avatar_url":"https://avatars.githubusercontent.com/u/1015767?v=3","gravatar_id":"","url":"https://api.github.com/users/ceph","html_url":"https://github.com/ceph","followers_url":"https://api.github.com/users/ceph/followers","following_url":"https://api.github.com/users/ceph/following{/other_user}","gists_url":"https://api.github.com/users/ceph/gists{/gist_id}","starred_url":"https://api.github.com/users/ceph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceph/subscriptions","organizations_url":"https://api.github.com/users/ceph/orgs","repos_url":"https://api.github.com/users/ceph/repos","events_url":"https://api.github.com/users/ceph/events{/privacy}","received_events_url":"https://api.github.com/users/ceph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ceph/ceph-docker","description":"Docker files and images to run Ceph in containers","fork":false,"url":"https://api.github.com/repos/ceph/ceph-docker","forks_url":"https://api.github.com/repos/ceph/ceph-docker/forks","keys_url":"https://api.github.com/repos/ceph/ceph-docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ceph/ceph-docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ceph/ceph-docker/teams","hooks_url":"https://api.github.com/repos/ceph/ceph-docker/hooks","issue_events_url":"https://api.github.com/repos/ceph/ceph-docker/issues/events{/number}","events_url":"https://api.github.com/repos/ceph/ceph-docker/events","assignees_url":"https://api.github.com/repos/ceph/ceph-docker/assignees{/user}","branches_url":"https://api.github.com/repos/ceph/ceph-docker/branches{/branch}","tags_url":"https://api.github.com/repos/ceph/ceph-docker/tags","blobs_url":"https://api.github.com/repos/ceph/ceph-docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ceph/ceph-docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ceph/ceph-docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/ceph/ceph-docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ceph/ceph-docker/statuses/{sha}","languages_url":"https://api.github.com/repos/ceph/ceph-docker/languages","stargazers_url":"https://api.github.com/repos/ceph/ceph-docker/stargazers","contributors_url":"https://api.github.com/repos/ceph/ceph-docker/contributors","subscribers_url":"https://api.github.com/repos/ceph/ceph-docker/subscribers","subscription_url":"https://api.github.com/repos/ceph/ceph-docker/subscription","commits_url":"https://api.github.com/repos/ceph/ceph-docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/ceph/ceph-docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/ceph/ceph-docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/ceph/ceph-docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/ceph/ceph-docker/contents/{+path}","compare_url":"https://api.github.com/repos/ceph/ceph-docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ceph/ceph-docker/merges","archive_url":"https://api.github.com/repos/ceph/ceph-docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ceph/ceph-docker/downloads","issues_url":"https://api.github.com/repos/ceph/ceph-docker/issues{/number}","pulls_url":"https://api.github.com/repos/ceph/ceph-docker/pulls{/number}","milestones_url":"https://api.github.com/repos/ceph/ceph-docker/milestones{/number}","notifications_url":"https://api.github.com/repos/ceph/ceph-docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ceph/ceph-docker/labels{/name}","releases_url":"https://api.github.com/repos/ceph/ceph-docker/releases{/id}","created_at":"2015-01-21T17:22:51Z","updated_at":"2015-06-23T22:54:17Z","pushed_at":"2015-06-23T10:46:13Z","git_url":"git://github.com/ceph/ceph-docker.git","ssh_url":"git@github.com:ceph/ceph-docker.git","clone_url":"https://github.com/ceph/ceph-docker.git","svn_url":"https://github.com/ceph/ceph-docker","homepage":null,"size":7060,"stargazers_count":69,"watchers_count":69,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":32,"mirror_url":null,"open_issues_count":12,"forks":32,"open_issues":12,"watchers":69,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph-docker/pulls/103"},"html":{"href":"https://github.com/ceph/ceph-docker/pull/103"},"issue":{"href":"https://api.github.com/repos/ceph/ceph-docker/issues/103"},"comments":{"href":"https://api.github.com/repos/ceph/ceph-docker/issues/103/comments"},"review_comments":{"href":"https://api.github.com/repos/ceph/ceph-docker/pulls/103/comments"},"review_comment":{"href":"https://api.github.com/repos/ceph/ceph-docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ceph/ceph-docker/pulls/103/commits"},"statuses":{"href":"https://api.github.com/repos/ceph/ceph-docker/statuses/6c5184ccf1c6f198db222a3a573158a8c3624e90"}}}}