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

chore: istio README updated used kyverno-envoy-plugin as ext-auth server #62

Merged
merged 6 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
369 changes: 189 additions & 180 deletions demo/istio/README.md

Large diffs are not rendered by default.

Binary file added demo/istio/architecture-istio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed demo/istio/architecture1.png
Binary file not shown.
Binary file removed demo/istio/architecture2.png
Binary file not shown.
16 changes: 16 additions & 0 deletions demo/istio/manifests/authorizationpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: security.istio.io/v1
kind: AuthorizationPolicy
metadata:
name: kyverno-ext-authz-grpc
namespace: demo
spec:
action: CUSTOM
provider:
# The provider name must match the extension provider defined in the mesh config.
name: kyverno-ext-authz-grpc
rules:
# The rules specify when to trigger the external authorizer.
- to:
- operation:
notPaths: ["/healthz"]
# Allowed all path except /healthz
40 changes: 0 additions & 40 deletions demo/istio/manifests/ext-authz.yaml

This file was deleted.

6 changes: 6 additions & 0 deletions demo/istio/manifests/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: demo
labels:
istio-injection: enabled
47 changes: 47 additions & 0 deletions demo/istio/manifests/policy-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: policy-files
namespace: demo
data:
policy.yaml: |
apiVersion: json.kyverno.io/v1alpha1
kind: ValidatingPolicy
metadata:
name: checkrequest
spec:
rules:
- name: deny-guest-request-at-post
assert:
any:
- message: "POST method calls at path /book are not allowed to guests users"
check:
request:
http:
method: POST
headers:
authorization:
(split(@, ' ')[1]):
(jwt_decode(@ , 'secret').payload.role): admin
path: /book
- message: "GET method call is allowed to both guest and admin users"
check:
request:
http:
method: GET
headers:
authorization:
(split(@, ' ')[1]):
(jwt_decode(@ , 'secret').payload.role): admin
path: /book
- message: "GET method call is allowed to both guest and admin users"
check:
request:
http:
method: GET
headers:
authorization:
(split(@, ' ')[1]):
(jwt_decode(@ , 'secret').payload.role): guest
path: /book

17 changes: 17 additions & 0 deletions demo/istio/manifests/service-entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ServiceEntry to register the Kyverno-Envoy sidecars as external authorizers.
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: kyverno-ext-authz-grpc-local
spec:
hosts:
- "kyverno-ext-authz-grpc.local"
# The service name to be used in the extension provider in the mesh config.
endpoints:
- address: "127.0.0.1"
ports:
- name: grpc
number: 9000
# The port number to be used in the extension provider in the mesh config.
protocol: GRPC
resolution: STATIC
Original file line number Diff line number Diff line change
@@ -1,40 +1,34 @@
apiVersion: v1
kind: Namespace
metadata:
name: demo
labels:
istio-injection: enabled
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: echo
name: testapp
namespace: demo
spec:
replicas: 1
selector:
matchLabels:
app: echo
app: testapp
template:
metadata:
labels:
app: echo
kyverno-envoy-sidecar/injection: enabled
app: testapp
spec:
containers:
- name: echo
image: mendhak/http-https-echo
- name: testapp
image: sanskardevops/test-application:0.0.1
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: echo
name: testapp
namespace: demo
spec:
type: ClusterIP
type: ClusterIP
selector:
app: echo
app: testapp
ports:
- port: 8080
targetPort: 8080