Skip to content

Commit

Permalink
Merge pull request #26 from bfenetworks/develop
Browse files Browse the repository at this point in the history
version v0.2.1
  • Loading branch information
daimg authored Oct 27, 2021
2 parents 1bc0ca1 + 4667fa8 commit 68c9bac
Show file tree
Hide file tree
Showing 34 changed files with 1,153 additions and 94 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "ci"
ci:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repository
uses: actions/checkout@v2
with:
# Must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head of the pull request.
# Only include this option if you are running this workflow on pull requests.
fetch-depth: 2

# If this run was triggered by a pull request event then checkout
# the head of the pull request instead of the merge commit.
# Only include this step if you are running this workflow on pull requests.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Build
- name: Build
shell: bash
run: |
make
47 changes: 47 additions & 0 deletions README-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# BFE Ingress Controller

中文 | [English](README.md)

## 简介

BFE Ingress Controller 为基于 [BFE][] 实现的[Kubernetes Ingress Controller][],用于支持在 Kubernetes 中使用 [Ingress][]

## 开始使用
详见[部署指南](docs/zh_cn/deployment.md)

## 说明文档
详见[文档列表](docs/zh_cn/SUMMARY.md)

## 参与贡献
- 请首先在 [issue 列表](https://github.com/bfenetworks/ingress-bfe/issues) 中创建一个 issue
- 如有必要,请联系项目维护者/负责人进行进一步讨论
- 请遵循 [Golang 编程规范](https://github.com/golang/go/wiki/Style)

## 社区交流

- [用户论坛](https://github.com/bfenetworks/ingress-bfe/discussions)

- **开源BFE微信公众号**:扫码关注公众号“BFE开源项目”,及时获取项目最新信息和技术分享

<table>
<tr>
<td><img src="./docs/images/qrcode_for_gh.jpg" width="100"></td>
</tr>
</table>

- **开源BFE用户微信群**:扫码加入,探讨和分享对BFE的建议、使用心得、疑问等

<table>
<tr>
<td><img src="https://bfeopensource.bj.bcebos.com/wechatQRCode.png" width="100"></td>
</tr>
</table>

- **开源BFE开发者微信群**: [发送邮件](mailto:[email protected])说明您的微信号及贡献(例如PR/Issue),我们将及时邀请您加入

## 许可
基于 Apache 2.0 许可证,详见 [LICENSE](https://github.com/bfenetworks/ingress-bfe/blob/master/LICENSE) 文件说明

[Kubernetes Ingress Controller]: https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/ "Kubernetes"
[Ingress]: https://kubernetes.io/docs/concepts/services-networking/ingress/ "Kubernetes"
[BFE]: https://github.com/bfenetworks/bfe "Github"
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
# BFE Ingress Controller

BFE Ingress Controller 为基于 [BFE][] 实现的[Kubernetes Ingress Controller][],用于支持在 Kubernetes 中使用 [Ingress][]
English | [中文](README-CN.md)

## 开始使用
详见[部署指南](docs/zh_cn/deployment.md)
## Overview

## 说明文档
详见[文档列表](docs/zh_cn/SUMMARY.md)
BFE Ingress Controller is an implementation of Kubernetes [Ingress Controller][] based on [BFE][] , to fulfill [Ingress][] in Kubernetes。

## 参与贡献
- 请首先在 issue 列表中创建一个 issue
- 如有必要,请联系项目维护者/负责人进行进一步讨论
- 请遵循 Golang 编程规范
## Quick start
See [Deployment](docs/en_us/deployment.md) for quick start of using BFE Ingress Controller

## 许可
基于 Apache 2.0 许可证,详见 [LICENSE](https://github.com/bfenetworks/ingress-bfe/blob/master/LICENSE) 文件说明
## Documentation
See [Document Summary](docs/en_us/SUMMARY.md)

[Kubernetes Ingress Controller]: https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/ "Kubernetes"
## Contribute
- Create and issue in [Issue List](https://github.com/bfenetworks/ingress-bfe/issues)
- If necessary, contact and discuss with maintainer
- Follow the [Golang style guide](https://github.com/golang/go/wiki/Style)

## Communication

- [Forum](https://github.com/bfenetworks/ingress-bfe/discussions)
- BFE community on Slack: [Sign up](https://slack.cncf.io/) CNCF Slack and join bfe channel.
- BFE developer group on WeChat: [Send a request mail](mailto:[email protected]) with your WeChat ID and a contribution you've made to BFE(such as a PR/Issue). We will invite you right away.

## License

BFE is under the Apache 2.0 license. See the [LICENSE](https://github.com/bfenetworks/ingress-bfe/blob/master/LICENSE) file for details

[Ingress Controller]: https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/ "Kubernetes"
[Ingress]: https://kubernetes.io/docs/concepts/services-networking/ingress/ "Kubernetes"
[BFE]: https://github.com/bfenetworks/bfe "Github"
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0
0.2.1
2 changes: 2 additions & 0 deletions cmd/ingress-controller/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var (
namespaces string
ingressClass string
configPath string
reloadAddr string
metricsAddr string
probeAddr string
defaultBackend string
Expand All @@ -46,6 +47,7 @@ func initFlags() {
flag.StringVar(&configPath, "bfe-config-path", option.ConfigPath, "Root directory of bfe configuration files.")
flag.StringVar(&configPath, "c", option.ConfigPath, "Root directory of bfe configuration files.")

flag.StringVar(&reloadAddr, "bfe-reload-address", option.ReloadAddr, "Address of bfe config reloading.")
flag.StringVar(&ingressClass, "ingress-class", option.IngressClassName, "Class name of bfe ingress controller.")
flag.StringVar(&metricsAddr, "metrics-bind-address", option.MetricsBindAddress, "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", option.HealthProbeBindAddress, "The address the probe endpoint binds to.")
Expand Down
2 changes: 1 addition & 1 deletion cmd/ingress-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func main() {
}

err := option.SetOptions(
namespaces, ingressClass, configPath,
namespaces, ingressClass, configPath, reloadAddr,
metricsAddr, probeAddr, defaultBackend)
if err != nil {
setupLog.Error(err, "fail to start controllers")
Expand Down
22 changes: 22 additions & 0 deletions docs/en_us/FAQ/FAQ.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# FAQ
1. Question:what arguments can be used to run BFE Ingress Controller, and how to define them?

Answer: Arguments supported by BFE Ingress Controller:

|Argument | Default value | Description|
| --- | --- | --- |
| --namespace <br> -n | Null | Specify in which namespaces BFE Ingress Controller will monitor Ingress. Multiple namespaces are seperated by `,`. <br>Default value means to monitor all namespaces. |
| --ingress-class| bfe | Specify the `kubernetes.io/ingress.class` value of Ingress it monitors. <br>If not specified, BFE Ingress Controller monitors the Ingress with ingress class set as "bfe". Usually you don't need to specify it. |
| --default-backend| Null | Specify name of default backend service, in the format of `namespace/name`.<br>If specified, requests that match no Ingress rule will be forwarded to the service specified. |

How to define:
Define in config file of BFE Ingress Controller, like [controller.yaml](../../../examples/controller.yaml). Example:

```yaml
...
containers:
- name: bfe-ingress-controller
image: bfenetworks/bfe-ingress-controller:latest
args: ["-n", "ns1,ns2", "--default-backend", "test/whoami"]
...
```
10 changes: 10 additions & 0 deletions docs/en_us/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# BFE Ingress Controller

BFE Ingress Controller is a Kubernetes [Ingress Controller][] based on [BFE][], to fullfill the [Ingress][] in Kubernetes.

[Documents](SUMMARY.md)

[Ingress Controller]: https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/ "Kubernetes"
[Ingress]: https://kubernetes.io/docs/concepts/services-networking/ingress/ "Kubernetes"
[BFE]: https://github.com/bfenetworks/bfe "Github"

25 changes: 25 additions & 0 deletions docs/en_us/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Summary

[comment]: <> "For user"
* Deployment
* [Deployment Guide](deployment.md)
* [Role-Based Access Control (RBAC)](rbac.md)
* Configuration
* [Configuration Guide](ingress/basic.md)
* [Ingress Status](ingress/validate-state.md)
* [Priority of Route Rules](ingress/priority.md)
* [Principles of Handling Route Rule Conflicts](ingress/conflict.md)
* [TLS Configuration](ingress/tls.md)
* [Load Balance](ingress/load-balance.md)
* Configuration Examples
* [Config File Example](example/example.md)
* [Canary Release Example](example/canary-release.md)
* [FAQ](FAQ/FAQ.md)
---

[comment]: <> "For developer"
* [How to contribute](contribute/how-to-contribute.md)
* [Contribute codes](contribute/contribute-codes.md)
* [Contribute documents](contribute/contribute-documents.md)
* [Release Regulation](https://www.bfe-networks.net/en_us/development/release_regulation/)

108 changes: 108 additions & 0 deletions docs/en_us/contribute/contribute-codes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Contribute Code
This document explains how to contribute code

## Coding Standard
- For code and comment, follow the [Golang style guide](https://github.com/golang/go/wiki/Style).
- Provide unit test for all code
- Pass all unit test
- Follow our [regulations of submmiting codes](https://www.bfe-networks.net/en_us/development/submit_pr_guide/)

## Code Develop
Below tutorial will guide you to submit code

1. [Fork](https://help.github.com/articles/fork-a-repo/)

Go to [BFE Ingress Github][], click `Fork` button and generate a repository in your own github space.

> `https://github.com/${USERNAME}/ingress-bfe`
1. Clone

Clone the repository in your own space to your local :
```bash
$ git clone https://github.com/${USERNAME}/ingress-bfe
$ cd ingress-bfe
```

1. Create local branch

We currently use [Git Branching Model][] to develop, test, release and maintenance, refer to [Release Regulation][]。
* all development for feature and bug fix should be performed in a new branch
* create new branch from branch `develop` in most case

Use `git checkout -b` to create and switch to a new branch.
```bash
$ git checkout -b my-cool-stuff
```

> Before checkout, verify by `git status` command and keep current branch clean, otherwise untracked files will be bring to the new branch.

1. Use pre-commit hook

We use [pre-commit][] tool to manage Git pre-commit hook.


1. run following command:
```bash
$ pip install pre-commit
$ pre-commit install
```
1. use `gofmt` to adjust golang source code format.

1. Coding

1. Build and test

Compile BFE Ingress Controller docker from source code and test, see more instruction in [Deploy Guide](../deployment.md)

1. Commit

run `git commit` .

Provides commit message for each commit, to let other people know what is changed in this commit.`git commit` .

<b> <font color="red">Notice:commit message is also required to trigger CI unit test,format as below:</font> </b>

```bash
# trigger CI unit test in develop branch
$ git commit -m "test=develop"
# trigger CI unit test in release/1.1 branch
$ git commit -m "test=release/1.1"
```

1. Keep local repository up-to-date

1. An experienced Git user pulls from the official repo often -- daily or even hourly, so they notice conflicts with others work early, and it's easier to resolve smaller conflicts.
```bash
git remote add upstream https://github.com/bfenetworks/bfe
git pull upstream develop
```
10. Push to remote repository
Push local to your repository on GitHub `https://github.com/${USERNAME}/ingress-bfe`
```bash
# Example: push to remote repository `origin` branch `my-cool-stuff`
$ git push origin my-cool-stuff
```
> Refer to BFE [Local Develop Guide](https://www.bfe-networks.net/en_us/development/local_dev_guide/)
## Pull Request
1. Create an Issue and initiate Pull Request
1. Pass unit test
1. Delete the branch used at your own repository
1. Delete the branch used at your local repository
> Refer to BFE [Submit PR Guide][submit PR guide]
[BFE Ingress Github]: https://github.com/bfenetworks/ingress-bfe
[Git Branching Model]: http://nvie.com/posts/a-successful-git-branching-model/
[Release Regulation]: https://github.com/bfenetworks/bfe/blob/develop/docs/en_us/development/release_regulation.md
[pre-commit]: http://pre-commit.com/
[git remote]: https://git-scm.com/docs/git-remote
[submit PR guide]: https://www.bfe-networks.net/en_us/development/submit_pr_guide/
17 changes: 17 additions & 0 deletions docs/en_us/contribute/contribute-documents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Contribute Document

## Requirement
- All documents should be written in [Markdown][markdown] (GitHub style),using filename with suffix `.md`
- If new document will be add, add the link to the new document in the index file([SUMMARY.md](../SUMMARY.md)
## Process

1. Write or edit document
1. Use preview tools to preview and modify if neccesary
- [How to use preview tool](https://www.bfe-networks.net/en_us/development/write_doc_guide/#_2)
1. Submit
- Commit and initiate a Pull Request, refer to [Contribute Code](contribute-codes.md)

> Also you can refer to [Contribute Documentation](https://www.bfe-networks.net/en_us/development/write_doc_guide/) of BFE
[markdown]: https://guides.github.com/features/mastering-markdown/

5 changes: 5 additions & 0 deletions docs/en_us/contribute/how-to-contribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Contribute
- [Contribute Code](contribute-codes.md)
- [Contribute Document](contribute-documents.md)
- [Release Regulation](https://www.bfe-networks.net/en_us/development/release_regulation/)

41 changes: 41 additions & 0 deletions docs/en_us/deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Deployment Guide

## Install

* To deploy BFE Ingress Controller and configure related access control:

``` shell script
kubectl apply -f controller.yaml
```
- Config file example: [controller.yaml](../../examples/controller.yaml)
- This config file uses [BFE Ingress Controller latest image on Docker Hub](https://hub.docker.com/r/bfenetworks/bfe-ingress-controller). If you want to use your customized version of the image, edit the config file to specify it.
- Or you can run `make docker` in root folder of this project to create your own local image and use it.

* To config role-based access control:
``` shell script
kubectl apply -f rbac.yaml
```

- Config file example: [rbac.yaml](../../examples/rbac.yaml)
- See detailed instructions in [Role-Based Access Control](rbac.md)

## Test

* Create a test service

``` shell script
kubectl apply -f whoami.yaml
```


test service config file example:[whoami](../../examples/whoami.yaml)

* Create ingress resource,configure route for the test service and verify

``` shell script
kubectl apply -f ingress.yaml
```

- Refer to [ingress.yaml](../../examples/ingress.yaml) for basic Ingress configuration.

- Refer to [Summary](SUMMARY.md) for more Ingress configuration options that BFE Ingress Controller support.
Loading

0 comments on commit 68c9bac

Please sign in to comment.