-
Notifications
You must be signed in to change notification settings - Fork 119
feat(#4477): add caData, skipTLSVerify to OgxEntityProviderConfig #4574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
dd087e2
feat(#4477): add caData, skipTLSVerify to OgxEntityProviderConfig
fullsend-ai-coder[bot] 049baf1
Update workspaces/boost/app-config.yaml
gabemontero 75fc43a
Update workspaces/boost/app-config.yaml
gabemontero 3871acf
Update workspaces/boost/app-config.yaml
gabemontero 7b8a7b3
Update workspaces/boost/app-config.yaml
gabemontero fce28c6
Update workspaces/boost/app-config.yaml
gabemontero 03280e5
fix(ogx-entity-provider): address review feedback on PR #4574
fullsend-ai-coder[bot] e0c3369
ogx-package-json-fix
gabemontero 05a8a99
openspec/specs and CURRENT.md adjustment
gabemontero 4d0d2db
have invalid PEM fallback to undefined / System CA
gabemontero 1028b29
update JSDoc YAML config example with caData / skip tls
gabemontero File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@red-hat-developer-hub/backstage-plugin-ogx-entity-provider': minor | ||
| --- | ||
|
|
||
| Add per-provider TLS connection settings (`caData` and `skipTLSVerify`) to `OgxEntityProviderConfig` so `OgxModelEntityProvider` can fetch `/v1/models` from OGX endpoints that use a private CA or self-signed certificates. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /* | ||
| * Copyright Red Hat, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| /** | ||
| * Configuration schema for the OGX entity provider module. | ||
| * | ||
| * Declares the config paths read by readOgxEntityProviderConfig so that | ||
| * Backstage validates and enforces visibility on these keys even if | ||
| * the module is loaded independently of boost-backend. | ||
| */ | ||
| export interface Config { | ||
| boost?: { | ||
| /** Entity-provider-specific config (standalone deployment). */ | ||
| entityProviders?: { | ||
| /** OGX entity provider connection. */ | ||
| ogx?: { | ||
| /** | ||
| * Base URL of the OGX API endpoint. | ||
| * @configScope yaml-only | ||
| */ | ||
| baseUrl?: string; | ||
| /** | ||
| * API key for authenticated endpoints. | ||
| * @visibility secret | ||
| */ | ||
| apiKey?: string; | ||
| /** | ||
| * PEM-encoded CA certificate or certificate bundle used to verify the OGX endpoint. | ||
| * @visibility backend | ||
| */ | ||
| caData?: string; | ||
| /** | ||
| * Disable TLS certificate verification. Development use only. | ||
| * @configScope yaml-only | ||
| */ | ||
| skipTLSVerify?: boolean; | ||
| }; | ||
| }; | ||
|
|
||
| /** Provider module config (composed deployment). */ | ||
| providers?: { | ||
| /** OGX provider connection. */ | ||
| ogx?: { | ||
| /** | ||
| * Base URL of the OGX API endpoint. | ||
| * @configScope yaml-only | ||
| */ | ||
| baseUrl?: string; | ||
| /** | ||
| * API key for authenticated endpoints. | ||
| * @visibility secret | ||
| */ | ||
| apiKey?: string; | ||
| /** | ||
| * PEM-encoded CA certificate or certificate bundle used to verify the OGX endpoint. | ||
| * @visibility backend | ||
| */ | ||
| caData?: string; | ||
| /** | ||
| * Disable TLS certificate verification. Development use only. | ||
| * @configScope yaml-only | ||
| */ | ||
| skipTLSVerify?: boolean; | ||
| }; | ||
| }; | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
workspaces/boost/plugins/ogx-entity-provider/src/module.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| /* | ||
| * Copyright Red Hat, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import { ConfigReader } from '@backstage/config'; | ||
|
|
||
| import { readOgxEntityProviderConfig } from './module'; | ||
|
|
||
| describe('readOgxEntityProviderConfig', () => { | ||
| it('reads caData and skipTLSVerify from boost.entityProviders.ogx', () => { | ||
| const config = new ConfigReader({ | ||
| boost: { | ||
| entityProviders: { | ||
| ogx: { | ||
| baseUrl: 'https://ogx.example.com', | ||
| caData: | ||
| '-----BEGIN CERTIFICATE-----\nMIIBxTCC...\n-----END CERTIFICATE-----', | ||
| skipTLSVerify: true, | ||
| }, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| const result = readOgxEntityProviderConfig(config); | ||
|
|
||
| expect(result.baseUrl).toBe('https://ogx.example.com'); | ||
| expect(result.caData).toBe( | ||
| '-----BEGIN CERTIFICATE-----\nMIIBxTCC...\n-----END CERTIFICATE-----', | ||
| ); | ||
| expect(result.skipTLSVerify).toBe(true); | ||
| }); | ||
|
|
||
| it('reads caData and skipTLSVerify from fallback boost.providers.ogx', () => { | ||
| const config = new ConfigReader({ | ||
| boost: { | ||
| providers: { | ||
| ogx: { | ||
| baseUrl: 'https://ogx-fallback.example.com', | ||
| caData: 'PEM-CERT-DATA', | ||
| skipTLSVerify: false, | ||
| }, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| const result = readOgxEntityProviderConfig(config); | ||
|
|
||
| expect(result.baseUrl).toBe('https://ogx-fallback.example.com'); | ||
| expect(result.caData).toBe('PEM-CERT-DATA'); | ||
| expect(result.skipTLSVerify).toBe(false); | ||
| }); | ||
|
|
||
| it('returns undefined for caData and skipTLSVerify when not configured', () => { | ||
| const config = new ConfigReader({ | ||
| boost: { | ||
| entityProviders: { | ||
| ogx: { | ||
| baseUrl: 'http://localhost:8321', | ||
| }, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| const result = readOgxEntityProviderConfig(config); | ||
|
|
||
| expect(result.baseUrl).toBe('http://localhost:8321'); | ||
| expect(result.caData).toBeUndefined(); | ||
| expect(result.skipTLSVerify).toBeUndefined(); | ||
| }); | ||
|
|
||
| it('falls back to localhost when no OGX config is present', () => { | ||
| const config = new ConfigReader({}); | ||
|
|
||
| const result = readOgxEntityProviderConfig(config); | ||
|
|
||
| expect(result.baseUrl).toBe('http://localhost:8321'); | ||
| expect(result.caData).toBeUndefined(); | ||
| expect(result.skipTLSVerify).toBeUndefined(); | ||
| }); | ||
|
|
||
| it('prefers entityProviders.ogx over providers.ogx', () => { | ||
| const config = new ConfigReader({ | ||
| boost: { | ||
| entityProviders: { | ||
| ogx: { | ||
| baseUrl: 'https://primary.example.com', | ||
| caData: 'PRIMARY-CA', | ||
| }, | ||
| }, | ||
| providers: { | ||
| ogx: { | ||
| baseUrl: 'https://fallback.example.com', | ||
| caData: 'FALLBACK-CA', | ||
| }, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| const result = readOgxEntityProviderConfig(config); | ||
|
|
||
| expect(result.baseUrl).toBe('https://primary.example.com'); | ||
| expect(result.caData).toBe('PRIMARY-CA'); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.