Skip to content

Commit

Permalink
Add development setup document and modify config files as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
kasabe28 committed Feb 13, 2024
1 parent 7c0e217 commit 437081e
Show file tree
Hide file tree
Showing 23 changed files with 141 additions and 103 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ deploy-ironcore-net: manifests kustomize ## Deploy ironcore-net controller to th

.PHONY: deploy-apinetlet
deploy-apinetlet: manifests kustomize ## Deploy apinetlet controller to the K8s cluster specified in ~/.kube/config.
cd config/apinetlet/manager && $(KUSTOMIZE) edit set image controller=${APINETLET_IMG}
cd config/apinetlet/manager && $(KUSTOMIZE) edit set image apinetlet=${APINETLET_IMG}
kubectl apply -k config/apinetlet/default

.PHONY: deploy-metalnetlet
deploy-metalnetlet: manifests kustomize ## Deploy metalnetlet controller to the K8s cluster specified in ~/.kube/config.
cd config/metalnetlet/manager && $(KUSTOMIZE) edit set image controller=${METALNETLET_IMG}
cd config/metalnetlet/manager && $(KUSTOMIZE) edit set image metalnetlet=${METALNETLET_IMG}
kubectl apply -k config/metalnetlet/default

.PHONY: deploy
Expand Down Expand Up @@ -304,7 +304,7 @@ kind-apply: manifests ## Apply config/kind to the cluster specified in ~/.kube/c
kubectl apply -k config/kind

.PHONY: kind-deploy
kind-deploy: kind-build-load-restart kind-apply ## Build, load and restart ironcore-net and apinetlet and apply them.
kind-deploy: kind-build-load-restart kind-apply ## Build, load and restart ironcore-net apiserver and controller manager and apply them.

.PHONY: kind-delete
kind-delete: ## Delete config/kind from the cluster specified in ~/.kube/config.
Expand Down
1 change: 0 additions & 1 deletion config/apinetlet/apinet-rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ kind: Kustomization
resources:
- role.yaml
- role_binding.yaml
- service_account.yaml
5 changes: 0 additions & 5 deletions config/apinetlet/apinet-rbac/service_account.yaml

This file was deleted.

5 changes: 3 additions & 2 deletions config/apinetlet/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namePrefix: apinetlet-
resources:
- ../rbac
- ../manager
- ../apinet-rbac
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
#- ../webhook
Expand All @@ -23,11 +24,11 @@ resources:
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
#- ../prometheus

patchesStrategicMerge:
patches:
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- manager_auth_proxy_patch.yaml
- path: manager_auth_proxy_patch.yaml

# Mount the controller config file for loading manager configurations
# through a ComponentConfig type
Expand Down
1 change: 1 addition & 0 deletions config/apinetlet/default/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ spec:
- "--health-probe-bind-address=:8081"
- "--metrics-bind-address=127.0.0.1:8080"
- "--leader-elect"
- "--api-net-namespace=apinetlet-system"
3 changes: 0 additions & 3 deletions config/apinetlet/kind/add-manager-args.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions config/apinetlet/kind/apinet-rbac/kustomization.yaml

This file was deleted.

14 changes: 2 additions & 12 deletions config/apinetlet/kind/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ kind: Kustomization

resources:
- ../default
- apinet-rbac

patchesStrategicMerge:
- patch-controller.yaml

patchesJson6902:
- target:
group: apps
version: v1
kind: Deployment
namespace: apinetlet-system
name: apinetlet-controller-manager
path: add-manager-args.yaml
patches:
- path: patch-controller.yaml
6 changes: 3 additions & 3 deletions config/apiserver/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ resources:
- ../apiservice
- ../certmanager

patchesStrategicMerge:
- apiserver_certificate_patch.yaml
- apiservicecainjection_patch.yaml
patches:
- path: apiserver_certificate_patch.yaml
- path: apiservicecainjection_patch.yaml

replacements:
- source:
Expand Down
4 changes: 2 additions & 2 deletions config/controller/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ resources:
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
#- ../prometheus

patchesStrategicMerge:
patches:
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- manager_auth_proxy_patch.yaml
- path: manager_auth_proxy_patch.yaml

# Mount the controller config file for loading manager configurations
# through a ComponentConfig type
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions config/default/apiserver/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ kind: Kustomization
resources:
- ../../apiserver/default

patchesStrategicMerge:
- remove-namespace.yaml
patches:
- path: remove-namespace.yaml
4 changes: 2 additions & 2 deletions config/default/controller/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ kind: Kustomization
resources:
- ../../controller/default

patchesStrategicMerge:
- remove-namespace.yaml
patches:
- path: remove-namespace.yaml
9 changes: 9 additions & 0 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@ resources:
- namespace.yaml
- apiserver
- controller

patches:
- target:
group: apps
version: v1
kind: Deployment
namespace: ironcore-net-system
name: ironcore-net-apiserver
path: add-apiserver-args.yaml
13 changes: 2 additions & 11 deletions config/kind/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ kind: Kustomization
resources:
- ../default

patchesStrategicMerge:
- patch-apiserver.yaml
- patch-manager.yaml

patches:
- target:
group: apps
version: v1
kind: Deployment
namespace: ironcore-net-system
name: ironcore-net-apiserver
path: add-apiserver-args.yaml
- path: patch-apiserver.yaml
- path: patch-manager.yaml
1 change: 0 additions & 1 deletion config/metalnetlet/apinet-rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ kind: Kustomization
resources:
- role.yaml
- role_binding.yaml
- service_account.yaml
5 changes: 0 additions & 5 deletions config/metalnetlet/apinet-rbac/service_account.yaml

This file was deleted.

5 changes: 3 additions & 2 deletions config/metalnetlet/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namePrefix: metalnetlet-
resources:
- ../rbac
- ../manager
- ../apinet-rbac
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
#- ../webhook
Expand All @@ -23,11 +24,11 @@ resources:
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
#- ../prometheus

patchesStrategicMerge:
patches:
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- manager_auth_proxy_patch.yaml
- path: manager_auth_proxy_patch.yaml

# Mount the controller config file for loading manager configurations
# through a ComponentConfig type
Expand Down
1 change: 1 addition & 0 deletions config/metalnetlet/default/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ spec:
- "--health-probe-bind-address=:8081"
- "--metrics-bind-address=127.0.0.1:8080"
- "--leader-elect"
- "--name=metalnetlet"
3 changes: 0 additions & 3 deletions config/metalnetlet/kind/add-manager-args.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions config/metalnetlet/kind/apinet-rbac/kustomization.yaml

This file was deleted.

14 changes: 2 additions & 12 deletions config/metalnetlet/kind/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ kind: Kustomization

resources:
- ../default
- apinet-rbac

patchesStrategicMerge:
- patch-controller.yaml

patchesJson6902:
- target:
group: apps
version: v1
kind: Deployment
namespace: metalnetlet-system
name: metalnetlet-controller-manager
path: add-manager-args.yaml
patches:
- path: patch-controller.yaml
106 changes: 106 additions & 0 deletions docs/development/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Local Development Setup

## Requirements

* `go` >= 1.20
* `git`, `make` and `kubectl`
* [Kustomize](https://kustomize.io/)
* Access to a Kubernetes cluster ([Minikube](https://minikube.sigs.k8s.io/docs/), [kind](https://kind.sigs.k8s.io/) or a
real cluster)

## Clone the Repository

To bring up and start locally the `ironcore-net` project for development purposes clone the repository.

```shell
git clone [email protected]:ironcore-dev/ironcore-net.git
cd ironcore-net
```

## Install cert-manager

If there is no [cert-manager](https://cert-manager.io/docs/) present in the cluster it needs to be installed.

```shell
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.2/cert-manager.yaml
```

## Setup `ironcore`

Reference: [ironcore docs](https://github.com/ironcore-dev/ironcore/blob/main/docs/development/setup.md)


## Setup `ironcore-net`

### Setup `ironcore-net` with `kind` cluster

For local development with `kind`, a make target that builds and loads the apiserver/controller images and then applies
the manifests is available via

1. Build and apply ironcore-net apiserver and controller manager to the cluster

```shell
make kind-deploy
```

2. Build and apply apinetlet to the cluster

```shell
make kind-build-load-restart-apinetlet
make kind-apply-apinetlet
```

3. Build and apply metalnetlet to the cluster

```shell
make kind-build-load-restart-metalnetlet
make kind-apply-metalnetlet
```

### Setup `ironcore-net` with any other kubernetes cluster

For local development with any kubernetes cluster other than `kind`, a make target that applies the manifests using
provided images is available via

1. Install ironcore-net API server and API services into the K8s cluster.

```shell
make install APISERVER_IMG=<apiserver image>
```

2. Deploy ironcore-net controller, apinetlet controller and metalnetlet controller to the K8s cluster.

```shell
make deploy CONTROLLER_MANAGER_IMG=<ironcore-net controller-manager image> APINETLET_IMG=<apinetlet image> METALNETLET_IMG=<metalnetlet image>
```

If you want to deploy any of ironcore-net controller, apinetlet controller and metalnetlet controller individually
then use below make targets respectively

```shell
make deploy-ironcore-net CONTROLLER_MANAGER_IMG=<ironcore-net controller-manager image>
make deploy-apinetlet APINETLET_IMG=<apinetlet image>
make deploy-metalnetlet METALNETLET_IMG=<metalnetlet image>
```

**Note**: This requires the `APISERVER_IMG` (Makefile default set to `apiserver`), `CONTROLLER_MANAGER_IMG` (Makefile default set to `controller`), `APINETLET_IMG` (Makefile default set to `apinetlet`) and `METALNETLET_IMG` (Makefile default set to `metalnetlet`) to be pullable from your kubernetes
cluster.

## Cleanup

### Cleanup from `kind` cluster

```shell
make kind-delete
make kind-delete-apinetlet
make kind-delete-metalnetlet
```

### Cleanup from any other kubernetes cluster

```shell
make uninstall
make undeploy
make undeploy-apinetlet
make undeploy-metalnetlet
```

0 comments on commit 437081e

Please sign in to comment.