arturo-c / addon-oam-kubernetes-local

Run OAM workloads on a Kubernetes cluster.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OAM Controllers

đź‘· WARNNING: This repo is designed to be used by OAM workloads/traits/scopes developers.

What's inside?

This repo contains Kubernetes controllers for core OAM workloads/traits/scopes.

Workloads

Traits

Prerequisites

  • Kubernetes v1.16+
  • Helm 3
  • Crossplane v0.11+ installed

(Optional) In case you don't know how to install Crossplane

Here's an easy three steps version:

kubectl create namespace crossplane-system
helm repo add crossplane-alpha https://charts.crossplane.io/alpha
helm install crossplane --namespace crossplane-system crossplane-alpha/crossplane

Please feel free to ignore this warning which is caused by helm v2 compatibility issue:

manifest_sorter.go:192: info: skipping unknown hook: "crd-install"

Install OAM controllers

Clone this repo

git clone git@github.com:crossplane/addon-oam-kubernetes-local.git
cd ./addon-oam-kubernetes-local

(Optional) Enable webhook and install cert manager

The OAM ManualScalerTrait controller includes a sample webhook to validate the manual scalar trait. This webhook is disabled by default in its helm chart.

You need to install a cert-manager to provide self-signed certifications if you want to play with the webhooks.

kubectl create namespace cert-manager
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v0.14.0/cert-manager.yaml

For more detailed instructions of cert manager please check Cert-manager docs.

Install controllers

kubectl create namespace oam-system
helm install controller -n oam-system ./charts/oam-core-resources/ 

Verify

  • Apply a sample application configuration
kubectl apply -f examples/containerized-workload/
  • Verify that the application is running You can check the status and events from the applicationconfiguration object
kubectl describe applicationconfigurations.core.oam.dev example-appconfig
Status:
  Conditions:
    Last Transition Time:  2020-06-12T21:18:40Z
    Reason:                Successfully reconciled resource
    Status:                True
    Type:                  Synced
  Workloads:
    Component Name:  example-component
    Traits:
      Trait Ref:
        API Version:  core.oam.dev/v1alpha2
        Kind:         ManualScalerTrait
        Name:         example-appconfig-trait
    Workload Ref:
      API Version:  core.oam.dev/v1alpha2
      Kind:         ContainerizedWorkload
      Name:         example-appconfig-workload
Events:
  Type    Reason                 Age              From                                       Message
  ----    ------                 ----             ----                                       -------
  Normal  RenderedComponents     6s (x2 over 7s)  oam/applicationconfiguration.core.oam.dev  Successfully rendered components
  Normal  AppliedComponents      6s (x2 over 6s)  oam/applicationconfiguration.core.oam.dev  Successfully applied components
  Normal  Deployment created     6s (x3 over 6s)  ContainerizedWorkload                      Workload `example-appconfig-workload` successfully server side patched a deployment `example-appconfig-workload`
  Normal  Service created        6s (x3 over 6s)  ContainerizedWorkload                      Workload `example-appconfig-workload` successfully server side patched a service `example-appconfig-workload`
  Normal  Manual scalar applied  6s (x2 over 6s)  ManualScalarTrait                          Trait `example-appconfig-trait` successfully scaled a resouce to 3 instances

You should also see a deployment looking like below

kubectl get deployments
NAME                                    READY   UP-TO-DATE   AVAILABLE   AGE
example-appconfig-workload-deployment   3/3   3           3              28s

And a service looking like below

kubectl get services
AME                                             TYPE       CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
example-appconfig-workload-deployment-service   NodePort   10.96.78.215   <none>        8080/TCP   28s

About

Run OAM workloads on a Kubernetes cluster.

License:Apache License 2.0


Languages

Language:Go 92.1%Language:Makefile 3.9%Language:Smarty 3.0%Language:Dockerfile 1.0%