Skip to content

Commit

Permalink
feat: upgrade CRD version to v1 (#693)
Browse files Browse the repository at this point in the history
  • Loading branch information
tao12345666333 authored Sep 28, 2021
1 parent 957c315 commit 0630ac5
Show file tree
Hide file tree
Showing 16 changed files with 1,605 additions and 1,098 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ unit-test:
### e2e-test: Run e2e test cases (kind is required)
.PHONY: e2e-test
e2e-test: ginkgo-check push-images-to-kind
kubectl apply -k $(PWD)/samples/deploy/crd/v1beta1
kubectl apply -k $(PWD)/samples/deploy/crd/v1
cd test/e2e && ginkgo -cover -coverprofile=coverage.txt -r --randomizeSuites --randomizeAllSpecs --trace -p --nodes=$(E2E_CONCURRENCY)

.PHONY: ginkgo-check
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ This project is currently general availability.

## Prerequisites

Apisix ingress controller requires Kubernetes version 1.15+.
Apisix ingress controller requires Kubernetes version 1.16+. Because we used `CustomResourceDefinition` v1 stable API.
From the version 1.0.0, APISIX-ingress-controller need to work with Apache APISIX version 2.7+.

## Apache APISIX Ingress vs. Kubernetes Ingress Nginx
Expand Down
2 changes: 1 addition & 1 deletion docs/en/latest/practices/check-crd-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@ Status:
If can not see the Status information, please check the following points:

1. The version of Apache APISIX Ingress Controller needs to be >= 1.0.
2. Use the latest CRD definition file, refer to [here](https://github.com/apache/apisix-ingress-controller/tree/master/samples/deploy/crd/v1beta1).
2. Use the latest CRD definition file, refer to [here](https://github.com/apache/apisix-ingress-controller/tree/master/samples/deploy/crd/v1).
3. Use the latest RBAC configuration, refer to [here](https://github.com/apache/apisix-ingress-controller/tree/master/samples/deploy/rbac).
2 changes: 1 addition & 1 deletion docs/en/latest/practices/proxy-the-httpbin-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ kubectl expose pod httpbin --port 80

## Resource Delivery

In order to let Apache APISIX proxies requests to httpbin, we need to create an `ApisixRoute` resource, if you're not familiar with it, see the [reference](https://github.com/apache/apisix-ingress-controller/blob/master/samples/deploy/crd/v1beta1/ApisixRoute.yaml) for the details.
In order to let Apache APISIX proxies requests to httpbin, we need to create an `ApisixRoute` resource, if you're not familiar with it, see the [reference](https://github.com/apache/apisix-ingress-controller/blob/master/samples/deploy/crd/v1/ApisixRoute.yaml) for the details.

```yaml
# httpbin-route.yaml
Expand Down
65 changes: 3 additions & 62 deletions docs/en/latest/practices/the-hard-way.md
Original file line number Diff line number Diff line change
Expand Up @@ -601,70 +601,11 @@ subjects:

Then, we need to create ApisixRoute CRD:

```yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: apisixroutes.apisix.apache.org
spec:
group: apisix.apache.org
versions:
- name: v1
served: true
storage: false
- name: v2alpha1
served: true
storage: false
- name: v2beta1
served: true
storage: true
scope: Namespaced
names:
plural: apisixroutes
singular: apisixroute
kind: ApisixRoute
shortNames:
- ar
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: apisixtlses.apisix.apache.org
spec:
group: apisix.apache.org
versions:
- name: v1
served: true
storage: true
scope: Namespaced
names:
plural: apisixtlses
singular: apisixtls
kind: ApisixTls
shortNames:
- atls
---
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
```bash
kubectl apply -k samples/deploy/crd/v1
```

This yaml doesn't contain all the CRDs for APISIX Ingress Controller. Please refer to [samples](http://github.com/apache/apisix-ingress-controller/blob/master/samples/deploy/crd) for details.
Please refer to [samples](http://github.com/apache/apisix-ingress-controller/blob/master/samples/deploy/crd) for details.

To make the ingress controller works properly with APISIX, we need to create a config file containing the APISIX admin API URL and API key as below:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@
# limitations under the License.
#

apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: apisixclusterconfigs.apisix.apache.org
spec:
group: apisix.apache.org
versions:
- name: v2alpha1
served: true
storage: true
scope: Cluster
names:
plural: apisixclusterconfigs
Expand All @@ -33,39 +29,43 @@ spec:
shortNames:
- acc
preserveUnknownFields: false
subresources:
status: {}
validation:
openAPIV3Schema:
type: object
properties:
spec:
versions:
- name: v2alpha1
served: true
storage: true
subresources:
status: {}
schema:
openAPIV3Schema:
type: object
properties:
admin:
type: object
required:
- baseURL
properties:
baseURL:
type: string
pattern: "https?://[^:]+:(\\d+)"
adminKey:
type: string
monitoring:
spec:
type: object
properties:
prometheus:
admin:
type: object
required:
- baseURL
properties:
enable:
type: boolean
skywalking:
baseURL:
type: string
pattern: "https?://[^:]+:(\\d+)"
adminKey:
type: string
monitoring:
type: object
properties:
enable:
type: boolean
sampleRatio:
type: number
minimum: 0.00001
maximum: 1
prometheus:
type: object
properties:
enable:
type: boolean
skywalking:
type: object
properties:
enable:
type: boolean
sampleRatio:
type: number
minimum: 0.00001
maximum: 1
100 changes: 100 additions & 0 deletions samples/deploy/crd/v1/ApisixConsumer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: apisixconsumers.apisix.apache.org
spec:
group: apisix.apache.org
scope: Namespaced
names:
plural: apisixconsumers
singular: apisixconsumer
kind: ApisixConsumer
shortNames:
- ac
preserveUnknownFields: false
versions:
- name: v2alpha1
served: true
storage: true
subresources:
status: {}
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
required:
- authParameter
properties:
authParameter:
type: object
oneOf:
- required: ["basicAuth"]
- required: ["keyAuth"]
properties:
basicAuth:
type: object
oneOf:
- required: ["value"]
- required: ["secretRef"]
properties:
value:
type: object
properties:
username:
type: string
minLength: 1
password:
type: string
minLength: 1
required:
- username
- password
secretRef:
type: object
properties:
name:
type: string
minLength: 1
required:
- name
keyAuth:
type: object
oneOf:
- required: ["value"]
- required: ["secretRef"]
properties:
value:
type: object
properties:
key:
type: string
minLength: 1
required:
- key
secretRef:
type: object
properties:
name:
type: string
minLength: 1
required:
- name
Loading

0 comments on commit 0630ac5

Please sign in to comment.