Code Monkey home page Code Monkey logo

klusterlet-addon-controller's Introduction

klusterlet addon controller

Klusterlet addon controller supports some installation and termination of add-ons on ManagedCluster for ACM.

Community, discussion, contribution, and support

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


Getting Started

This is a guide on how to build and deploy klusterlet addon controller from code.

Kubernetes controller for the KlusterletAddonConfig custom resource that manages the Create/Update/Delete of klusterlet addon operator and klusterlet addons on the managed cluster via ManifestWork.

Prerequisites

# can be installed with the following command
> make deps

Prepare your cluster

  1. Import a managed cluster. Follow this guidelines to import cluster manually.
  1. Install klusterlet CRD
make utils-crds-install

Running Klusterlet addon controller locally for development

  1. Run Klusterlet Addon Controller locally
make run

Running Klusterlet addon controller in-cluster for deployment

  1. Apply the deploy to create the ServiceAccount, ClusterRole, ClusterRoleBinding and Deployment for the operator
make deploy

NOTE:

Installing klusterlet addons using Klusterlet addon controller

To create a klusterlet addon operator deployment with the klusterlet addon controller you need to create the KlusterletAddonConfig CR

Example of KlusterletAddonConfig CR https://github.com/stolostron/klusterlet-addon-controller/blob/main/deploy/crds/agent.open-cluster-management.io_v1_klusterletaddonconfig_cr.yaml

Rebuilding zz_generated.deepcopy.go file

Any modifications to files pkg/apis/agent/v1/*types.go will require you to run the following:

operator-sdk generate k8s

to regenerate the zz_generated.deepcopy.go file.

Run e2e Test

  1. Prepare a Kubernetes cluster, for example Kind
  2. Execute following commands
export KUBECONFIG=<cluster kube config>
make test-e2e

Run Functional Test

Before Testing functional test with KinD

  1. Make sure you have ginkgo excutable ready in your env. If not, do the following:

     go get github.com/onsi/ginkgo/ginkgo
     go get github.com/onsi/gomega/...
    
  2. Run functional test locally with KinD, you will need to install Kind https://kind.sigs.k8s.io/docs/user/quick-start/#installation

Run Functional Test Locally with KinD

  1. Export the image postfix for rcm-controller image:
     export COMPONENT_TAG_EXTENSION=-SNAPSHOT-2020-04-01-20-49-00
    
  2. Run tests:
    • Run the following command to build the image, setup & start a kind cluster (Ideal for someone new to the repo and wanting to test changes):
    export DOCKER_USER=<Docker username>
    export DOCKER_PASS=<Docker password>
    make functional-test-full
    
    • Run the following command to setup & start a kind cluster:
     make component/test/functional
    
    • Run the following command to run the test on an existing cluster:
    export KUBECONFIG=...
    make functional-test
    

Addon Development

Stop Reconcile

To patch the addons, you need to first stop reconcile of the KlusterletAddonConfig on hub:

oc annotate klusterletaddonconfig -n ${CLUSTER_NAME} ${CLUSTER_NAME} klusterletaddonconfig-pause=true --overwrite=true

After running the command, klusterlet-addon-controller will not update and sync the addons, so you can modify.

Update Image

If you only want to update images of an addon, you can directly modify the manifestwork for that addon on hub. Here is an example of updating application manager. Execute this command on hub:

oc edit manifestwork -n ${CLUSTER_NAME}  ${CLUSTER_NAME}-klusterlet-addon-appmgr

Other addons are:

  • ${CLUSTER_NAME}-klusterlet-addon-appmgr
  • ${CLUSTER_NAME}-klusterlet-addon-certpolicyctrl
  • ${CLUSTER_NAME}-klusterlet-addon-crds
  • ${CLUSTER_NAME}-klusterlet-addon-policyctrl
  • ${CLUSTER_NAME}-klusterlet-addon-search
  • ${CLUSTER_NAME}-klusterlet-addon-workmgr

Scale Done klusterlet-addon-operator

If you want to patch deployments directly on the managed cluster.

You can scale down the klusterlet-addon-operator on the managed cluster.

To do so, on hub, edit the manifestwork of ${CLUSTER_NAME}-klusterlet-addon-operator on hub, and search for Deployment. Set spec.replicas to 0:

oc edit manifestwork -n ${CLUSTER_NAME}  ${CLUSTER_NAME}-klusterlet-addon-operator

Please remember to restore the replicas when you finishing the devs. Otherwise you will not able to cleanup the managed cluster properly when detach.

klusterlet-addon-controller's People

Contributors

compt0n-afk avatar dianexie avatar eemurphy avatar elgnay avatar hanqiuzh avatar haoqing0110 avatar itdove avatar jnpacker avatar justinkuli avatar kevinfcormier avatar leena-jawale avatar mdelder avatar mikeshng avatar mprahl avatar openshift-merge-robot avatar randy424 avatar randybrunopiverger-ibm avatar rayharris-ibm avatar red-hat-konflux[bot] avatar rokej avatar showeimer avatar skeeey avatar smithbw88 avatar subbarao-meduri avatar therealhaoliu avatar xiangjingli avatar xuezhaojun avatar yiraechristinekim avatar zhiweiyin318 avatar zhujian7 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

klusterlet-addon-controller's Issues

File does not exist after run "make utils-crds-install"

Hi guys, I'm trying to install klusterlet-addon-controller on my hub cluster and after I run make utils-crds-install and I got:

kubectl apply -f deploy/dev-crds/agent.open-cluster-management.io_klusterletaddonconfigs_crd.yaml
go: downloading k8s.io/client-go v0.20.0
go: downloading github.com/open-cluster-management/api v0.0.0-20210409125704-06f2aec1a73f
go: downloading k8s.io/apimachinery v0.20.0
go: downloading k8s.io/api v0.20.0
go: downloading github.com/Masterminds/semver v1.5.0
go: downloading github.com/gogo/protobuf v1.3.2
go: downloading github.com/open-cluster-management/library-go v0.0.0-20200828173847-299c21e6c3fc
go: downloading github.com/openshift/api v3.9.1-0.20190924102528-32369d4db2ad+incompatible
go: downloading github.com/Masterminds/sprig v2.22.0+incompatible
go: downloading k8s.io/apiextensions-apiserver v0.20.0
go: downloading github.com/Masterminds/goutils v1.1.0
go: downloading github.com/imdario/mergo v0.3.9
error: the path "deploy/dev-crds/agent.open-cluster-management.io_klusterletaddonconfigs_crd.yaml" does not exist
make: *** [utils-crds-install] 错误 1

I checked the main branch and found no file named agent.open-cluster-management.io_klusterletaddonconfigs_crd.yaml in deploy/dev-crds/.

Am I doing anything wrong? Hope for you help plz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.