|
| 1 | +:_mod-docs-content-type: PROCEDURE |
| 2 | + |
| 3 | +[id="proc-setting-up-openshift-ai-connector-for-rhdh-with-rhoai_{context}"] |
| 4 | += Setting up {openshift-ai-connector-name} with {rhoai-brand-name} |
| 5 | + |
| 6 | +The installation of the {openshift-ai-connector-name} requires manual updates to {product-very-short}-related Kubernetes resources. |
| 7 | + |
| 8 | +.{rhoai-short} Prerequisites |
| 9 | + |
| 10 | +* To import model cards from the model catalog into TechDocs, you must use {rhoai-short} 2.25. |
| 11 | ++ |
| 12 | +[NOTE] |
| 13 | +==== |
| 14 | +If you upgraded to {rhoai-short} 2.25 from an earlier version, you must manually enable the model catalog dashboard and model registry before you can import model cards. |
| 15 | +==== |
| 16 | + |
| 17 | +* If you used the model catalog in earlier versions of {rhoai-short}, TechDocs propagation does not work for any models you registered into the model registry while at those earlier versions; only models registered into model registry from a {rhoai-short} 2.25 model catalog have their model cards transferred to {product-very-short} as TechDocs. |
| 18 | + |
| 19 | +* For the rest of the features, version 2.20 or later suffices. Enabling model registry and its associated dashboard allows for a user experience that more directly allows for customizing AI Model metadata. |
| 20 | +For best overall experience, {rhoai-short} 2.25 is recommended. |
| 21 | + |
| 22 | +For more details, see {rhoai-docs-link}/enabling_the_model_registry_component/index[Enabling the model registry component]. |
| 23 | + |
| 24 | +.Procedure |
| 25 | + |
| 26 | +. Configure {rhoai-short}-related RBAC and credentials. |
| 27 | +A Kubernetes `ServiceAccount` and a `service-account-token` Secret are required for the connector to retrieve data from {rhoai-short}. The following resources must be created, replacing namespace names (`ai-rhdh` for {product-very-short}, `rhoai-model-registries` for {rhoai-short}) as needed: |
| 28 | +** `ServiceAccount` (`rhdh-rhoai-connector`). For example: |
| 29 | ++ |
| 30 | +[source,yaml] |
| 31 | +---- |
| 32 | +apiVersion: v1 |
| 33 | +kind: ServiceAccount |
| 34 | +metadata: |
| 35 | + name: rhdh-rhoai-connector |
| 36 | + namespace: ai-rhdh |
| 37 | +---- |
| 38 | +** `ClusterRole` and `ClusterRoleBinding` (`rhdh-rhoai-connector`) to allow access to OCP resources like `routes`, `services`, and `inferenceservices`. For example: |
| 39 | ++ |
| 40 | +[source,yaml] |
| 41 | +---- |
| 42 | +# Example for `ClusterRole` |
| 43 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 44 | +kind: ClusterRole |
| 45 | +metadata: |
| 46 | + name: rhdh-rhoai-connector |
| 47 | + annotations: |
| 48 | + argocd.argoproj.io/sync-wave: "0" |
| 49 | +rules: |
| 50 | + - apiGroups: |
| 51 | + - apiextensions.k8s.sio |
| 52 | + resources: |
| 53 | + - customresourcedefinitions |
| 54 | + verbs: |
| 55 | + - get |
| 56 | + - apiGroups: |
| 57 | + - route.openshift.io |
| 58 | + resources: |
| 59 | + - routes |
| 60 | + verbs: |
| 61 | + - get |
| 62 | + - list |
| 63 | + - watch |
| 64 | + - apiGroups: [""] |
| 65 | + resources: |
| 66 | + - serviceaccounts |
| 67 | + - services |
| 68 | + verbs: |
| 69 | + - get |
| 70 | + - list |
| 71 | + - watch |
| 72 | +
|
| 73 | + - apiGroups: ["serving.kserve.io"] |
| 74 | + resources: ["inferenceservices"] |
| 75 | + verbs: ["get", "list", "watch"] |
| 76 | +---- |
| 77 | ++ |
| 78 | +[source,yaml] |
| 79 | +---- |
| 80 | +# Example for `ClusterRoleBinding` |
| 81 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 82 | +kind: ClusterRoleBinding |
| 83 | +metadata: |
| 84 | + name: rhdh-rhoai-connector |
| 85 | +roleRef: |
| 86 | + apiGroup: rbac.authorization.k8s.io |
| 87 | + kind: ClusterRole |
| 88 | + name: rhdh-rhoai-connector |
| 89 | +subjects: |
| 90 | + - kind: ServiceAccount |
| 91 | + name: rhdh-rhoai-connector |
| 92 | + namespace: ai-rhdh |
| 93 | +---- |
| 94 | +** `Role` and `RoleBinding` to allow ConfigMap updates within the {product-very-short} namespace. For example: |
| 95 | ++ |
| 96 | +[source,yaml] |
| 97 | +---- |
| 98 | +# Example for `Role` |
| 99 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 100 | +kind: Role |
| 101 | +metadata: |
| 102 | + name: rhdh-rhoai-connector |
| 103 | + namespace: ai-rhdh |
| 104 | +rules: |
| 105 | + - apiGroups: [""] |
| 106 | + resources: ["configmaps"] |
| 107 | + verbs: ["get", "list", "watch", "create", "update", "patch"] |
| 108 | +---- |
| 109 | ++ |
| 110 | +[source,yaml] |
| 111 | +---- |
| 112 | +# Example for `RoleBinding` |
| 113 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 114 | +kind: RoleBinding |
| 115 | +metadata: |
| 116 | + name: rhdh-rhoai-dashboard-permissions |
| 117 | + namespace: rhoai-model-registries |
| 118 | +roleRef: |
| 119 | + apiGroup: rbac.authorization.k8s.io |
| 120 | + kind: Role |
| 121 | + name: registry-user-modelregistry-public |
| 122 | +subjects: |
| 123 | + - apiGroup: rbac.authorization.k8s.io |
| 124 | + kind: Group |
| 125 | + name: system:serviceaccounts:ai-rhdh |
| 126 | +---- |
| 127 | +** `RoleBinding` in the {rhoai-short} namespace to grant the {product-very-short} `ServiceAccount` read permissions to the model registry data (binding to `registry-user-modelregistry-public`). |
| 128 | ++ |
| 129 | +[source,yaml] |
| 130 | +---- |
| 131 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 132 | +kind: RoleBinding |
| 133 | +metadata: |
| 134 | + name: rhdh-rhoai-connector |
| 135 | + namespace: ai-rhdh |
| 136 | +roleRef: |
| 137 | + apiGroup: rbac.authorization.k8s.io |
| 138 | + kind: Role |
| 139 | + name: rhdh-rhoai-connector |
| 140 | +subjects: |
| 141 | + - kind: ServiceAccount |
| 142 | + name: rhdh-rhoai-connector |
| 143 | + namespace: ai-rhdh |
| 144 | +---- |
| 145 | +** Secret (`rhdh-rhoai-connector-token`) of type `kubernetes.io/service-account-token` that goes along with the `rhdh-rhoai-connector` `ServiceAccount`. |
| 146 | ++ |
| 147 | +[source,yaml] |
| 148 | +---- |
| 149 | +apiVersion: v1 |
| 150 | +kind: Secret |
| 151 | +metadata: |
| 152 | + name: rhdh-rhoai-connector-token |
| 153 | + namespace: ai-rhdh |
| 154 | + annotations: |
| 155 | + kubernetes.io/service-account.name: rhdh-rhoai-connector |
| 156 | +type: kubernetes.io/service-account-token |
| 157 | +---- |
| 158 | + |
| 159 | +. Update your {product-very-short} dynamic plugin configuration. |
| 160 | +The {product-very-short} Pod requires two dynamic plugins. |
| 161 | +.. In your {product-very-short} dynamic plugins ConfigMap, add the following code: |
| 162 | ++ |
| 163 | +[source,yaml] |
| 164 | +---- |
| 165 | +plugins: |
| 166 | + - disabled: false |
| 167 | + package: oci://ghcr.io/redhat-developer/rhdh-plugin-export-overlays/red-hat-developer-hub-backstage-plugin-catalog-backend-module-model-catalog:bs_1.42.5__0.7.0!red-hat-developer-hub-backstage-plugin-catalog-backend-module-model-catalog |
| 168 | + - disabled: false |
| 169 | + package: oci://ghcr.io/redhat-developer/rhdh-plugin-export-overlays/red-hat-developer-hub-backstage-plugin-catalog-techdoc-url-reader-backend:bs_1.42.5__0.3.0!red-hat-developer-hub-backstage-plugin-catalog-techdoc-url-reader-backend |
| 170 | +---- |
| 171 | + |
| 172 | +. Add the `Connector` sidecar containers to the {product-very-short} Pod. |
| 173 | +** If {product-very-short} was installed using the Operator, modify your {product-very-short} custom resource (CR) instance. |
| 174 | +** If {product-very-short} was installed using the Helm charts, modify the *Deployment* specification. |
| 175 | + |
| 176 | +. The system relies on three sidecar containers ({openshift-ai-connector-name}) running alongside the `backstage-backend` container. Add these sidecar containers to your configuration referencing the `rhdh-rhoai-connector-token` Secret: |
| 177 | +** `location`: Provides the REST API for {product-very-short} plugins to fetch model metadata. |
| 178 | +** `storage-rest`: Maintains a cache of AI Model metadata in a ConfigMap called `bac-import-model`. |
| 179 | +** `rhoai-normalizer`: Acts as a Kubernetes controller and {rhoai-short} client, normalizing {rhoai-short} metadata for the connector. The following code block is an example: |
| 180 | ++ |
| 181 | +[source,yaml] |
| 182 | +---- |
| 183 | +spec: |
| 184 | + template: |
| 185 | + spec: |
| 186 | + containers: |
| 187 | + - name: backstage-backend |
| 188 | + - env: |
| 189 | + - name: NORMALIZER_FORMAT |
| 190 | + value: JsonArrayFormat |
| 191 | + - name: POD_IP |
| 192 | + valueFrom: |
| 193 | + fieldRef: |
| 194 | + fieldPath: status.podIP |
| 195 | + - name: POD_NAMESPACE |
| 196 | + valueFrom: |
| 197 | + fieldRef: |
| 198 | + fieldPath: metadata.namespace |
| 199 | + envFrom: |
| 200 | + - secretRef: |
| 201 | + name: rhdh-rhoai-connector-token |
| 202 | + image: quay.io/redhat-ai-dev/model-catalog-location-service@sha256:4f6ab6624a29f627f9f861cfcd5d18177d46aa2c67a81a75a1502c49bc2ff012 |
| 203 | +
|
| 204 | + imagePullPolicy: Always |
| 205 | + name: location |
| 206 | + ports: |
| 207 | + - containerPort: 9090 |
| 208 | + name: location |
| 209 | + protocol: TCP |
| 210 | + volumeMounts: |
| 211 | + - mountPath: /opt/app-root/src/dynamic-plugins-root |
| 212 | + name: dynamic-plugins-root |
| 213 | + workingDir: /opt/app-root/src |
| 214 | + - env: |
| 215 | + - name: NORMALIZER_FORMAT |
| 216 | + value: JsonArrayFormat |
| 217 | + - name: STORAGE_TYPE |
| 218 | + value: ConfigMap |
| 219 | + - name: BRIDGE_URL |
| 220 | + value: http://localhost:9090 |
| 221 | + - name: POD_IP |
| 222 | + valueFrom: |
| 223 | + fieldRef: |
| 224 | + fieldPath: status.podIP |
| 225 | + - name: POD_NAMESPACE |
| 226 | + valueFrom: |
| 227 | + fieldRef: |
| 228 | + fieldPath: metadata.namespace |
| 229 | + envFrom: |
| 230 | + - secretRef: |
| 231 | + name: rhdh-rhoai-connector-token |
| 232 | + image: quay.io/redhat-ai-dev/model-catalog-storage-rest@sha256:398095e7469e86d84b1196371286363f4b7668aa3e26370b4d78cb8d4ace1dc9 |
| 233 | +
|
| 234 | + imagePullPolicy: Always |
| 235 | + name: storage-rest |
| 236 | + volumeMounts: |
| 237 | + - mountPath: /opt/app-root/src/dynamic-plugins-root |
| 238 | + name: dynamic-plugins-root |
| 239 | + workingDir: /opt/app-root/src |
| 240 | + - env: |
| 241 | + - name: NORMALIZER_FORMAT |
| 242 | + value: JsonArrayFormat |
| 243 | + - name: POD_IP |
| 244 | + valueFrom: |
| 245 | + fieldRef: |
| 246 | + fieldPath: status.podIP |
| 247 | + - name: POD_NAMESPACE |
| 248 | + valueFrom: |
| 249 | + fieldRef: |
| 250 | + fieldPath: metadata.namespace |
| 251 | + envFrom: |
| 252 | + - secretRef: |
| 253 | + name: rhdh-rhoai-connector-token |
| 254 | + image: quay.io/redhat-ai-dev/model-catalog-rhoai-normalizer@sha256:fe6c05d57495d6217c4d584940ec552c3727847ff60f39f5d04f94be024576d8 |
| 255 | +
|
| 256 | + imagePullPolicy: Always |
| 257 | + name: rhoai-normalizer |
| 258 | + volumeMounts: |
| 259 | + - mountPath: /opt/app-root/src/dynamic-plugins-root |
| 260 | + name: dynamic-plugins-root |
| 261 | + workingDir: /opt/app-root/src |
| 262 | +---- |
| 263 | + |
| 264 | +. Enable `Connector` in your `{product-very-short}{my-app-config-file}` file. |
| 265 | +In your `{backstage} `app-config.extra.yaml` file, configure `Entity Provider` under the `catalog.providers` section: |
| 266 | ++ |
| 267 | +[source,yaml] |
| 268 | +---- |
| 269 | +providers: |
| 270 | + modelCatalog: |
| 271 | + development: |
| 272 | + baseUrl: http://localhost:9090 |
| 273 | +---- |
| 274 | + |
| 275 | +where: |
| 276 | + |
| 277 | +`modelCatalog`:: Specifies the name of the provider. |
| 278 | +`development`:: Defines future connector capability beyond a single `baseUrl`. |
| 279 | +`baseUrl`:: For Developer Preview, this value is the only one supported. Future releases might support external routes. |
0 commit comments