-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
internal/scaffold/crd.go: use structural schema for non-go operator CRDs #2275
internal/scaffold/crd.go: use structural schema for non-go operator CRDs #2275
Conversation
@@ -15,6 +15,7 @@ | |||
package scaffold | |||
|
|||
import ( | |||
goerrors "errors" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why create an alias ? Could not it jus be :
goerrors "errors" | |
"errors" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're already using github.com/pkg/errors
in this file, so one of them needs an alias. Rather than changing all of the existing usages, I thought it would be simpler and easier to review to use an alias here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm /approved
- Test changes locally
- The CRD was created with
$ cat deploy/crds/cache.example.com_memcacheds_crd.yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: memcacheds.cache.example.com
spec:
group: cache.example.com
names:
kind: Memcached
listKind: MemcachedList
plural: memcacheds
singular: memcached
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
versions:
- name: v1alpha1
served: true
- It was applied in the cluster with success as well.
Description of the change:
This PR updates the CRD scaffolder for non-go projects to begin using valid structural schema.
Motivation for the change:
Structural schemas are required in v1 CRDs. This change will make it simpler for project maintainers and users to migrate from v1beta1 CRDs to v1 CRDs in the future.
Since ansible and helm v2 do not provide schemas for their roles, playbooks, and charts, and we have no way to easily derive them, we need to continue preserving all CR fields.