Skip to content

Commit

Permalink
Merge pull request #35 from Kuadrant/kuadrant-v0.2.1
Browse files Browse the repository at this point in the history
Kuadrantctl v0.1.0 release
  • Loading branch information
eguzki authored Jan 21, 2022
2 parents 21fb6c7 + 84c1e8b commit 98434dc
Show file tree
Hide file tree
Showing 13 changed files with 310 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ istio-manifest-update-test: generate-istio-manifests
[ -z "$$(git ls-files --other --exclude-standard --directory --no-empty-directory ./istiomanifests/autogenerated)" ]

# Generates kuadrant manifests.
KUADRANTVERSION=v0.2.0
KUADRANTVERSION=v0.2.1
KUADRANT_CONTROLLER_IMAGE=quay.io/3scale/kuadrant-controller:$(KUADRANTVERSION)
.PHONY: generate-kuadrant-manifests
generate-kuadrant-manifests:
Expand Down
34 changes: 34 additions & 0 deletions examples/apiproduct/dogs-cats/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Dogs and Cats API


## Install kuadrant

The install command will create a namespace called `kuadrant-system` and deploy kuadrant services in that namespace.

```bash
kuadrantctl install
```

## Deploy all

```bash
kubectl apply -f examples/dogs-cats
```


## Test

Run kubectl port-forward in a different shell:

```bash
❯ kubectl port-forward -n kuadrant-system service/kuadrant-gateway 9080:80
Forwarding from [::1]:9080 -> 8080
```

The service can now be accessed at `http://localhost:9080` via a browser or any other client, like curl.

```bash
❯ curl -H "Authorization: APIKEY JUSTFORDEMOSOBVIOUSLYqDQsqSPMHkRhriEOtcRx" -H "Host: api.animaltoys.127.0.0.1.nip.io" localhost:9080/cats/toys

❯ curl -H "Authorization: APIKEY JUSTFORDEMOSOBVIOUSLYqDQsqSPMHkRhriEOtcRx" -H "Host: api.animaltoys.127.0.0.1.nip.io" localhost:9080/dogs/toys
```
36 changes: 36 additions & 0 deletions examples/apiproduct/dogs-cats/apiproduct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
apiVersion: networking.kuadrant.io/v1beta1
kind: APIProduct
metadata:
name: animaltoys
spec:
hosts:
- api.animaltoys.127.0.0.1.nip.io
APIs:
- name: dogs
namespace: default
tag: production
prefix: /dogs
- name: cats
namespace: default
tag: production
prefix: /cats
securityScheme:
- name: MyAPIKey
apiKeyAuth:
location: authorization_header
name: APIKEY
credential_source:
labelSelectors:
authorino.kuadrant.io/managed-by: authorino
api: animaltoys
rateLimit:
global:
maxValue: 100
period: 30
perRemoteIP:
maxValue: 10
period: 30
authenticated:
maxValue: 5
period: 30
62 changes: 62 additions & 0 deletions examples/apiproduct/dogs-cats/cats.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cats
labels:
svc: cats
spec:
selector:
matchLabels:
svc: cats
template:
metadata:
labels:
svc: cats
spec:
containers:
- name: cats
image: quay.io/3scale/authorino-examples:talker-api
env:
- name: PORT
value: "3000"
ports:
- containerPort: 3000
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
name: cats-api
annotations:
discovery.kuadrant.io/scheme: "http"
discovery.kuadrant.io/api-name: "cats"
discovery.kuadrant.io/tag: "production"
discovery.kuadrant.io/port: "80"
discovery.kuadrant.io/oas-configmap: "cats-oas"
labels:
discovery.kuadrant.io/enabled: "true"
spec:
selector:
svc: cats
ports:
- port: 80
protocol: TCP
targetPort: 3000
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cats-oas
data:
openapi.yaml: |
openapi: "3.0.0"
info:
title: "toy API"
version: "1.0.0"
servers:
- url: http://toys/
paths:
/toys:
get:
operationId: "getToys"
46 changes: 46 additions & 0 deletions examples/apiproduct/dogs-cats/dogs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dogs
labels:
svc: dogs
spec:
selector:
matchLabels:
svc: dogs
template:
metadata:
labels:
svc: dogs
spec:
containers:
- name: dogs
image: quay.io/3scale/authorino-examples:talker-api
env:
- name: PORT
value: "3000"
ports:
- containerPort: 3000
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
name: dogs-api
annotations:
discovery.kuadrant.io/scheme: "http"
discovery.kuadrant.io/api-name: "dogs"
discovery.kuadrant.io/tag: "production"
discovery.kuadrant.io/port: "80"
discovery.kuadrant.io/matchpath: "/"
discovery.kuadrant.io/matchpath-type: Prefix
labels:
discovery.kuadrant.io/enabled: "true"
spec:
selector:
svc: dogs
ports:
- port: 80
protocol: TCP
targetPort: 3000
12 changes: 12 additions & 0 deletions examples/apiproduct/dogs-cats/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Secret
metadata:
name: user-secret-apikey
annotations:
secret.kuadrant.io/user-id: user-01
labels:
authorino.kuadrant.io/managed-by: authorino
api: animaltoys
stringData:
api_key: JUSTFORDEMOSOBVIOUSLYqDQsqSPMHkRhriEOtcRx
type: Opaque
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ go 1.16
require (
github.com/getkin/kin-openapi v0.76.0
github.com/google/uuid v1.3.0
github.com/kuadrant/authorino-operator v0.0.0-20220117102614-26a1140e3e92
github.com/kuadrant/kuadrant-controller v0.1.1
github.com/kuadrant/authorino-operator v0.1.0
github.com/kuadrant/kuadrant-controller v0.2.1
github.com/kuadrant/limitador-operator v0.2.0
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.13.0
github.com/onsi/gomega v1.15.0
github.com/spf13/cobra v1.2.1
istio.io/client-go v1.12.1
k8s.io/api v0.21.2
k8s.io/apiextensions-apiserver v0.21.2
k8s.io/apimachinery v0.21.2
k8s.io/client-go v0.21.2
sigs.k8s.io/controller-runtime v0.9.2
k8s.io/api v0.22.1
k8s.io/apiextensions-apiserver v0.22.1
k8s.io/apimachinery v0.22.1
k8s.io/client-go v0.22.1
sigs.k8s.io/controller-runtime v0.10.0
sigs.k8s.io/gateway-api v0.3.0
sigs.k8s.io/yaml v1.2.0
)
Loading

0 comments on commit 98434dc

Please sign in to comment.