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

Add cloud providers via configuration #1553

Open
wants to merge 36 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-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 Jul 23, 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 Jul 23, 2024
# Conflicts:
#	backend/test/acceptance/__snapshots__/api.cloudprofiles.spec.js.snap
#	charts/gardener-dashboard/charts/runtime/templates/dashboard/deployment.yaml
#	docs/README.md
#	frontend/src/components/GCloudProfile.vue
#	frontend/src/components/NewShoot/GNewShootInfrastructureDetails.vue
#	frontend/src/components/NewShoot/GNewShootSelectInfrastructure.vue
#	frontend/src/components/Secrets/GSecretDialogAlicloud.vue
#	frontend/src/components/Secrets/GSecretDialogAws.vue
#	frontend/src/components/Secrets/GSecretDialogAzure.vue
#	frontend/src/components/Secrets/GSecretDialogCloudflare.vue
#	frontend/src/components/Secrets/GSecretDialogGeneric.vue
#	frontend/src/components/Secrets/GSecretDialogHCloud.vue
#	frontend/src/components/Secrets/GSecretDialogInfoblox.vue
#	frontend/src/components/Secrets/GSecretDialogMetal.vue
#	frontend/src/components/Secrets/GSecretDialogNetlify.vue
#	frontend/src/components/Secrets/GSecretDialogVSphere.vue
#	frontend/src/components/ShootWorkers/GManageWorkers.vue
#	frontend/src/components/ShootWorkers/GWorkerConfiguration.vue
#	frontend/src/store/cloudProfile/index.js
#	frontend/src/store/config.js
#	frontend/src/utils/shoot.js
#	frontend/src/views/GNewShoot.vue
@grolu grolu force-pushed the enh/configure_cloudprovider_vue3 branch from 1203a2c to bbca10c Compare July 23, 2024 13:08
@gardener-robot-ci-3 gardener-robot-ci-3 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 Jul 23, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 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 Jul 23, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 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 Jul 23, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 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 Jul 23, 2024
# Conflicts:
#	frontend/src/composables/useShootContext.js
@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 24, 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 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
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
5 participants