karmada/samples/guestbook
chaunceyjiang bd0fb4fa5f Add a CRD sample
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
2022-06-07 20:50:55 +08:00
..
README.md Add a CRD sample 2022-06-07 20:50:55 +08:00
guestbook.yaml Add a CRD sample 2022-06-07 20:50:55 +08:00
guestbooks-clusterpropagationolicy.yaml Add a CRD sample 2022-06-07 20:50:55 +08:00
guestbooks-crd.yaml Add a CRD sample 2022-06-07 20:50:55 +08:00
guestbooks-overridepolicy.yaml Add a CRD sample 2022-06-07 20:50:55 +08:00
guestbooks-propagationpolicy.yaml Add a CRD sample 2022-06-07 20:50:55 +08:00

README.md

Propagate CRD application

The following steps demonstrating how to propagate a Guestbook which is defined by CRD.

Assume you are under the guestbook directory.

cd samples/guestbook

and set the KUBECONFIG environment with Karmada configuration.

export KUBECONFIG=${HOME}/.kube/karmada.config
  1. Create Guestbook CRD in Karmada
kubectl apply -f guestbooks-crd.yaml 

The CRD should be applied to karmada-apiserver. 2. Create ClusterPropagationPolicy that will propagate Guestbook CRD to member cluster

kubectl apply -f guestbooks-clusterpropagationolicy.yaml

The CRD will be propagated to member clusters according to the rules defined in ClusterPropagationPolicy

Note: We can only use ClusterPropagationPolicy not PropagationPolicy here. Please refer to FAQ Difference between PropagationPolicy and ClusterPropagationPolicy for more details.

  1. Create a Guestbook named guestbook-sample in Karmada
kubectl apply -f guestbook.yaml
  1. Create PropagationPolicy that will propagate guestbook-sample to member cluster
kubectl apply -f guestbooks-propagationpolicy.yaml
  1. Check the guestbook-sample status from Karmada
kubectl get guestbook -oyaml
  1. Create OverridePolicy that will override the size field of guestbook-sample in member cluster
kubectl apply -f guestbooks-overridepolicy.yaml
  1. Check the size field of guestbook-sample from member cluster
kubectl --kubeconfig=${HOME}/.kube/members.config config use-context member1
kubectl --kubeconfig=${HOME}/.kube/members.config get guestbooks -o yaml

If it works as expected, the .spec.size will be overwritten to 4.