fabric8-tenant

Service responsible for provisioning and updating the tenant scoped services

Github星跟踪图

= Fabric8 Tenant Service

image:https://ci.centos.org/buildStatus/icon?job=devtools-fabric8-tenant-build-master[Jenkins,link="https://ci.centos.org/view/Devtools/job/devtools-fabric8-tenant-build-master/lastBuild/"]
image:https://goreportcard.com/badge/github.com/fabric8-services/fabric8-tenant[Go Report Card, link="https://goreportcard.com/report/github.com/fabric8-services/fabric8-tenant"]
image:https://godoc.org/github.com/fabric8-services/fabric8-tenant?status.png[GoDoc,link="https://godoc.org/github.com/fabric8-services/fabric8-tenant"]
image:https://codecov.io/gh/fabric8-services/fabric8-tenant/branch/master/graph/badge.svg[Codecov.io,link="https://codecov.io/gh/fabric8-services/fabric8-tenant"]

== Service for initializing and updating the tenant services in fabric8/openshift.io

=== Template YAML files

All template YAML files and YAML files containing resource quotas and limits are located in link:environment/templates/[] directory.
Every template uses the same versioning system - the version is stored as a label called version and is equal to a short version of SHA of the latest commit that changes the particular file.

==== In-production testing

To be able to use the in-production testing feature, you need to have the Internal Experimental Features toggle activated. To do that:

===== Pull request

When a PR is made on one of the YAML files you can test in production in your tenant via the following:

  • http://openshift.io/ and login
  • go to https://openshift.io/_profile/_tenant
  • enter the SHA of the latest commit in your PR as the "Repository blob SHA"
  • check Auto-update your tenant
  • click Save and Update Tenant - your tenant should now be updating/running namespaces using the files from your PR
  • the version (label) inside of the updated tenant namespaces is set to the blob SHA that was set in the form

===== Without creating a pull request

If it is needed to test templates without submitting a PR, you can do in a similar way as in case of PR, but on the https://openshift.io/_profile/_tenant page, you have to also specify the name of the repository and path to the directory where the templates are stored. The blob SHA is mandatory even if it should be taken from the master branch.

===== Reset back

To go back to using the default YAML:

  • go back to your tenant page like https://openshift.io/_profile/_tenant
  • click Clear Values
  • check Auto-update your tenant
  • click Save and Update Tenant - and you should be back to the default versions

=== Development

==== Prerequisites

  • git
  • make
  • go (tested with go 1.10.2)

==== How to build

Get the project:

$ git clone https://github.com/fabric8-services/fabric8-tenant $GOPATH/src/github.com/fabric8-services/fabric8-tenant
$ cd $GOPATH/src/github.com/fabric8-services/fabric8-tenant

Build the project:

$ make

==== Run unit tests

Clean and generate objects (to have the latest version of the generated files in case of any changes since the last run):

$ make clean && make generate

Check any dependency changes:

$ make deps

Run tests (without code coverage):

$ make test-unit-no-coverage

==== Run integration tests

You can do the same clean, generate and fetch the dependencies as it is suggested for unit tests:

$ make clean && make generate && make deps

Start the DB:

$ make integration-test-env-prepare

Run all integration tests (without code coverage):

$ make test-migration && make test-integration-no-coverage && make test-remote-no-coverage

To stop DB:

$ make integration-test-env-tear-down

==== Run Minishift integration tests

Follow the instruction from <> to make sure you have DB running
Start https://github.com/minishift/minishift[Minishift] (if it is not running already):

$ minishift start

https://docs.okd.io/latest/minishift/using/addons.html#installing-addons[Install] and https://docs.okd.io/latest/minishift/using/addons.html#apply-addons[apply] the https://docs.okd.io/latest/minishift/using/addons.html#default-addons[admin-user] Minishift addon.
The reason is that we need to use a user (admin) with cluster-admin rights for creating/updating/deleting namespaces.

$ minishift addons apply admin-user

Run Minishift integration tests. Some of the tests may take a longer time to finish

$ make test-with-minishift

NOTE: These minishift integration tests create a new user for every run using a format tenant.minishift.test.$(date +'%H.%M.%S'). It is possible to use a specific already created one by setting a variable MINISHIFT_USER_NAME to the name of the intended user.
The test-cases then create,update and delete namespaces, but it can happen that the proper cleanup is not correctly performed at the end of each test.
To remove all namespaces starting with tenant-minishift-test-\* please use $ make clean-minishift-namespaces. To remove all users starting with tenant.minishift.test.* please use $ make clean-minishift-users. To remove both users and namespaces use $ make clean-minishift.

==== Run all tests

Expecting that the DB is running (see <>) you can trigger all tests by a command:

make test-all

==== Code formatting

To check if the code is properly formatted run:

$ make check-go-format

To format the code:

$ make format-go-code

主要指标

概览
名称与所有者fabric8-services/fabric8-tenant
主编程语言Go
编程语言Ruby (语言数: 6)
平台
许可证Apache License 2.0
所有者活动
创建于2017-03-15 17:22:51
推送于2020-05-19 16:10:12
最后一次提交2020-02-27 16:51:38
发布数0
用户参与
星数12
关注者数13
派生数29
提交数0.9k
已启用问题?
问题数77
打开的问题数13
拉请求数607
打开的拉请求数4
关闭的拉请求数98
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?