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

Conversation

grolu
Copy link
Contributor

@grolu grolu commented Sep 11, 2023

What this PR does / why we need it:
On top of PR #1434 this PR adds logic to define additional cloud providers via configuration (customCloudProviders).
It is possible to define a custom secret dialog including (simple) validation and help texts.
It is also possible to configure custom input fields that are added to the Infrastructure Details section of the create cluster page.

Supported input types:

  • text: Simple plain text input.
  • password: Hidden plain text input.
  • select: List of values that the user can select.
  • select-multiple: Allow to select multiple values from a list.
  • json: Object data in JSON format.
  • yaml: Object data in YAML input.

Supported validations:

  • required
  • requiredIf (ref to other field)
  • regex
  • isValidObject (depends on the type - valid json or a yaml object)

See example configuration below for more details.

A custom cloud provider icon can be defined using an image resource mounted via asset configuration.
This way it is also possible to overwrite icons as well as names for build-in cloud providers (like aws, gpc, etc) and for machine image vendors (ubuntu, gardenlinux, etc.)
It is possible to provide additional required static data for the shoot template of a custom cloud provider via configuration.
For additional required configurable data, input fields for the custom cloud provider can be defined that will appear on the create cluster page.

This PR also adds a configuration option for the available cloud providers (cloudProviderList). This allows to add additional cloud providers as well as configure their order in the Dashboard. It is possible to add cloud providers without additional configuration, the secret dialog and logo will fallback to generic input / icon.

This PR removes the logic that filters cloud profiles without a matching seed in the backend. All cloud profiles show up in the frontend. Cloud profiles without matching seed will show a hint to the user.

Example dashboard configuration for a cloud provider with name custom

cloudProviderList:
  - gcp
  - aws
  - custom
customCloudProviders:
  fooProvider:
    zoned: false
    shoot:
      createFields:
        - key: foo
          path: spec.provider.extra
          hint: Enter Additional data
          label: Additional Information
          type: text
          validators:
            required:
              type: required
        - key: selectFoo
          path: spec.provider
          hint: Select foo value
          label: Select Foo
          type: select
          validators:
            required:
              type: required
          values: 
            cloudprofilePath: data.foo
            key: name
        - key: selectBar
          path: spec.provider
          hint: Select bar value
          label: Select Bar
          type: select
          validators:
            required:
              type: required
          values: 
            - abc
            - def
      specTemplate:
        provider:
          type: custom
          infrastructureConfig:
            apiVersion: custom.provider.extensions.gardener.cloud/v1alpha1
            kind: InfrastructureConfig
            networks:
              vpc:
                cidr: ${workerCIDR}
          controlPlaneConfig:
            apiVersion: custom.provider.extensions.gardener.cloud/v1alpha1
            kind: ControlPlaneConfig
        networking:
          nodes: ${workerCIDR}
          foo: bar
    secret:
      fields:
        - key: namespace
          hint: Enter a valid namespace
          label: Namespace
          type: text
          validators:
            required:
              type: required
            isNamespace:
              type: regex
              value: .+.+--.+
              message: Must be a valid namespace with format a--b
        - key: token 
          hint: Enter a valid token
          label: Token
          type: password
          validators:
            required:
              type: requiredIf
              not:
                - user
                - password
              message: Token is required if no user / password provided
            isToken:
              type: regex
              value: ^.{10}$
              message: Must be a valid token with length 10
        - key: user
          hint: Enter a valid User
          label: User
          type: text
          validators:
            required:
              type: requiredIf
              not:
                - token
              message: User is required if no token provided
        - key: password 
          hint: Enter a password
          label: password
          type: password
          validators:
            required:
              type: requiredIf
              not:
                - token
              message: Password is required if no token provided
        - key: json
          hint: Enter additional Data as JSON
          label: JSON
          type: json
          validators:
            isJSON:
              type: isValidObject
              message: Data must be valid JSON
        - key: yaml
          hint: Enter additional Data as YAML
          label: YAML
          type: yaml
          validators:
            isYAML:
              type: isValidObject
              message: Data must be valid YAML
      help: |
        #Custom Cloud Provider
        <br />
        <img src="/static/vendor-assets/custom.png" width="100px" />
        <br />
        ## Namespace
        Please enter a valid namespace with format a--b
        <br />
        ## Token / Username - Passwod
        Please enter a valid token with exactly 10 chars. Alternatively you can enter username and password.
vendors:
    aws:
      icon: amazon.svg
      name: Amazon
    custom:
      name: Custom CC
      icon: custom.png

Icons can be provided as base64 encoded values when using the helm chart in the frontendConfig.vendorAssets map. Those icons can then be refrenced in the vendor configurations as well as the help html as shown above.
You can also use data: scheme for development. For production it is recommended to provide static assets.

Cloud provider custom rendered in the Dashboard
Screenshot 2023-03-06 at 16 51 34
Screenshot 2023-03-06 at 16 53 47
Screenshot 2023-03-06 at 16 54 20
Screenshot 2023-12-04 at 20 34 50

Which issue(s) this PR fixes:
Fixes #1445 Fixes #554 Fixes #1707 Fixes #207

Special notes for your reviewer:

Release note:

Define order, name and icon of cloud providers in dashboard configuration
Define additional cloud providers in dashboard configuration
Removed the logic that filters cloud profiles without a matching seed in the backend. All cloud profiles will now show up in the frontend. If a cloud profile without a matching seed is selected for a new cluster, a hint will be shown to the user

@gardener-robot gardener-robot added needs/review Needs review size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py) needs/second-opinion Needs second review by someone else labels Sep 11, 2023
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 11, 2023
@gardener-robot-ci-1 gardener-robot-ci-1 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 11, 2023
@gardener-robot-ci-3 gardener-robot-ci-3 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 11, 2023
@grolu grolu added the area/ipcei IPCEI (Important Project of Common European Interest) label Sep 11, 2023
@gardener-robot gardener-robot added the needs/rebase Needs git rebase label Oct 5, 2023
@gardener-robot
Copy link

@grolu You need rebase this pull request with latest master branch. Please check.

# Conflicts:
#	frontend/src/components/ShootWorkers/GManageWorkers.vue
#	frontend/src/views/GNewShoot.vue
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 9, 2023
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 20, 2023
@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 20, 2023
@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Jul 25, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Aug 6, 2024
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Aug 9, 2024
@grolu grolu marked this pull request as ready for review August 12, 2024 12:08
@grolu grolu changed the title [DRAFT] Add cloud providers via configuration Add cloud providers via configuration Aug 12, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Aug 12, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 23, 2024
Gardener landscape administrators should have the possibility to change icons and names of vendors (cloud providers, image vendors, etc.). This enables the administrator to adjust vendors and apply company or context-specific values. An example of use could be a locally hosted OpenStack infrastructure that should appear as `MyCustomCloud` with a custom icon in the Dashboard, so that the user immediately identifies it as `MyCustomCloud` as they might not be familiar with the term `OpenStack`.

## Vendor Configuration
It is possible to change the name and icon of built-in vendors in the Gardener Dashboard (e.g., AWS, Ubuntu, etc.) when using the [helm chart](https://github.com/gardener/dashboard/blob/master/charts/gardener-dashboard) in the `frontend.vendors` map. You can add a key for each vendor that you want to customize. The key equals the vendor type. The following configuration properties are supported:
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
It is possible to change the name and icon of built-in vendors in the Gardener Dashboard (e.g., AWS, Ubuntu, etc.) when using the [helm chart](https://github.com/gardener/dashboard/blob/master/charts/gardener-dashboard) in the `frontend.vendors` map. You can add a key for each vendor that you want to customize. The key equals the vendor type. The following configuration properties are supported:
You can change the name and icon of built-in vendors in the Gardener Dashboard (e.g., AWS, Ubuntu) by configuring the `frontendConfig.vendors` map in the [Helm chart](https://github.com/gardener/dashboard/blob/master/charts/gardener-dashboard). To customize a vendor, add a key corresponding to the vendor type. The following configuration properties are supported:

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

Comment on lines +365 to +366
# # cloudProviderList - configure available cloud providers. This allows to change order and to add additional (not built-in providers), see also customCloudProviders
# cloudProviderList:
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:

Comment on lines +382 to +384
# path: spec.provider.extra
# hint: Enter Additional data
# label: Additional Information
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

Comment on lines +872 to +873
/* customCloudProvider */
// const customCloudProviderData = reactive({})
Copy link
Member

Choose a reason for hiding this comment

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

remove?

@blur="v$.fieldData[key].$touch()"
/>
<v-select
v-if="type === 'select' || type === 'select-multiple'"
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
v-if="type === 'select' || type === 'select-multiple'"
v-else-if="type === 'select' || type === 'select-multiple'"

@blur="v$.fieldData[key].$touch()"
/>
<v-textarea
v-if="type === 'yaml' || type === 'json'"
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
v-if="type === 'yaml' || type === 'json'"
v-else-if="type === 'yaml' || type === 'json'"

It is possible to define input fields with data validation for the `Infrastructure Details` section on the create cluster page as well as for the infrastructure secret dialog. The array can contain field definitions with the following properties:
| name | description |
| ---- | ----------- |
| `key` | Unique key for the input field. Used as the secret data key if defined as part of infrastructure secret dialog. |
Copy link
Member

Choose a reason for hiding this comment

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

Used as the secret data key if defined as part of infrastructure secret dialog.

Not sure if this sentence can easily be understood.

},
set (value) {
forEach(customCloudProviderFields.value, ({ key, path }) => {
set(manifest.value, [`${path}.${key}`], get(value, [key]))
Copy link
Member

Choose a reason for hiding this comment

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

[`${path}.${key}`]

a bug sneaked in after you have adapted for the changes introduced with #2029

Now, a top level property with dots would be set

SPDX-License-Identifier: Apache-2.0
-->

<template>
Copy link
Member

Choose a reason for hiding this comment

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

introduce GGenericInputField.vue component that handles one field for better readability. Not sure if a component like GGenericInputFields.vue is then still necessary

values:
- foo
- bar
specTemplate:
Copy link
Member

Choose a reason for hiding this comment

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

I could not get the specTemplate to work, the following was my config (snipped)

  customCloudProviders:
    custom-provider:
      shoot:
        specTemplate:
          provider:
            type: DUMMY
          networking:
            nodes: 9.8.7.6

@grolu grolu marked this pull request as draft October 10, 2024 11:17
@holgerkoser holgerkoser changed the title Add cloud providers via configuration [DRAFT] Add cloud providers via configuration Oct 11, 2024
# Conflicts:
#	charts/__tests__/gardener-dashboard/runtime/dashboard/__snapshots__/configmap.spec.js.snap
#	frontend/src/components/Secrets/GSecretDialogAzure.vue
@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 23, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 13, 2024
# Conflicts:
#	backend/lib/routes/config.js
#	frontend/src/components/GVendorIcon.vue
#	frontend/src/components/NewShoot/GNewShootInfrastructureDetails.vue
#	frontend/src/components/Secrets/GSecretDialog.vue
#	frontend/src/components/Secrets/GSecretDialogGeneric.vue
#	frontend/src/composables/useShootContext.js
#	frontend/src/views/GSecrets.vue
@grolu grolu force-pushed the enh/configure_cloudprovider_vue3 branch from 108bf87 to d6e5d0a Compare November 14, 2024 08:51
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 14, 2024
@gardener-robot-ci-3 gardener-robot-ci-3 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ipcei IPCEI (Important Project of Common European Interest) needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) needs/rebase Needs git rebase needs/review Needs review needs/second-opinion Needs second review by someone else size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py)
Projects
None yet
6 participants