feat: add OpenShift AI inference provider#388
Merged
jeffmaury merged 3 commits intokortex-hub:mainfrom Sep 19, 2025
Merged
Conversation
benoitf
reviewed
Sep 18, 2025
benoitf
approved these changes
Sep 18, 2025
Contributor
benoitf
left a comment
There was a problem hiding this comment.
LGTM. not tested but it won't break anything
simonrey1
reviewed
Sep 19, 2025
simonrey1
reviewed
Sep 19, 2025
simonrey1
reviewed
Sep 19, 2025
simonrey1
reviewed
Sep 19, 2025
simonrey1
reviewed
Sep 19, 2025
| */ | ||
| private async saveConnectionInfo(token: string, baseURL: string): Promise<void> { | ||
| // get existing tokens | ||
| const tokens = (await this.getConnectionInfos()).map(t => `${t.token}|${t.baseURL}`); |
Contributor
There was a problem hiding this comment.
suggestion: introduce intermediate method to avoid doing split then map on the same separator
private async getTokens(): Promise<string[]> {
// get raw string from secret storage
let raw: string | undefined;
try {
raw = await this.secrets.get(TOKENS_KEY);
} catch (err: unknown) {
console.error('OpenShift AI: something went wrong while trying to get tokens from secret storage', err);
}
// if undefined return empty array
if (!raw) return [];
// split raw string by token separator
return raw.split(TOKEN_SEPARATOR)
}
/**
* Get all connection infos from secret storage
* @private
*/
private async getConnectionInfos(): Promise<ConnectionInfo[]> {
return (await this.getTokens()).map(str => {
const [token, baseURL] = str.split(INFO_SEPARATOR);
return {
token,
baseURL,
};
});
}
/**
* Save connection info to secret storage
* @param token
* @param baseURL
* @private
*/
private async saveConnectionInfo(token: string, baseURL: string): Promise<void> {
// get existing tokens
const tokens = await this.getTokens();
// concat new token with existing tokens
const raw = [...tokens, `${token}${INFO_SEPARATOR}${baseURL}`].join(TOKEN_SEPARATOR);
// save to secret storage
await this.secrets.store(TOKENS_KEY, raw);
}
private async removeConnectionInfo(token: string, baseURL: string): Promise<void> {
const connectionInfos = await this.getConnectionInfos();
// filter out the token
const raw = connectionInfos.filter(t => t.token !== token || t.baseURL !== baseURL).join(TOKEN_SEPARATOR);
// save to secret storage
await this.secrets.store(TOKENS_KEY, raw);
}
simonrey1
reviewed
Sep 19, 2025
simonrey1
reviewed
Sep 19, 2025
simonrey1
reviewed
Sep 19, 2025
simonrey1
reviewed
Sep 19, 2025
simonrey1
reviewed
Sep 19, 2025
Fixes kortex-hub#326 Signed-off-by: Jeff MAURY <jmaury@redhat.com>
Signed-off-by: Jeff MAURY <jmaury@redhat.com>
Signed-off-by: Jeff MAURY <jmaury@redhat.com>
benoitf
pushed a commit
that referenced
this pull request
Oct 8, 2025
benoitf
pushed a commit
that referenced
this pull request
Oct 8, 2025
benoitf
pushed a commit
that referenced
this pull request
Oct 8, 2025
benoitf
pushed a commit
that referenced
this pull request
Oct 8, 2025
benoitf
pushed a commit
that referenced
this pull request
Oct 8, 2025
benoitf
pushed a commit
to benoitf/kortex
that referenced
this pull request
Mar 4, 2026
gastoner
pushed a commit
to gastoner/kortex
that referenced
this pull request
Mar 6, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #326