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

docs(development): add steps for setup of kind cluster #10

Merged
merged 1 commit into from
Jan 28, 2025
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
43 changes: 43 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Node.js: This project requires Node.js version 18 or 20 to run.
- Yarn: This project uses Yarn version 4 for package management.
- Kind: This project uses Kind to run a local Kubernetes cluster.
- Kubectl: This project uses Kubectl to interact with the Kubernetes cluster.
- Policy Reporter: Ensure you have a Policy Reporter instance running. The plugin is configured to query `http://localhost:8080/api/policy-reporter`.

## Step 1: Install Dependencies
Expand All @@ -16,6 +18,47 @@ yarn install

## Step 2: Start Local Development

Prerequired Steps (without existing Cluster)

1. Create a local cluster (e.g. with Kind or Minikube)

```bash
kind create cluster -n kyverno
```

NOTE: if you get error on [too many open files](https://kind.sigs.k8s.io/docs/user/known-issues/#pod-errors-due-to-too-many-open-files) you need to increase the inotify limits.

2. Install Kyverno + Kyverno PSS Policies

Kyverno installs the required CRDS and you get some sample PolicyReports by installing the PSS policies.

Add Helm chart

```bash
helm repo add kyverno https://kyverno.github.io/kyverno/
helm repo add policy-reporter https://kyverno.github.io/policy-reporter
helm repo update
```

install Kyverno + CRDs

```bash
helm upgrade --install kyverno kyverno/kyverno -n kyverno --create-namespace
```

Add Pod Security Standard Policies

```bash
helm upgrade --install kyverno-policies kyverno/kyverno-policies -n kyverno --set podSecurityStandard=restricted
```

Add Policy Reporter

```bash
helm install policy-reporter policy-reporter/policy-reporter --create-namespace -n policy-reporter --set ui.enabled=true --set kyverno-plugin.enabled=true --version ^2.0.0
kubectl port-forward service/policy-reporter 8080:8080 -n policy-reporter
```

To start local development, use the `yarn dev` command. This command starts the local development server using the `dev` folders inside the `kyverno-policy-reports` and `kyverno-policy-reports-backend` directories.

```sh
Expand Down
4 changes: 2 additions & 2 deletions catalog/entities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: dev
description: Development Cluster
annotations:
kyverno.io/endpoint: 'http://localhost:8080/policy-reporter/api/'
kyverno.io/endpoint: 'http://localhost:8080/'
spec:
type: kubernetes-cluster
owner: user:guest
Expand All @@ -16,7 +16,7 @@ metadata:
name: test
description: Testing Cluster
annotations:
kyverno.io/endpoint: 'http://localhost:8080/policy-reporter/api/'
kyverno.io/endpoint: 'http://localhost:8080/'
spec:
type: kubernetes-cluster
owner: user:guest
Expand Down
4 changes: 2 additions & 2 deletions plugins/policy-reporter/dev/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const mockEntity: Entity = {
annotations: {
'github.com/project-slug': 'kyverno/policy-reporter',

'kyverno.io/namespace': 'default',
'kyverno.io/namespace': 'kyverno',
'kyverno.io/kind': 'Deployment,Pod',
'kyverno.io/resource-name': 'policy-reporter',
'kyverno.io/resource-name': 'kyverno-background-controller',
},
},
spec: {
Expand Down
Loading