Drop admission logic. Use a plain controller instead
This commit is contained in:
@@ -7,11 +7,9 @@ import (
|
||||
type OSUpgradePhase string
|
||||
|
||||
const (
|
||||
OSUpgradePhasePending OSUpgradePhase = "Pending"
|
||||
OSUpgradePhaseAccepted OSUpgradePhase = "Accepted"
|
||||
OSUpgradePhaseRollingOut OSUpgradePhase = "RollingOut"
|
||||
OSUpgradePhaseCompleted OSUpgradePhase = "Completed"
|
||||
OSUpgradePhaseRejected OSUpgradePhase = "Rejected"
|
||||
OSUpgradePhasePending OSUpgradePhase = "Pending"
|
||||
OSUpgradePhaseAccepted OSUpgradePhase = "Accepted"
|
||||
OSUpgradePhaseRejected OSUpgradePhase = "Rejected"
|
||||
)
|
||||
|
||||
type OSUpgradeProgressPhase string
|
||||
@@ -34,9 +32,6 @@ const (
|
||||
// +kubebuilder:printcolumn:name="Desired",type=string,JSONPath=`.spec.desiredVersion`
|
||||
// +kubebuilder:printcolumn:name="Resolved",type=string,JSONPath=`.status.resolvedVersion`
|
||||
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`
|
||||
// +kubebuilder:printcolumn:name="Targets",type=integer,JSONPath=`.status.summary.targetedNodes`
|
||||
// +kubebuilder:printcolumn:name="OK",type=integer,JSONPath=`.status.summary.succeededNodes`
|
||||
// +kubebuilder:printcolumn:name="Fail",type=integer,JSONPath=`.status.summary.failedNodes`
|
||||
type OSUpgrade struct {
|
||||
metav1.TypeMeta `json:",inline" yaml:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
|
||||
@@ -74,20 +69,11 @@ type OSUpgradeStatus struct {
|
||||
Phase OSUpgradePhase `json:"phase,omitempty" yaml:"phase,omitempty"`
|
||||
ResolvedVersion string `json:"resolvedVersion,omitempty" yaml:"resolvedVersion,omitempty"`
|
||||
ObservedGeneration int64 `json:"observedGeneration,omitempty" yaml:"observedGeneration,omitempty"`
|
||||
Summary OSUpgradeSummary `json:"summary,omitempty" yaml:"summary,omitempty"`
|
||||
Conditions []metav1.Condition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
|
||||
Reason string `json:"reason,omitempty" yaml:"reason,omitempty"`
|
||||
Message string `json:"message,omitempty" yaml:"message,omitempty"`
|
||||
}
|
||||
|
||||
type OSUpgradeSummary struct {
|
||||
TargetedNodes int32 `json:"targetedNodes,omitempty" yaml:"targetedNodes,omitempty"`
|
||||
PendingNodes int32 `json:"pendingNodes,omitempty" yaml:"pendingNodes,omitempty"`
|
||||
RunningNodes int32 `json:"runningNodes,omitempty" yaml:"runningNodes,omitempty"`
|
||||
SucceededNodes int32 `json:"succeededNodes,omitempty" yaml:"succeededNodes,omitempty"`
|
||||
FailedNodes int32 `json:"failedNodes,omitempty" yaml:"failedNodes,omitempty"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:subresource:status
|
||||
@@ -96,7 +82,7 @@ type OSUpgradeSummary struct {
|
||||
// +kubebuilder:printcolumn:name="Source",type=string,JSONPath=`.spec.sourceRef.name`
|
||||
// +kubebuilder:printcolumn:name="Current",type=string,JSONPath=`.status.currentVersion`
|
||||
// +kubebuilder:printcolumn:name="Target",type=string,JSONPath=`.status.targetVersion`
|
||||
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.phase`
|
||||
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`
|
||||
type OSUpgradeProgress struct {
|
||||
metav1.TypeMeta `json:",inline" yaml:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
|
||||
@@ -138,3 +124,11 @@ type OSUpgradeProgressStatus struct {
|
||||
CurrentFrom string `json:"currentFrom,omitempty" yaml:"currentFrom,omitempty"`
|
||||
CurrentTo string `json:"currentTo,omitempty" yaml:"currentTo,omitempty"`
|
||||
}
|
||||
|
||||
func (osu OSUpgrade) StatusPhase() string {
|
||||
phase := ""
|
||||
if osu.Status != nil {
|
||||
phase = string(osu.Status.Phase)
|
||||
}
|
||||
return phase
|
||||
}
|
||||
|
||||
@@ -360,7 +360,6 @@ func (in *OSUpgradeSpec) DeepCopy() *OSUpgradeSpec {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *OSUpgradeStatus) DeepCopyInto(out *OSUpgradeStatus) {
|
||||
*out = *in
|
||||
out.Summary = in.Summary
|
||||
if in.Conditions != nil {
|
||||
in, out := &in.Conditions, &out.Conditions
|
||||
*out = make([]v1.Condition, len(*in))
|
||||
@@ -380,21 +379,6 @@ func (in *OSUpgradeStatus) DeepCopy() *OSUpgradeStatus {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *OSUpgradeSummary) DeepCopyInto(out *OSUpgradeSummary) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OSUpgradeSummary.
|
||||
func (in *OSUpgradeSummary) DeepCopy() *OSUpgradeSummary {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(OSUpgradeSummary)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VersionCatalogSource) DeepCopyInto(out *VersionCatalogSource) {
|
||||
*out = *in
|
||||
|
||||
Reference in New Issue
Block a user