Skip to content

Commit

Permalink
fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nakamasato committed Nov 23, 2023
1 parent 33eb170 commit 6f8b2af
Showing 1 changed file with 62 additions and 9 deletions.
71 changes: 62 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,72 @@ It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controlle
which provides a reconcile function responsible for synchronizing resources untile the desired state is reached on the cluster

### Test It Out
1. Install the CRDs into the cluster:

```sh
make install
```
1. Start kind cluster

2. Run your controller (this will run in the foreground, so switch to a new terminal if you want to leave it running):
```sh
kind create cluster
```

```sh
make run
```
1. Install the CRDs into the cluster:

**NOTE:** You can also run this in one step by running: `make install run`
```sh
make install
```

1. Run cert manager

```
CERT_MANAGER_VERSION=v1.8.0
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/$CERT_MANAGER_VERSION/cert-manager.yaml
```

1. Run your controller (this will run in the foreground, so switch to a new terminal if you want to leave it running):

```sh
IMG=password-operator:webhook
make docker-build IMG=$IMG
kind load docker-image $IMG
make deploy IMG=$IMG
```

1. Create `Password` CR

```sh
kubectl apply -f config/samples/secret_v1alpha1_password.yaml
```

1. Check Secret

```sh
kubectl get secret
NAME TYPE DATA AGE
password-sample Opaque 1 5s
```

1. Check invalid CR (denied by admission webhook)

```yaml
apiVersion: secret.example.com/v1alpha1
kind: Password
metadata:
labels:
app.kubernetes.io/name: password
app.kubernetes.io/instance: password-sample
app.kubernetes.io/part-of: password-operator
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/created-by: password-operator
name: password-sample
spec:
length: 20
digit: 10
symbol: 15
```

```sh
kubectl apply -f config/samples/secret_v1alpha1_password.yaml
Error from server (Forbidden): error when creating "config/samples/secret_v1alpha1_password.yaml": admission webhook "vpassword.kb.io" denied the request: Number of digits and symbols must be less than total length
```

### Modifying the API definitions
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
Expand Down

0 comments on commit 6f8b2af

Please sign in to comment.