-
Notifications
You must be signed in to change notification settings - Fork 247
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
specify CRD for custom labeling rules #653
specify CRD for custom labeling rules #653
Conversation
Create a new package pkg/apis/nfd/v1alpha1 and migrate the custom rule expressions over there. This is the first step in creating a new CRD API for custom rules.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: marquiz 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 |
Still want to check some details |
af8254f
to
73d827b
Compare
73d827b
to
ddeeb95
Compare
I changed to CRD to cluster-scoped |
ddeeb95
to
5d03094
Compare
Add a cluster-scoped Custom Resource Definition for specifying labeling rules. Nodes (node features, node objects) are cluster-level objects and thus the natural and encouraged setup is to only have one NFD deployment per cluster - the set of underlying features of the node stays the same independent of how many parallel NFD deployments you have. Our extension points (hooks, feature files and now CRs) can be be used by multiple actors (depending on us) simultaneously. Having the CRD cluster-scoped hopefully drives deployments in this direction. It also should make deployment of vendor-specific labeling rules easy as there is no need to worry about the namespace. This patch virtually replicates the source.custom.FeatureSpec in a CRD API (located in the pkg/apis/nfd/v1alpha1 package) with the notable exception that "MatchOn" legacy rules are not supported. Legacy rules are left out in order to keep the CRD simple and clean. The duplicate functionality in source/custom will be dropped by upcoming patches. This patch utilizes controller-gen (from sigs.k8s.io/controller-tools) for generating the CRD and deepcopy methods. Code can be (re-)generated with "make generate". Install controller-gen with: go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0 Update kustomize and helm deployments to deploy the CRD.
Without this hack the generated code does not compile.
Having a dedicated type makes it possible to specify deepcopy functions for it. We need to do this manually as deepcopy-gen doesn't know how to create copies of regexps.
5d03094
to
3765ae2
Compare
/lgtm |
Added a Helm parameter to make CRD generation configurable (true by default). |
Add a cluster-scoped Custom Resource Definition for specifying labeling
rules. Nodes (node features, node objects) are cluster-level objects and
thus the natural and encouraged setup is to only have one NFD deployment
per cluster - the set of underlying features of the node stays the same
independent of how many parallel NFD deployments you have. Our extension
points (hooks, feature files and now CRs) can be be used by multiple
actors (depending on us) simultaneously. Having the CRD cluster-scoped
hopefully drives deployments in this direction. It also should make
deployment of vendor-specific labeling rules easy as there is no need to
worry about the namespace.
This patch virtually replicates the source.custom.FeatureSpec in a CRD
API (located in the pkg/apis/nfd/v1alpha1 package) with the notable
exception that "MatchOn" legacy rules are not supported. Legacy rules
are left out in order to keep the CRD simple and clean.
The duplicate functionality in source/custom will be dropped by upcoming
patches.
This patch utilizes controller-gen (from sigs.k8s.io/controller-tools)
for generating the CRD and deepcopy methods. Code can be (re-)generated
with "make apigen". Install controller-gen with:
Update kustomize and helm deployments to deploy the CRD.