Skip to content

Commit febb773

Browse files
shivamerlacdesiniotis
authored andcommitted
Change NVIDIADriver type to be cluster scoped to avoid duplicates
Signed-off-by: Shiva Krishna, Merla <[email protected]>
1 parent 07c274a commit febb773

6 files changed

+177
-5
lines changed

Diff for: PROJECT

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ resources:
1717
version: v1
1818
- api:
1919
crdVersion: v1
20-
namespaced: true
2120
controller: true
2221
domain: com
2322
group: nvidia

Diff for: api/v1/zz_generated.deepcopy.go

+9-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: api/v1alpha1/nvidiadriver_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ type NVIDIADriverSpec struct {
121121
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
122122
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Kernel module configuration parameters for the NVIDIA driver"
123123
KernelModuleConfig *gpuv1.KernelModuleConfigSpec `json:"kernelModuleConfig,omitempty"`
124+
124125
//+kubebuilder:validation:Optional
125126
// NodeSelector specifies a selector for installation of NVIDIA driver
126127
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
@@ -153,6 +154,9 @@ type NVIDIADriverStatus struct {
153154

154155
//+kubebuilder:object:root=true
155156
//+kubebuilder:subresource:status
157+
//+kubebuilder:resource:scope=Cluster
158+
//+kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.state`,priority=0
159+
//+kubebuilder:printcolumn:name="Age",type=string,JSONPath=`.metadata.creationTimestamp`,priority=0
156160

157161
// NVIDIADriver is the Schema for the nvidiadrivers API
158162
type NVIDIADriver struct {

Diff for: api/v1alpha1/zz_generated.deepcopy.go

+9-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: config/crd/bases/nvidia.com_clusterpolicies.yaml

+71
Original file line numberDiff line numberDiff line change
@@ -2185,6 +2185,76 @@ spec:
21852185
status:
21862186
description: ClusterPolicyStatus defines the observed state of ClusterPolicy
21872187
properties:
2188+
conditions:
2189+
description: Conditions is a list of conditions representing the ClusterPolicy's
2190+
current state.
2191+
items:
2192+
description: "Condition contains details for one aspect of the current
2193+
state of this API Resource. --- This struct is intended for direct
2194+
use as an array at the field path .status.conditions. For example,
2195+
\n type FooStatus struct{ // Represents the observations of a
2196+
foo's current state. // Known .status.conditions.type are: \"Available\",
2197+
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
2198+
// +listType=map // +listMapKey=type Conditions []metav1.Condition
2199+
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
2200+
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
2201+
properties:
2202+
lastTransitionTime:
2203+
description: lastTransitionTime is the last time the condition
2204+
transitioned from one status to another. This should be when
2205+
the underlying condition changed. If that is not known, then
2206+
using the time when the API field changed is acceptable.
2207+
format: date-time
2208+
type: string
2209+
message:
2210+
description: message is a human readable message indicating
2211+
details about the transition. This may be an empty string.
2212+
maxLength: 32768
2213+
type: string
2214+
observedGeneration:
2215+
description: observedGeneration represents the .metadata.generation
2216+
that the condition was set based upon. For instance, if .metadata.generation
2217+
is currently 12, but the .status.conditions[x].observedGeneration
2218+
is 9, the condition is out of date with respect to the current
2219+
state of the instance.
2220+
format: int64
2221+
minimum: 0
2222+
type: integer
2223+
reason:
2224+
description: reason contains a programmatic identifier indicating
2225+
the reason for the condition's last transition. Producers
2226+
of specific condition types may define expected values and
2227+
meanings for this field, and whether the values are considered
2228+
a guaranteed API. The value should be a CamelCase string.
2229+
This field may not be empty.
2230+
maxLength: 1024
2231+
minLength: 1
2232+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
2233+
type: string
2234+
status:
2235+
description: status of the condition, one of True, False, Unknown.
2236+
enum:
2237+
- "True"
2238+
- "False"
2239+
- Unknown
2240+
type: string
2241+
type:
2242+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
2243+
--- Many .condition.type values are consistent across resources
2244+
like Available, but because arbitrary conditions can be useful
2245+
(see .node.status.conditions), the ability to deconflict is
2246+
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
2247+
maxLength: 316
2248+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
2249+
type: string
2250+
required:
2251+
- lastTransitionTime
2252+
- message
2253+
- reason
2254+
- status
2255+
- type
2256+
type: object
2257+
type: array
21882258
namespace:
21892259
description: Namespace indicates a namespace in which the operator
21902260
is installed
@@ -2197,6 +2267,7 @@ spec:
21972267
- notReady
21982268
type: string
21992269
required:
2270+
- conditions
22002271
- state
22012272
type: object
22022273
type: object

Diff for: config/crd/bases/nvidia.com_nvidiadrivers.yaml

+84-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@ spec:
1313
listKind: NVIDIADriverList
1414
plural: nvidiadrivers
1515
singular: nvidiadriver
16-
scope: Namespaced
16+
scope: Cluster
1717
versions:
18-
- name: v1alpha1
18+
- additionalPrinterColumns:
19+
- jsonPath: .status.state
20+
name: Status
21+
type: string
22+
- jsonPath: .metadata.creationTimestamp
23+
name: Age
24+
type: string
25+
name: v1alpha1
1926
schema:
2027
openAPIV3Schema:
2128
description: NVIDIADriver is the Schema for the nvidiadrivers API
@@ -456,6 +463,80 @@ spec:
456463
status:
457464
description: NVIDIADriverStatus defines the observed state of NVIDIADriver
458465
properties:
466+
conditions:
467+
description: Conditions is a list of conditions representing the NVIDIADriver's
468+
current state.
469+
items:
470+
description: "Condition contains details for one aspect of the current
471+
state of this API Resource. --- This struct is intended for direct
472+
use as an array at the field path .status.conditions. For example,
473+
\n type FooStatus struct{ // Represents the observations of a
474+
foo's current state. // Known .status.conditions.type are: \"Available\",
475+
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
476+
// +listType=map // +listMapKey=type Conditions []metav1.Condition
477+
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
478+
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
479+
properties:
480+
lastTransitionTime:
481+
description: lastTransitionTime is the last time the condition
482+
transitioned from one status to another. This should be when
483+
the underlying condition changed. If that is not known, then
484+
using the time when the API field changed is acceptable.
485+
format: date-time
486+
type: string
487+
message:
488+
description: message is a human readable message indicating
489+
details about the transition. This may be an empty string.
490+
maxLength: 32768
491+
type: string
492+
observedGeneration:
493+
description: observedGeneration represents the .metadata.generation
494+
that the condition was set based upon. For instance, if .metadata.generation
495+
is currently 12, but the .status.conditions[x].observedGeneration
496+
is 9, the condition is out of date with respect to the current
497+
state of the instance.
498+
format: int64
499+
minimum: 0
500+
type: integer
501+
reason:
502+
description: reason contains a programmatic identifier indicating
503+
the reason for the condition's last transition. Producers
504+
of specific condition types may define expected values and
505+
meanings for this field, and whether the values are considered
506+
a guaranteed API. The value should be a CamelCase string.
507+
This field may not be empty.
508+
maxLength: 1024
509+
minLength: 1
510+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
511+
type: string
512+
status:
513+
description: status of the condition, one of True, False, Unknown.
514+
enum:
515+
- "True"
516+
- "False"
517+
- Unknown
518+
type: string
519+
type:
520+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
521+
--- Many .condition.type values are consistent across resources
522+
like Available, but because arbitrary conditions can be useful
523+
(see .node.status.conditions), the ability to deconflict is
524+
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
525+
maxLength: 316
526+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
527+
type: string
528+
required:
529+
- lastTransitionTime
530+
- message
531+
- reason
532+
- status
533+
- type
534+
type: object
535+
type: array
536+
namespace:
537+
description: Namespace indicates a namespace in which the operator
538+
and driver are installed
539+
type: string
459540
state:
460541
description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
461542
of cluster Important: Run "make" to regenerate code after modifying
@@ -466,6 +547,7 @@ spec:
466547
- notReady
467548
type: string
468549
required:
550+
- conditions
469551
- state
470552
type: object
471553
type: object

0 commit comments

Comments
 (0)