|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * scalability_and_performance/ztp_far_edge/ztp-preparing-the-hub-cluster.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="ztp-preparing-the-ztp-git-repository-ver-ind_{context}"] |
| 7 | += Preparing the {ztp} site configuration repository for version independence |
| 8 | + |
| 9 | +You can use {ztp} to manage source custom resources (CRs) for managed clusters that are running different versions of {product-title}. |
| 10 | +This means that the version of {product-title} running on the hub cluster can be independent of the version running on the managed clusters. |
| 11 | + |
| 12 | +.Procedure |
| 13 | + |
| 14 | +. Create a directory structure with separate paths for the `SiteConfig` and `PolicyGenTemplate` CRs. |
| 15 | + |
| 16 | +. Within the `PolicyGenTemplate` directory, create a directory for each {product-title} version you want to make available. |
| 17 | +For each version, create the following resources: |
| 18 | +* `kustomization.yaml` file that explicitly includes the files in that directory |
| 19 | +* `source-crs` directory to contain reference CR configuration files from the `ztp-site-generate` container |
| 20 | + |
| 21 | +. In the `/siteconfig` directory, create a subdirectory for each {product-title} version you want to make available. For each version, create at least one directory for reference CRs to be copied from the container. There is no restriction on the naming of directories or on the number of reference directories. If you want to work with custom CRs, you must create a separate directory for those. |
| 22 | ++ |
| 23 | +The following example describes a structure using custom CRs for different versions of {product-title}: |
| 24 | ++ |
| 25 | +[source,text] |
| 26 | +---- |
| 27 | +├── policygentemplates |
| 28 | +│ ├── kustomization.yaml <1> |
| 29 | +│ ├── version_4.13 <2> |
| 30 | +│ │ ├── common-ranGen.yaml |
| 31 | +│ │ ├── group-du-sno-ranGen.yaml |
| 32 | +│ │ ├── group-du-sno-validator-ranGen.yaml |
| 33 | +│ │ ├── helix56-v413.yaml |
| 34 | +│ │ ├── kustomization.yaml <3> |
| 35 | +│ │ ├── ns.yaml |
| 36 | +│ │ └── source-crs/ <4> |
| 37 | +│ └── version_4.14 <2> |
| 38 | +│ ├── common-ranGen.yaml |
| 39 | +│ ├── group-du-sno-ranGen.yaml |
| 40 | +│ ├── group-du-sno-validator-ranGen.yaml |
| 41 | +│ ├── helix56-v414.yaml |
| 42 | +│ ├── kustomization.yaml <3> |
| 43 | +│ ├── ns.yaml |
| 44 | +│ └── source-crs/ <4> |
| 45 | +└── siteconfig |
| 46 | + ├── kustomization.yaml |
| 47 | + ├── version_4.13 |
| 48 | + │ ├── helix56-v413.yaml |
| 49 | + │ ├── kustomization.yaml |
| 50 | + │ ├── extra-manifest/ <5> |
| 51 | + │ └── custom-manifest/ <6> |
| 52 | + └── version_4.14 |
| 53 | + ├── helix57-v414.yaml |
| 54 | + ├── kustomization.yaml |
| 55 | + ├── extra-manifest/ <5> |
| 56 | + └── custom-manifest/ <6> |
| 57 | + |
| 58 | +---- |
| 59 | +<1> Create a top-level `kustomization` yaml file. |
| 60 | +<2> Create the version-specific directories within the custom `/policygentemplates` directory. |
| 61 | +<3> Create a `kustomization.yaml` file for each version. |
| 62 | +<4> Create a `source-crs` directory for each version to contain reference CRs from the `ztp-site-generate` container. |
| 63 | +<5> Create a directory within the custom `/siteconfig` directory to contain extra manifests from the `ztp-site-generate` container. |
| 64 | +<6> Create a folder to hold custom CRs. |
| 65 | ++ |
| 66 | +[NOTE] |
| 67 | +==== |
| 68 | +In the previous example, each version subdirectory in the custom `/siteconfig` directory contains two further subdirectories, one containing the reference manifests copied from the container, the other for custom manifests that you provide. |
| 69 | +The names assigned to those directories are examples. |
| 70 | +If you use custom CRs, the last directory listed under `extraManifests.searchPaths` in the `SiteConfig` CR must be the directory containing custom CRs. |
| 71 | +==== |
| 72 | +
|
| 73 | +. Edit the `SiteConfig` CR to include the search paths of any directories you have created. |
| 74 | +The first directory that is listed under `extraManifests.searchPaths` must be the directory containing the reference manifests. |
| 75 | +Consider the order in which the directories are listed. |
| 76 | +In cases where directories contain files with the same name, the file in the final directory takes precedence. |
| 77 | ++ |
| 78 | +.Example SiteConfig CR |
| 79 | ++ |
| 80 | +[source,yaml] |
| 81 | +---- |
| 82 | +extraManifests: |
| 83 | + searchPaths: |
| 84 | + - extra-manifest/ <1> |
| 85 | + - custom-manifest/ <2> |
| 86 | +---- |
| 87 | +<1> The directory containing the reference manifests must be listed first under `extraManifests.searchPaths`. |
| 88 | +<2> If you are using custom CRs, the last directory listed under `extraManifests.searchPaths` in the `SiteConfig` CR must be the directory containing those custom CRs. |
| 89 | + |
| 90 | +. Edit the top-level `kustomization.yaml` file to control which {product-title} versions are active. The following is an example of a `kustomization.yaml` file at the top level: |
| 91 | ++ |
| 92 | +[source,yaml] |
| 93 | +---- |
| 94 | +resources: |
| 95 | +- version_4.13 <1> |
| 96 | +#- version_4.14 <2> |
| 97 | +---- |
| 98 | +<1> Activate version 4.13. |
| 99 | +<2> Use comments to deactivate a version. |
0 commit comments