Skip to content

Commit 8d7f14a

Browse files
committed
update README
Signed-off-by: Luiz Oliveira <ziuloliveira@gmail.com>
1 parent 56bb3b8 commit 8d7f14a

File tree

1 file changed

+106
-64
lines changed

1 file changed

+106
-64
lines changed

README.md

Lines changed: 106 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -9,55 +9,42 @@
99

1010
A Kubernetes operator that automatically discovers services annotated with OpenAPI/Swagger documentation and aggregates their documentation in a single UI.
1111

12+
13+
## Table of Contents
14+
15+
- [Features](#features)
16+
- [Getting Started (Helm)](#getting-started-helm)
17+
- [How to Annotate Your Services](#how-to-annotate-your-services)
18+
- [Accessing the UI](#accessing-the-ui)
19+
- [Configuration & Customization](#configuration--customization)
20+
- [Environment Variables](#environment-variables)
21+
- [OIDC Authentication (SSO)](#oidc-authentication-sso)
22+
- [Local Development](#local-development)
23+
- [License](#license)
24+
25+
1226
## Features
1327

1428
- Watches Kubernetes services for specific annotations.
1529
- Aggregates OpenAPI/Swagger endpoints from discovered services.
16-
- Serves a dynamic Swagger UI using FastAPI.
17-
- Easy deployment with Docker or Helm.
18-
19-
## Requirements
20-
21-
- Python 3.10+
22-
- Kubernetes cluster
23-
- Docker (for containerization)
24-
- [Poetry](https://python-poetry.org/) for dependency management
25-
- [Helm](https://helm.sh/) (optional, for easy installation)
30+
- Serves a dynamic Swagger UI or Redoc using FastAPI.
31+
- Easy deployment with Helm.
2632

27-
## Getting Started
2833

29-
### 1. Install with Helm (recommended)
34+
## Getting Started (Helm)
3035

31-
You can install the Swagger Operator easily using the Helm Chart available on our GH pages:
36+
Install the Swagger Operator using the Helm Chart:
3237

3338
```bash
3439
helm repo add swagger-operator https://ziul.github.io/swagger-operator/
3540
helm repo update
3641
helm install my-release swagger-operator/swagger-operator
3742
```
3843

39-
### 2. Clone the repository (optional)
4044

41-
If you prefer, clone the repository for customization or local development:
45+
### How to Annotate Your Services
4246

43-
```bash
44-
git clone https://github.com/ziuloliveira/swagger-operator.git
45-
cd swagger-operator
46-
```
47-
48-
### 3. Build the Docker image
49-
50-
```bash
51-
docker build -t swagger-operator:latest .
52-
```
53-
54-
### 4. Deploy to Kubernetes
55-
56-
You can deploy the operator as a Deployment in your cluster. Make sure to set the required environment variables if you want to customize annotation keys and a service account with permissions to watch `services` events.
57-
58-
### 5. Annotate your services
59-
60-
Add the following annotation to your Kubernetes services:
47+
Add the following annotations to your Kubernetes services:
6148

6249
```yaml
6350
metadata:
@@ -72,11 +59,18 @@ metadata:
7259
# (Optional) Extra headers
7360
```
7461

75-
### 6. Access the Swagger UI
62+
63+
### Accessing the UI
7664

7765
Expose the operator service (default port: 80) and access `/` to see the aggregated documentation.
7866

79-
## Environment Variables
67+
---
68+
69+
## Configuration & Customization
70+
71+
### Environment Variables
72+
73+
You can customize the operator's behavior via environment variables:
8074

8175
| Variable | Default | Description |
8276
|----------------------------------|-----------------------------|-----------------------------------------------------------------------------|
@@ -86,53 +80,101 @@ Expose the operator service (default port: 80) and access `/` to see the aggrega
8680
| `SWAGGER_OPERATOR_HEADER_KEY` | `swagger-operator-header` | Annotation key for extra headers. |
8781
| `PROXY_TIMEOUT` | `10` | Timeout for proxy requests (in seconds). |
8882
| `ENABLE_OIDC` | `false` | Enables (`true`) or disables (`false`) OIDC authentication. |
89-
| `TITLE` | `API Documentation` | Title for the Swagger UI. |
83+
| `TITLE` | `API Documentation` | Title for the UI. |
9084
| `INTERFACE` | `swagger-ui` | UI interface (`swagger-ui` or `redoc`). |
9185

92-
## OpenID Connect (OIDC) Authentication Configuration
9386

94-
To enable authentication via OpenID Connect (OIDC), set the following environment variables. These allow your application to interact with an OIDC-compliant identity provider for secure authentication and authorization.
87+
### OIDC Authentication (SSO)
9588

96-
### Required Environment Variables
89+
By default, SSO is configured through the Helm chart. The following values can be set in your `values.yaml`:
9790

98-
| Variable | Description |
99-
|-----------------------|--------------------------------------------------------------------------------------------|
100-
| `ENABLE_OIDC` | Enables (`true`) or disables (`false`) OIDC authentication. |
101-
| `OIDC_CLIENT_ID` | Client ID provided by the OIDC provider during registration. |
102-
| `OIDC_CLIENT_SECRET` | Client secret provided by the OIDC provider during registration. |
103-
| `OIDC_METADATA_URL` | URL to fetch the OIDC provider configuration (endpoints, public keys, etc.). |
104-
| `AUTH_CALLBACK` | Callback URL where the OIDC provider will redirect after authentication. |
91+
```yaml
92+
sso:
93+
enabled: false
94+
existingSecret: ""
95+
metadataUrl: ""
96+
clientSecret: ""
97+
clientID: ""
98+
authCallback: ""
99+
```
105100
106-
#### Example configuration
101+
You have two options to configure SSO:
107102
108-
```env
109-
ENABLE_OIDC=true
110-
OIDC_CLIENT_ID=your-client-id
111-
OIDC_CLIENT_SECRET=your-client-secret
112-
OIDC_METADATA_URL=https://your-oidc-provider.com/.well-known/openid-configuration
113-
AUTH_CALLBACK=https://your-app.com/auth/callback
114-
```
103+
#### 1. Using an existing Kubernetes Secret
115104
116-
## Development
105+
Set `sso.existingSecret` to the name of your secret. The Secret must contain the following fields:
117106

118-
Install dependencies with Poetry:
107+
- `OIDC_CLIENT_SECRET`
108+
- `ENABLE_OIDC`
109+
- `OIDC_METADATA_URL`
110+
- `OIDC_CLIENT_ID`
111+
- `AUTH_CALLBACK`
119112

120-
```bash
121-
poetry install
113+
**Example:**
114+
115+
```yaml
116+
sso:
117+
enabled: true
118+
existingSecret: your-secret-name
122119
```
123120

124-
Run the FastAPI server locally:
121+
**Example Secret:**
125122

126-
```bash
127-
poetry run fastapi run server.py
123+
```yaml
124+
apiVersion: v1
125+
kind: Secret
126+
metadata:
127+
name: your-secret-name
128+
type: Opaque
129+
stringData:
130+
OIDC_CLIENT_SECRET: your-client-secret
131+
ENABLE_OIDC: "true"
132+
OIDC_METADATA_URL: https://your-oidc-provider.com/.well-known/openid-configuration
133+
OIDC_CLIENT_ID: your-client-id
134+
AUTH_CALLBACK: https://your-app.com/auth/callback
128135
```
129136

130-
Or run the operator:
137+
#### 2. Setting values directly in the Helm chart
131138

132-
```bash
133-
poetry run kopf run controller.py
139+
Alternatively, you can provide the SSO configuration directly in your `values.yaml`:
140+
141+
```yaml
142+
sso:
143+
enabled: true
144+
existingSecret: ""
145+
metadataUrl: https://your-oidc-provider.com/.well-known/openid-configuration
146+
clientSecret: your-client-secret
147+
clientID: your-client-id
148+
authCallback: https://your-app.com/auth/callback
134149
```
135150

151+
If both `existingSecret` and the direct values are provided, the operator will prioritize the existing secret.
152+
153+
---
154+
155+
## Local Development
156+
157+
For local development:
158+
159+
1. Install dependencies with [Poetry](https://python-poetry.org/):
160+
161+
```bash
162+
poetry install
163+
```
164+
165+
2. Run the FastAPI server locally:
166+
167+
```bash
168+
poetry run fastapi run server.py
169+
```
170+
171+
3. Run the operator:
172+
173+
```bash
174+
poetry run kopf run controller.py
175+
```
176+
177+
136178
## License
137179

138180
MIT License

0 commit comments

Comments
 (0)