Skip to content

Commit

Permalink
update readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
dbadura committed Apr 3, 2024
1 parent f0917bd commit 5b347e6
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 22 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ install-serverless-latest-release: ## Install serverless from latest release
remove-serverless: ## Remove serverless-cr and serverless operator
make -C ${OPERATOR_ROOT} remove-serverless undeploy

.PHONY: run
run: create-k3d install-serverless-main ## Create k3d cluster and install serverless from main
.PHONY: run-main
run-main: create-k3d install-serverless-main ## Create k3d cluster and install serverless from main

check-var = $(if $(strip $($1)),,$(error "$1" is not defined))

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ kubectl apply -f https://github.com/kyma-project/serverless-manager/releases/lat
2. Build Serverless Operator locally and run it in the k3d cluster.

```bash
make run
make run-main
```

> **NOTE:** To clean up the k3d cluster, use the `make delete-k3d` make target.

> **NOTE:** If you have k3d already running you can use `install-*` target to install serverless in different flavours.

## Using Serverless Operator

Expand Down
18 changes: 16 additions & 2 deletions components/operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,26 @@ The Function Operator requires the following components to be installed:

## Development

### Run/Debug local sources locally
### Installing locally build serverless operator image on k3d with serverless

To install serverless-manager from local sources on k3d cluster run:
```bash
make install-operator-k3d
```

This target does:
- build local image with serverless-operator
- tag local serverless-operator image with its hash to be sure to deployment be updated
- upload local image to k3d
- update image in serverless-operator deployment

### Running/Debugging serverless-operator locally
To develop the component as normal binary, set up environment variables.

### Environment Variables

#### The Function Operator Uses These Environment Variables:

| Variable | Description | Default value |
|----------------------------------|------------------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **CHART_PATH** | Location of serverless chart | `/module-chart` |
| **CHART_PATH** | Location of serverless chart | `/module-chart` |
16 changes: 8 additions & 8 deletions components/serverless/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ manifests: kustomize controller-gen ## Render CRDs

install: manifests ## Install CRDS into the k8s cluster specified in ~/.kube/config
kubectl apply -f ../../config/serverless/templates/crds.yaml
######## function manager
MANAGER_NAME = function-controller
######## function controller
CONTROLLER_NAME = function-controller

.PHONY: build-image-function-controller
build-image-function-controller:
docker build -t $(MANAGER_NAME) -f $(COMPONENT_ROOT)/deploy/manager/Dockerfile $(PROJECT_ROOT)
docker build -t $(CONTROLLER_NAME) -f $(COMPONENT_ROOT)/deploy/manager/Dockerfile $(PROJECT_ROOT)

install-manager-k3d: build-image-function-controller disable-operator ## Build and install serverless manager from local sources on k3d
$(eval HASH_TAG=$(shell docker images $(MANAGER_NAME):latest --quiet))
docker tag $(MANAGER_NAME) $(MANAGER_NAME):$(HASH_TAG)
install-controller-k3d: build-image-function-controller disable-operator ## Build and install serverless manager from local sources on k3d
$(eval HASH_TAG=$(shell docker images $(CONTROLLER_NAME):latest --quiet))
docker tag $(CONTROLLER_NAME) $(CONTROLLER_NAME):$(HASH_TAG)

k3d image import $(MANAGER_NAME):$(HASH_TAG) -c kyma
kubectl set image deployment serverless-ctrl-mngr -n kyma-system manager=$(MANAGER_NAME):$(HASH_TAG)
k3d image import $(CONTROLLER_NAME):$(HASH_TAG) -c kyma
kubectl set image deployment serverless-ctrl-mngr -n kyma-system manager=$(CONTROLLER_NAME):$(HASH_TAG)

######## function webhook
WEBHOOK_NAME = function-webhook
Expand Down
22 changes: 16 additions & 6 deletions components/serverless/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ The Function Controller is a Kubernetes controller that enables Kyma to manage F
## Prerequisites

The Function Controller requires the following components to be installed:

- [Istio](https://github.com/istio/istio/releases) (v1.4.3)
- [Docker registry](https://github.com/docker/distribution) (v2.7.1)
- [Go](https://go.dev/)

## Development

Expand All @@ -16,11 +14,23 @@ To develop the Function Controller, you need:
- [controller-gen](https://github.com/kubernetes-sigs/controller-tools/releases/tag/v0.6.2) (v0.6.2)
- <!-- markdown-link-check-disable-line -->[kustomize](https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize%2Fv4.5.7) (v4.5.7)

To develop the component, use the formulae declared in the [Makefile](./Makefile).
### Installing locally build serverless controller image on k3d with serverless

To install serverless-manager from local sources on k3d cluster run:
```bash
make install-controller-k3d
```

To run the manager and set up envs correctly, source [controller.env](./hack/controller.env).
You can customize the configuration by editing files in [hack](./hack) dir.
This target does:
- scale down serverless operator to prevent reverting further changes made to serverless-controller deployment
- build local image with serverless-controller image
- tag local serverless-controller image with its hash to be sure to deployment be updated
- upload local image to k3d
- update image in serverless-ctrl-mngr deployment

### Running/Debugging serverless-manager locally
To develop the component as normal binary, set up envs correctly, example envs to use [controller.env](./hack/controller.env).
You can customize the configuration by editing files in [hack](./hack) dir.

### Environment Variables

Expand Down
4 changes: 2 additions & 2 deletions hack/makefile-strategy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pros of the architecture:
* extensibility

## Dependencies description
* `Makefile` - The main makefile that allows for installing and running the Serverless Operator. It's a high-level target to run the module without knowing its internals. It's the first contact point for the Serverless module users.
* `Makefile` - The main makefile that allows for installing and running the Serverless. It's a high-level target to run the module without knowing its internals. It's the first contact point for the Serverless module users.
* `hack/Makefile` - High-level API that contains all targets that may be used by any CI/CD system. It has dependencies on the `hack/*.mk` makefiles.
* `hack/*.mk` - Contains common targets that may be used by other makefiles (they are included and shouldn't be run directly). Targets are grouped by functionality. They should contain helpers' targets.
* `components/operator/Makefile` - Contains all basic operations on Serverless Operator like builds, tests, etc., used during development. It's also used by `Makefile`.
Expand Down Expand Up @@ -37,4 +37,4 @@ include ${PROJECT_ROOT}/hack/help.mk

.PHONY: run
run: create-k3d install-serverless-main ## Create k3d cluster and install serverless from main
```
```

0 comments on commit 5b347e6

Please sign in to comment.