GithubHelp home page GithubHelp logo

isabella232 / placement Goto Github PK

View Code? Open in Web Editor NEW

This project forked from open-cluster-management-io/placement

0.0 0.0 0.0 12.24 MB

Controller to make placement decisions based on Placement APIs

License: Apache License 2.0

Shell 0.37% Go 98.14% Makefile 1.27% Dockerfile 0.22%

placement's Introduction

Placement

With Placement, you can select a set of ManagedClusters from the ManagedClusterSets bound to the placement namespace.

Community, discussion, contribution, and support

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


Getting Started

Prerequisites

You have at least one running kubernetes cluster;

Clone this repo

git clone https://github.com/open-cluster-management-io/placement.git
cd placement

Deploy the placement controller

Set environment variables.

export KUBECONFIG=</path/to/kubeconfig>

Build the docker image to run the placement controller.

go install github.com/openshift/imagebuilder/cmd/[email protected]
make images
export IMAGE_NAME=<placement_image_name> # export IMAGE_NAME=quay.io/open-cluster-management/placement:latest

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

kind load docker-image <placement_image_name> # kind load docker-image quay.io/open-cluster-management/placement:latest

And then deploy placement manager on the cluster.

make deploy-hub

What is next

After a successful deployment, check on the cluster and see the placement controller has been deployed.

kubectl -n open-cluster-management-hub get pods
NAME                                                  READY   STATUS    RESTARTS   AGE
cluster-manager-placement-controller-cf9bbd6c-x9dnd   1/1     Running   0          2m16s

Here is an example.

Create a ManagedClusterSet.

cat <<EOF | kubectl apply -f -
apiVersion: cluster.open-cluster-management.io/v1alpha1
kind: ManagedClusterSet
metadata:
  name: clusterset1
EOF

Create a ManagedCluster and assign it to clusterset clusterset1.

cat <<EOF | kubectl apply -f -
apiVersion: cluster.open-cluster-management.io/v1
kind: ManagedCluster
metadata:
  name: cluster1
  labels:
    cluster.open-cluster-management.io/clusterset: clusterset1
    vendor: OpenShift
spec:
  hubAcceptsClient: true
EOF

Create a ManagedClusterSetBinding to bind the ManagedClusterSet to the default namespace.

cat <<EOF | kubectl apply -f -
apiVersion: cluster.open-cluster-management.io/v1alpha1
kind: ManagedClusterSetBinding
metadata:
  name: clusterset1
  namespace: default
spec:
  clusterSet: clusterset1
EOF

Now create a Placement:

cat <<EOF | kubectl apply -f -
apiVersion: cluster.open-cluster-management.io/v1alpha1
kind: Placement
metadata:
  name: placement1
  namespace: default
spec:
  predicates:
    - requiredClusterSelector:
        labelSelector:
          matchLabels:
            vendor: OpenShift
EOF

Check the PlacementDecision created for this placement. It contains all selected clusters in status.

kubectl get placementdecisions
NAME                    AGE
placement1-decision-1   2m27s

kubectl describe placementdecisions placement1-decision-1
......
Status:
  Decisions:
    Cluster Name:  cluster1
    Reason:
Events:            <none>

Clean up

Undeploy placement controller from the cluster.

make undeploy-hub

placement's People

Contributors

elgnay avatar haoqing0110 avatar jnpacker avatar kim-fitness avatar ldpliu avatar openshift-ci[bot] avatar openshift-merge-robot avatar qiujian16 avatar suigh avatar vincent-pli avatar xuezhaojun avatar xunpan avatar yue9944882 avatar zhiweiyin318 avatar

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.