Skip to content

feat(api): add validation and defaults for WebServer CRD#227

Open
Baigsufiyan wants to merge 3 commits intoweb-servers:mainfrom
Baigsufiyan:feat/api-validation-hardening
Open

feat(api): add validation and defaults for WebServer CRD#227
Baigsufiyan wants to merge 3 commits intoweb-servers:mainfrom
Baigsufiyan:feat/api-validation-hardening

Conversation

@Baigsufiyan
Copy link
Copy Markdown
Contributor

This PR adds basic validation and default values to the WebServer CRD.

Some fields in the spec could previously accept empty or malformed input,
which could later cause issues during S2I builds or deployment. The goal
here is to catch those cases earlier at the CRD validation level.

Changes:

  • Added regex validation for SourceRepositoryURL
  • Added MinLength checks for required fields
  • Added default values using Kubebuilder markers:
    • SourceRepositoryRef -> "master"
    • ContextDir -> "."
  • Regenerated CRD manifests with make manifests
  • Updated v1alpha1_webserver.yaml example to match the updated schema
    I verified the generated schema under config/crd/bases/ and checked that
    the updated example CR passes validation with the new rules.

This commit improves the API contract by:
- Adding Kubebuilder markers for ImageStream and Source URL validation.
- Implementing safe defaults for S2I build references (master branch, root context).
- Enforcing mandatory readiness probes to ensure deployment stability.
- Updating samples to reflect best practices for JBoss Web Server on OpenShift.
@Baigsufiyan Baigsufiyan force-pushed the feat/api-validation-hardening branch from 87528e7 to 5d170ad Compare March 16, 2026 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant