Skip to content

[Feature]: use webhooks to verify mutually exclusive fields #139

@whg517

Description

@whg517

Duplicates

I have searched the existing issues

Summary 💡

In some field attributes, it is necessary to verify the mutually exclusive condition of the attribute fields. The oneof field configuration cannot be generated using kubebuilder's mark, so it is necessary to implement the logical verification on the server side through webhook.

expect:

spec:
  properties:
    provider:
      oneOf:
      - required:
          - static
      - required:
          - ldap
      - required:
          - oidc
      - required:
          - tls
      properties:
        ldap:
          type: object
        oidc:
          type: object
        static:
          type: object
        tls:
          type: object
      type: object
  type: object

Actual kubebuilder can only be generated:

spec:
  properties:
    provider:
      properties:
        ldap:
          type: object
        oidc:
          type: object
        static:
          type: object
        tls:
          type: object
      type: object
  type: object

Some useful links:

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions