{"action":"created","comment":{"url":"https://api.github.com/repos/giantswarm/operatorkit/pulls/comments/146858254","pull_request_review_id":71862297,"id":146858254,"diff_hunk":"@@ -0,0 +1,88 @@\n+package crdclient\n+\n+import (\n+\t\"context\"\n+\n+\t\"github.com/cenk/backoff\"\n+\t\"github.com/giantswarm/microerror\"\n+\t\"github.com/giantswarm/micrologger\"\n+\t\"github.com/giantswarm/operatorkit/crd\"\n+\tapiextensionsv1beta1 \"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1\"\n+\tapiextensionsclient \"k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset\"\n+\t\"k8s.io/apimachinery/pkg/api/errors\"\n+\tmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+)\n+\n+type Config struct {\n+\t// Dependencies.\n+\n+\tK8sExtClient apiextensionsclient.Interface\n+\tLogger       micrologger.Logger\n+}\n+\n+type CRDClient struct {\n+\tk8sExtClient apiextensionsclient.Interface\n+\tlogger       micrologger.Logger\n+}\n+\n+func New(config Config) (*CRDClient, error) {\n+\t// Dependencies.\n+\tif config.K8sExtClient == nil {\n+\t\treturn nil, microerror.Maskf(invalidConfigError, \"config.K8sExtClient must not be empty\")\n+\t}\n+\tif config.Logger == nil {\n+\t\treturn nil, microerror.Maskf(invalidConfigError, \"config.Logger must not be empty\")\n+\t}\n+\n+\tcrdClient := &CRDClient{\n+\t\tk8sExtClient: config.K8sExtClient,\n+\t\tlogger:       config.Logger,\n+\t}\n+\n+\treturn crdClient, nil\n+}\n+\n+// Ensure ensures CRD exists, it is active (aka. established) and does not have\n+// conflicting names.\n+func (c *CRDClient) Ensure(ctx context.Context, customResource *crd.CRD, backOff backoff.BackOff) error {\n+\t_, err := c.k8sExtClient.ApiextensionsV1beta1().CustomResourceDefinitions().Create(customResource.NewResource())\n+\tif errors.IsAlreadyExists(err) {\n+\t\t// Fall trough. We need to check CRD status.","path":"crdclient/crd_client.go","position":50,"original_position":50,"commit_id":"3ec8e2252031d6920387881c68afac2b2e8197c1","original_commit_id":"3ec8e2252031d6920387881c68afac2b2e8197c1","user":{"login":"kopiczko","id":4608994,"avatar_url":"https://avatars0.githubusercontent.com/u/4608994?v=4","gravatar_id":"","url":"https://api.github.com/users/kopiczko","html_url":"https://github.com/kopiczko","followers_url":"https://api.github.com/users/kopiczko/followers","following_url":"https://api.github.com/users/kopiczko/following{/other_user}","gists_url":"https://api.github.com/users/kopiczko/gists{/gist_id}","starred_url":"https://api.github.com/users/kopiczko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kopiczko/subscriptions","organizations_url":"https://api.github.com/users/kopiczko/orgs","repos_url":"https://api.github.com/users/kopiczko/repos","events_url":"https://api.github.com/users/kopiczko/events{/privacy}","received_events_url":"https://api.github.com/users/kopiczko/received_events","type":"User","site_admin":false},"body":"This is one-line, but important change. `manifest.Status.Conditions` are checked even if CRD already exists.\r\n\r\nOtherwise it's all copy/paste + adding Config and New.","created_at":"2017-10-25T13:36:34Z","updated_at":"2017-10-25T13:37:16Z","html_url":"https://github.com/giantswarm/operatorkit/pull/95#discussion_r146858254","pull_request_url":"https://api.github.com/repos/giantswarm/operatorkit/pulls/95","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/giantswarm/operatorkit/pulls/comments/146858254"},"html":{"href":"https://github.com/giantswarm/operatorkit/pull/95#discussion_r146858254"},"pull_request":{"href":"https://api.github.com/repos/giantswarm/operatorkit/pulls/95"}}},"pull_request":{"url":"https://api.github.com/repos/giantswarm/operatorkit/pulls/95","id":148669134,"html_url":"https://github.com/giantswarm/operatorkit/pull/95","diff_url":"https://github.com/giantswarm/operatorkit/pull/95.diff","patch_url":"https://github.com/giantswarm/operatorkit/pull/95.patch","issue_url":"https://api.github.com/repos/giantswarm/operatorkit/issues/95","number":95,"state":"open","locked":false,"title":"extract crdclient","user":{"login":"kopiczko","id":4608994,"avatar_url":"https://avatars0.githubusercontent.com/u/4608994?v=4","gravatar_id":"","url":"https://api.github.com/users/kopiczko","html_url":"https://github.com/kopiczko","followers_url":"https://api.github.com/users/kopiczko/followers","following_url":"https://api.github.com/users/kopiczko/following{/other_user}","gists_url":"https://api.github.com/users/kopiczko/gists{/gist_id}","starred_url":"https://api.github.com/users/kopiczko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kopiczko/subscriptions","organizations_url":"https://api.github.com/users/kopiczko/orgs","repos_url":"https://api.github.com/users/kopiczko/repos","events_url":"https://api.github.com/users/kopiczko/events{/privacy}","received_events_url":"https://api.github.com/users/kopiczko/received_events","type":"User","site_admin":false},"body":"It felt strange that we pass dependency to an Establish method. I made proper\nCRDCleint struct in a separate package. I also renamed `client/crdclient` to\n`client/k8sextclient`. I think functionality will grow here as new API\nextensions will be added. Then calling it `crdclient.New` may become weird.","created_at":"2017-10-25T13:34:14Z","updated_at":"2017-10-25T13:37:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8d9363c222e80b84081833704006de2aacb70bfb","assignee":null,"assignees":[],"requested_reviewers":[{"login":"JosephSalisbury","id":297653,"avatar_url":"https://avatars1.githubusercontent.com/u/297653?v=4","gravatar_id":"","url":"https://api.github.com/users/JosephSalisbury","html_url":"https://github.com/JosephSalisbury","followers_url":"https://api.github.com/users/JosephSalisbury/followers","following_url":"https://api.github.com/users/JosephSalisbury/following{/other_user}","gists_url":"https://api.github.com/users/JosephSalisbury/gists{/gist_id}","starred_url":"https://api.github.com/users/JosephSalisbury/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosephSalisbury/subscriptions","organizations_url":"https://api.github.com/users/JosephSalisbury/orgs","repos_url":"https://api.github.com/users/JosephSalisbury/repos","events_url":"https://api.github.com/users/JosephSalisbury/events{/privacy}","received_events_url":"https://api.github.com/users/JosephSalisbury/received_events","type":"User","site_admin":false},{"login":"rossf7","id":311527,"avatar_url":"https://avatars1.githubusercontent.com/u/311527?v=4","gravatar_id":"","url":"https://api.github.com/users/rossf7","html_url":"https://github.com/rossf7","followers_url":"https://api.github.com/users/rossf7/followers","following_url":"https://api.github.com/users/rossf7/following{/other_user}","gists_url":"https://api.github.com/users/rossf7/gists{/gist_id}","starred_url":"https://api.github.com/users/rossf7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rossf7/subscriptions","organizations_url":"https://api.github.com/users/rossf7/orgs","repos_url":"https://api.github.com/users/rossf7/repos","events_url":"https://api.github.com/users/rossf7/events{/privacy}","received_events_url":"https://api.github.com/users/rossf7/received_events","type":"User","site_admin":false},{"login":"xh3b4sd","id":552769,"avatar_url":"https://avatars3.githubusercontent.com/u/552769?v=4","gravatar_id":"","url":"https://api.github.com/users/xh3b4sd","html_url":"https://github.com/xh3b4sd","followers_url":"https://api.github.com/users/xh3b4sd/followers","following_url":"https://api.github.com/users/xh3b4sd/following{/other_user}","gists_url":"https://api.github.com/users/xh3b4sd/gists{/gist_id}","starred_url":"https://api.github.com/users/xh3b4sd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xh3b4sd/subscriptions","organizations_url":"https://api.github.com/users/xh3b4sd/orgs","repos_url":"https://api.github.com/users/xh3b4sd/repos","events_url":"https://api.github.com/users/xh3b4sd/events{/privacy}","received_events_url":"https://api.github.com/users/xh3b4sd/received_events","type":"User","site_admin":false},{"login":"MarcelMue","id":9303709,"avatar_url":"https://avatars1.githubusercontent.com/u/9303709?v=4","gravatar_id":"","url":"https://api.github.com/users/MarcelMue","html_url":"https://github.com/MarcelMue","followers_url":"https://api.github.com/users/MarcelMue/followers","following_url":"https://api.github.com/users/MarcelMue/following{/other_user}","gists_url":"https://api.github.com/users/MarcelMue/gists{/gist_id}","starred_url":"https://api.github.com/users/MarcelMue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarcelMue/subscriptions","organizations_url":"https://api.github.com/users/MarcelMue/orgs","repos_url":"https://api.github.com/users/MarcelMue/repos","events_url":"https://api.github.com/users/MarcelMue/events{/privacy}","received_events_url":"https://api.github.com/users/MarcelMue/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/giantswarm/operatorkit/pulls/95/commits","review_comments_url":"https://api.github.com/repos/giantswarm/operatorkit/pulls/95/comments","review_comment_url":"https://api.github.com/repos/giantswarm/operatorkit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/giantswarm/operatorkit/issues/95/comments","statuses_url":"https://api.github.com/repos/giantswarm/operatorkit/statuses/3ec8e2252031d6920387881c68afac2b2e8197c1","head":{"label":"giantswarm:crdclient","ref":"crdclient","sha":"3ec8e2252031d6920387881c68afac2b2e8197c1","user":{"login":"giantswarm","id":7556340,"avatar_url":"https://avatars3.githubusercontent.com/u/7556340?v=4","gravatar_id":"","url":"https://api.github.com/users/giantswarm","html_url":"https://github.com/giantswarm","followers_url":"https://api.github.com/users/giantswarm/followers","following_url":"https://api.github.com/users/giantswarm/following{/other_user}","gists_url":"https://api.github.com/users/giantswarm/gists{/gist_id}","starred_url":"https://api.github.com/users/giantswarm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giantswarm/subscriptions","organizations_url":"https://api.github.com/users/giantswarm/orgs","repos_url":"https://api.github.com/users/giantswarm/repos","events_url":"https://api.github.com/users/giantswarm/events{/privacy}","received_events_url":"https://api.github.com/users/giantswarm/received_events","type":"Organization","site_admin":false},"repo":{"id":87818870,"name":"operatorkit","full_name":"giantswarm/operatorkit","owner":{"login":"giantswarm","id":7556340,"avatar_url":"https://avatars3.githubusercontent.com/u/7556340?v=4","gravatar_id":"","url":"https://api.github.com/users/giantswarm","html_url":"https://github.com/giantswarm","followers_url":"https://api.github.com/users/giantswarm/followers","following_url":"https://api.github.com/users/giantswarm/following{/other_user}","gists_url":"https://api.github.com/users/giantswarm/gists{/gist_id}","starred_url":"https://api.github.com/users/giantswarm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giantswarm/subscriptions","organizations_url":"https://api.github.com/users/giantswarm/orgs","repos_url":"https://api.github.com/users/giantswarm/repos","events_url":"https://api.github.com/users/giantswarm/events{/privacy}","received_events_url":"https://api.github.com/users/giantswarm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/giantswarm/operatorkit","description":"The operatorkit package implements an opinionated framework for developing Kubernetes operators.","fork":false,"url":"https://api.github.com/repos/giantswarm/operatorkit","forks_url":"https://api.github.com/repos/giantswarm/operatorkit/forks","keys_url":"https://api.github.com/repos/giantswarm/operatorkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/giantswarm/operatorkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/giantswarm/operatorkit/teams","hooks_url":"https://api.github.com/repos/giantswarm/operatorkit/hooks","issue_events_url":"https://api.github.com/repos/giantswarm/operatorkit/issues/events{/number}","events_url":"https://api.github.com/repos/giantswarm/operatorkit/events","assignees_url":"https://api.github.com/repos/giantswarm/operatorkit/assignees{/user}","branches_url":"https://api.github.com/repos/giantswarm/operatorkit/branches{/branch}","tags_url":"https://api.github.com/repos/giantswarm/operatorkit/tags","blobs_url":"https://api.github.com/repos/giantswarm/operatorkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/giantswarm/operatorkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/giantswarm/operatorkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/giantswarm/operatorkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/giantswarm/operatorkit/statuses/{sha}","languages_url":"https://api.github.com/repos/giantswarm/operatorkit/languages","stargazers_url":"https://api.github.com/repos/giantswarm/operatorkit/stargazers","contributors_url":"https://api.github.com/repos/giantswarm/operatorkit/contributors","subscribers_url":"https://api.github.com/repos/giantswarm/operatorkit/subscribers","subscription_url":"https://api.github.com/repos/giantswarm/operatorkit/subscription","commits_url":"https://api.github.com/repos/giantswarm/operatorkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/giantswarm/operatorkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/giantswarm/operatorkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/giantswarm/operatorkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/giantswarm/operatorkit/contents/{+path}","compare_url":"https://api.github.com/repos/giantswarm/operatorkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/giantswarm/operatorkit/merges","archive_url":"https://api.github.com/repos/giantswarm/operatorkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/giantswarm/operatorkit/downloads","issues_url":"https://api.github.com/repos/giantswarm/operatorkit/issues{/number}","pulls_url":"https://api.github.com/repos/giantswarm/operatorkit/pulls{/number}","milestones_url":"https://api.github.com/repos/giantswarm/operatorkit/milestones{/number}","notifications_url":"https://api.github.com/repos/giantswarm/operatorkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/giantswarm/operatorkit/labels{/name}","releases_url":"https://api.github.com/repos/giantswarm/operatorkit/releases{/id}","deployments_url":"https://api.github.com/repos/giantswarm/operatorkit/deployments","created_at":"2017-04-10T14:12:58Z","updated_at":"2017-10-19T03:25:53Z","pushed_at":"2017-10-25T13:34:15Z","git_url":"git://github.com/giantswarm/operatorkit.git","ssh_url":"git@github.com:giantswarm/operatorkit.git","clone_url":"https://github.com/giantswarm/operatorkit.git","svn_url":"https://github.com/giantswarm/operatorkit","homepage":"","size":21730,"stargazers_count":26,"watchers_count":26,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":11,"forks":2,"open_issues":11,"watchers":26,"default_branch":"master"}},"base":{"label":"giantswarm:master","ref":"master","sha":"a17d84983586a0a9a57afe56ca242e206f78b55c","user":{"login":"giantswarm","id":7556340,"avatar_url":"https://avatars3.githubusercontent.com/u/7556340?v=4","gravatar_id":"","url":"https://api.github.com/users/giantswarm","html_url":"https://github.com/giantswarm","followers_url":"https://api.github.com/users/giantswarm/followers","following_url":"https://api.github.com/users/giantswarm/following{/other_user}","gists_url":"https://api.github.com/users/giantswarm/gists{/gist_id}","starred_url":"https://api.github.com/users/giantswarm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giantswarm/subscriptions","organizations_url":"https://api.github.com/users/giantswarm/orgs","repos_url":"https://api.github.com/users/giantswarm/repos","events_url":"https://api.github.com/users/giantswarm/events{/privacy}","received_events_url":"https://api.github.com/users/giantswarm/received_events","type":"Organization","site_admin":false},"repo":{"id":87818870,"name":"operatorkit","full_name":"giantswarm/operatorkit","owner":{"login":"giantswarm","id":7556340,"avatar_url":"https://avatars3.githubusercontent.com/u/7556340?v=4","gravatar_id":"","url":"https://api.github.com/users/giantswarm","html_url":"https://github.com/giantswarm","followers_url":"https://api.github.com/users/giantswarm/followers","following_url":"https://api.github.com/users/giantswarm/following{/other_user}","gists_url":"https://api.github.com/users/giantswarm/gists{/gist_id}","starred_url":"https://api.github.com/users/giantswarm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giantswarm/subscriptions","organizations_url":"https://api.github.com/users/giantswarm/orgs","repos_url":"https://api.github.com/users/giantswarm/repos","events_url":"https://api.github.com/users/giantswarm/events{/privacy}","received_events_url":"https://api.github.com/users/giantswarm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/giantswarm/operatorkit","description":"The operatorkit package implements an opinionated framework for developing Kubernetes operators.","fork":false,"url":"https://api.github.com/repos/giantswarm/operatorkit","forks_url":"https://api.github.com/repos/giantswarm/operatorkit/forks","keys_url":"https://api.github.com/repos/giantswarm/operatorkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/giantswarm/operatorkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/giantswarm/operatorkit/teams","hooks_url":"https://api.github.com/repos/giantswarm/operatorkit/hooks","issue_events_url":"https://api.github.com/repos/giantswarm/operatorkit/issues/events{/number}","events_url":"https://api.github.com/repos/giantswarm/operatorkit/events","assignees_url":"https://api.github.com/repos/giantswarm/operatorkit/assignees{/user}","branches_url":"https://api.github.com/repos/giantswarm/operatorkit/branches{/branch}","tags_url":"https://api.github.com/repos/giantswarm/operatorkit/tags","blobs_url":"https://api.github.com/repos/giantswarm/operatorkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/giantswarm/operatorkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/giantswarm/operatorkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/giantswarm/operatorkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/giantswarm/operatorkit/statuses/{sha}","languages_url":"https://api.github.com/repos/giantswarm/operatorkit/languages","stargazers_url":"https://api.github.com/repos/giantswarm/operatorkit/stargazers","contributors_url":"https://api.github.com/repos/giantswarm/operatorkit/contributors","subscribers_url":"https://api.github.com/repos/giantswarm/operatorkit/subscribers","subscription_url":"https://api.github.com/repos/giantswarm/operatorkit/subscription","commits_url":"https://api.github.com/repos/giantswarm/operatorkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/giantswarm/operatorkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/giantswarm/operatorkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/giantswarm/operatorkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/giantswarm/operatorkit/contents/{+path}","compare_url":"https://api.github.com/repos/giantswarm/operatorkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/giantswarm/operatorkit/merges","archive_url":"https://api.github.com/repos/giantswarm/operatorkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/giantswarm/operatorkit/downloads","issues_url":"https://api.github.com/repos/giantswarm/operatorkit/issues{/number}","pulls_url":"https://api.github.com/repos/giantswarm/operatorkit/pulls{/number}","milestones_url":"https://api.github.com/repos/giantswarm/operatorkit/milestones{/number}","notifications_url":"https://api.github.com/repos/giantswarm/operatorkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/giantswarm/operatorkit/labels{/name}","releases_url":"https://api.github.com/repos/giantswarm/operatorkit/releases{/id}","deployments_url":"https://api.github.com/repos/giantswarm/operatorkit/deployments","created_at":"2017-04-10T14:12:58Z","updated_at":"2017-10-19T03:25:53Z","pushed_at":"2017-10-25T13:34:15Z","git_url":"git://github.com/giantswarm/operatorkit.git","ssh_url":"git@github.com:giantswarm/operatorkit.git","clone_url":"https://github.com/giantswarm/operatorkit.git","svn_url":"https://github.com/giantswarm/operatorkit","homepage":"","size":21730,"stargazers_count":26,"watchers_count":26,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":11,"forks":2,"open_issues":11,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/giantswarm/operatorkit/pulls/95"},"html":{"href":"https://github.com/giantswarm/operatorkit/pull/95"},"issue":{"href":"https://api.github.com/repos/giantswarm/operatorkit/issues/95"},"comments":{"href":"https://api.github.com/repos/giantswarm/operatorkit/issues/95/comments"},"review_comments":{"href":"https://api.github.com/repos/giantswarm/operatorkit/pulls/95/comments"},"review_comment":{"href":"https://api.github.com/repos/giantswarm/operatorkit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/giantswarm/operatorkit/pulls/95/commits"},"statuses":{"href":"https://api.github.com/repos/giantswarm/operatorkit/statuses/3ec8e2252031d6920387881c68afac2b2e8197c1"}},"author_association":"OWNER"}}
{"actor":{"display_login":"kopiczko"}}