|
| 1 | +:_content-type: PROCEDURE |
| 2 | +:stylesheet: mystyles.css |
| 3 | +:myfunctionone: maintaining_operator_graphs |
| 4 | + |
| 5 | +[id="maintaining_operator_graphs_{context}"] |
| 6 | += Maintaining operator graphs using the information on the File-based catalogs |
| 7 | +File-based catalogs (FBC) provide a streamlined approach to storing and distributing metadata about operators written for the Operator Lifecycle Manager (OLM) and can be built and distributed uisng {ProductName}. You can use {ProductName} to build, test, and release multiple components from a single FBC repo. Here release means that {ProductName} releases an FBC image to the Red Hat’s public index. |
| 8 | + |
| 9 | +File-based catalogs simplify the management of graph updates, offering enhanced control and ownership of operator graphs. With a choice of JSON or YAML formats, File-based catalogs ensure backward compatibility while optimizing efficiency. |
| 10 | + |
| 11 | +The advantages it offers are: |
| 12 | + |
| 13 | +* *Enhance control and simplify graph updates:* With FBC, graph updates are consolidated into a single catalog file. This eliminates the need for iterative updates and simplifies the management of complex graphs. Users can easily manipulate and control their graphs by working with a centralized catalog file. |
| 14 | + |
| 15 | +* *Convenient management and flexibility:* Compared to SQLite, FBC offers a more convenient solution. Rather than adding one set of graph updates at a time, users can define all updates in one place using File-based catalogs. This centralized management capability simplifies the process and improves overall efficiency. |
| 16 | + |
| 17 | +* *Improved ownership and analysis:* FBC provides users with improved ownership and control over their graphs. They offer a clean and declarative template that facilitates comprehensive analysis and sanity checks. Users can easily determine upgrade possibilities and recover from error states, no longer relying on limited configuration options found in localized CSV files. |
| 18 | + |
| 19 | + |
| 20 | +For additional information, see link:https://olm.operatorframework.io/docs/reference/file-based-catalogs/[File based Catalog]. |
| 21 | + |
| 22 | +== Setting up an FBC Compatible git repository |
| 23 | + |
| 24 | +An FBC-compatible git repository has: |
| 25 | + |
| 26 | +* A Docker file at the root of the FBC repository. This file has the `ose-operator-registry` binary images. |
| 27 | +A `yaml` file (for example, `catalog-config.yml`) that targets different Red Hat OpenShift Container Platform (OCP) versions. This `yaml` file contains important metadata of the operator. |
| 28 | + |
| 29 | ++ |
| 30 | +*Example:* |
| 31 | + |
| 32 | ++ |
| 33 | +[source,yaml] |
| 34 | +---- |
| 35 | +schema: olm.composite.catalogs |
| 36 | +catalogs: |
| 37 | + - name: "4.13" <1> |
| 38 | + destination: |
| 39 | + baseImage: registry.redhat.io/openshift4/ose-operator-registry:v4.13 <2> |
| 40 | + workingDir: . |
| 41 | + builders: |
| 42 | + - olm.builder.basic |
| 43 | + - name: "4.12" |
| 44 | + destination: |
| 45 | + baseImage: registry.redhat.io/openshift4/ose-operator-registry:v4.12 This template can be hosted |
| 46 | + workingDir: . |
| 47 | + builders: |
| 48 | + - olm.builder.basic |
| 49 | +---- |
| 50 | +<1> The OCP version. |
| 51 | +<2> The binary image that the system uses to build the FBC fragments. |
| 52 | + |
| 53 | + |
| 54 | +* For every targeted OCP version, you should have a directory with a `devfile` that {ProductName} uses to detect the type of component. It also contains information about how to set up a build. |
| 55 | + |
| 56 | ++ |
| 57 | +*Example:* |
| 58 | + |
| 59 | ++ |
| 60 | +[source,yaml] |
| 61 | +---- |
| 62 | +schemaVersion: 2.2.0 |
| 63 | +metadata: |
| 64 | + name: fbc-4.12 |
| 65 | + displayName: FBC 4.12 |
| 66 | + description: 'File based catalog' |
| 67 | + language: fbc <1> |
| 68 | + provider: Red Hat |
| 69 | +components: |
| 70 | + - name: image-build |
| 71 | + image: |
| 72 | + imageName: "" |
| 73 | + dockerfile: |
| 74 | + uri: catalog.Dockerfile |
| 75 | + buildContext: "4.12" |
| 76 | + - name: kubernetes |
| 77 | + kubernetes: |
| 78 | + inlined: placeholder |
| 79 | + attributes: |
| 80 | + deployment/container-port: 50051 |
| 81 | + deployment/cpuRequest: "100m" |
| 82 | + deployment/memoryRequest: 512Mi |
| 83 | + deployment/replicas: 1 |
| 84 | + deployment/storageRequest: "0" |
| 85 | +commands: |
| 86 | + - id: build-image |
| 87 | + apply: |
| 88 | + component: image-build" |
| 89 | +---- |
| 90 | +<1> Indicates the component that {ProductName} builds. |
| 91 | + |
| 92 | +== Adding a component |
| 93 | +Users should manage all the FBC components through a single application. This centralized management enables synchronized updates for graphs across all OpenShift versions. |
| 94 | + |
| 95 | +.Prerequisites |
| 96 | + |
| 97 | +* You have access to link:https://console.redhat.com/beta/hac/application-pipeline[App Studio]. |
| 98 | +* You have FBC compatible git repository. |
| 99 | +* You have to link:https://redhat-appstudio.github.io/docs.appstudio.io/Documentation/main/how-to-guides/Import-code/proc_importing_code/#creating-a-red-hat-container-registry-token[create a Red Hat Container Registry token]. |
| 100 | + |
| 101 | +.Procedures |
| 102 | + |
| 103 | +. Go to App Studio and select Create application. |
| 104 | +. In the *Git repository URL* field, enter the URL of your FBC-compatible Git repository. |
| 105 | +. Select *Import code*. The system displays the Configure your components for deployment page. |
| 106 | +. Disable the Default build pipeline. |
| 107 | +. In the Secrets section, select *Add secret*. |
| 108 | +. From the *Secret type* dropdown list, select *Image pull secret*. |
| 109 | +. In the *Select or enter name*, enter *registry-redhat-io-docker*. |
| 110 | +. In the *Value* field, copy paste or upload the downloaded secret. |
| 111 | +. Select *Create*. |
| 112 | +. Select *Create application*. The system displays a Manage build pipelines pop-up and sends a pull request. |
| 113 | +. Select Merge in GitHub. |
| 114 | +. In GitHub, merge the pull request from the “red-hat-trusted-app-pipeline” bot. |
| 115 | +. Let {ProductName} complete PipelineRun for the upgraded build pipeline. |
| 116 | + |
| 117 | +.Verification |
| 118 | + |
| 119 | +. Go to *Activity > Pipeline* runs. |
| 120 | + |
| 121 | +. Select the most recent *PipelineRun*. |
| 122 | + |
| 123 | +. View the +++ <span class="popup"><code>fbc-label-check</code><span class="popuptext">Ensures that FBC image have all necessary labels.</span> </span>, <span class="popup"><code>fbc-validate</code><span class="popuptext">Checks the existence and functionality of binaries, and runs validation on configs within the image.</span> </span>, and the <code>fbc-related-image-check</code> task within the build pipeline. Ensure that the build process is executing these tasks and not indicating a “skip checks” status. If these tasks show a green checkmark, it indicates that the build process has validated the fbc components against an existing link:https://enterprisecontract.dev/docs/ec-policies/release_policy.html#labels_package[Enterprise Contract] policy. However, if they do not show a green checkmark, it indicates some potential issues in FBC components. +++ |
| 124 | + |
| 125 | +NOTE: We now have the image now, next step is to release the image for which we need to set up the workspace. |
| 126 | + |
| 127 | +== Setting up workspaces to release an FBC application |
| 128 | + |
| 129 | +Two teams work together to release an application: |
| 130 | + |
| 131 | +* *Development team*- The team that develops and supports the application in a pre-production environment. |
| 132 | +* *Managed environment team* - The team that supports the production instance of that application. |
| 133 | + |
| 134 | +To release an application to a managed environment, the development team creates a `ReleasePlan` object in the developer workspace. The `ReleasePlan` object includes a reference to the application that the development team wants to release, along with the namespace and workspace where the application is supposed to release. |
| 135 | + |
| 136 | +=== Creating a ReleasePlan object |
| 137 | + |
| 138 | +.Prerequisites |
| 139 | + |
| 140 | +* You have an existing Development and Managed workspace. |
| 141 | +* You have installed `oc`. |
| 142 | +* You have completed the steps listed in the link:https://redhat-appstudio.github.io/docs.appstudio.io/Documentation/main/getting-started/getting_started_in_cli/[Getting started in the CLI] page. |
| 143 | + |
| 144 | +.Procedures |
| 145 | + |
| 146 | +* In the development workspace, create a `release_plan.yaml` object by running: `oc apply -f releaseplan.yaml -n dev`. It add the required configuration to your workspace that is needed to execute a release pipeline. |
| 147 | + |
| 148 | ++ |
| 149 | +[source,yaml] |
| 150 | +---- |
| 151 | +apiVersion: appstudio.redhat.com/v1alpha1 |
| 152 | +kind: ReleasePlan <1> |
| 153 | +metadata: |
| 154 | + labels: |
| 155 | + release.appstudio.openshift.io/auto-release: 'true' |
| 156 | + release.appstudio.openshift.io/standing-attribution: 'true' |
| 157 | +name: manual-fbc-release <2> |
| 158 | +spec: |
| 159 | + application: fbc-example <3> |
| 160 | + displayName: manual-fbc-release |
| 161 | + target: managed-release-team-tenant <4> |
| 162 | +---- |
| 163 | +<1> The name of the resource that you are creating. |
| 164 | +<2> The name of the release plan. |
| 165 | +<3> The name of the application that you want to deploy to the managed workspace. |
| 166 | +<4> The workspace to which the system deploys the application. This workspace is created by the Managed environment team (for example, your organization’s SRE team) |
| 167 | + |
| 168 | +.Verification |
| 169 | + |
| 170 | +. Browse the application you are creating. |
| 171 | +. <More information to be added> |
| 172 | + |
| 173 | + |
| 174 | +== Additional information |
| 175 | +For information about releasing an Application to production, see link:https://redhat-appstudio.github.io/docs.appstudio.io/Documentation/main/how-to-guides/proc_release_application/[Releasing an application] |
0 commit comments