Skip to content

SataQiu/addon-framework

 
 

Repository files navigation

Addon Framework

This is to define an addon framework library.

Still in PoC phase.

Community, discussion, contribution, and support

Check the CONTRIBUTING Doc for how to contribute to the repo.


Getting Started

Prerequisites

These instructions assume:

  • You have at least one running kubernetes cluster;
  • You have already followed instructions from registration-operator and installed OCM successfully;
  • A managed cluster with name cluster1 has been imported and accepted;

Deploy the helloworld addon

Set environment variables.

export KUBECONFIG=</path/to/hub_cluster/kubeconfig>

Build the docker image to run the sample addon.

make images
export EXAMPLE_IMAGE_NAME=<helloworld_addon_image_name> # export EXAMPLE_IMAGE_NAME=quay.io/open-cluster-management/helloworld-addon:latest

If your are using kind, load image into kind cluster.

kind load docker-image <helloworld_addon_image_name> # kind load docker-image quay.io/open-cluster-management/helloworld-addon:latest

And then deploy helloworld addon contoller on hub cluster

make deploy-example

Create a addon-cr.yaml as shown in this example:

apiVersion: addon.open-cluster-management.io/v1alpha1
kind: ManagedClusterAddOn
metadata:
  name: helloworld
  namespace: cluster1
spec:
  installNamespace: default

Apply the yaml file to the hub cluster.

kubectl apply -f addon-cr.yaml

What is next

After a successful deployment, check on the managed cluster cluster1 and see the helloworld addon agent has been deployed from the hub cluster.

kubectl --kubeconfig </path/to/managed_cluster/kubeconfig> -n default get pods
NAME                               READY   STATUS    RESTARTS   AGE
helloworld-agent-b99d47f76-v2j6h   1/1     Running   0          53s

Clean up

Remove the addon CR from hub cluster. It will undeploy the helloworld addon agent from the managed cluster cluster1 as well.

kubectl delete --ignore-not-found -f addon-cr.yaml

Undeploy helloworld addon contoller from hub cluster.

make undeploy-example

Follow instructions from registration-operator to uninstall OCM if necessary;

Releases

No releases published

Packages

No packages published

Languages

  • Go 96.9%
  • Makefile 2.8%
  • Dockerfile 0.3%