Skip to content

Commit

Permalink
Remove Conditions field from ClusterPolicyStatus and other improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tariq1890 committed Sep 12, 2023
1 parent 8184428 commit adfb877
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 230 deletions.
4 changes: 3 additions & 1 deletion api/v1/clusterpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1581,8 +1581,10 @@ type ClusterPolicyStatus struct {
State State `json:"state"`
// Namespace indicates a namespace in which the operator is installed
Namespace string `json:"namespace,omitempty"`

// TODO: Uncomment this later once we start using field
// Conditions is a list of conditions representing the ClusterPolicy's current state.
Conditions []metav1.Condition `json:"conditions"`
// Conditions []metav1.Condition `json:"conditions"`
}

// +kubebuilder:object:root=true
Expand Down
10 changes: 1 addition & 9 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 0 additions & 71 deletions bundle/manifests/nvidia.com_clusterpolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2185,76 +2185,6 @@ spec:
status:
description: ClusterPolicyStatus defines the observed state of ClusterPolicy
properties:
conditions:
description: Conditions is a list of conditions representing the ClusterPolicy's
current state.
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
\n type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
// +listType=map // +listMapKey=type Conditions []metav1.Condition
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
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])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
namespace:
description: Namespace indicates a namespace in which the operator
is installed
Expand All @@ -2267,7 +2197,6 @@ spec:
- notReady
type: string
required:
- conditions
- state
type: object
type: object
Expand Down
71 changes: 0 additions & 71 deletions config/crd/bases/nvidia.com_clusterpolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2185,76 +2185,6 @@ spec:
status:
description: ClusterPolicyStatus defines the observed state of ClusterPolicy
properties:
conditions:
description: Conditions is a list of conditions representing the ClusterPolicy's
current state.
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
\n type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
// +listType=map // +listMapKey=type Conditions []metav1.Condition
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
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])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
namespace:
description: Namespace indicates a namespace in which the operator
is installed
Expand All @@ -2267,7 +2197,6 @@ spec:
- notReady
type: string
required:
- conditions
- state
type: object
type: object
Expand Down
3 changes: 1 addition & 2 deletions controllers/state_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,7 @@ func (n *ClusterPolicyController) step() (gpuv1.State, error) {
// before managing them. Clusterpolicy controller should not be creating /
// updating / deleting objects owned by another controller.
if n.stateNames[n.idx] == "state-driver" &&
n.singleton.Spec.Driver.UseNvidiaDriverCRD != nil &&
*n.singleton.Spec.Driver.UseNvidiaDriverCRD {
n.singleton.Spec.Driver.UseNvdiaDriverCRDType() {
n.rec.Log.Info("NVIDIADriver CRD is enabled, cleaning up all NVIDIA driver daemonsets owned by ClusterPolicy")
n.idx++
// Cleanup all driver daemonsets owned by ClusterPolicy.
Expand Down
71 changes: 0 additions & 71 deletions deployments/gpu-operator/crds/nvidia.com_clusterpolicies_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2185,76 +2185,6 @@ spec:
status:
description: ClusterPolicyStatus defines the observed state of ClusterPolicy
properties:
conditions:
description: Conditions is a list of conditions representing the ClusterPolicy's
current state.
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
\n type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
// +listType=map // +listMapKey=type Conditions []metav1.Condition
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
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])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
namespace:
description: Namespace indicates a namespace in which the operator
is installed
Expand All @@ -2267,7 +2197,6 @@ spec:
- notReady
type: string
required:
- conditions
- state
type: object
type: object
Expand Down
6 changes: 1 addition & 5 deletions docker/Dockerfile.devel
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
ARG GOLANG_VERSION=x.x.x
ARG GOLANGCI_LINT_VERSION=1.54.2

# We switch to bullesye tags as the main/default golang docker tags include a base image with a newer glibc version.
# This causes the curl command to fail with the error: "curl: (6) getaddrinfo() thread failed to start"
# The newer glibc versions has newer syscalls that are possibly unrecognised by libseccomp of the docker engine that
# resides on the host CI runner.
FROM golang:${GOLANG_VERSION}-bullseye
FROM golang:${GOLANG_VERSION}

RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}

0 comments on commit adfb877

Please sign in to comment.