Skip to content

Commit f588faf

Browse files
committed
feat: readme and example
1 parent b124e7f commit f588faf

File tree

1 file changed

+14
-47
lines changed

1 file changed

+14
-47
lines changed

README.md

Lines changed: 14 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,68 +9,35 @@ Auth-Bridge is an open-source project that provides proxy capabilities for Kuber
99
- Policy-based automatic credential injection
1010
- Flexible proxy configuration based on [Open Policy Agent](https://www.openpolicyagent.org).
1111

12-
## Prepare
12+
13+
## Installation
14+
1315
Before installing Auth-Bridge, ensure you have the following prerequisites:
1416

15-
### A Kubernetes cluster
16-
You can use [kind](https://kind.sigs.k8s.io) for local development.
17+
#### A Kubernetes cluster
18+
You can use [Kind](https://kind.sigs.k8s.io) for local development.
1719
Alternatively [OrbStack](https://orbstack.dev) provides a lightweight Kubernetes environment.
1820

1921

20-
### Install cert-manager
22+
#### Install cert-manager
2123
```shell
2224
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.0/cert-manager.yaml
2325
```
2426

25-
### Install skaffold
27+
#### Install skaffold
2628
```bash
2729
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && \
2830
sudo install skaffold /usr/local/bin/
2931
```
3032

31-
## Installation
33+
#### Install
3234

3335
```bash
3436
skaffold deploy
3537
```
3638

3739
## Configuration
3840

39-
Auth-Bridge is configured by ProxyPolicy CRD. Here's a basic configuration example:
40-
41-
```yaml
42-
apiVersion: auth-bridge.dev/v1alpha1
43-
kind: ProxyPolicy
44-
metadata:
45-
name: basic-auth
46-
namespace: default
47-
spec:
48-
auth:
49-
method: basicAuth
50-
secret:
51-
reference:
52-
name: basic-auth
53-
namespace: <secret namespace>
54-
rules:
55-
- name: basic-rule
56-
validate: |
57-
package proxy
58-
59-
default allow = true
60-
---
61-
apiVersion: v1
62-
kind: Secret
63-
metadata:
64-
name: basic-auth
65-
namespace: default
66-
type: Opaque
67-
stringData:
68-
username: username
69-
password: password
70-
```
71-
72-
## Configuration
73-
7441
Auth-Bridge is configured by ProxyPolicy and Secret. Ensure that your ProxyPolicy and associated Secret are correctly configured based on your chosen authentication method and validation rules.
7542

7643
Here's a basic configuration example:
@@ -106,7 +73,7 @@ stringData:
10673
password: password
10774
```
10875
109-
### Field Definition
76+
#### Field Definition
11077
11178
* `auth.method`
11279
This field specifies the authentication method to be used. It can be set to either:
@@ -132,7 +99,7 @@ stringData:
13299
}
133100
```
134101

135-
### Advanced
102+
#### Advanced
136103
The OPA script also has access to an input object that contains information about the target request and the pod.
137104
You can use input.<field> in your OPA script to make decisions. The available fields include:
138105

@@ -158,7 +125,7 @@ In this example, the secret will only be injected if the request host is "exampl
158125
## Usage
159126
Using Auth-Bridge involves several key steps:
160127

161-
### Configure ProxyPolicy
128+
#### Configure ProxyPolicy
162129
Create a ProxyPolicy resource to define your proxy rules:
163130
```yaml
164131
apiVersion: auth-bridge.dev/v1alpha1
@@ -177,7 +144,7 @@ spec:
177144
validate: <rule opa>
178145
```
179146

180-
### Create Secret
147+
#### Create Secret
181148

182149
Create a Secret with correct credentials based on your policy auth method:
183150

@@ -193,7 +160,7 @@ stringData:
193160
password: <password>
194161
```
195162

196-
### Set proxy
163+
#### Set proxy
197164
To enable the Auth-Bridge proxy, set the following environment variables for your application:
198165
```shell
199166
HTTP_PROXY=http://auth-bridge-proxy.auth-bridge:80
@@ -203,7 +170,7 @@ https_proxy=http://auth-bridge-proxy.auth-bridge:80
203170
```
204171
the proxy host `auth-bridge-proxy.auth-bridge` here follows the Kubernetes service naming convention:`<service-name>.<namespace>`
205172

206-
For a more detailed demonstration of how these steps come together, please refer to the [examples](tree/@/examples
173+
For a more detailed demonstration of how these steps come together, please refer to the [examples](tree/main/examples
207174
).
208175

209176
## Contributing

0 commit comments

Comments
 (0)