Conversation
| kind: CustomResourceDefinition | ||
| metadata: | ||
| annotations: | ||
| controller-gen.kubebuilder.io/version: (devel) |
There was a problem hiding this comment.
It would be preferable to use a released binary of controller-gen somehow to avoid this label.
There was a problem hiding this comment.
Can we maybe dockerize release version in some (separate or this one) repository? Maybe docker image already exists? then we can generate stuff with docker run and volume bindings.
There was a problem hiding this comment.
This would be nice, but I tend to worry about the added complexity of keeping another image updated. What do you think about the cluster-api approach of installing the tool before build? https://github.com/kubernetes-sigs/cluster-api/blob/master/Makefile#L164-L165 In this case it's using a Makefile, but I guess we can just add it to scripts/gen.sh.
There was a problem hiding this comment.
This is improved in the following PR (#410) so I'm not too worried about this being perfect.
kopiczko
left a comment
There was a problem hiding this comment.
Awesome work man! It would be cool if we somehow could use those yaml directly to install them in CPs (I saw what you wrote in the description). Would be good to try to align with https://github.com/giantswarm/opsctl/pull/596.
There was a problem hiding this comment.
I think this is a step into the right direction. Really cool. But we need to figure out how to extend the CRDs based on the CR related go types/comments. With this approach it would then maybe make sense to simply download the YAML files in opsctl in order to ensure them.
docs/crd/infrastructure.giantswarm.io_awsmachinedeployments.yaml
Outdated
Show resolved
Hide resolved
|
|
||
| type KVMConfigSpecKVMNode struct { | ||
| CPUs int `json:"cpus" yaml:"cpus"` | ||
| Disk float64 `json:"disk" yaml:"disk"` |
There was a problem hiding this comment.
According to kubernetes-sigs/controller-tools#245 (comment), float64 is not a good type to use in Kubernetes due to round-tripping issues. I'm not sure what the implications of changing this type would be though.
|
Property descriptions apparently are now coming from Go comments. This has several ramifications:
properties:
configMap:
description: ConfigMap references a config map containing catalog
values that should be applied to apps in this catalog.From a UX perspective, that's less than ideal.
I see the benefit of having descriptions only in one place. However, using the Golang one is a trade-off for where UX loses. |
marians
left a comment
There was a problem hiding this comment.
As it is this PR means we are loosing descriptions.
|
Let's not mix docs with internal tooling. In this PR the docs are actually overwritten which we could change. It may not be reasonable to try to solve our documentation needs in one solution together with our internal CRD management. So separating this would probably be better. |
I don't get that. Can you elaborate here? Or maybe tell what you are referring to? |
Is the lost bigger than the benefit in your opinion? I'd say people who read those are kind of used to Go style comments. For me not copying stuff over and having simpler workflows by far outweighs a problem of description starting with a repeated name. |
|
Marian and Thomas started to generate CRDs for documentation reasons and put them in the |
Which is you, the developer speaking. Marian thinks about the users. See my comment about mixing use cases above. |
|
@xh3b4sd Everything in the The problem is not that we overwrite
|
That's hard to judge and to compare, mainly as the gains and losses happen on different ends (internal vs. external). I think most users will be able to cope with the strangeness and still be able to make the right conclusions. If this helps us getting more complete, up-to-date and accurate property docs, fine. I'm not in the way. |
|
Thanks for the review and comments. I'll try to address each concern. |
I think we have the opportunity to address both use cases with this change. Here's how:
|
xh3b4sd
left a comment
There was a problem hiding this comment.
This is cool. We discussed a little. Here are some final thoughts.
- When the go types changed, but the CRDs are not re-generated, CI should fail in an idea world. Not a big deal in the first step, but let's consider this for the upcoming PRs.
- I already made the experience that the files are hard to determine in the Github file tree UI because the generated file names are super long. This makes it super hard for humans to identify where the file you are looking for is. Maybe we could work more with a directory structure. Just an idea.
- It is amazing that now all CR status structures are also defined and that the whole schemas are actually structural and valid. This makes so much sense.
- We should test this somehow on a Control Plane to see if the CRDs are still fine. We can maybe talk about it and try something out together. It is a bit dangerous to deal with so we should make sure this does not break production environments.
docs/crd/infrastructure.giantswarm.io_awsmachinedeployments.yaml
Outdated
Show resolved
Hide resolved
docs/crd/infrastructure.giantswarm.io_awsmachinedeployments.yaml
Outdated
Show resolved
Hide resolved
|
Another thought which I don't know why I didn't propose in the first place. I'd be fine with breaking godoc conventions for there files to have CRDs properly generated. We can add |
I checked cluster-api and it uses normal GoDoc style comments for CRs (field name in CamelCase at the beginning of each one). Both ways seem reasonable to me. |
|
Anyway, I'd leave the comment changes out of this PR. We can tackle that later. |
|
This PR isn't perfect, but most of the issues are resolved in the next PR, #410. If it's okay with everyone, I would merge this to master after some approvals and tie up any loose ends in the next PR. |
|
The only remaining task for this PR is figuring out what to do about the |
|
I did not fully understand the problem and we can talk about it in more detail if you like. I just found |
| StorageSizeGB float64 `json:"storageSizeGB,omitempty" yaml:"storageSizeGB,omitempty"` | ||
| ID string `json:"id" yaml:"id"` | ||
| CPUCores int `json:"cpuCores,omitempty" yaml:"cpuCores,omitempty"` | ||
| // +kubebuilder:validation:Type=number |
There was a problem hiding this comment.
Specifying the type here for validation. This will still be a breaking change for the kvm-operator but should be able to work around it with strconv.ParseFloat(MemorySizeGB, 64). I'll test in kvm-operator now.
|
Now that |
|
Closing in favour of #410. |
Unhappy with our current setup around CRDs, I thought it was time to try upstream Kubernetes
controller-toolsto generate CRDs from CRs (and extra metadata from comments, see https://book.kubebuilder.io/reference/generating-crd.html). For now, I would just like a review on the resulting CRDs and whether we could migrate to these CRDs in the near future without breaking anything.This PR does not include the additional step of converting CRD YAMLs to functions that return
apiextensionsv1beta1.CustomResourceDefinitionsuch asNewG8sControlPlaneCRD(). This can be done in a separate PR since this PR doesn't actually affect any code yet, just thedocs/directory. Until then there would be duplicate CRD definitions, those in the multiline strings in source code and the generated CRDs indocs/. This would be a temporary state.An extra benefit of this approach is that we can have full schemata for all types which is required for moving to
apiextensionsv1.CustomResourceDefinitiondue to enforced pruning. See https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#controlling-pruning for more info. This is currently a blocker for spot instances as I understand it.Checklist