Skip to content

Commit

Permalink
Merge pull request #11369 from sbueringer/pr-fix-panics
Browse files Browse the repository at this point in the history
🐛 Fix panics in SetV1Beta2Conditions methods
  • Loading branch information
k8s-ci-robot authored Nov 4, 2024
2 parents 9f5a94e + 7551f08 commit 90e86ab
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion api/v1beta1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ func (c *Cluster) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (c *Cluster) SetV1Beta2Conditions(conditions []metav1.Condition) {
if c.Status.V1Beta2 == nil && conditions != nil {
if c.Status.V1Beta2 == nil {
c.Status.V1Beta2 = &ClusterV1Beta2Status{}
}
c.Status.V1Beta2.Conditions = conditions
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/clusterclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ func (c *ClusterClass) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (c *ClusterClass) SetV1Beta2Conditions(conditions []metav1.Condition) {
if c.Status.V1Beta2 == nil && conditions != nil {
if c.Status.V1Beta2 == nil {
c.Status.V1Beta2 = &ClusterClassV1Beta2Status{}
}
c.Status.V1Beta2.Conditions = conditions
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ func (m *Machine) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (m *Machine) SetV1Beta2Conditions(conditions []metav1.Condition) {
if m.Status.V1Beta2 == nil && conditions != nil {
if m.Status.V1Beta2 == nil {
m.Status.V1Beta2 = &MachineV1Beta2Status{}
}
m.Status.V1Beta2.Conditions = conditions
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/machinedeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ func (m *MachineDeployment) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (m *MachineDeployment) SetV1Beta2Conditions(conditions []metav1.Condition) {
if m.Status.V1Beta2 == nil && conditions != nil {
if m.Status.V1Beta2 == nil {
m.Status.V1Beta2 = &MachineDeploymentV1Beta2Status{}
}
m.Status.V1Beta2.Conditions = conditions
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/machinehealthcheck_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (m *MachineHealthCheck) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (m *MachineHealthCheck) SetV1Beta2Conditions(conditions []metav1.Condition) {
if m.Status.V1Beta2 == nil && conditions != nil {
if m.Status.V1Beta2 == nil {
m.Status.V1Beta2 = &MachineHealthCheckV1Beta2Status{}
}
m.Status.V1Beta2.Conditions = conditions
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/machineset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func (m *MachineSet) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (m *MachineSet) SetV1Beta2Conditions(conditions []metav1.Condition) {
if m.Status.V1Beta2 == nil && conditions != nil {
if m.Status.V1Beta2 == nil {
m.Status.V1Beta2 = &MachineSetV1Beta2Status{}
}
m.Status.V1Beta2.Conditions = conditions
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/kubeadm/api/v1beta1/kubeadmconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ func (c *KubeadmConfig) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (c *KubeadmConfig) SetV1Beta2Conditions(conditions []metav1.Condition) {
if c.Status.V1Beta2 == nil && conditions != nil {
if c.Status.V1Beta2 == nil {
c.Status.V1Beta2 = &KubeadmConfigV1Beta2Status{}
}
c.Status.V1Beta2.Conditions = conditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ func (in *KubeadmControlPlane) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (in *KubeadmControlPlane) SetV1Beta2Conditions(conditions []metav1.Condition) {
if in.Status.V1Beta2 == nil && conditions != nil {
if in.Status.V1Beta2 == nil {
in.Status.V1Beta2 = &KubeadmControlPlaneV1Beta2Status{}
}
in.Status.V1Beta2.Conditions = conditions
Expand Down
2 changes: 1 addition & 1 deletion exp/addons/api/v1beta1/clusterresourceset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (m *ClusterResourceSet) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (m *ClusterResourceSet) SetV1Beta2Conditions(conditions []metav1.Condition) {
if m.Status.V1Beta2 == nil && conditions != nil {
if m.Status.V1Beta2 == nil {
m.Status.V1Beta2 = &ClusterResourceSetV1Beta2Status{}
}
m.Status.V1Beta2.Conditions = conditions
Expand Down
2 changes: 1 addition & 1 deletion exp/api/v1beta1/machinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func (m *MachinePool) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (m *MachinePool) SetV1Beta2Conditions(conditions []metav1.Condition) {
if m.Status.V1Beta2 == nil && conditions != nil {
if m.Status.V1Beta2 == nil {
m.Status.V1Beta2 = &MachinePoolV1Beta2Status{}
}
m.Status.V1Beta2.Conditions = conditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (c *DockerCluster) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (c *DockerCluster) SetV1Beta2Conditions(conditions []metav1.Condition) {
if c.Status.V1Beta2 == nil && conditions != nil {
if c.Status.V1Beta2 == nil {
c.Status.V1Beta2 = &DockerClusterV1Beta2Status{}
}
c.Status.V1Beta2.Conditions = conditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (c *DockerMachine) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (c *DockerMachine) SetV1Beta2Conditions(conditions []metav1.Condition) {
if c.Status.V1Beta2 == nil && conditions != nil {
if c.Status.V1Beta2 == nil {
c.Status.V1Beta2 = &DockerMachineV1Beta2Status{}
}
c.Status.V1Beta2.Conditions = conditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (c *InMemoryCluster) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (c *InMemoryCluster) SetV1Beta2Conditions(conditions []metav1.Condition) {
if c.Status.V1Beta2 == nil && conditions != nil {
if c.Status.V1Beta2 == nil {
c.Status.V1Beta2 = &InMemoryClusterV1Beta2Status{}
}
c.Status.V1Beta2.Conditions = conditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func (c *InMemoryMachine) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (c *InMemoryMachine) SetV1Beta2Conditions(conditions []metav1.Condition) {
if c.Status.V1Beta2 == nil && conditions != nil {
if c.Status.V1Beta2 == nil {
c.Status.V1Beta2 = &InMemoryMachineV1Beta2Status{}
}
c.Status.V1Beta2.Conditions = conditions
Expand Down
6 changes: 3 additions & 3 deletions util/test/builder/v1beta2_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (o *Phase1Obj) GetV1Beta2Conditions() []metav1.Condition {

// SetV1Beta2Conditions sets conditions for an API object.
func (o *Phase1Obj) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
if o.Status.V1Beta2 == nil {
o.Status.V1Beta2 = &Phase1ObjStatusV1Beta2{}
}
o.Status.V1Beta2.Conditions = conditions
Expand Down Expand Up @@ -233,10 +233,10 @@ func (o *Phase2Obj) GetConditions() clusterv1.Conditions {

// SetConditions sets the conditions on this object.
func (o *Phase2Obj) SetConditions(conditions clusterv1.Conditions) {
if o.Status.Deprecated == nil && conditions != nil {
if o.Status.Deprecated == nil {
o.Status.Deprecated = &Phase2ObjStatusDeprecated{V1Beta1: &Phase2ObjStatusDeprecatedV1Beta1{}}
}
if o.Status.Deprecated.V1Beta1 == nil && conditions != nil {
if o.Status.Deprecated.V1Beta1 == nil {
o.Status.Deprecated.V1Beta1 = &Phase2ObjStatusDeprecatedV1Beta1{}
}
o.Status.Deprecated.V1Beta1.Conditions = conditions
Expand Down

0 comments on commit 90e86ab

Please sign in to comment.