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 yaml-based crd validation + defaults #150

Merged
merged 6 commits into from
Jan 9, 2024
Merged

add yaml-based crd validation + defaults #150

merged 6 commits into from
Jan 9, 2024

Conversation

OliverMKing
Copy link
Collaborator

@OliverMKing OliverMKing commented Jan 8, 2024

Description

adds yaml-based crd validation to our crd. Reduces the need for webhooks (makes it more acceptable to not use webhooks which add lots of overhead).

Will clean up some old stuff that's not needed anymore in the next PR (and add some stuff to our e2e runner).

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested locally and e2e tested.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@OliverMKing
Copy link
Collaborator Author

Angry unit tests. Will figure out why tomorrow

jaiveerk
jaiveerk previously approved these changes Jan 9, 2024
@@ -146,7 +153,8 @@ type NginxIngressController struct {
metav1.ObjectMeta `json:"metadata,omitempty"`

// +required
Spec NginxIngressControllerSpec `json:"spec,omitempty"`
// +kubebuilder:default:={"ingressClassName":"nginx.approuting.kubernetes.azure.com","controllerNamePrefix":"nginx"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there any way we can validate that this inline json string is properly formatted? it looks fine, but just wondering more from a theoretical standpoint

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If this string is malformed our e2e runner will fail because the crd won't be able to be applied.
CRDs validate this when they are applied against the k8s api server.

I know because this happened to me when I made a typo in an earlier iteration of this PR.

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 7464140143

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.005%) to 80.915%

Totals Coverage Status
Change from base Build 7413697096: -0.005%
Covered Lines: 2989
Relevant Lines: 3694

💛 - Coveralls

@OliverMKing
Copy link
Collaborator Author

/ok-to-test sha=7c5e5de

@OliverMKing OliverMKing merged commit dae9a52 into Azure:main Jan 9, 2024
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.

4 participants