生产环境的开源容器管理平台--Rancher入门教程 5 自定义Catalog工具

这里写图片描述

Rancher是一个用于部署和管理生产环境的容器的开源平台,它与Kubernetes/Mesos/Docker Swarm进行集成。使得在任何硬件环境上容器化应用变得触手可及。在这个系列的教程中我们将会学习如何使用rancher, 上篇文章介绍了如何在rancher中添加自定义的catalog,由于较为繁琐,本文介绍一下相关自动化工具。

yo rancher-catalog

在上篇文章中介绍了自定义catalog的方法,但是文件较多,限制很多,从文件名到内容很小的地方都可能造成不能正常显示,使用npm的rancher-catalog这个小工具可以绕开一部分问题。

安装

npm install -g yo
npm install -g generator-rancher-catalog
  • 1
  • 2

执行方法

yo rancher-catalog
  • 1

demo

生成

这里写图片描述

设定

这里写图片描述

确认

这里写图片描述

这里写图片描述

rancher-cattle-autocatalog

使用npm的yo,前提是还必须要安装npm,所以也可以使用rancher-cattle-autocatalog进行处理。

使用例

[root@liumiaocn rancher]# pwd
/tmp/rancher
[root@liumiaocn rancher]# ll
total 0
[root@liumiaocn rancher]# git clone https://github.com/liumiaocn/rancher-cattle-autocatalog
Cloning into 'rancher-cattle-autocatalog'...
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 18 (delta 1), reused 14 (delta 0), pack-reused 0
Unpacking objects: 100% (18/18), done.
[root@liumiaocn rancher]# cd rancher-cattle-autocatalog/scripts/
[root@liumiaocn scripts]# ll
total 8
-rw-r--r--. 1 root root 2525 Sep 28 20:39 create_rancher_cattle_catalog.sh
drwxr-xr-x. 3 root root   22 Sep 28 20:39 DEMO
-rw-r--r--. 1 root root  401 Sep 28 20:39 init.conf
[root@liumiaocn scripts]# cat init.conf
DEMO                @ nginx
DEMONAME            @ nginx
DEMODESCRIPTION     @ nginx image
DEMOVERSION         @ 1.0.0
DEMOCATAGORY        @ WEB
DEMOMAINTAINER      @ liumiaocn@outlook.com
DEMOLICENSE         @ Apache 2
DEMOURL             @ liumiaocn\/rancher-cattle-autocatalog
DEMOIMAGE           @ nginx
DEMOPORTMAPPING     @ 80:80
DEMOUUID            @
DEMOMINIMUM_VERSION @
DEMOQUESTIONS       @
[root@liumiaocn scripts]#
[root@liumiaocn scripts]# sh create_rancher_cattle_catalog.sh  init.conf
[root@liumiaocn scripts]# ll
total 8
-rw-r--r--. 1 root root 2525 Sep 28 20:39 create_rancher_cattle_catalog.sh
drwxr-xr-x. 3 root root   22 Sep 28 20:39 DEMO
-rw-r--r--. 1 root root  401 Sep 28 20:39 init.conf
drwxr-xr-x. 3 root root   22 Sep 28 20:39 nginx
[root@liumiaocn scripts]# mv nginx/templates/ ..
[root@liumiaocn scripts]# rm -rf nginx/
[root@liumiaocn scripts]# cd ..
[root@liumiaocn rancher-cattle-autocatalog]# ll
total 16
-rw-r--r--. 1 root root 11357 Sep 28 20:39 LICENSE
-rw-r--r--. 1 root root    64 Sep 28 20:39 README.md
drwxr-xr-x. 3 root root    72 Sep 28 20:44 scripts
drwxr-xr-x. 3 root root    18 Sep 28 20:44 templates
[root@liumiaocn rancher-cattle-autocatalog]# git add *
[root@liumiaocn rancher-cattle-autocatalog]# git commit -m "add nginx rancher catalog"
[master e64daec] add nginx rancher catalog
 5 files changed, 1701 insertions(+)
 create mode 100644 templates/nginx/0/docker-compose.yml
 create mode 100644 templates/nginx/0/rancher-compose.yml
 create mode 100644 templates/nginx/README.md
 create mode 100644 templates/nginx/catalogIcon-nginx.svg
 create mode 100644 templates/nginx/config.yml
[root@liumiaocn rancher-cattle-autocatalog]# git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Username for 'https://github.com': liumiaocn
Password for 'https://[email protected]':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/liumiaocn/rancher-cattle-autocatalog/'
[root@liumiaocn rancher-cattle-autocatalog]#
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76

上篇文章的例子即为使用这种方法自动生成。熟悉格式之后不用任何工具也是一样。

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://www.cnblogs.com/captainbed

猜你喜欢

转载自www.cnblogs.com/firsttry/p/10232427.html
今日推荐