Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kuadrantctl v0.1.0 release #35

Merged
merged 7 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
secret.kuadrant.io/managed-by: authorino
api: animaltoys
rateLimit:
global:
maxValue: 100
period: 30
perRemoteIP:
maxValue: 10
period: 30
authenticated:
maxValue: 5
period: 30
61 changes: 61 additions & 0 deletions examples/apiproduct/dogs-cats/cats.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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:echo-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"
45 changes: 45 additions & 0 deletions examples/apiproduct/dogs-cats/dogs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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:echo-api
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend instead using:

Suggested change
image: quay.io/3scale/authorino:echo-api
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:
secret.kuadrant.io/managed-by: authorino
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authorino may cache this API key secret when it reconciles the AuthConfig because Kuadrant controller will set label selectors that match the ones here. This part is OK.

However, this is NOT enough for Authorino to watch changes related to this API key secret, independently from the reconciliation of the AuthConfig (e.g. key rotation, label update on the secret, deletion of the secret). To put such events within the scope of the Authorino secret reconciler, matching SecretLabelSelectors must as well be specified in the spec of the Authorino CR that is created by kuadrantctl.

If not specified, Authorino will default to watching only secret-related events of resources that include labels matching authorino.kuadrant.io/managed-by=authorino.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the tip. I will update to use the default value then.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added changes to 4707414

api: animaltoys
stringData:
api_key: JUSTFORDEMOSOBVIOUSLYqDQsqSPMHkRhriEOtcRx
type: Opaque
2 changes: 1 addition & 1 deletion istiomanifests/autogenerated/Base/Pilot/Pilot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ data:
extensionProviders:
- envoyExtAuthzGrpc:
port: 50051
service: authorino-authorization.kuadrant-system.svc.cluster.local
service: authorino-authorino-authorization.kuadrant-system.svc.cluster.local
name: kuadrant-authorization
rootNamespace: kuadrant-system
trustDomain: cluster.local
Expand Down
2 changes: 1 addition & 1 deletion istiomanifests/patches/istio-externalProvider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ spec:
extensionProviders:
- name: "kuadrant-authorization"
envoyExtAuthzGrpc:
service: "authorino-authorization.kuadrant-system.svc.cluster.local"
service: "authorino-authorino-authorization.kuadrant-system.svc.cluster.local"
port: 50051
components:
ingressGateways:
Expand Down
8 changes: 4 additions & 4 deletions kuadrantmanifests/autogenerated/kuadrant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
labels:
app: kuadrant
Expand Down Expand Up @@ -228,7 +228,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
labels:
app: kuadrant
Expand Down Expand Up @@ -388,7 +388,7 @@ metadata:
name: kuadrant-manager-role
rules:
- apiGroups:
- authorino.3scale.net
- authorino.kuadrant.io
resources:
- authconfigs
verbs:
Expand Down Expand Up @@ -642,7 +642,7 @@ spec:
- --config=controller_manager_config.yaml
command:
- /manager
image: quay.io/3scale/kuadrant-controller:v0.2.0
image: quay.io/3scale/kuadrant-controller:v0.2.1
livenessProbe:
httpGet:
path: /healthz
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ limitations under the License.
package version

var (
Version = "0.0.1"
Version = "0.1.0"
)