-
Notifications
You must be signed in to change notification settings - Fork 120
feat: Add support for namespacedcloudprofiles #2691
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
Open
klocke-io
wants to merge
4
commits into
master
Choose a base branch
from
feature/namespaced-cloud-profile-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
32b2081
backend: add namespaced cloudprofile support with packages and chart …
klocke-io 6d52a64
frontend: support namespaced cloudprofiles including all-project scope
klocke-io b6bbcc0
chore: fix fixture naming
klocke-io eef1d61
feat: add integrity verification for namespaced cloud profile rehydra…
klocke-io 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file added
BIN
+85.2 KB
.yarn/cache/@dmsnell-diff-match-patch-npm-1.1.0-021308d314-8547bf4a62.zip
Binary file not shown.
Binary file not shown.
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,144 @@ | ||
| // | ||
| // SPDX-FileCopyrightText: 2026 SAP SE or an SAP affiliate company and Gardener contributors | ||
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
|
|
||
| 'use strict' | ||
|
|
||
| const { cloneDeep, find } = require('lodash') | ||
|
|
||
| function getNamespacedCloudProfile ({ uid, name, namespace, parentName, kind, seedSelector = {} }) { | ||
| return { | ||
| metadata: { | ||
| name, | ||
| namespace, | ||
| uid, | ||
| }, | ||
| spec: { | ||
| parent: { | ||
| kind: 'CloudProfile', | ||
| name: parentName, | ||
| }, | ||
| kubernetes: { | ||
| versions: [ | ||
| { | ||
| version: '1.31.1', | ||
| expirationDate: '2025-02-28T23:59:59Z', | ||
| }, | ||
| ], | ||
| }, | ||
| machineTypes: [ | ||
| { | ||
| name: `${kind}-large`, | ||
| cpu: '4', | ||
| gpu: '0', | ||
| memory: '16Gi', | ||
| usable: true, | ||
| }, | ||
| ], | ||
| }, | ||
| status: { | ||
| cloudProfileSpec: { | ||
| type: kind, | ||
| seedSelector, | ||
| kubernetes: { | ||
| versions: [ | ||
| { | ||
| version: '1.31.1', | ||
| expirationDate: '2025-02-28T23:59:59Z', | ||
| }, | ||
| { | ||
| version: '1.30.8', | ||
| }, | ||
| { | ||
| version: '1.29.10', | ||
| }, | ||
| ], | ||
| }, | ||
| machineTypes: [ | ||
| { | ||
| name: `${kind}-large`, | ||
| cpu: '4', | ||
| gpu: '0', | ||
| memory: '16Gi', | ||
| usable: true, | ||
| }, | ||
| { | ||
| name: `${kind}-medium`, | ||
| cpu: '2', | ||
| gpu: '0', | ||
| memory: '8Gi', | ||
| usable: true, | ||
| }, | ||
| ], | ||
| machineImages: [ | ||
| { | ||
| name: 'gardenlinux', | ||
| versions: [ | ||
| { | ||
| version: '15.4.20220818', | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| regions: [ | ||
| { | ||
| name: 'europe-central-1', | ||
| zones: [ | ||
| { | ||
| name: 'europe-central-1a', | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| const namespacedCloudProfileList = [ | ||
| getNamespacedCloudProfile({ | ||
| uid: 1001, | ||
| name: 'custom-cloudprofile-1', | ||
| namespace: 'garden-local', | ||
| parentName: 'local', | ||
| kind: 'local', | ||
| }), | ||
| getNamespacedCloudProfile({ | ||
| uid: 1002, | ||
| name: 'custom-cloudprofile-2', | ||
| namespace: 'garden-local', | ||
| parentName: 'infra1-profileName', | ||
| kind: 'infra1', | ||
| seedSelector: { | ||
| matchLabels: { env: 'dev' }, | ||
| }, | ||
| }), | ||
| getNamespacedCloudProfile({ | ||
| uid: 1003, | ||
| name: 'custom-cloudprofile-3', | ||
| namespace: 'garden-dev', | ||
| parentName: 'infra2-profileName', | ||
| kind: 'infra2', | ||
| }), | ||
| ] | ||
|
|
||
| const namespacedCloudprofiles = { | ||
| create (...args) { | ||
| return getNamespacedCloudProfile(...args) | ||
| }, | ||
| get (namespace, name) { | ||
| return find(this.list(namespace), ['metadata.name', name]) | ||
| }, | ||
| list (namespace) { | ||
| const items = cloneDeep(namespacedCloudProfileList) | ||
| if (!namespace || namespace === '_all') { | ||
| return items | ||
| } | ||
| return items.filter(item => item.metadata.namespace === namespace) | ||
| }, | ||
| reset () {}, | ||
| } | ||
|
|
||
| module.exports = namespacedCloudprofiles |
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,28 @@ | ||
| // | ||
| // SPDX-FileCopyrightText: 2026 SAP SE or an SAP affiliate company and Gardener contributors | ||
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
|
|
||
| // CJS wrapper for the ESM-only jsondiffpatch package. | ||
| // Only the `diff` export is used by the backend. | ||
|
|
||
| // jsondiffpatch ships only ESM. This wrapper is needed so that Jest (which | ||
| // loads the compiled CJS dist) can resolve the package without triggering | ||
| // "Must use import to load ES Module". | ||
| // | ||
| // We expose a lazy async-loader via a sync facade. Because the actual tests | ||
| // for namespacedCloudProfiles run under Vitest (which handles ESM natively), | ||
| // the real jsondiffpatch is never called through this mock in production tests. | ||
| // For Jest-based tests the service module is imported as a side-effect of | ||
| // loading dist/lib/services/index.cjs; those tests mock the service layer and | ||
| // never exercise the diff call directly, so a no-op implementation is fine. | ||
|
|
||
| function diff (left, right) { | ||
| // Minimal no-op diff sufficient for Jest test suite isolation. | ||
| // Real diff logic is exercised in Vitest tests that import ESM directly. | ||
| if (left === right) return undefined | ||
| return { _placeholder: true } | ||
| } | ||
|
|
||
| module.exports = { diff } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use camel case for file like you did with the other files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b6bbcc0
done, thanks for catching it :)