Manages the lifecycle of Eventing resources.
It is a standard Kubernetes operator which observes the state of Eventing resources and reconciles its state according to the desired state.
You’ll need a Kubernetes cluster to run against. You can use k3d to get a local cluster for testing, or run against a remote cluster.
Note: Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster kubectl cluster-info
shows).
This project aims to follow the Kubernetes Operator pattern.
It uses Controllers, which provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster.
This project is scaffolded using Kubebuilder, and all the Kubebuilder makefile
helpers mentioned here can be used.
-
Install the CRDs into the cluster:
make install
-
Run your controller (this will run in the foreground, so switch to a new terminal if you want to leave it running):
make run
NOTE: You can also run this in one step by running:
make install run
Run the unit and integration tests:
make test-only
-
Fix common lint issues:
make imports-local make fmt-local
-
Run lint check:
make lint-thoroughly
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
make manifests
NOTE: Run make --help
for more information on all potential make
targets
More information can be found via the Kubebuilder Documentation
Build and push your image to the location specified by IMG
:
make docker-build docker-push IMG=<container-registry>/eventing-manager:<tag> # If using docker, <container-registry> is your username.
NOTE: Run the following for MacBook M1 devices:
make docker-buildx IMG=<container-registry>/eventing-manager:<tag>
You’ll need a Kubernetes cluster to run against. You can use k3d to get a local cluster for testing, or run against a remote cluster.
Note: Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster kubectl cluster-info
shows).
-
Install the CRDs to the cluster:
make install
-
Build and push your image to the location specified by
IMG
:make docker-build docker-push IMG=<container-registry>/eventing-manager:<tag>
-
Deploy the
eventing-manager
controller to the cluster:make deploy IMG=<container-registry>/eventing-manager:<tag>
-
[Optional] Install
Eventing
Custom Resource:kubectl apply -f config/samples/eventing-eval.yaml
Undeploy controller
Undeploy the controller from the cluster:
make undeploy
Uninstall CRDs
To delete the CRDs from the cluster:
make uninstall
Deploying using Kyma Lifecycle Manager
- Deploy the Lifecycle Manager & Module Manager to the Control Plane cluster with:
kyma alpha deploy
NOTE: For single-cluster mode, edit the Lifecycle Manager role to give access to all resources. Run kubectl edit clusterrole lifecycle-manager-manager-role
and have the following under rules
:
- apiGroups:
- "*"
resources:
- "*"
verbs:
- "*"
- Prepare OCI container registry:
Supported registries are Github, DockerHub, GCP or local registry. If you do not have a registry available, here are some useful resources to guide you through the set-up:
- Lifecycle manager provision-cluster-and-registry documentation
- Github container registry documentation. Change the visibility of a GH package to public if you don't provide a registry secret.
- Generate a module template and push the container image by running the following command in the project root director:
kyma alpha create module -n kyma-project.io/module/eventing --version 0.0.1 --registry ghcr.io/{GH_USERNAME}/eventing-manager -c {REGISTRY_USER_NAME}:{REGISTRY_AUTH_TOKEN} -w
In the command the GH container registry sample is used. Replace GH_USERNAME=REGISTRY_USER_NAME and REGISTRY_AUTH_TOKEN with the GH username and token/password respectively.
The command generates a ModuleTemplate template.yaml
file in the project folder.
NOTE: Change template.yaml
content with spec.target=remote
to spec.target=control-plane
for single-cluster mode as follows:
spec:
target: control-plane
channel: regular
- Apply the module template to the K8s cluster:
kubectl apply -f template.yaml
- Deploy the
eventing
module by adding it to thekyma
custom resourcespec.modules
:
kubectl edit -n kyma-system kyma default-kyma
The spec part should have the following:
...
spec:
modules:
- name: eventing
...
- Check whether your modules is deployed properly:
Check eventing resource if it has ready state:
kubectl get -n kyma-system eventing
Check if the Kyma resource has the ready state:
kubectl get -n kyma-system kyma
If it doesn't have the ready state, one can troubleshoot it by checking the pods under eventing-manager-system
namespace where the module is installed:
kubectl get pods -n eventing-manager-system
Uninstalling controller with Kyma Lifecycle Manager
-
Delete eventing from
kyma
resourcespec.modules
kubectl edit -n kyma-system kyma default-kyma
: -
Check whether the
eventing
resource and module namespace were deleted:
kubectl get -n kyma-system eventing
Copyright 2023.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.