-
Notifications
You must be signed in to change notification settings - Fork 35
app-catalog: Support serviceproxy and support helm repos in the catalog #304
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
illume
merged 3 commits into
headlamp-k8s:main
from
oracle-cne:serviceproxy-app-catalog
Oct 15, 2025
+985
−229
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
ed3bef9
app-catalog: Support serviceproxy and support helm repos in the catalog
muraliinformal 31ea85f
app-catalog: Convert global constants with shared contants and addres…
muraliinformal b8c81a1
app-catalog, doc: Update README to include supported labels and annot…
muraliinformal 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
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,51 @@ | ||
/** | ||
* Configuration object for chart settings. | ||
* | ||
* @property chartURLPrefix - The prefix for chart URLs. | ||
* @property chartProfile - The profile for charts. | ||
* @property chartValuesPrefix - The prefix for chart values. | ||
* @property catalogNamespace - The namespace for the catalog. | ||
* @property catalogName - The name of the catalog. | ||
*/ | ||
export type ChartConfig = { | ||
chartURLPrefix: string; | ||
chartProfile: string; | ||
chartValuesPrefix: string; | ||
catalogNamespace: string; | ||
catalogName: string; | ||
}; | ||
|
||
const catalogConfig: ChartConfig = { | ||
chartURLPrefix: '', | ||
chartProfile: '', | ||
chartValuesPrefix: '', | ||
catalogNamespace: '', | ||
catalogName: '', | ||
}; | ||
|
||
/** | ||
* Sets the prefix for chart values in the catalog configuration. | ||
* @param valuesPrefix - The prefix to be used for chart values. | ||
* @param valuesPrefix - The new prefix for chart values. | ||
*/ | ||
export function setChartValuesPrefix(valuesPrefix: string) { | ||
catalogConfig.chartValuesPrefix = valuesPrefix; | ||
} | ||
|
||
/** | ||
* Updates the catalog configuration with the provided partial configuration. | ||
* | ||
* @param update - A partial ChartConfig object containing the properties to be updated. | ||
*/ | ||
export function setCatalogConfig(update: Partial<ChartConfig>) { | ||
Object.assign(catalogConfig, update); | ||
} | ||
|
||
/** | ||
* Retrieves the current catalog configuration. | ||
* | ||
* @returns {Readonly<ChartConfig>} The current catalog configuration. | ||
*/ | ||
export function getCatalogConfig(): Readonly<ChartConfig> { | ||
return catalogConfig; | ||
} |
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,74 @@ | ||
import { QueryParameters, request } from '@kinvolk/headlamp-plugin/lib/ApiProxy'; | ||
import { ChartsList } from '../components/charts/List'; | ||
import { COMMUNITY_REPO, VANILLA_HELM_REPO } from '../constants/catalog'; | ||
import { setCatalogConfig } from './catalogConfig'; | ||
|
||
const SERVICE_ENDPOINT = '/api/v1/services'; | ||
const LABEL_CATALOG = 'catalog.headlamp.dev/is-catalog'; | ||
|
||
/** | ||
* Resets the global variables used for chart configuration. | ||
* Reset the prefix and profile, to switch between different catalogs | ||
* @param metadataName - The metadata name of the catalog. | ||
* @param namespace - The namespace of the catalog. | ||
* @param prefix - The prefix for chart URLs. | ||
* @param profile - The profile for charts. | ||
* @param valuesPrefix - The prefix for chart values. | ||
*/ | ||
export function ResetGlobalVars( | ||
metadataName: string, | ||
namespace: string, | ||
prefix: string, | ||
profile: string, | ||
valuesPrefix: string | ||
) { | ||
setCatalogConfig({ | ||
chartURLPrefix: prefix, | ||
chartProfile: profile, | ||
chartValuesPrefix: valuesPrefix, | ||
catalogNamespace: namespace, | ||
catalogName: metadataName, | ||
}); | ||
} | ||
|
||
/** | ||
* Resets the global variables and renders the ChartsList component for a Helm chart. | ||
* | ||
* @param metadataName - The metadata name of the catalog. | ||
* @param namespace - The namespace of the catalog. | ||
* @param chartUrl - The URL of the Helm chart repository. | ||
* | ||
* @returns The ChartsList component. | ||
*/ | ||
export function HelmChartList(metadataName: string, namespace: string, chartUrl: string) { | ||
ResetGlobalVars(metadataName, namespace, chartUrl, VANILLA_HELM_REPO, `values`); | ||
return <ChartsList />; | ||
} | ||
|
||
/** | ||
* Resets the global variables and renders the ChartsList component for a community chart(artifacthub). | ||
* | ||
* @param metadataName - The metadata name of the catalog. | ||
* @param namespace - The namespace of the catalog. | ||
* @param chartUrl - The URL of the community chart repository. | ||
* | ||
* @returns The ChartsList component for the community chart. | ||
*/ | ||
export function CommunityChartList(metadataName: string, namespace: string, chartUrl: string) { | ||
ResetGlobalVars(metadataName, namespace, chartUrl, COMMUNITY_REPO, ''); | ||
return <ChartsList />; | ||
} | ||
|
||
/** | ||
* Fetches the list of catalogs in the cluster. | ||
* It uses a query parameter to fetch services with the given label. | ||
* | ||
* @returns A promise resolving to the response from the request. | ||
*/ | ||
export function fetchCatalogs() { | ||
// Use query parameter to fetch the services with label catalog.headlamp.dev/is-catalog | ||
const queryParam: QueryParameters = { | ||
labelSelector: LABEL_CATALOG + '=', | ||
}; | ||
return request(SERVICE_ENDPOINT, {}, true, true, queryParam).then(response => response); | ||
} |
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.