github.com/oam-dev/kubevela@v1.9.11/design/vela-core/migrate-from-oam-runtime.md (about)

     1  # How to upgrade to KubeVela
     2  
     3  What if I want to upgrade from [oam-kubernetes-runtime](https://github.com/crossplane/oam-kubernetes-runtime) to KubeVela? Here's a detailed guide!
     4  
     5  ## For users who are using OAM runtime as standalone controller
     6  
     7  If you are using OAM Runtime as Standalone Controller, upgrading to KubeVela to KubeVela is very straight forward.
     8  
     9  Server-side KubeVela(We call it `vela-core` for convenience) now includes following **BUILT-IN** CRDs and controllers.
    10  
    11  | Type |  CRD   | Controller  | From |
    12  | ---- |  ----  | ----  | ----  |
    13  | Control Plane Object | `applicationconfigurations.core.oam.dev` | Yes | OAM Runtime |
    14  | Control Plane Object | `components.core.oam.dev` | Yes | OAM Runtime |
    15  | Workload Type | `containerizedworklaods.core.oam.dev` | Yes | OAM Runtime |
    16  | Scope | `healthscope.core.oam.dev` | Yes | OAM Runtime |
    17  | Control Plane Object | `scopedefinitions.core.oam.dev` | No | OAM Runtime |
    18  | Control Plane Object | `traitdefinitions.core.oam.dev` | No | OAM Runtime |
    19  | Control Plane Object | `workloaddefinitions.core.oam.dev` | No | OAM Runtime |
    20  | Trait | `autoscalers.standard.oam.dev` | Yes | New in KubeVela |
    21  | Trait | `metricstraits.standard.oam.dev` | Yes | New in KubeVela |
    22  | Workload Type | `podspecworkloads.standard.oam.dev` | Yes | New in KubeVela |
    23  | Trait | `route.standard.oam.dev` | Yes | New in KubeVela |
    24  
    25  CRDs and Controllers in the table from 'OAM Runtime' are exactly the same to those in `oam-kubernetes-runtime`.
    26  So in KubeVela we have added 4 more new CRDs with controller. 
    27  
    28  ### Option 1: I only want to have OAM control plane objects only, no additional traits and workload types.
    29  
    30  1. Find you deployment
    31  
    32  ```shell script
    33  $ kubectl -n oam-system get deployment -l app.kubernetes.io/name=oam-kubernetes-runtime
    34  NAME                         READY   UP-TO-DATE   AVAILABLE   AGE
    35  oam-kubernetes-runtime-oam   1/1     1            1           62s
    36  ```
    37  
    38  2. Update the deployment
    39  
    40  In this case, the deployment name of OAM runtime is `oam-kubernetes-runtime-oam`, let's edit it to update the image:
    41  
    42  ```shell script
    43  $ kubectl -n oam-system edit deployment oam-kubernetes-runtime-oam
    44  ```
    45  
    46  There are two changes:
    47  
    48  - update the image from `crossplane/oam-kubernetes-runtime:latest` to `oamdev/vela-core:latest`
    49  - add an args `- "--disable-caps=all"`, which will disable all additional workloads and traits built in vela-core described in the following table.
    50  
    51  | Type | Current KubeVela Additional CRD   |
    52  | ---- |  ----  |
    53  | Trait | `autoscalers.standard.oam.dev` |
    54  | Trait | `metricstraits.standard.oam.dev` |
    55  | Workload | `podspecworkloads.standard.oam.dev` |
    56  | Trait | `route.standard.oam.dev` |
    57  
    58  ```yaml
    59  apiVersion: apps/v1
    60  kind: Deployment
    61  metadata:
    62    name: oam-kubernetes-runtime-oam
    63  ...
    64        containers:
    65          - name: oam
    66            args:
    67              - "--metrics-addr=:8080"
    68              - "--enable-leader-election"
    69  +           - "--disable-caps=all"
    70  -         image: crossplane/oam-kubernetes-runtime:latest
    71  +         image: oamdev/vela-core:latest
    72            imagePullPolicy: "Always"
    73  ...
    74  ```
    75  
    76  ### Option 2: I want full featured KubeVela, including its built-in workload types and traits.
    77  
    78  1. Install Additional CRDs
    79  
    80  ```shell script
    81  $ kubectl apply -f charts/vela-core/crds
    82  ```
    83  
    84  2. Install Definition files
    85  
    86  ```shell script
    87  $ kubectl apply -f charts/vela-core/templates/defwithtemplate
    88  ```
    89  
    90  3. Create namespace, vela-core use `vela-system` as default
    91  
    92  ```shell script
    93  $ kubectl create ns vela-system
    94  ```
    95  
    96  4. Install Cert Manager
    97  
    98  ```shell script
    99  $ kubectl apply -f charts/vela-core/templates/cert-manager.yaml
   100  ```
   101  
   102  5. Delete your old oam-runtime deployment
   103  
   104  Find the running deployment.
   105  
   106  ```shell script
   107  $ kubectl -n oam-system get deployment -l app.kubernetes.io/name=oam-kubernetes-runtime
   108  NAME                         READY   UP-TO-DATE   AVAILABLE   AGE
   109  oam-kubernetes-runtime-oam   1/1     1            1           62s
   110  ```
   111  
   112  Delete the deployment found.
   113  
   114  ```shell script
   115  $ kubectl -n oam-system delete deployment oam-kubernetes-runtime-oam
   116  ```
   117  
   118  6. Install Certificate and Webhook for the new controller
   119  
   120  ```shell script
   121  $ helm template --release-name kubevela -n vela-system -s templates/webhook.yaml charts/vela-core/ | kubectl apply -f -
   122  ```
   123  
   124  7. Install the new controller
   125  
   126  ```shell script
   127  $ helm template --release-name kubevela -n vela-system -s templates/kubevela-controller.yaml charts/vela-core/ | kubectl apply -f -
   128  ```
   129  
   130  > TIPS: If you want to disable webhook, change 'useWebhook' to be 'false' in  `charts/vela-core/values.yaml`
   131  
   132  Then you have successfully migrate from oam-kubernetes-runtime to KubeVela.
   133  
   134  ## For users who are importing OAM runtime as library
   135  
   136  If you are importing `oam-kubernetes-runtime` as library, you can update your import headers.
   137  
   138  Files are refactored as below:
   139  
   140  | OLD |  NEW   | Usage  |
   141  | ---- |  ----  | ----  |
   142  | `github.com/crossplane/oam-kubernetes-runtime/apis/core` | `github.com/oam-dev/kubevela/apis/core.oam.dev` | API Spec Code |
   143  | `github.com/crossplane/oam-kubernetes-runtime/pkg/controller` | `github.com/oam-dev/kubevela/pkg/controller/core.oam.dev` | OAM Controller Code |
   144  | `github.com/crossplane/oam-kubernetes-runtime/pkg/oam` | `github.com/oam-dev/kubevela/pkg/oam` | OAM Common Lib Code |
   145  | `github.com/crossplane/oam-kubernetes-runtime/pkg/webhook` | `github.com/oam-dev/kubevela/pkg/webhook/core.oam.dev` | OAM Webhook Code |