Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 125 additions & 5 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions backend/__fixtures__/cloudprofiles.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function getCloudProfile ({ uid, name, kind, seedSelector = {} }) {
metadata: {
name,
uid,
resourceVersion: String(uid * 100),
},
spec: {
type: kind,
Expand Down
2 changes: 2 additions & 0 deletions backend/__fixtures__/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const resourcequotas = require('./resourcequotas')
const projects = require('./projects')
const serviceaccounts = require('./serviceaccounts')
const cloudprofiles = require('./cloudprofiles')
const namespacedcloudprofiles = require('./namespacedCloudprofiles.cjs')
const nodes = require('./nodes')
const terminals = require('./terminals')
const github = require('./github')
Expand Down Expand Up @@ -58,6 +59,7 @@ const fixtures = {
projects,
serviceaccounts,
cloudprofiles,
namespacedcloudprofiles,
quotas,
controllerregistrations,
resourcequotas,
Expand Down
144 changes: 144 additions & 0 deletions backend/__fixtures__/namespacedCloudprofiles.cjs
Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member Author

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 :)

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
Loading
Loading