{"action":"opened","issue":{"url":"https://api.github.com/repos/kubernetes/kubeadm/issues/997","repository_url":"https://api.github.com/repos/kubernetes/kubeadm","labels_url":"https://api.github.com/repos/kubernetes/kubeadm/issues/997/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubeadm/issues/997/comments","events_url":"https://api.github.com/repos/kubernetes/kubeadm/issues/997/events","html_url":"https://github.com/kubernetes/kubeadm/issues/997","id":341704764,"node_id":"MDU6SXNzdWUzNDE3MDQ3NjQ=","number":997,"title":"implement a sentinel file to guard kubeadm init and join commands","user":{"login":"neolit123","id":331852,"node_id":"MDQ6VXNlcjMzMTg1Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/331852?v=4","gravatar_id":"","url":"https://api.github.com/users/neolit123","html_url":"https://github.com/neolit123","followers_url":"https://api.github.com/users/neolit123/followers","following_url":"https://api.github.com/users/neolit123/following{/other_user}","gists_url":"https://api.github.com/users/neolit123/gists{/gist_id}","starred_url":"https://api.github.com/users/neolit123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neolit123/subscriptions","organizations_url":"https://api.github.com/users/neolit123/orgs","repos_url":"https://api.github.com/users/neolit123/repos","events_url":"https://api.github.com/users/neolit123/events{/privacy}","received_events_url":"https://api.github.com/users/neolit123/received_events","type":"User","site_admin":false},"labels":[{"id":488846147,"node_id":"MDU6TGFiZWw0ODg4NDYxNDc=","url":"https://api.github.com/repos/kubernetes/kubeadm/labels/area/UX","name":"area/UX","color":"bfd4f2","default":false},{"id":486863285,"node_id":"MDU6TGFiZWw0ODY4NjMyODU=","url":"https://api.github.com/repos/kubernetes/kubeadm/labels/help%20wanted","name":"help wanted","color":"006b75","default":true},{"id":764044866,"node_id":"MDU6TGFiZWw3NjQwNDQ4NjY=","url":"https://api.github.com/repos/kubernetes/kubeadm/labels/kind/documentation","name":"kind/documentation","color":"c7def8","default":false},{"id":764040710,"node_id":"MDU6TGFiZWw3NjQwNDA3MTA=","url":"https://api.github.com/repos/kubernetes/kubeadm/labels/kind/feature","name":"kind/feature","color":"c7def8","default":false},{"id":488819762,"node_id":"MDU6TGFiZWw0ODg4MTk3NjI=","url":"https://api.github.com/repos/kubernetes/kubeadm/labels/kind/tracking-issue","name":"kind/tracking-issue","color":"006b75","default":false}],"state":"open","locked":false,"assignee":{"login":"neolit123","id":331852,"node_id":"MDQ6VXNlcjMzMTg1Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/331852?v=4","gravatar_id":"","url":"https://api.github.com/users/neolit123","html_url":"https://github.com/neolit123","followers_url":"https://api.github.com/users/neolit123/followers","following_url":"https://api.github.com/users/neolit123/following{/other_user}","gists_url":"https://api.github.com/users/neolit123/gists{/gist_id}","starred_url":"https://api.github.com/users/neolit123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neolit123/subscriptions","organizations_url":"https://api.github.com/users/neolit123/orgs","repos_url":"https://api.github.com/users/neolit123/repos","events_url":"https://api.github.com/users/neolit123/events{/privacy}","received_events_url":"https://api.github.com/users/neolit123/received_events","type":"User","site_admin":false},"assignees":[{"login":"neolit123","id":331852,"node_id":"MDQ6VXNlcjMzMTg1Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/331852?v=4","gravatar_id":"","url":"https://api.github.com/users/neolit123","html_url":"https://github.com/neolit123","followers_url":"https://api.github.com/users/neolit123/followers","following_url":"https://api.github.com/users/neolit123/following{/other_user}","gists_url":"https://api.github.com/users/neolit123/gists{/gist_id}","starred_url":"https://api.github.com/users/neolit123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neolit123/subscriptions","organizations_url":"https://api.github.com/users/neolit123/orgs","repos_url":"https://api.github.com/users/neolit123/repos","events_url":"https://api.github.com/users/neolit123/events{/privacy}","received_events_url":"https://api.github.com/users/neolit123/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/kubernetes/kubeadm/milestones/8","html_url":"https://github.com/kubernetes/kubeadm/milestone/8","labels_url":"https://api.github.com/repos/kubernetes/kubeadm/milestones/8/labels","id":3345961,"node_id":"MDk6TWlsZXN0b25lMzM0NTk2MQ==","number":8,"title":"v1.12","description":"","creator":{"login":"luxas","id":5442475,"node_id":"MDQ6VXNlcjU0NDI0NzU=","avatar_url":"https://avatars1.githubusercontent.com/u/5442475?v=4","gravatar_id":"","url":"https://api.github.com/users/luxas","html_url":"https://github.com/luxas","followers_url":"https://api.github.com/users/luxas/followers","following_url":"https://api.github.com/users/luxas/following{/other_user}","gists_url":"https://api.github.com/users/luxas/gists{/gist_id}","starred_url":"https://api.github.com/users/luxas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luxas/subscriptions","organizations_url":"https://api.github.com/users/luxas/orgs","repos_url":"https://api.github.com/users/luxas/repos","events_url":"https://api.github.com/users/luxas/events{/privacy}","received_events_url":"https://api.github.com/users/luxas/received_events","type":"User","site_admin":false},"open_issues":63,"closed_issues":14,"state":"open","created_at":"2018-05-14T18:14:21Z","updated_at":"2018-07-16T22:46:00Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2018-07-16T22:46:00Z","updated_at":"2018-07-16T22:46:00Z","closed_at":null,"author_association":"MEMBER","body":"## the issue\r\n\r\nusers end up calling `kubeadm init / join` on the same node and we don't have good error messaging for that.\r\n\r\nhttps://github.com/kubernetes/kubeadm/issues/974\r\n\r\n## the solution\r\n\r\nthe idea here, as discussed in a SIG meeting with @timothysc and @chuckha , is to create a so called \"sentinel file\" (guard file) which will be used to determine if `kubeadm init` or `kubeadm join` has previously ran on this particular machine.\r\n\r\nthis change should be split into two phases.\r\n\r\n### phase 1:\r\nphase 1 is nice to have for k8s 1.12. the idea here is just create the file and determine if `init` or `join` were used for creating it.\r\n\r\n- create a new file called `cmd/kubeadm/app/util/sentinelfile.go`.\r\n- in that file create a couple of constants:\r\n* `KubeadmSentinelFolder = /var/lib/kubeadm`\r\n* `KubeadmSentinelFile = kubeadm-sentinel`\r\n- add methods in this file for writing / reading and deleting a file\r\n- permissions for this file and folder should be `0664` (see note [1] in phase 2)/\r\n- file and folder should be created when `kubeadm join` and `kubeadm init` are called\r\n- if `kubeadm init` is called write `kubeadm init\\n` to the file, else if `kubeadm join` is called write `kubeadm join\\n`\r\n- if `kubeadm init` or `kubeadm join` are called while the file exists, print an error message saying `kubeadm <CMD> was already called on this machine`, replace `<CMD>` with the command from the sentinel file.\r\n- the folder and file should be removed when `kubeadm reset` is called.\r\n\r\n### phase 2:\r\nphase 2 can go for a future release of k8s after 1.12. the idea is to be able to log recent `kubeadm` calls in this file, until `reset` is called.\r\n\r\n- add timestamps and all flags to the sentinel file, for example:\r\n```\r\n2009-11-10T23:00:00Z kubeadm init --config=....\r\n2009-11-10T23:00:00Z kubeadm config images list\r\n...\r\n```\r\nThis should be done using `time.Format()`, `time.Parse()` and the `time.RFC3339` layout. For the flags we need to get them from Cobra.\r\n- add Windows support with `sentinelfile_windows.go` vs `sentinelfile_unix.go`. different constants should be enough for the separate OS files.\r\n- if `kubeadm init` or `kubeadm join` are called while the file exists, print an error message saying `kubeadm <CMD> was already called on this machine`, replace `<CMD>` with the command from the sentinel file, print a timestamp, but don't include all flags.\r\n- **note [1]:** given some `kubeadm` commands don't need root access either the folder on Linux should not be `var/lib/kubeadm` or the permissions for this folder and the file in there should be `0666`\r\n\r\noptional:\r\n- possibly add a command to kubeadm for showing the contents of the file -  e.g. `kubeadm sentinel show -N`, where `-N` can print the last N entries.\r\n- document the new behavior and command at `k/website`.\r\n\r\n/cc @timothysc @chuckha \r\n/cc @kubernetes/sig-cluster-lifecycle-feature-requests \r\n\r\nboth @xlgao-zju @chenyb4 wanted to work on this.\r\nif you guys want you can split the work on phase 1 and 2?\r\n\r\nin the meantime this is open for comments and questions.\r\n"}}
{"actor":{"display_login":"neolit123"}}