You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by to...@apache.org on 2020/12/10 01:26:19 UTC
[apisix-ingress-controller] branch master updated: chore: support
to use kustomize install all resources (#72)
This is an automated email from the ASF dual-hosted git repository.
tokers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git
The following commit(s) were added to refs/heads/master by this push:
new 14a399a chore: support to use kustomize install all resources (#72)
14a399a is described below
commit 14a399afb5acd46cc15ccf5db1c4e7989af10a26
Author: Alex Zhang <zc...@gmail.com>
AuthorDate: Thu Dec 10 09:26:12 2020 +0800
chore: support to use kustomize install all resources (#72)
* chore: support to use kustomize install all resources
* doc: fixed kubectl kustomize link
* doc: removed deploy.md
* fix: add shell in code snippet
---
docs/deploy.md | 120 ---------------------
docs/develop.md | 61 +----------
docs/install.md | 97 +----------------
.../deploy/configmap/{cloud.yaml => apisix.yaml} | 0
samples/deploy/configmap/kustomization.yaml | 2 +
samples/deploy/crd/v1beta1/ApisixRoute.yaml | 17 +++
samples/deploy/crd/v1beta1/ApisixService.yaml | 17 +++
samples/deploy/crd/v1beta1/ApisixUpstream.yaml | 17 +++
samples/deploy/crd/v1beta1/kustomization.yaml | 4 +
samples/deploy/deployment/kustomization.yaml | 2 +
samples/deploy/kustomization.yaml | 10 ++
.../rbac/apisix_view_clusterrolebinding.yaml | 1 -
samples/deploy/rbac/kustomization.yaml | 4 +
13 files changed, 80 insertions(+), 272 deletions(-)
diff --git a/docs/deploy.md b/docs/deploy.md
deleted file mode 100644
index 5ba74fc..0000000
--- a/docs/deploy.md
+++ /dev/null
@@ -1,120 +0,0 @@
-# 集群部署
-
-## 配置RBAC
-示例文件在项目下的samples下
-* 执行下面的命令之前按需修改一下name和namespaces
-### 1.创建ServiceAccount
-
-```shell
-kubectl apply -f samples/deploy/rbac/service_account.yaml
-```
-
-### 2.创建ClusterRole
-```shell
-kubectl apply -f samples/deploy/rbac/apisix_view_clusterrole.yaml
-```
-
-### 3.创建ClusterRoleBinding
-```shell
-kubectl apply -f samples/deploy/rbac/apisix_view_clusterrolebinding.yaml
-```
-
-## 配置 ConfigMap
-* 执行命令之前按需修改
-
-```shell
-kubectl apply -f samples/deploy/configmap/cloud.yaml
-```
-
-## 配置 Deployment
-* 执行命令之前按需修改name和namespaces,并且补充APISIX ingress controller image路径和版本号
-
-
-```shell
-kubectl apply -f samples/deploy/deployment/ingress-controller.yaml
-```
-
-## CRD定义文件
-
-如果APISIX CRD还未定义,执行以下脚本
-```
-kubectl apply -f - <<EOF
-apiVersion: apiextensions.k8s.io/v1beta1
-kind: CustomResourceDefinition
-metadata:
- name: apisixroutes.apisix.apache.org
-spec:
- group: apisix.apache.org
- versions:
- - name: v1
- served: true
- storage: true
- scope: Namespaced
- names:
- plural: apisixroutes
- singular: apisixroute
- kind: ApisixRoute
- shortNames:
- - ar
-
----
-apiVersion: apiextensions.k8s.io/v1beta1
-kind: CustomResourceDefinition
-metadata:
- name: apisixservices.apisix.apache.org
-spec:
- group: apisix.apache.org
- versions:
- - name: v1
- served: true
- storage: true
- scope: Namespaced
- names:
- plural: apisixservices
- singular: apisixservice
- kind: ApisixService
- shortNames:
- - as
-
----
-apiVersion: apiextensions.k8s.io/v1beta1
-kind: CustomResourceDefinition
-metadata:
- name: apisixupstreams.apisix.apache.org
-spec:
- group: apisix.apache.org
- versions:
- - name: v1
- served: true
- storage: true
- scope: Namespaced
- names:
- plural: apisixupstreams
- singular: apisixupstream
- kind: ApisixUpstream
- shortNames:
- - au
-
-EOF
-```
-
-## 通过CRD定义apisix路由的描述文件
-
-尝试通过ApisixRoute定义一个路由
-```
-kubectl apply -f - <<EOF
-apiVersion: apisix.apache.org/v1
-kind: ApisixRoute
-metadata:
- name: httpserver-route
-spec:
- rules:
- - host: test.apisix.apache.org
- http:
- paths:
- - backend:
- serviceName: httpserver
- servicePort: 8080
- path: /hello*
-EOF
-```
diff --git a/docs/develop.md b/docs/develop.md
index d18351a..ef46ff2 100644
--- a/docs/develop.md
+++ b/docs/develop.md
@@ -36,65 +36,8 @@ Configure the service address of Apache APISIX to conf/apisix/base_url ($GOPATH/
* Create CRDs
-```yaml
-kubectl apply -f - <<EOF
-apiVersion: apiextensions.k8s.io/v1beta1
-kind: CustomResourceDefinition
-metadata:
- name: apisixroutes.apisix.apache.org
-spec:
- group: apisix.apache.org
- versions:
- - name: v1
- served: true
- storage: true
- scope: Namespaced
- names:
- plural: apisixroutes
- singular: apisixroute
- kind: ApisixRoute
- shortNames:
- - ar
-
----
-apiVersion: apiextensions.k8s.io/v1beta1
-kind: CustomResourceDefinition
-metadata:
- name: apisixservices.apisix.apache.org
-spec:
- group: apisix.apache.org
- versions:
- - name: v1
- served: true
- storage: true
- scope: Namespaced
- names:
- plural: apisixservices
- singular: apisixservice
- kind: ApisixService
- shortNames:
- - as
-
----
-apiVersion: apiextensions.k8s.io/v1beta1
-kind: CustomResourceDefinition
-metadata:
- name: apisixupstreams.apisix.apache.org
-spec:
- group: apisix.apache.org
- versions:
- - name: v1
- served: true
- storage: true
- scope: Namespaced
- names:
- plural: apisixupstreams
- singular: apisixupstream
- kind: ApisixUpstream
- shortNames:
- - au
-
-EOF
+```shell
+kubectl apply -k samples/deploy/crd/v1beta1
```
* Run apisix-ingress-controller
diff --git a/docs/install.md b/docs/install.md
index f9f7ba0..0395479 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -13,105 +13,18 @@ To install `ingress controller` in k8s, need to care about 3 parts:
3. Configmap: Contains the necessary configuration for `ingress controller`.
-## CRDs installation
+## Kustomize
-Install CRDs in Kubernetes
+Install the abovementioned resources by [Kustomize](https://kustomize.io/):
```shell
-kubectl apply -f - <<EOF
-apiVersion: apiextensions.k8s.io/v1beta1
-kind: CustomResourceDefinition
-metadata:
- name: apisixroutes.apisix.apache.org
-spec:
- group: apisix.apache.org
- versions:
- - name: v1
- served: true
- storage: true
- scope: Namespaced
- names:
- plural: apisixroutes
- singular: apisixroute
- kind: ApisixRoute
- shortNames:
- - ar
-
----
-apiVersion: apiextensions.k8s.io/v1beta1
-kind: CustomResourceDefinition
-metadata:
- name: apisixservices.apisix.apache.org
-spec:
- group: apisix.apache.org
- versions:
- - name: v1
- served: true
- storage: true
- scope: Namespaced
- names:
- plural: apisixservices
- singular: apisixservice
- kind: ApisixService
- shortNames:
- - as
-
----
-apiVersion: apiextensions.k8s.io/v1beta1
-kind: CustomResourceDefinition
-metadata:
- name: apisixupstreams.apisix.apache.org
-spec:
- group: apisix.apache.org
- versions:
- - name: v1
- served: true
- storage: true
- scope: Namespaced
- names:
- plural: apisixupstreams
- singular: apisixupstream
- kind: ApisixUpstream
- shortNames:
- - au
-
-EOF
+kubectl kustomize "github.com/apache/apisix-ingress-controller/samples/deploy?ref=master" | kubectl apply -f -
```
-## RBAC configuration
-
-* Create ServiceAccount
-
-```shell
-kubectl apply -f ../samples/deploy/rbac/service_account.yaml
-```
-
-* Create ClusterRole
-
-```shell
-kubectl apply -f ../samples/deploy/rbac/apisix_view_clusterrole.yaml
-```
-
-* Create ClusterRoleBinding
-
-```shell
-kubectl apply -f ../samples/deploy/rbac/apisix_view_clusterrolebinding.yaml
-```
-
-## Configmap for ingress controller
-
-Pay attention to the `namespace` and `APISIX address` in configmap.
-
-```shell
-kubectl apply -f ../samples/deploy/configmap/cloud.yaml
-```
-
-## Deploy ingress controller
-
-[How to build image from master branch?](#Master-branch-builds)
+If the default parameters in samples/deploy are not good for you, just tweak them and run:
```shell
-kubectl apply -f ../samples/deploy/deployment/ingress-controller.yaml
+kubectl apply -k /path/to/apisix-ingress-controller/samples/deploy
```
## Helm
diff --git a/samples/deploy/configmap/cloud.yaml b/samples/deploy/configmap/apisix.yaml
similarity index 100%
rename from samples/deploy/configmap/cloud.yaml
rename to samples/deploy/configmap/apisix.yaml
diff --git a/samples/deploy/configmap/kustomization.yaml b/samples/deploy/configmap/kustomization.yaml
new file mode 100644
index 0000000..99eb537
--- /dev/null
+++ b/samples/deploy/configmap/kustomization.yaml
@@ -0,0 +1,2 @@
+resources:
+ - ./apisix.yaml
diff --git a/samples/deploy/crd/v1beta1/ApisixRoute.yaml b/samples/deploy/crd/v1beta1/ApisixRoute.yaml
new file mode 100644
index 0000000..4c8911f
--- /dev/null
+++ b/samples/deploy/crd/v1beta1/ApisixRoute.yaml
@@ -0,0 +1,17 @@
+apiVersion: apiextensions.k8s.io/v1beta1
+kind: CustomResourceDefinition
+metadata:
+ name: apisixroutes.apisix.apache.org
+spec:
+ group: apisix.apache.org
+ versions:
+ - name: v1
+ served: true
+ storage: true
+ scope: Namespaced
+ names:
+ plural: apisixroutes
+ singular: apisixroute
+ kind: ApisixRoute
+ shortNames:
+ - ar
diff --git a/samples/deploy/crd/v1beta1/ApisixService.yaml b/samples/deploy/crd/v1beta1/ApisixService.yaml
new file mode 100644
index 0000000..a9ade49
--- /dev/null
+++ b/samples/deploy/crd/v1beta1/ApisixService.yaml
@@ -0,0 +1,17 @@
+apiVersion: apiextensions.k8s.io/v1beta1
+kind: CustomResourceDefinition
+metadata:
+ name: apisixservices.apisix.apache.org
+spec:
+ group: apisix.apache.org
+ versions:
+ - name: v1
+ served: true
+ storage: true
+ scope: Namespaced
+ names:
+ plural: apisixservices
+ singular: apisixservice
+ kind: ApisixService
+ shortNames:
+ - as
diff --git a/samples/deploy/crd/v1beta1/ApisixUpstream.yaml b/samples/deploy/crd/v1beta1/ApisixUpstream.yaml
new file mode 100644
index 0000000..8502552
--- /dev/null
+++ b/samples/deploy/crd/v1beta1/ApisixUpstream.yaml
@@ -0,0 +1,17 @@
+apiVersion: apiextensions.k8s.io/v1beta1
+kind: CustomResourceDefinition
+metadata:
+ name: apisixupstreams.apisix.apache.org
+spec:
+ group: apisix.apache.org
+ versions:
+ - name: v1
+ served: true
+ storage: true
+ scope: Namespaced
+ names:
+ plural: apisixupstreams
+ singular: apisixupstream
+ kind: ApisixUpstream
+ shortNames:
+ - au
diff --git a/samples/deploy/crd/v1beta1/kustomization.yaml b/samples/deploy/crd/v1beta1/kustomization.yaml
new file mode 100644
index 0000000..20449eb
--- /dev/null
+++ b/samples/deploy/crd/v1beta1/kustomization.yaml
@@ -0,0 +1,4 @@
+resources:
+ - ./ApisixRoute.yaml
+ - ./ApisixUpstream.yaml
+ - ./ApisixService.yaml
diff --git a/samples/deploy/deployment/kustomization.yaml b/samples/deploy/deployment/kustomization.yaml
new file mode 100644
index 0000000..b3995fc
--- /dev/null
+++ b/samples/deploy/deployment/kustomization.yaml
@@ -0,0 +1,2 @@
+resources:
+ - ./ingress-controller.yaml
diff --git a/samples/deploy/kustomization.yaml b/samples/deploy/kustomization.yaml
new file mode 100644
index 0000000..5b1c275
--- /dev/null
+++ b/samples/deploy/kustomization.yaml
@@ -0,0 +1,10 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+namespace: ingress-apisix
+commonLabels:
+ apisix.apache.org/app: ingress-apisix
+bases:
+ - ./configmap
+ - ./deployment
+ - ./rbac
+ - ./crd/v1beta1
diff --git a/samples/deploy/rbac/apisix_view_clusterrolebinding.yaml b/samples/deploy/rbac/apisix_view_clusterrolebinding.yaml
index fb78d3a..07bb94e 100644
--- a/samples/deploy/rbac/apisix_view_clusterrolebinding.yaml
+++ b/samples/deploy/rbac/apisix_view_clusterrolebinding.yaml
@@ -9,4 +9,3 @@ roleRef:
subjects:
- kind: ServiceAccount
name: apisix-view-serviceaccount
-
\ No newline at end of file
diff --git a/samples/deploy/rbac/kustomization.yaml b/samples/deploy/rbac/kustomization.yaml
new file mode 100644
index 0000000..b434800
--- /dev/null
+++ b/samples/deploy/rbac/kustomization.yaml
@@ -0,0 +1,4 @@
+resources:
+ - ./apisix_view_clusterrole.yaml
+ - ./service_account.yaml
+ - ./apisix_view_clusterrolebinding.yaml