Rancher 1.6:禁用内置目录 [英] Rancher 1.6: Disable builtin catalogs

查看:145
本文介绍了Rancher 1.6:禁用内置目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用bash脚本安装Rancher 1.6。

I'm installing Rancher 1.6 with a bash script.

如何使用curl使用API​​请求禁用默认的社区和企业目录?

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

如何使用API​​添加我的私有目录?

How to add my private catalog using the API?

推荐答案

Rancher使用API​​公开了所有内容,这也是UI所使用的。有两种方法可以找出这些信息。

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)在打开Chrome / Browser Developer工具的同时,导航到用户界面中的设置页面,然后禁用图书馆和社区目录,然后单击保存。 UI发出的API请求将在开发人员工具中提供,您可以在脚本中使用它。

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)Rancher API还具有漂亮的UI界面可以用来编辑各种资源,并在发出请求之前显示cURL摘要。可以直接在您的脚本中使用。

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.

以下是代码段:

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'

类似地,您可以算出用curl命令添加您的私有目录。我将它留给您作为练习;-)

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

API UI的屏幕截图:

Screenshot of the API UI:

< a href = https://i.stack.imgur.com/KzNKQ.png rel = nofollow noreferrer>

这篇关于Rancher 1.6:禁用内置目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆