Commit 8ddce137 authored by garciadeblas's avatar garciadeblas
Browse files

Update how-to seciton about OKA preparation to fix image of KSU layers and...


Update how-to seciton about OKA preparation to fix image of KSU layers and include additional examples

Signed-off-by: default avatargarciadeblas <gerardo.garciadeblas@telefonica.com>
parent 6bdfd31e
Loading
Loading
Loading
Loading
Loading
+36 −15
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ osm oka-delete testacme
osm oka-delete jenkins
```

#### OKA generation for helm charts:
#### OKA generation for helm charts

```bash
osm oka-generate jenkins --base-directory okas --profile-type app-profile --helm-repo-name bitnamicharts --helm-repo-url oci://registry-1.docker.io/bitnamicharts --helm-chart jenkins --version 13.4.20 --namespace jenkins
@@ -349,16 +349,7 @@ There are three layers that contribute to the final result (Kubernetes SW unit)
2. Overlays that allow customization of these manifests. They are changes relative to the original manifests.
3. Modifications to the overlays that OSM can make at instantiation time (KSU deployment).

```mermaid
block-beta
columns 3
  space blockArrowId<["&nbsp;&nbsp;&nbsp;"]>(down) space
  space A["Manifests"] space
  space B["Overlays"] space
  space C["OSM modifications"] space
  %% A --> B
  %% B --> C
```
![Layers contributing to a KSU](assets/layers-contributing-to-a-ksu.png)

Manifests and overlays can be encapsulated in a package called OKA. Examples of OKAs can be found [here](https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages/-/tree/master/oka?ref_type=heads)

@@ -538,7 +529,7 @@ spec:

Please use the right path pointing to the folder where the manifests of your OKA are located (`./apps/jenkins/manifests` in this case).

For the moment, we will skip the meaning of the variable `${APPNAME}`.
For the moment, we will skip the meaning of variables such as `${APPNAME}` or `${TARGET_NS}`.

Then, we need to define in the kustomization the overlay patches (second layer) that will be applied to the manifests.

@@ -549,7 +540,7 @@ Three mechanisms to create overlays in [Flux kustomizations](https://fluxcd.io/f
- Overlay patch.
  - It follows the mechanisms described [here](https://fluxcd.io/flux/components/kustomize/kustomizations/#patches)
  - They are added with the directive: `patches`.
  - Example:
  - Example from `apps/namespace` OKA:

    ```yaml
    patches:
@@ -563,10 +554,40 @@ Three mechanisms to create overlays in [Flux kustomizations](https://fluxcd.io/f
            value: finalnamespace
    ```

  - Example from `apps/jenkins` OKA:

    ```yaml
    patches:
      - target:
          kind: HelmRelease
          version: v2beta1
          name: jenkins
          namespace: jenkins
        patch: |-
          - op: replace
            path: /metadata/name
            value: ${APPNAME}
          - op: replace
            path: /spec/chart/spec/sourceRef/namespace
            value: ${TARGET_NS}
          - op: replace
            path: /spec/targetNamespace
            value: ${TARGET_NS}
      - target:
          kind: HelmRepository
          version: v2beta1
          name: bitnamicharts
          namespace: jenkins
        patch: |-
          - op: replace
            path: /metadata/namespace
            value: ${TARGET_NS}
    ```

- Postbuilder: A simple parameterization mechanism that allows replacing values defined in the manifests. It can be compared to Helm values but is less powerful.
  - It follows the mechanisms described [here](https://fluxcd.io/flux/components/kustomize/kustomizations/#post-build-variable-substitution)
  - They are added with the directive `postbuild`.
  - Manifests should be properly updated to use the variables that will be substituted by the `postBuild` directive. For instance, the manifests for `apps/testacme` OKA [here](https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages/-/tree/master/oka/apps/testacme/manifests?ref_type=heads) use the variables `${appname}`, `${target_ns}` and `${echo:message}`. 
  - Manifests should be properly updated to use the variables that will be substituted by the `postBuild` directive. For instance, the manifests for `apps/testacme` OKA [here](https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages/-/tree/master/oka/apps/testacme/manifests?ref_type=heads) use the variables `${appname}`, `${target_ns}` and `${echo_message}`.
  - Example:

    ```yaml
@@ -650,7 +671,7 @@ export OKA_FOLDER="${OSM_PACKAGES_FOLDER}/oka/apps"
osm oka-add jenkins ${OKA_FOLDER}/namespace --description namespace --profile-type app-profile
osm oka-add jenkins ${OKA_FOLDER}/jenkins --description jenkins --profile-type app-profile
osm oka-add testacme ${OKA_FOLDER}/testacme --description testacme --profile-type app-profile
osm ksu-create --ksu namespace --profile mydemo --profile-type app-profile --oka namespace
osm ksu-create --ksu namespace --profile mydemo --profile-type app-profile --oka namespace --params ${OKA_FOLDER}/jenkins-ns-params.yaml
osm ksu-create --ksu testacme --profile mydemo --profile-type app-profile --oka testacme --params ${OKA_FOLDER}/testacme-params.yaml
osm ksu-create --ksu jenkins --description "Jenkins" --profile mydemo --profile-type app-profile --oka jenkins --params ${OKA_FOLDER}/jenkins-params.yaml
```
+91.3 KiB
Loading image diff...