Rancher 1.6: Disable builtin catalogs

空扰寡人 提交于 2019-12-25 01:12:01

问题


I'm installing Rancher 1.6 with a bash script.

How to disable the default "Community" and "Enterprise" catalogs with an API request using curl?

How to add my private catalog using the API?


回答1:


Rancher exposes everything using the API, which was what the UI also uses. There are two ways one could go about to figure out this information.

1) While having Chrome/Browser Developer tools open, navigate to the Settings page in the UI, disable both Library and Community catalogs and hit "Save". The API request made by the UI would be available in the Developer Tools that you can grab to use in your script.

2) The Rancher API also has a slick UI interface which can be used to edit various resources and shows a cURL summary before making the request. This can be used directly in your scripts.

Here is the snippet:

curl -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \
-X PUT \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"activeValue":"{\"catalogs\":{\"library\":{\"url\":\"https://git.rancher.io/rancher-catalog.git\", \"branch\":\"${RELEASE}\"}, \"community\":{\"url\":\"https://git.rancher.io/community-catalog.git\", \"branch\":\"master\"}}}", "id":"catalog.url", "name":"catalog.url", "source":"Database", "value":"{}"}' \
'http://myrancher.xip.io/v2-beta/settings/catalog.url'

Similarly, you can figure out the curl command to add your private catalog. I'll leave it as an exercise for you ;-)

Screenshot of the API UI:



来源:https://stackoverflow.com/questions/54315006/rancher-1-6-disable-builtin-catalogs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!