{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/installer/pulls/comments/221442555","pull_request_review_id":160095546,"id":221442555,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTQ0MjU1NQ==","diff_hunk":"@@ -0,0 +1,53 @@\n+## How to add a new operator to the installer?\n+\n+### Goals:\n+To follow this document and be able to\n+ - Get an operator’s configuration files be created for installation\n+ - Get an operator’s manifest files be put in place for cluster to pick up\n+ - Get the config files and manifest files be created as resources in the new cluster, in the appropriate order\n+\n+### Details\n+The source code for the installer is here: https://github.com/openshift/installer. We will refer to this repo as installer-src for this document.\n+\n+One can can classify all the manifest/config files of an operator in two categories:\n+ - Static\n+ - Templatized\n+ \n+The static ones are clearly just byte blobs and the templates are ones that have some variable that needs to be filled up. Typically the variables that need filling up will come from user preferences as specified in the install config (e.g. cluster name, cluster domain, service cidr etc). Other dependencies could be TLS cert keys for example.\n+\n+#### The recommended way\n+Take the static files and ready it for the Cluster Version Operator (CVO) to pick it up as its payload. See this document:\n+https://docs.google.com/document/d/1CGZVEyuloZ9oD4NUArW6dnEpi0WFc6BP2tqPSwFZTCY/edit#heading=h.1zgrwxmpgxbr\n+\n+Upshot of the above document is that the operator should keep its static manifest files in manifests/ folder of the operator repository and manage image references through an image-references file. The order of creation of the files is alphabetical, so the files should be numbered like below to effectively create the service account before the deployment.\n+:\n+```\n+0000_70_my-operator-name_04_service-account.yaml\n+0000_70_my-operator-name_05_deployment.yaml\n+```\n+where, 0000 is the global run-level, 70 is the operator level, and 04/05 is the internal ordering of the resource manifests.\n+\n+*What to do for my dynamic template files?*\n+\n+An operator should auto-discover the install config rather than expand the templates through the installer-src integration (see alternative). Simply use the apiserver access to get the install-config as a config map. The config map is stored by the name ‘cluster-config-v1’ in the ‘kube-system’ namespaces.\n+Psuedo code:\n+```\n+kube-client(apiserver-url).Get(Resource: “config-map”, Namespace: “kube-system”, Name: “cluster-config-v1”)\n+```\n+where, apiserver-url is a cluster supplied ENV var ‘KUBERNETES_SERVICE_HOST’ in the pod.\n+Example:\n+https://github.com/openshift/machine-config-operator/blob/e932afdec07dc86d5b643590164f86811e205c57/pkg/operator/operator.go#L272\n+\n+After discovering the InstallConfig, the operator pod can create its own configuration in memory. e.g. the discoverMCOConfig returns the configuration for the operator as it is discovered rather than picking it up from an actual configmap. \n+https://github.com/openshift/machine-config-operator/blob/31c20eefca172d5c1173e7b79b30bad540958dfe/pkg/operator/render.go#L46\n+\n+#### The alternative (for exceptions only)\n+The main directory for manifests in the installer-src is pkg/asset/manifests. Within the installer-src, there are two ways to get the manifests/config files integrated:","path":"docs/dev/integrate_operator_how_to.md","position":45,"original_position":45,"commit_id":"4f66f9763ee71ea9cbabc3f0dc1edf8757f29727","original_commit_id":"4f66f9763ee71ea9cbabc3f0dc1edf8757f29727","user":{"login":"wking","id":209920,"node_id":"MDQ6VXNlcjIwOTkyMA==","avatar_url":"https://avatars1.githubusercontent.com/u/209920?v=4","gravatar_id":"","url":"https://api.github.com/users/wking","html_url":"https://github.com/wking","followers_url":"https://api.github.com/users/wking/followers","following_url":"https://api.github.com/users/wking/following{/other_user}","gists_url":"https://api.github.com/users/wking/gists{/gist_id}","starred_url":"https://api.github.com/users/wking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wking/subscriptions","organizations_url":"https://api.github.com/users/wking/orgs","repos_url":"https://api.github.com/users/wking/repos","events_url":"https://api.github.com/users/wking/events{/privacy}","received_events_url":"https://api.github.com/users/wking/received_events","type":"User","site_admin":false},"body":"If you drop the `installer-src` definition as I suggest below, you can use:\r\n\r\n```markdown\r\nManifests which need to be directly integrated in the installer live in [the `manifests` package](../../pkg/asset/manifests).\r\n```","created_at":"2018-09-29T23:26:48Z","updated_at":"2018-09-29T23:38:15Z","html_url":"https://github.com/openshift/installer/pull/377#discussion_r221442555","pull_request_url":"https://api.github.com/repos/openshift/installer/pulls/377","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/openshift/installer/pulls/comments/221442555"},"html":{"href":"https://github.com/openshift/installer/pull/377#discussion_r221442555"},"pull_request":{"href":"https://api.github.com/repos/openshift/installer/pulls/377"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/installer/pulls/377","id":219107426,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5MTA3NDI2","html_url":"https://github.com/openshift/installer/pull/377","diff_url":"https://github.com/openshift/installer/pull/377.diff","patch_url":"https://github.com/openshift/installer/pull/377.patch","issue_url":"https://api.github.com/repos/openshift/installer/issues/377","number":377,"state":"open","locked":false,"title":"New doc on how to integrate an operator","user":{"login":"rajatchopra","id":982221,"node_id":"MDQ6VXNlcjk4MjIyMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/982221?v=4","gravatar_id":"","url":"https://api.github.com/users/rajatchopra","html_url":"https://github.com/rajatchopra","followers_url":"https://api.github.com/users/rajatchopra/followers","following_url":"https://api.github.com/users/rajatchopra/following{/other_user}","gists_url":"https://api.github.com/users/rajatchopra/gists{/gist_id}","starred_url":"https://api.github.com/users/rajatchopra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rajatchopra/subscriptions","organizations_url":"https://api.github.com/users/rajatchopra/orgs","repos_url":"https://api.github.com/users/rajatchopra/repos","events_url":"https://api.github.com/users/rajatchopra/events{/privacy}","received_events_url":"https://api.github.com/users/rajatchopra/received_events","type":"User","site_admin":false},"body":"A document to help an operator developer to integrate the operator with the installer. It covers what files to keep where so that configurations can be properly generated.\r\n\r\n","created_at":"2018-09-28T23:23:08Z","updated_at":"2018-09-29T23:38:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a28caa5495073426073d38fa8605c2a532581d75","assignee":null,"assignees":[],"requested_reviewers":[{"login":"steveeJ","id":1181362,"node_id":"MDQ6VXNlcjExODEzNjI=","avatar_url":"https://avatars3.githubusercontent.com/u/1181362?v=4","gravatar_id":"","url":"https://api.github.com/users/steveeJ","html_url":"https://github.com/steveeJ","followers_url":"https://api.github.com/users/steveeJ/followers","following_url":"https://api.github.com/users/steveeJ/following{/other_user}","gists_url":"https://api.github.com/users/steveeJ/gists{/gist_id}","starred_url":"https://api.github.com/users/steveeJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steveeJ/subscriptions","organizations_url":"https://api.github.com/users/steveeJ/orgs","repos_url":"https://api.github.com/users/steveeJ/repos","events_url":"https://api.github.com/users/steveeJ/events{/privacy}","received_events_url":"https://api.github.com/users/steveeJ/received_events","type":"User","site_admin":false},{"login":"staebler","id":30120115,"node_id":"MDQ6VXNlcjMwMTIwMTE1","avatar_url":"https://avatars1.githubusercontent.com/u/30120115?v=4","gravatar_id":"","url":"https://api.github.com/users/staebler","html_url":"https://github.com/staebler","followers_url":"https://api.github.com/users/staebler/followers","following_url":"https://api.github.com/users/staebler/following{/other_user}","gists_url":"https://api.github.com/users/staebler/gists{/gist_id}","starred_url":"https://api.github.com/users/staebler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/staebler/subscriptions","organizations_url":"https://api.github.com/users/staebler/orgs","repos_url":"https://api.github.com/users/staebler/repos","events_url":"https://api.github.com/users/staebler/events{/privacy}","received_events_url":"https://api.github.com/users/staebler/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":959732229,"node_id":"MDU6TGFiZWw5NTk3MzIyMjk=","url":"https://api.github.com/repos/openshift/installer/labels/approved","name":"approved","color":"0ffa16","default":false},{"id":959729794,"node_id":"MDU6TGFiZWw5NTk3Mjk3OTQ=","url":"https://api.github.com/repos/openshift/installer/labels/size/M","name":"size/M","color":"eebb00","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/openshift/installer/pulls/377/commits","review_comments_url":"https://api.github.com/repos/openshift/installer/pulls/377/comments","review_comment_url":"https://api.github.com/repos/openshift/installer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/installer/issues/377/comments","statuses_url":"https://api.github.com/repos/openshift/installer/statuses/4f66f9763ee71ea9cbabc3f0dc1edf8757f29727","head":{"label":"rajatchopra:patch-1","ref":"patch-1","sha":"4f66f9763ee71ea9cbabc3f0dc1edf8757f29727","user":{"login":"rajatchopra","id":982221,"node_id":"MDQ6VXNlcjk4MjIyMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/982221?v=4","gravatar_id":"","url":"https://api.github.com/users/rajatchopra","html_url":"https://github.com/rajatchopra","followers_url":"https://api.github.com/users/rajatchopra/followers","following_url":"https://api.github.com/users/rajatchopra/following{/other_user}","gists_url":"https://api.github.com/users/rajatchopra/gists{/gist_id}","starred_url":"https://api.github.com/users/rajatchopra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rajatchopra/subscriptions","organizations_url":"https://api.github.com/users/rajatchopra/orgs","repos_url":"https://api.github.com/users/rajatchopra/repos","events_url":"https://api.github.com/users/rajatchopra/events{/privacy}","received_events_url":"https://api.github.com/users/rajatchopra/received_events","type":"User","site_admin":false},"repo":{"id":143057825,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMwNTc4MjU=","name":"installer","full_name":"rajatchopra/installer","private":false,"owner":{"login":"rajatchopra","id":982221,"node_id":"MDQ6VXNlcjk4MjIyMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/982221?v=4","gravatar_id":"","url":"https://api.github.com/users/rajatchopra","html_url":"https://github.com/rajatchopra","followers_url":"https://api.github.com/users/rajatchopra/followers","following_url":"https://api.github.com/users/rajatchopra/following{/other_user}","gists_url":"https://api.github.com/users/rajatchopra/gists{/gist_id}","starred_url":"https://api.github.com/users/rajatchopra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rajatchopra/subscriptions","organizations_url":"https://api.github.com/users/rajatchopra/orgs","repos_url":"https://api.github.com/users/rajatchopra/repos","events_url":"https://api.github.com/users/rajatchopra/events{/privacy}","received_events_url":"https://api.github.com/users/rajatchopra/received_events","type":"User","site_admin":false},"html_url":"https://github.com/rajatchopra/installer","description":"Install an OpenShift cluster","fork":true,"url":"https://api.github.com/repos/rajatchopra/installer","forks_url":"https://api.github.com/repos/rajatchopra/installer/forks","keys_url":"https://api.github.com/repos/rajatchopra/installer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rajatchopra/installer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rajatchopra/installer/teams","hooks_url":"https://api.github.com/repos/rajatchopra/installer/hooks","issue_events_url":"https://api.github.com/repos/rajatchopra/installer/issues/events{/number}","events_url":"https://api.github.com/repos/rajatchopra/installer/events","assignees_url":"https://api.github.com/repos/rajatchopra/installer/assignees{/user}","branches_url":"https://api.github.com/repos/rajatchopra/installer/branches{/branch}","tags_url":"https://api.github.com/repos/rajatchopra/installer/tags","blobs_url":"https://api.github.com/repos/rajatchopra/installer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rajatchopra/installer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rajatchopra/installer/git/refs{/sha}","trees_url":"https://api.github.com/repos/rajatchopra/installer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rajatchopra/installer/statuses/{sha}","languages_url":"https://api.github.com/repos/rajatchopra/installer/languages","stargazers_url":"https://api.github.com/repos/rajatchopra/installer/stargazers","contributors_url":"https://api.github.com/repos/rajatchopra/installer/contributors","subscribers_url":"https://api.github.com/repos/rajatchopra/installer/subscribers","subscription_url":"https://api.github.com/repos/rajatchopra/installer/subscription","commits_url":"https://api.github.com/repos/rajatchopra/installer/commits{/sha}","git_commits_url":"https://api.github.com/repos/rajatchopra/installer/git/commits{/sha}","comments_url":"https://api.github.com/repos/rajatchopra/installer/comments{/number}","issue_comment_url":"https://api.github.com/repos/rajatchopra/installer/issues/comments{/number}","contents_url":"https://api.github.com/repos/rajatchopra/installer/contents/{+path}","compare_url":"https://api.github.com/repos/rajatchopra/installer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rajatchopra/installer/merges","archive_url":"https://api.github.com/repos/rajatchopra/installer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rajatchopra/installer/downloads","issues_url":"https://api.github.com/repos/rajatchopra/installer/issues{/number}","pulls_url":"https://api.github.com/repos/rajatchopra/installer/pulls{/number}","milestones_url":"https://api.github.com/repos/rajatchopra/installer/milestones{/number}","notifications_url":"https://api.github.com/repos/rajatchopra/installer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rajatchopra/installer/labels{/name}","releases_url":"https://api.github.com/repos/rajatchopra/installer/releases{/id}","deployments_url":"https://api.github.com/repos/rajatchopra/installer/deployments","created_at":"2018-07-31T19:24:28Z","updated_at":"2018-08-10T23:29:03Z","pushed_at":"2018-09-28T23:22:31Z","git_url":"git://github.com/rajatchopra/installer.git","ssh_url":"git@github.com:rajatchopra/installer.git","clone_url":"https://github.com/rajatchopra/installer.git","svn_url":"https://github.com/rajatchopra/installer","homepage":"","size":39877,"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","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"0284d4e9a099dd131b2730c61cc0ac3876907290","user":{"login":"openshift","id":792337,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc5MjMzNw==","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":136633680,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY2MzM2ODA=","name":"installer","full_name":"openshift/installer","private":false,"owner":{"login":"openshift","id":792337,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc5MjMzNw==","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},"html_url":"https://github.com/openshift/installer","description":"Install an OpenShift cluster","fork":false,"url":"https://api.github.com/repos/openshift/installer","forks_url":"https://api.github.com/repos/openshift/installer/forks","keys_url":"https://api.github.com/repos/openshift/installer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/installer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/installer/teams","hooks_url":"https://api.github.com/repos/openshift/installer/hooks","issue_events_url":"https://api.github.com/repos/openshift/installer/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/installer/events","assignees_url":"https://api.github.com/repos/openshift/installer/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/installer/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/installer/tags","blobs_url":"https://api.github.com/repos/openshift/installer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/installer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/installer/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/installer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/installer/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/installer/languages","stargazers_url":"https://api.github.com/repos/openshift/installer/stargazers","contributors_url":"https://api.github.com/repos/openshift/installer/contributors","subscribers_url":"https://api.github.com/repos/openshift/installer/subscribers","subscription_url":"https://api.github.com/repos/openshift/installer/subscription","commits_url":"https://api.github.com/repos/openshift/installer/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/installer/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/installer/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/installer/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/installer/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/installer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/installer/merges","archive_url":"https://api.github.com/repos/openshift/installer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/installer/downloads","issues_url":"https://api.github.com/repos/openshift/installer/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/installer/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/installer/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/installer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/installer/labels{/name}","releases_url":"https://api.github.com/repos/openshift/installer/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/installer/deployments","created_at":"2018-06-08T15:04:41Z","updated_at":"2018-09-29T16:20:30Z","pushed_at":"2018-09-29T20:12:00Z","git_url":"git://github.com/openshift/installer.git","ssh_url":"git@github.com:openshift/installer.git","clone_url":"https://github.com/openshift/installer.git","svn_url":"https://github.com/openshift/installer","homepage":"","size":39886,"stargazers_count":61,"watchers_count":61,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":63,"mirror_url":null,"archived":false,"open_issues_count":34,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":63,"open_issues":34,"watchers":61,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/installer/pulls/377"},"html":{"href":"https://github.com/openshift/installer/pull/377"},"issue":{"href":"https://api.github.com/repos/openshift/installer/issues/377"},"comments":{"href":"https://api.github.com/repos/openshift/installer/issues/377/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/installer/pulls/377/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/installer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/installer/pulls/377/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/installer/statuses/4f66f9763ee71ea9cbabc3f0dc1edf8757f29727"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"wking"}}