-
Notifications
You must be signed in to change notification settings - Fork 84
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
WIP: ✨ A yaml-based DSL for creating CRDs #350
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: justinsb The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -0,0 +1,70 @@ | |||
XNamespace: |
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.
it's hard to compare input with output since none of your fields appear to be omitempty in the output.
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.
Good point! And fixed - I was importing the wrong yaml library (yaml.v3 instead of sigs.k8s.io/yaml)
@@ -0,0 +1,22 @@ | |||
XNamespace: |
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.
is this example using all the features you've implemented? I'm curious how some of the complicated corner-cases are going to turn out?
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.
So there's definitely some major cheating going on right now, things like map(key=string,value=string)
and int(min=0)
are hard-coded so we can iterate on the syntax before committing to it.
Are there any particular corner scenarios you have in mind?
# maxReplicas is the maximum number of replicas | ||
maxReplicas: int(min=0) | ||
|
||
containers: |
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.
For example, that list should have a listMap or whatever, right?
minReplicas: int(min=0) | ||
|
||
# maxReplicas is the maximum number of replicas | ||
maxReplicas: int(min=0) |
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.
I'm assuming the int(min=0)
language is entirely made-up? What are some of the principles behind it?
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.
Inspired by your kabstract python syntax. I think that named parameters are much better than positional ones here. We don't have anything particularly relevant in yaml. I guess that maybe we could do something like int{ min: 0 }
but I think that might actually interact relatively poorly with yaml - I'm trying to do things that aren't too painful with yaml escaping rules etc.
I guess one big question is what about string values, how will quoting work there - I guess I'll try adding a string or two :-)
Aiming to make it easier to create CRDs.
Wrote a (slightly) better parsing function for arguments, and also implemented a few more trickier annotations:
I don't love the placement of the map-key, but it does show that we can put parameters on keys without any real problem from the yaml parser. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Aiming to make it easier to create CRDs.