Skip to content

Add validation logic to OpenstackCreds webhook #2347

Description

@OmkarDeshpande7

Summary

The OpenstackCredsCustomValidator webhook scaffold was added in # but the ValidateCreate, ValidateUpdate, and ValidateDelete methods are currently no-ops.

Work Required

  • Implement validation logic in k8s/migration/api/v1alpha1/openstackcreds_webhook.go:
    • ValidateCreate: validate required fields (auth URL, username, password, tenant, domain, region) are non-empty
    • ValidateUpdate: validate same fields; optionally prevent immutable field changes (e.g. auth URL)
    • ValidateDelete: optionally block deletion if referenced by an active MigrationPlan
  • Expand openstackcreds_webhook_test.go with table-driven tests covering accept/reject cases for each operation
  • Remove the TODO(user) placeholders in the test file

Acceptance Criteria

  • Webhook rejects OpenstackCreds with missing required fields at admission time
  • Unit tests cover at minimum: missing auth URL, missing username, valid object, update with valid object

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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