Skip to content
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

[DRAFT] Add cloud providers via configuration #1553

Draft
wants to merge 38 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
25753e5
Migrated WIP from enh/configure_cloudprovider to vue3 branch
grolu Sep 5, 2023
c51dba5
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Sep 6, 2023
fd98aff
fixed some issues
grolu Sep 8, 2023
9993beb
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Sep 11, 2023
b4527f8
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Oct 9, 2023
c7cf471
Added known vendor names
grolu Oct 20, 2023
b130779
rm unused action
grolu Oct 20, 2023
ae459ff
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Oct 20, 2023
5969d55
Some lint fixes
grolu Oct 23, 2023
0c773ef
Added documentation
grolu Oct 23, 2023
45a673d
Small fixes
grolu Oct 23, 2023
3cad75d
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Oct 23, 2023
6f251a7
Show cloud profiles without seed in frontend
grolu Dec 4, 2023
2e51cf9
Add custom input fields to create shoot infrastructure card
grolu Dec 4, 2023
e139528
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Dec 7, 2023
88ab096
moved custom fields to dedicated component
grolu Dec 11, 2023
2f6711e
Added simple generic selects
grolu Dec 11, 2023
ec98a0a
Removed logger import
grolu Dec 11, 2023
72208fc
updated tests (no longer filter cloudprofiles without matching seed)
grolu Dec 11, 2023
7a8d167
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Feb 5, 2024
fabc571
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Feb 6, 2024
8a9482e
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Mar 1, 2024
35547f7
updated charts
grolu Mar 1, 2024
0c8e20d
Updated documentation
grolu Mar 4, 2024
34a4285
Optimized documentation
grolu Mar 5, 2024
52f7da2
Further cleanup
grolu Mar 6, 2024
b65d099
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Mar 21, 2024
bbca10c
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Jul 23, 2024
bfe68dd
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Jul 23, 2024
400565e
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Jul 24, 2024
0e88908
Fixed helm template. & tests
grolu Jul 25, 2024
38cffb6
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Aug 6, 2024
a5ba4cc
Some docu fixes
grolu Aug 9, 2024
c8911c3
Some minor fixes
grolu Aug 12, 2024
467f7dd
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Sep 23, 2024
3290653
Fixed lint security warnings
grolu Sep 23, 2024
f04a237
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Oct 23, 2024
d6e5d0a
Merge branch 'master' into enh/configure_cloudprovider_vue3
grolu Nov 13, 2024
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
8 changes: 8 additions & 0 deletions backend/lib/routes/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ function sanitizeFrontendConfig (frontendConfig) {
vendorHints = [],
resourceQuotaHelp = '',
controlPlaneHighAvailabilityHelp = '',
customCloudProviders = {},
} = sanitizedFrontendConfig

convertAndSanitize(alert, 'message')
Expand Down Expand Up @@ -92,5 +93,12 @@ function sanitizeFrontendConfig (frontendConfig) {
convertAndSanitize(vendorHint, 'message')
}

for (const key of Object.keys(customCloudProviders)) {
const secret = _.get(customCloudProviders, [key, 'secret'])
if (secret) {
convertAndSanitize(secret, 'help')
}
}

return sanitizedFrontendConfig
}
13 changes: 1 addition & 12 deletions backend/lib/services/cloudprofiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

const { NotFound, Forbidden } = require('http-errors')
const authorization = require('./authorization')
const logger = require('../logger')
const _ = require('lodash')
const { getCloudProfiles, getVisibleAndNotProtectedSeeds } = require('../cache')

Expand Down Expand Up @@ -65,17 +64,7 @@ exports.list = async function ({ user }) {

const cloudProfiles = getCloudProfiles()
const seeds = getVisibleAndNotProtectedSeeds()
return _
.chain(cloudProfiles)
.map(assignSeedsToCloudProfileIteratee(seeds))
.filter(cloudProfile => {
if (!_.isEmpty(cloudProfile.data.seedNames)) {
return true
}
logger.info(`No matching seed for cloud profile with name ${cloudProfile.metadata.name} found`)
return false
})
.value()
return _.map(cloudProfiles, assignSeedsToCloudProfileIteratee(seeds))
}

exports.read = async function ({ user, name }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,27 @@ exports[`api cloudprofiles should return all cloudprofiles 2`] = `
"name": "infra1-profileName2",
},
},
{
"data": {
"kubernetes": {
"versions": [
{
"version": "1.9.0",
},
{
"version": "1.8.5",
},
],
},
"seedSelector": {},
"type": "infra2",
},
"metadata": {
"cloudProviderKind": "infra2",
"displayName": "infra2-profileName",
"name": "infra2-profileName",
},
},
{
"data": {
"kubernetes": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,115 @@ describe('gardener-dashboard', function () {
})
})

describe('cloudProviderList', function () {
it('should render the template with cloudProviderList', async function () {
const values = {
global: {
dashboard: {
frontendConfig: {
cloudProviderList: [
'foo',
'bar'
]
}
}
}
}
const documents = await renderTemplates(templates, values)
expect(documents).toHaveLength(1)
const [configMap] = documents
const config = yaml.load(configMap.data['config.yaml'])
expect(pick(config, ['frontend.cloudProviderList'])).toMatchSnapshot()
})
})

describe('customCloudProviders', function () {
it('should render the template with customCloudProviders', async function () {
const values = {
global: {
dashboard: {
frontendConfig: {
customCloudProviders: {
fooProvider: {
zoned: false,
shoot: {
createFields: [
{
key: 'selectFoo',
path: 'spec.provider',
hint: 'Select foo value',
label: 'Select Foo',
type: 'select',
validators: {
required: {
type: 'required'
}
},
values: {
cloudprofilePath: 'data.foo',
key: 'name'
}
}
],
specTemplate: {
provider: {
type: 'custom'
}
}
},
secret: {
fields: [
{
key: 'namespace',
hint: 'Enter a valid namespace',
label: 'Namespace',
type: 'text',
validators: {
required: {
type: 'required'
}
}
}
],
help: '#Custom Cloud Provider\nfoo'
}
}
}
}
}
}
}
const documents = await renderTemplates(templates, values)
expect(documents).toHaveLength(1)
const [configMap] = documents
const config = yaml.load(configMap.data['config.yaml'])
expect(pick(config, ['frontend.customCloudProviders'])).toMatchSnapshot()
})
})

describe('vendors', function () {
it('should render the template with vendors', async function () {
const values = {
global: {
dashboard: {
frontendConfig: {
vendors: {
foo: {
icon: 'foo_icon.svg'
}
}
}
}
}
}
const documents = await renderTemplates(templates, values)
expect(documents).toHaveLength(1)
const [configMap] = documents
const config = yaml.load(configMap.data['config.yaml'])
expect(pick(config, ['frontend.vendors'])).toMatchSnapshot()
})
})

describe('knownConditions', function () {
it('should render the template with knownConditions markdown', async function () {
const values = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.global.dashboard.enabled }}
{{- if .Values.global.dashboard.frontendConfig.vendorAssets }}
apiVersion: v1
kind: ConfigMap
metadata:
name: dashboard-vendor-assets
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar to configmap-assets.spec.js, add tests for vendor-assets

namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: gardener-dashboard
app.kubernetes.io/component: dashboard
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
binaryData:
{{- range $file, $content := .Values.global.dashboard.frontendConfig.vendorAssets }}
{{ $file }}: |
{{ $content }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,18 @@ data:
{{- if .Values.global.dashboard.frontendConfig.serviceAccountDefaultTokenExpiration }}
serviceAccountDefaultTokenExpiration: {{ .Values.global.dashboard.frontendConfig.serviceAccountDefaultTokenExpiration }}
{{- end }}
{{- if .Values.global.dashboard.frontendConfig.cloudProviderList }}
cloudProviderList:
{{- range .Values.global.dashboard.frontendConfig.cloudProviderList }}
- {{ . }}
{{- end }}
{{- end }}
{{- if .Values.global.dashboard.frontendConfig.customCloudProviders }}
customCloudProviders: {{ toYaml .Values.global.dashboard.frontendConfig.customCloudProviders | nindent 8 }}
{{- end }}
{{- if .Values.global.dashboard.frontendConfig.vendors }}
vendors: {{ toYaml .Values.global.dashboard.frontendConfig.vendors | nindent 8 }}
{{- end }}
{{- if .Values.global.dashboard.frontendConfig.knownConditions }}
knownConditions: {{ toYaml .Values.global.dashboard.frontendConfig.knownConditions | nindent 8 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ spec:
name: dashboard-assets
defaultMode: 0444
{{- end }}
{{- if .Values.global.dashboard.frontendConfig.vendorAssets }}
- name: vendor-assets
configMap:
name: dashboard-vendor-assets
defaultMode: 0444
{{- end }}
{{- if .Values.global.dashboard.oidc }}
- name: gardener-dashboard-oidc
secret:
Expand Down Expand Up @@ -206,6 +212,10 @@ spec:
- name: assets
mountPath: /app/public/static/assets
{{- end }}
{{- if .Values.global.dashboard.frontendConfig.vendorAssets }}
- name: vendor-assets
mountPath: /app/public/static/vendor-assets
{{- end }}
{{- if .Values.global.dashboard.serviceAccountTokenVolumeProjection.enabled }}
- name: service-account-token
mountPath: /var/run/secrets/projected/serviceaccount
Expand Down
46 changes: 46 additions & 0 deletions charts/gardener-dashboard/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,52 @@ global:
# resourceQuotaHelp:
# text: Help text

# # cloudProviderList - configure available cloud providers. This allows to change order and to add additional (not built-in providers), see also customCloudProviders
# cloudProviderList:
Comment on lines +364 to +365
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# # cloudProviderList - configure available cloud providers. This allows to change order and to add additional (not built-in providers), see also customCloudProviders
# cloudProviderList:
# # cloudProviderList - configure available cloud providers. This allows to change order and to add additional (not built-in providers), see also customCloudProviders
# cloudProviderList:

# - aws
# - custom-provider

# # customCloudProviders - configure additional cloud providers
# customCloudProviders:
# custom-provider:
# zoned: true
# shoot:
# specTemplate: # shoot template for this provider
# provider:
# type: custom-provider
# networking:
# nodes: ${workerCIDR}
# createFields:
# - key: foo
# path: spec.provider.extra
# hint: Enter Additional data
# label: Additional Information
Comment on lines +381 to +383
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# path: spec.provider.extra
# hint: Enter Additional data
# label: Additional Information
# path: spec.provider.extra
# hint: Enter Additional data
# label: Additional Information

# type: text
# validators:
# required:
# type: required
# secret: # secret dialog
# fields:
# - key: user
# hint: Enter a valid user
# label: User
# type: text
# validators:
# required:
# type: required
# validationErrors:
# required: User is required
# help: | # help text for secret dialog
# #Foo Cloud Provider

# # vendors - configure additional or overwrite built-in vendor icons
# vendors:
# custom-provider:
# icon: custom-provider.svg
#
# vendorAssets:
# custom-provider.svg: |

# # controlPlaneHighAvailabilityHelp - configure help text for control plane high availability, control plane pricing etc.
# controlPlaneHighAvailabilityHelp:
# text: Help text
Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

* [Configure Access Restrictions](operations/access-restrictions.md)
* [Theming and Branding](operations/customization.md)
* [Configure Vendors and Custom Cloud Providers](operations/vendors-custom-cps.md)
* [Webterminals](operations/webterminals.md)

## Development
Expand Down
Loading