hzliangbin / multicloud-operators-subscription

CRD and controller for Subscription (Channel Subscription model) for Multicloud Application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

multicloud-operators-subscription

Build GoDoc Go Report Card Sonarcloud Status License


Table of Contents generated with DocToc

Overview


Subscribes resources from channels and applies them to Kubernetes

Quick start


Subscribe a Helm chart

mkdir -p "$GOPATH"/src/github.com/open-cluster-management
cd "$GOPATH"/src/github.com/open-cluster-management
git clone https://github.com/open-cluster-management/multicloud-operators-subscription.git
cd "$GOPATH"/src/github.com/open-cluster-management/multicloud-operators-subscription
  • Set up the environment, and deploy the subscription operator.
kubectl apply -f ./deploy/standalone
  • Create a Channel and a Subscription.
kubectl apply -f ./examples/helmrepo-channel
  • Subscribe!
kubectl patch subscriptions.apps.open-cluster-management.io simple --type='json' -p='[{"op": "replace", "path": "/spec/placement/local", "value": true}]'

Find the nginx pods that are deployed to the current namespace. You should have 3 backend pods with the controller.

% kubectl get pods -l app=nginx-ingress
NAME                                             READY   STATUS    RESTARTS   AGE
nginx-ingress-controller-857f44797-7fx7c         1/1     Running   0          96s
nginx-ingress-default-backend-6b8dc9d88f-97pxz   1/1     Running   0          96s
nginx-ingress-default-backend-6b8dc9d88f-drt7c   1/1     Running   0          96s
nginx-ingress-default-backend-6b8dc9d88f-n26ls   1/1     Running   0          96s

Check the Getting started doc for more details.

Troubleshooting

  • Check operator availability
% kubectl get deploy,pods
NAME                                                READY     UP-TO-DATE   AVAILABLE   AGE
deployment.apps/multicloud-operators-subscription   1/1       1            1           99m

NAME                                                     READY     STATUS    RESTARTS   AGE
pod/multicloud-operators-subscription-557c676479-dh2fg   1/1       Running   0          24s
  • Check the Subscription and its status.
% kubectl describe appsub simple
Name:         simple
Namespace:    default
Labels:       <none>
Annotations:  kubectl.kubernetes.io/last-applied-configuration:
                {"apiVersion":"apps.open-cluster-management.io/v1","kind":"Subscription","metadata":{"annotations":{},"name":"simple","namespace":"default"},"spec":{"ch...
API Version:  apps.open-cluster-management.io/v1
Kind:         Subscription
Metadata:
  Creation Timestamp:  2019-11-21T04:01:47Z
  Generation:          2
  Resource Version:    24045
  Self Link:           /apis/apps/v1/namespaces/default/subscriptions/simple
  UID:                 a35b6ef5-0c13-11ea-b4e7-00000a100ef8
Spec:
  Channel:  dev/dev-helmrepo
  Name:     nginx-ingress
  Package Overrides:
    Package Alias:  nginx-ingress-alias
    Package Name:  nginx-ingress
    Package Overrides:
      Path:   spec
      Value:  defaultBackend:
  replicaCount: 3

  Placement:
    Local:  true
Status:
  Last Update Time:  2019-11-21T04:02:38Z
  Phase:             Subscribed
  Statuses:
    /:
      Packages:
        dev-helmrepo-nginx-ingress-1.25.0:
          Last Update Time:  2019-11-21T04:02:38Z
          Phase:             Subscribed
          Resource Status:
            Last Update:  2019-11-21T04:02:24Z
            Phase:        Success
Events:                   <none>

Multicluster application subscription deployment

kubectl config use-context _hub_cluster_context_ # replace _hub_cluster_context_ with the hub cluster context name
git clone https://github.com/open-cluster-management/multicloud-operators-subscription
cd multicloud-operators-subscription
TRAVIS_BUILD=0
make deploy-community-hub # make deploy-community-hub GO_REQUIRED_MIN_VERSION:= # if you see warning about min version
  • Deploy the subscription agent on the managed cluster.
kubectl config use-context _managed_cluster_context_ # replace _managed_cluster_context_ with the managed cluster context name
export HUB_KUBECONFIG=_path_to_hub_kubeconfig_ # replace _path_to_hub_kubeconfig_ with the full path to the hub cluster kubeconfig
export MANAGED_CLUSTER_NAME=cluster1
make deploy-community-managed # make deploy-community-managed GO_REQUIRED_MIN_VERSION:= # if you see warning about min version
  • Deploy an application subscription on the hub cluster and it will propagate down to the managed cluster
$ kubectl config use-context _hub_cluster_context_ # replace _hub_cluster_context_ with the hub cluster context name
$ kubectl apply -f examples/helmrepo-hub-channel
$ kubectl config use-context _managed_cluster_context_ # replace _managed_cluster_context_ with the managed cluster context name
$ sleep 60
$ kubectl get subscriptions.apps 
NAME        STATUS       AGE   LOCAL PLACEMENT   TIME WINDOW
nginx-sub   Subscribed   77s   true       
$ kubectl get pod
NAME                                                   READY   STATUS    RESTARTS   AGE
nginx-ingress-65f8e-controller-76fdf7f8bb-srfjp        1/1     Running   0          84s
nginx-ingress-65f8e-default-backend-865d66965c-ckq66   1/1     Running   0          84s

Community, discussion, contribution, and support

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


Getting started

Prerequisites

Check the Development Doc for information about how to contribute to the repository.

Security response

Check the Security Doc if you find a security issue.

References

Multicloud-operators repositories

About

CRD and controller for Subscription (Channel Subscription model) for Multicloud Application.

License:Apache License 2.0


Languages

Language:Go 86.1%Language:Shell 6.0%Language:Makefile 5.8%Language:Python 1.2%Language:Mustache 0.4%Language:Dockerfile 0.2%Language:Awk 0.2%Language:Ruby 0.0%