refator: refacoting, replace ssl by tls

This commit is contained in:
Jonas Kaninda
2024-11-29 13:48:00 +01:00
parent 076d9aa56d
commit e33af02f04
11 changed files with 233 additions and 80 deletions

View File

@@ -61,12 +61,12 @@ spec:
gatewayVersion: latest # 0.2.2
## Server config
server:
# # Kubernetes tls secret name
# tlsSecretName: tls-secret
# #Redis configs for distributed rate limiting across multiple instances
# redis:
# addr: redis:6379
# password: password
# Kubernetes tls secret name
tlsSecretName: '' #Optional, tls-secret
#Redis configs for distributed rate limiting across multiple instances
redis:
addr: '' #Optional, redis:6379
password: '' #Optional, password
writeTimeout: 10
readTimeout: 15
idleTimeout: 30
@@ -131,35 +131,33 @@ metadata:
name: route-sample
spec:
gateway: gateway-sample
routes:
- path: /
name: Example
hosts: []
rewrite: /
methods:
- GET
- POST
- PUT
destination: https://example.com
backends: []
insecureSkipVerify: false
healthCheck:
path: /
interval: 10s
timeout: 10s
healthyStatuses:
- 200
- 404
cors:
origins: []
headers: {}
rateLimit: 15
disableHostFording: true
interceptErrors: []
blockCommonExploits: false
## Middleware names
middlewares:
- basic-middleware-sample
path: /
hosts: []
rewrite: /
methods:
- GET
- POST
- PUT
destination: https://example.com
backends: []
insecureSkipVerify: false
healthCheck:
path: /
interval: 10s
timeout: 10s
healthyStatuses:
- 200
- 404
cors:
origins: []
headers: {}
rateLimit: 15
disableHostFording: true
interceptErrors: []
blockCommonExploits: false
## Middleware names
middlewares:
- basic-middleware-sample
```
## Uninstall

View File

@@ -37,4 +37,21 @@ Example of access middleware
cors: {}
middlewares:
- api-forbidden-paths
```
## Advanced Kubernetes deployment
```yaml
apiVersion: gomaproj.github.io/v1beta1
kind: Middleware
metadata:
name: access-middleware-sample
spec:
type: access
## prevents access paths
paths:
- /swagger-ui/*
- /v2/swagger-ui/*
- /api-docs/*
- /internal/*
- /actuator/*
```

View File

@@ -37,4 +37,20 @@ middlewares:
cors: {}
middlewares:
- basic-auth
```
## Advanced Kubernetes deployment
```yaml
apiVersion: gomaproj.github.io/v1beta1
kind: Middleware
metadata:
name: basic-middleware-sample
spec:
type: basic
paths:
- /admin/*
rule:
username: admin
password: admin
```

View File

@@ -5,9 +5,9 @@ parent: Middleware
nav_order: 5
---
### OAuth middleware
# OAuth middleware
Example of Google provider
### Example of Google provider
```yaml
- name: google-oauth
@@ -30,7 +30,7 @@ Example of Google provider
```
Example of Authentik provider
### Example of Authentik provider
```yaml
- name: oauth-authentik
@@ -59,32 +59,6 @@ Example of Authentik provider
jwtSecret: your-strong-jwt-secret | It's optional
```
### Access middleware
Access middleware prevents access to a route or specific route path.
Example of access middleware
```yaml
# The server will return 403
- name: api-forbidden-paths
type: access
## prevents access paths
paths:
- /swagger-ui/*
- /v2/swagger-ui/*
- /api-docs/*
- /internal/*
- /actuator/*
```
### RateLimit middleware
The RateLimit middleware ensures that services will receive a fair amount of requests, and allows one to define what fair is.
Example of rateLimit middleware
```yaml
```
### Apply middleware on the route
```yaml
@@ -99,4 +73,37 @@ Example of rateLimit middleware
cors: {}
middlewares:
- oauth-authentik
```
## Advanced Kubernetes deployment
```yaml
apiVersion: gomaproj.github.io/v1beta1
kind: Middleware
metadata:
name: oauth-middleware-sample
spec:
type: basic
paths:
- /protected
- /example-of-oauth
rule:
clientId: xxx
clientSecret: xxx
# oauth provider google, gitlab, github, amazon, facebook, custom
provider: custom
endpoint:
authUrl: https://authentik.example.com/application/o/authorize/
tokenUrl: https://authentik.example.com/application/o/token/
userInfoUrl: https://authentik.example.com/application/o/userinfo/
redirectUrl: https://example.com/callback
#RedirectPath is the PATH to redirect users after authentication, e.g: /my-protected-path/dashboard
redirectPath: ''
#CookiePath e.g.: /my-protected-path or / || by default is applied on a route path
cookiePath: "/"
scopes:
- email
- openid
state: randomStateString
jwtSecret: your-strong-jwt-secret | It's optional
```

View File

@@ -20,7 +20,7 @@ middlewares:
- /*
rule:
unit: minute # or hour
requestsPerUnit: 10
requestsPerUnit: 60
```
Example of route rate limiting middleware
@@ -41,4 +41,20 @@ gateway:
rateLimit: 60 # per minute
routes:
- name: Example
```
## Advanced Kubernetes deployment
```yaml
apiVersion: gomaproj.github.io/v1beta1
kind: Middleware
metadata:
name: ratelimit-middleware-sample
spec:
type: basic
paths:
- /*
rule:
unit: minute # or hour
requestsPerUnit: 60
```

View File

@@ -90,4 +90,48 @@ gateway:
directory: /etc/goma/extra
watch: true
routes: []
```
## Advanced Kubernetes deployment
```yaml
apiVersion: gomaproj.github.io/v1beta1
kind: Gateway
metadata:
labels: {}
name: gateway-sample
spec:
# The version of Goma Gateway
# See: https://github.com/jkaninda/goma-gateway/releases
gatewayVersion: latest # 0.2.2
server:
# Kubernetes tls secret name
tlsSecretName: '' #Optional, tls-secret
#Redis configs for distributed rate limiting across multiple instances
redis:
addr: '' #Optional, redis:6379
password: '' #Optional, password
writeTimeout: 10
readTimeout: 15
idleTimeout: 35
logLevel: info
disableHealthCheckStatus: true
disableKeepAlive: false
enableMetrics: true
# Replicas count
replicaCount: 1
resources:
limits:
cpu: 250m
memory: 512Mi
requests:
cpu: 100m
memory: 128Mi
autoScaling:
enabled: true
minReplicas: 2
maxReplicas: 5
targetCPUUtilizationPercentage: 80
targetMemoryUtilizationPercentage: 80
affinity: {}
```

View File

@@ -189,4 +189,37 @@ gateway:
middlewares:
- api-forbidden-paths
- jwt-auth
```
## Advanced Kubernetes deployment
```yaml
apiVersion: gomaproj.github.io/v1beta1
kind: Route
metadata:
labels: {}
name: route-sample
spec:
gateway: gateway-sample
path: /
hosts: []
rewrite: /g
methods: [GET]
destination: https://example.com
backends: []
insecureSkipVerify: true
healthCheck:
path: /
interval: 10s
timeout: 10s
healthyStatuses:
- 200
- 404
cors:
origins: []
headers: {}
disableHostFording: true
blockCommonExploits: true
middlewares:
- basic-middleware-sample
- ratelimit
```

View File

@@ -1,19 +1,19 @@
---
title: SSL Certificate
title: TLS Certificate
layout: default
parent: Quickstart
nav_order: 5
---
# SSL Certificate
# TLS Certificate
```yaml
version: 1.0
gateway:
sslCertFile: cert.pem
sslKeyFile: key.pem
tlsCertFile: cert.pem
tlsKeyFile: key.pem
```