Managing Capabilities

In KubeVela, developers can install more capabilities (i.e. new workload types and traits) from any GitHub repo that contains OAM definition files. We call these GitHub repos as Capability Centers.

KubeVela is able to discover OAM definition files in this repo automatically and sync them to your own KubeVela platform.

Add a capability center

Add and sync a capability center in KubeVela:

  1. $ vela cap center config my-center https://github.com/oam-dev/catalog/tree/master/registry
  2. successfully sync 1/1 from my-center remote center
  3. Successfully configured capability center my-center and sync from remote
  4. $ vela cap center sync my-center
  5. successfully sync 1/1 from my-center remote center
  6. sync finished

Now, this capability center my-center is ready to use.

List capability centers

You are allowed to add more capability centers and list them.

  1. $ vela cap center ls
  2. NAME ADDRESS
  3. my-center https://github.com/oam-dev/catalog/tree/master/registry

[Optional] Remove a capability center

Or, remove one.

  1. $ vela cap center remove my-center

List all available capabilities in capability center

Or, list all available capabilities in certain center.

  1. $ vela cap ls my-center
  2. NAME CENTER TYPE DEFINITION STATUS APPLIES-TO
  3. kubewatch my-center trait kubewatches.labs.bitnami.com uninstalled []

Install a capability from capability center

Now let’s try to install the new trait named kubewatch from my-center to your own KubeVela platform.

KubeWatch is a Kubernetes plugin that watches events and publishes notifications to Slack channel etc. We can use it as a trait to watch important changes of your app and notify the platform administrators via Slack.

Install kubewatch trait from my-center.

  1. $ vela cap install my-center/kubewatch
  2. Installing trait capability kubewatch
  3. "my-repo" has been added to your repositories
  4. 2020/11/06 16:19:30 [debug] creating 1 resource(s)
  5. 2020/11/06 16:19:30 [debug] CRD kubewatches.labs.bitnami.com is already present. Skipping.
  6. 2020/11/06 16:19:37 [debug] creating 3 resource(s)
  7. Successfully installed chart (kubewatch) with release name (kubewatch)
  8. Successfully installed capability kubewatch from my-center

Use the newly installed capability

Let’s check the kubewatch trait appears in your platform firstly:

  1. $ vela traits
  2. Synchronizing capabilities from cluster ...
  3. Sync capabilities successfully (no changes)
  4. TYPE CATEGORY DESCRIPTION
  5. kubewatch trait Add a watch for resource
  6. ...

Great! Now let’s deploy an app via Appfile.

  1. $ cat << EOF > vela.yaml
  2. name: testapp
  3. services:
  4. testsvc:
  5. type: webservice
  6. image: crccheck/hello-world
  7. port: 8000
  8. route:
  9. domain: testsvc.example.com
  10. EOF
  1. $ vela up

Then let’s add kubewatch as a trait in this Appfile.

  1. $ cat << EOF >> vela.yaml
  2. kubewatch:
  3. webhook: https://hooks.slack.com/<your-token>
  4. EOF

The https://hooks.slack.com/<your-token> is the Slack channel that your platform administrators are keeping an eye on.

Update the deployment:

  1. $ vela up

Now, your platform administrators should receive notifications whenever important changes happen to your app. For example, a fresh new deployment.

Image of Kubewatch

Uninstall a capability

NOTE: make sure no apps are using the capability before uninstalling.

  1. $ vela cap uninstall my-center/kubewatch
  2. Successfully removed chart (kubewatch) with release name (kubewatch)