Skip to content

Commit

Permalink
chore: support to use kustomize install all resources (#72)
Browse files Browse the repository at this point in the history
* chore: support to use kustomize install all resources

* doc: fixed kubectl kustomize link

* doc: removed deploy.md

* fix: add shell in code snippet
  • Loading branch information
tokers authored Dec 10, 2020
1 parent 4ffef79 commit 14a399a
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 272 deletions.
120 changes: 0 additions & 120 deletions docs/deploy.md

This file was deleted.

61 changes: 2 additions & 59 deletions docs/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
97 changes: 5 additions & 92 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions samples/deploy/configmap/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- ./apisix.yaml
17 changes: 17 additions & 0 deletions samples/deploy/crd/v1beta1/ApisixRoute.yaml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions samples/deploy/crd/v1beta1/ApisixService.yaml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions samples/deploy/crd/v1beta1/ApisixUpstream.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions samples/deploy/crd/v1beta1/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resources:
- ./ApisixRoute.yaml
- ./ApisixUpstream.yaml
- ./ApisixService.yaml
2 changes: 2 additions & 0 deletions samples/deploy/deployment/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- ./ingress-controller.yaml
10 changes: 10 additions & 0 deletions samples/deploy/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion samples/deploy/rbac/apisix_view_clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ roleRef:
subjects:
- kind: ServiceAccount
name: apisix-view-serviceaccount

4 changes: 4 additions & 0 deletions samples/deploy/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resources:
- ./apisix_view_clusterrole.yaml
- ./service_account.yaml
- ./apisix_view_clusterrolebinding.yaml

0 comments on commit 14a399a

Please sign in to comment.