Table of Contents generated with DocToc
- What is the Hybrid Deployable Operator
- Community, discussion, contribution, and support
- Getting Started
- Hybrid Application References
Deployer Operator
Works with Virtualization Operators (KubeVirt, CloudForms, etc) in a managed cluster for deployments and day2 actions.
Check the CONTRIBUTING Doc for how to contribute to the repo.
- git v2.18+
- Go v1.13.4+
- operator-sdk v0.15.1
- Kubernetes v1.14+
- kubectl v1.14+
Check the Development Doc for how to contribute to the repo.
Ideally, 2 kubernetes clusters should be used. 1 for the hub, and 1 for the managed cluster. For this quick start, the same cluster is for the hub and managed cluster. In this example, the managed cluster toronto in namespace toronto is actually pointing to the hub cluster.
mkdir -p "$GOPATH"/src/github.com/IBM
cd "$GOPATH"/src/github.com/IBM
git clone https://github.com/IBM/deployer-operator.git
cd "$GOPATH"/src/github.com/IBM/deployer-operator
Build the deployer-operator and push it to a registry. Modify the example below to reference a container reposistory you have access to, and update cluster name and it's namespace.
operator-sdk build quay.io/johndoe/deployer-operator:v0.1.0
sed -i 's|REPLACE_IMAGE|quay.io/johndoe/deployer-operator:v0.1.0|g' deploy/operator.yaml
sed -i 's|CLUSTER_NAME|toronto|g' deploy/operator.yaml
sed -i 's|CLUSTER_NAMESPACE|toronto|g' deploy/operator.yaml
docker push quay.io/johndoe/hybriddeployable-operator:v0.1.0
Register the deployer-operator CRDs.
kubectl create -f deploy/crds/app.cp4mcm.ibm.com_deployers_crd.yaml
kubectl create -f deploy/crds/app.cp4mcm.ibm.com_deployersets_crd.yaml
Register the deployer-operator CRD dependencies.
kubectl create -f hack/test/app_v1alpha1_deployable_crd.yaml
kubectl create -f hack/test/app_v1beta1_application.yaml
kubectl create -f hack/test/cluster-registry-crd.yaml
kubectl create -f hack/test/clusterstatus-crd.yaml
Setup RBAC and deploy.
kubectl create -f deploy/service_account.yaml
kubectl create -f deploy/role.yaml
kubectl create -f deploy/role_binding.yaml
kubectl create -f deploy/operator.yaml
Alternatively, the operator can run locally using the operator-sdk, using the following steps:
- Start deployer operator
- kubeconfig points to a kubernetes cluster with admin priviliege
- Note: if you actually have separate hub and managed clusters,
- use environment variable HUBCLUSTERCONFIGFILE to point to the kubeconfig to hub cluster
- environment variable KUBECONFIG to point to the kubeconfig to managed cluster
- Note: if you actually have separate hub and managed clusters,
cd "$GOPATH"/src/github.ibm.com/IBMPrivateCloud/deployer-operator
export CLUSTERNAME=toronto
export CLUSTERNAMESPACE=toronto
operator-sdk run --local --namespace=""
Verify deployer-operator is up and running.
kubectl get deployment
Create the following CRs to setup the test. This will create a Deployer to claim capability in managed cluster. After Deployer is created, DeployerSet in cluster namespace is updated.
% kubectl apply -f ./examples/kubevirt.yaml
deployer.app.ibm.com/mykv created
% kubectl get deployerset --all-namespaces
NAMESPACE NAME AGE
toronto toronto 7s
% kubectl describe deployerset -n toronto toronto
Name: toronto
Namespace: toronto
Labels: <none>
Annotations: <none>
API Version: app.ibm.com/v1alpha1
Kind: DeployerSet
Metadata:
Creation Timestamp: 2020-02-03T22:50:56Z
Generation: 1
Resource Version: 12413955
Self Link: /apis/app.ibm.com/v1alpha1/namespaces/toronto/deployersets/toronto
UID: a3a9e3af-46d7-11ea-9dba-00000a101bb8
Spec:
Deployers:
Key: default/mykv
Spec:
Type: kubevirt
Events: <none>
Add/set default Deployer (with discovery capability).
$ kubectl apply -f ./examples/cloudform.yaml
deployer.app.ibm.com/mycf created
$ kubectl describe deployerset -n toronto toronto
Name: toronto
Namespace: toronto
Labels: <none>
Annotations: <none>
API Version: app.ibm.com/v1alpha1
Kind: DeployerSet
Metadata:
Creation Timestamp: 2020-02-03T22:50:56Z
Generation: 2
Resource Version: 12415203
Self Link: /apis/app.ibm.com/v1alpha1/namespaces/toronto/deployersets/toronto
UID: a3a9e3af-46d7-11ea-9dba-00000a101bb8
Spec:
Default Deployer: default/mycf
Deployers:
Key: default/mycf
Spec:
Discovery:
Gvrs:
Group: cloudform.ibm.com
Resource: virtualmachines
Version: v1alpha1
Type: cloudform
Key: default/mykv
Spec:
Type: kubevirt
Events: <none>
$ kubectl get virtualmachines
NAME AGE
frontend 23m
$ kubectl get deployables -n toronto
NAME TEMPLATE-KIND TEMPLATE-APIVERSION AGE STATUS
cloudform-default-frontend-xlclx VirtualMachine cloudform.ibm.com/v1alpha1 3m40s
Go to HybridDeployable repository to play with workloads.
Please refer to Trouble shooting documentation for further info.