diff --git a/cmd/start.go b/cmd/start.go index 340ff30bd..9beaaedce 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -253,7 +253,7 @@ func startControllers(ctx *controllerContext) error { overrideDirectory, ctx.ResyncPeriod(), ctx.InformerFactory.Config().V1().ClusterVersions(), - ctx.InformerFactory.Operatorstatus().V1().ClusterOperators(), + ctx.InformerFactory.Config().V1().ClusterOperators(), ctx.ClientBuilder.RestConfig(), ctx.ClientBuilder.ClientOrDie(componentName), ctx.ClientBuilder.KubeClientOrDie(componentName), @@ -264,7 +264,7 @@ func startControllers(ctx *controllerContext) error { go autoupdate.New( componentNamespace, componentName, ctx.InformerFactory.Config().V1().ClusterVersions(), - ctx.InformerFactory.Operatorstatus().V1().ClusterOperators(), + ctx.InformerFactory.Config().V1().ClusterOperators(), ctx.ClientBuilder.ClientOrDie(componentName), ctx.ClientBuilder.KubeClientOrDie(componentName), ).Run(2, ctx.Stop) diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 2e1cdf197..3b631e9d3 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -6,5 +6,5 @@ ${PROJECT_ROOT}/vendor/k8s.io/code-generator/generate-groups.sh \ all \ github.com/openshift/cluster-version-operator/pkg/generated \ github.com/openshift/cluster-version-operator/pkg/apis \ - "config.openshift.io:v1 operatorstatus.openshift.io:v1" \ + "config.openshift.io:v1" \ $@ \ diff --git a/lib/resourcemerge/os.go b/lib/resourcemerge/os.go index c1035c90c..44fb517c0 100644 --- a/lib/resourcemerge/os.go +++ b/lib/resourcemerge/os.go @@ -6,15 +6,15 @@ import ( "k8s.io/apimachinery/pkg/api/equality" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - osv1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" + cvv1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" ) -func EnsureClusterOperatorStatus(modified *bool, existing *osv1.ClusterOperator, required osv1.ClusterOperator) { +func EnsureClusterOperatorStatus(modified *bool, existing *cvv1.ClusterOperator, required cvv1.ClusterOperator) { EnsureObjectMeta(modified, &existing.ObjectMeta, required.ObjectMeta) ensureClusterOperatorStatus(modified, &existing.Status, required.Status) } -func ensureClusterOperatorStatus(modified *bool, existing *osv1.ClusterOperatorStatus, required osv1.ClusterOperatorStatus) { +func ensureClusterOperatorStatus(modified *bool, existing *cvv1.ClusterOperatorStatus, required cvv1.ClusterOperatorStatus) { if !equality.Semantic.DeepEqual(existing.Conditions, required.Conditions) { *modified = true existing.Conditions = required.Conditions @@ -33,9 +33,9 @@ func ensureClusterOperatorStatus(modified *bool, existing *osv1.ClusterOperatorS } } -func SetOperatorStatusCondition(conditions *[]osv1.ClusterOperatorStatusCondition, newCondition osv1.ClusterOperatorStatusCondition) { +func SetOperatorStatusCondition(conditions *[]cvv1.ClusterOperatorStatusCondition, newCondition cvv1.ClusterOperatorStatusCondition) { if conditions == nil { - conditions = &[]osv1.ClusterOperatorStatusCondition{} + conditions = &[]cvv1.ClusterOperatorStatusCondition{} } existingCondition := FindOperatorStatusCondition(*conditions, newCondition.Type) if existingCondition == nil { @@ -53,11 +53,11 @@ func SetOperatorStatusCondition(conditions *[]osv1.ClusterOperatorStatusConditio existingCondition.Message = newCondition.Message } -func RemoveOperatorStatusCondition(conditions *[]osv1.ClusterOperatorStatusCondition, conditionType osv1.ClusterStatusConditionType) { +func RemoveOperatorStatusCondition(conditions *[]cvv1.ClusterOperatorStatusCondition, conditionType cvv1.ClusterStatusConditionType) { if conditions == nil { - conditions = &[]osv1.ClusterOperatorStatusCondition{} + conditions = &[]cvv1.ClusterOperatorStatusCondition{} } - newConditions := []osv1.ClusterOperatorStatusCondition{} + newConditions := []cvv1.ClusterOperatorStatusCondition{} for _, condition := range *conditions { if condition.Type != conditionType { newConditions = append(newConditions, condition) @@ -67,7 +67,7 @@ func RemoveOperatorStatusCondition(conditions *[]osv1.ClusterOperatorStatusCondi *conditions = newConditions } -func FindOperatorStatusCondition(conditions []osv1.ClusterOperatorStatusCondition, conditionType osv1.ClusterStatusConditionType) *osv1.ClusterOperatorStatusCondition { +func FindOperatorStatusCondition(conditions []cvv1.ClusterOperatorStatusCondition, conditionType cvv1.ClusterStatusConditionType) *cvv1.ClusterOperatorStatusCondition { for i := range conditions { if conditions[i].Type == conditionType { return &conditions[i] @@ -77,15 +77,15 @@ func FindOperatorStatusCondition(conditions []osv1.ClusterOperatorStatusConditio return nil } -func IsOperatorStatusConditionTrue(conditions []osv1.ClusterOperatorStatusCondition, conditionType osv1.ClusterStatusConditionType) bool { - return IsOperatorStatusConditionPresentAndEqual(conditions, conditionType, osv1.ConditionTrue) +func IsOperatorStatusConditionTrue(conditions []cvv1.ClusterOperatorStatusCondition, conditionType cvv1.ClusterStatusConditionType) bool { + return IsOperatorStatusConditionPresentAndEqual(conditions, conditionType, cvv1.ConditionTrue) } -func IsOperatorStatusConditionFalse(conditions []osv1.ClusterOperatorStatusCondition, conditionType osv1.ClusterStatusConditionType) bool { - return IsOperatorStatusConditionPresentAndEqual(conditions, conditionType, osv1.ConditionFalse) +func IsOperatorStatusConditionFalse(conditions []cvv1.ClusterOperatorStatusCondition, conditionType cvv1.ClusterStatusConditionType) bool { + return IsOperatorStatusConditionPresentAndEqual(conditions, conditionType, cvv1.ConditionFalse) } -func IsOperatorStatusConditionPresentAndEqual(conditions []osv1.ClusterOperatorStatusCondition, conditionType osv1.ClusterStatusConditionType, status osv1.ConditionStatus) bool { +func IsOperatorStatusConditionPresentAndEqual(conditions []cvv1.ClusterOperatorStatusCondition, conditionType cvv1.ClusterStatusConditionType, status cvv1.ConditionStatus) bool { for _, condition := range conditions { if condition.Type == conditionType { return condition.Status == status @@ -94,7 +94,7 @@ func IsOperatorStatusConditionPresentAndEqual(conditions []osv1.ClusterOperatorS return false } -func IsOperatorStatusConditionNotIn(conditions []osv1.ClusterOperatorStatusCondition, conditionType osv1.ClusterStatusConditionType, status ...osv1.ConditionStatus) bool { +func IsOperatorStatusConditionNotIn(conditions []cvv1.ClusterOperatorStatusCondition, conditionType cvv1.ClusterStatusConditionType, status ...cvv1.ConditionStatus) bool { for _, condition := range conditions { if condition.Type == conditionType { for _, s := range status { diff --git a/pkg/apis/apis.go b/pkg/apis/apis.go index c4cdcaea1..f2db9324f 100644 --- a/pkg/apis/apis.go +++ b/pkg/apis/apis.go @@ -2,6 +2,3 @@ package apis // ClusterVersionGroupName defines the API group for clusterversion. const ClusterVersionGroupName = "config.openshift.io" - -// OperatorStatusGroupName defines the API group for operatorstatus. -const OperatorStatusGroupName = "operatorstatus.openshift.io" diff --git a/pkg/apis/config.openshift.io/v1/register.go b/pkg/apis/config.openshift.io/v1/register.go index fc7869ee0..16c96be9d 100644 --- a/pkg/apis/config.openshift.io/v1/register.go +++ b/pkg/apis/config.openshift.io/v1/register.go @@ -38,6 +38,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &ClusterVersion{}, &ClusterVersionList{}, + &ClusterOperator{}, + &ClusterOperatorList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) diff --git a/pkg/apis/config.openshift.io/v1/types.go b/pkg/apis/config.openshift.io/v1/types.go index 2eb3ae465..f3f372f01 100644 --- a/pkg/apis/config.openshift.io/v1/types.go +++ b/pkg/apis/config.openshift.io/v1/types.go @@ -2,8 +2,7 @@ package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - osv1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" + "k8s.io/apimachinery/pkg/runtime" ) // ClusterVersionList is a list of ClusterVersion resources. @@ -109,7 +108,7 @@ type ClusterVersionStatus struct { // by a temporary or permanent error. Conditions are only valid for the // current desiredUpdate when metadata.generation is equal to // status.generation. - Conditions []osv1.ClusterOperatorStatusCondition `json:"conditions"` + Conditions []ClusterOperatorStatusCondition `json:"conditions"` // AvailableUpdates contains the list of updates that are appropriate // for this cluster. This list may be empty if no updates are recommended, @@ -148,8 +147,108 @@ type Update struct { Payload string `json:"payload"` } -// RetrievedUpdates reports whether available updates have been retrieved from -// the upstream update server. The condition is Unknown before retrieval, False -// if the updates could not be retrieved or recently failed, or True if the -// availableUpdates field is accurate and recent. -const RetrievedUpdates osv1.ClusterStatusConditionType = "RetrievedUpdates" +// ClusterOperatorList is a list of OperatorStatus resources. +// +k8s:deepcopy-gen=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ClusterOperatorList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []ClusterOperator `json:"items"` +} + +// ClusterOperator is the Custom Resource object which holds the current state +// of an operator. This object is used by operators to convey their state to +// the rest of the cluster. +// +genclient +// +k8s:deepcopy-gen=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ClusterOperator struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + // Spec hold the intent of how this operator should behave. + Spec ClusterOperatorSpec `json:"spec"` + + // status holds the information about the state of an operator. It is consistent with status information across + // the kube ecosystem. + Status ClusterOperatorStatus `json:"status"` +} + +// ClusterOperatorSpec is empty for now, but you could imagine holding information like "pause". +type ClusterOperatorSpec struct { +} + +// ClusterOperatorStatus provides information about the status of the operator. +// +k8s:deepcopy-gen=true +type ClusterOperatorStatus struct { + // conditions describes the state of the operator's reconciliation functionality. + // +patchMergeKey=type + // +patchStrategy=merge + Conditions []ClusterOperatorStatusCondition `json:"conditions"` + + // version indicates which version of the operator updated the current + // status object. + Version string `json:"version"` + + // extension contains any additional status information specific to the + // operator which owns this status object. + Extension runtime.RawExtension `json:"extension,omitempty"` +} + +type ConditionStatus string + +// These are valid condition statuses. "ConditionTrue" means a resource is in the condition. +// "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes +// can't decide if a resource is in the condition or not. In the future, we could add other +// intermediate conditions, e.g. ConditionDegraded. +const ( + ConditionTrue ConditionStatus = "True" + ConditionFalse ConditionStatus = "False" + ConditionUnknown ConditionStatus = "Unknown" +) + +// ClusterOperatorStatusCondition represents the state of the operator's +// reconciliation functionality. +// +k8s:deepcopy-gen=true +type ClusterOperatorStatusCondition struct { + // type specifies the state of the operator's reconciliation functionality. + Type ClusterStatusConditionType `json:"type"` + + // Status of the condition, one of True, False, Unknown. + Status ConditionStatus `json:"status"` + + // LastTransitionTime is the time of the last update to the current status object. + LastTransitionTime metav1.Time `json:"lastTransitionTime"` + + // reason is the reason for the condition's last transition. Reasons are CamelCase + Reason string `json:"reason,omitempty"` + + // message provides additional information about the current condition. + // This is only to be consumed by humans. + Message string `json:"message,omitempty"` +} + +// ClusterStatusConditionType is the state of the operator's reconciliation functionality. +type ClusterStatusConditionType string + +const ( + // OperatorAvailable indicates that the binary maintained by the operator (eg: openshift-apiserver for the + // openshift-apiserver-operator), is functional and available in the cluster. + OperatorAvailable ClusterStatusConditionType = "Available" + + // OperatorProgressing indicates that the operator is actively making changes to the binary maintained by the + // operator (eg: openshift-apiserver for the openshift-apiserver-operator). + OperatorProgressing ClusterStatusConditionType = "Progressing" + + // OperatorFailing indicates that the operator has encountered an error that is preventing it from working properly. + // The binary maintained by the operator (eg: openshift-apiserver for the openshift-apiserver-operator) may still be + // available, but the user intent cannot be fulfilled. + OperatorFailing ClusterStatusConditionType = "Failing" + + // RetrievedUpdates reports whether available updates have been retrieved from + // the upstream update server. The condition is Unknown before retrieval, False + // if the updates could not be retrieved or recently failed, or True if the + // availableUpdates field is accurate and recent. + RetrievedUpdates ClusterStatusConditionType = "RetrievedUpdates" +) diff --git a/pkg/apis/config.openshift.io/v1/zz_generated.deepcopy.go b/pkg/apis/config.openshift.io/v1/zz_generated.deepcopy.go index 07f9ca423..0a6255a8a 100644 --- a/pkg/apis/config.openshift.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/config.openshift.io/v1/zz_generated.deepcopy.go @@ -21,10 +21,111 @@ limitations under the License. package v1 import ( - operatorstatusopenshiftiov1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterOperator) DeepCopyInto(out *ClusterOperator) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterOperator. +func (in *ClusterOperator) DeepCopy() *ClusterOperator { + if in == nil { + return nil + } + out := new(ClusterOperator) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterOperator) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterOperatorList) DeepCopyInto(out *ClusterOperatorList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterOperator, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterOperatorList. +func (in *ClusterOperatorList) DeepCopy() *ClusterOperatorList { + if in == nil { + return nil + } + out := new(ClusterOperatorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterOperatorList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterOperatorStatus) DeepCopyInto(out *ClusterOperatorStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]ClusterOperatorStatusCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.Extension.DeepCopyInto(&out.Extension) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterOperatorStatus. +func (in *ClusterOperatorStatus) DeepCopy() *ClusterOperatorStatus { + if in == nil { + return nil + } + out := new(ClusterOperatorStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterOperatorStatusCondition) DeepCopyInto(out *ClusterOperatorStatusCondition) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterOperatorStatusCondition. +func (in *ClusterOperatorStatusCondition) DeepCopy() *ClusterOperatorStatusCondition { + if in == nil { + return nil + } + out := new(ClusterOperatorStatusCondition) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterVersion) DeepCopyInto(out *ClusterVersion) { *out = *in @@ -123,7 +224,7 @@ func (in *ClusterVersionStatus) DeepCopyInto(out *ClusterVersionStatus) { out.Current = in.Current if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make([]operatorstatusopenshiftiov1.ClusterOperatorStatusCondition, len(*in)) + *out = make([]ClusterOperatorStatusCondition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } diff --git a/pkg/apis/operatorstatus.openshift.io/v1/register.go b/pkg/apis/operatorstatus.openshift.io/v1/register.go deleted file mode 100644 index c3d1c82e0..000000000 --- a/pkg/apis/operatorstatus.openshift.io/v1/register.go +++ /dev/null @@ -1,45 +0,0 @@ -package v1 - -import ( - "github.com/openshift/cluster-version-operator/pkg/apis" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// SchemeGroupVersion is group version used to register these objects. -var SchemeGroupVersion = schema.GroupVersion{Group: apis.OperatorStatusGroupName, Version: "v1"} - -// Resource takes an unqualified resource and returns a Group qualified -// GroupResource. -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - // SchemeBuilder is the scheme builder for ClusterVersionOperator's types. - SchemeBuilder runtime.SchemeBuilder - // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. - localSchemeBuilder = &SchemeBuilder - // AddToScheme is the function alias for AddtoScheme. - AddToScheme = localSchemeBuilder.AddToScheme -) - -func init() { - // We only register manually written functions here. The registration of - // the generated functions takes place in the generated files. The - // separation makes the code compile even when the generated files are - // missing. - localSchemeBuilder.Register(addKnownTypes) -} - -// Adds the list of known types to api.Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &ClusterOperator{}, - &ClusterOperatorList{}, - ) - - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/pkg/apis/operatorstatus.openshift.io/v1/types.go b/pkg/apis/operatorstatus.openshift.io/v1/types.go deleted file mode 100644 index 75083bfad..000000000 --- a/pkg/apis/operatorstatus.openshift.io/v1/types.go +++ /dev/null @@ -1,106 +0,0 @@ -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" -) - -// ClusterOperatorList is a list of OperatorStatus resources. -// +k8s:deepcopy-gen=true -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type ClusterOperatorList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []ClusterOperator `json:"items"` -} - -// ClusterOperator is the Custom Resource object which holds the current state -// of an operator. This object is used by operators to convey their state to -// the rest of the cluster. -// +genclient -// +k8s:deepcopy-gen=true -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type ClusterOperator struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata"` - - // Spec hold the intent of how this operator should behave. - Spec ClusterOperatorSpec `json:"spec"` - - // status holds the information about the state of an operator. It is consistent with status information across - // the kube ecosystem. - Status ClusterOperatorStatus `json:"status"` -} - -// ClusterOperatorSpec is empty for now, but you could imagine holding information like "pause". -type ClusterOperatorSpec struct { -} - -// ClusterOperatorStatus provides information about the status of the operator. -// +k8s:deepcopy-gen=true -type ClusterOperatorStatus struct { - // conditions describes the state of the operator's reconciliation functionality. - // +patchMergeKey=type - // +patchStrategy=merge - Conditions []ClusterOperatorStatusCondition `json:"conditions"` - - // version indicates which version of the operator updated the current - // status object. - Version string `json:"version"` - - // extension contains any additional status information specific to the - // operator which owns this status object. - Extension runtime.RawExtension `json:"extension,omitempty"` -} - -type ConditionStatus string - -// These are valid condition statuses. "ConditionTrue" means a resource is in the condition. -// "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes -// can't decide if a resource is in the condition or not. In the future, we could add other -// intermediate conditions, e.g. ConditionDegraded. -const ( - ConditionTrue ConditionStatus = "True" - ConditionFalse ConditionStatus = "False" - ConditionUnknown ConditionStatus = "Unknown" -) - -// ClusterOperatorStatusCondition represents the state of the operator's -// reconciliation functionality. -// +k8s:deepcopy-gen=true -type ClusterOperatorStatusCondition struct { - // type specifies the state of the operator's reconciliation functionality. - Type ClusterStatusConditionType `json:"type"` - - // Status of the condition, one of True, False, Unknown. - Status ConditionStatus `json:"status"` - - // LastTransitionTime is the time of the last update to the current status object. - LastTransitionTime metav1.Time `json:"lastTransitionTime"` - - // reason is the reason for the condition's last transition. Reasons are CamelCase - Reason string `json:"reason,omitempty"` - - // message provides additional information about the current condition. - // This is only to be consumed by humans. - Message string `json:"message,omitempty"` -} - -// ClusterStatusConditionType is the state of the operator's reconciliation functionality. -type ClusterStatusConditionType string - -const ( - // OperatorAvailable indicates that the binary maintained by the operator (eg: openshift-apiserver for the - // openshift-apiserver-operator), is functional and available in the cluster. - OperatorAvailable ClusterStatusConditionType = "Available" - - // OperatorProgressing indicates that the operator is actively making changes to the binary maintained by the - // operator (eg: openshift-apiserver for the openshift-apiserver-operator). - OperatorProgressing ClusterStatusConditionType = "Progressing" - - // OperatorFailing indicates that the operator has encountered an error that is preventing it from working properly. - // The binary maintained by the operator (eg: openshift-apiserver for the openshift-apiserver-operator) may still be - // available, but the user intent cannot be fulfilled. - OperatorFailing ClusterStatusConditionType = "Failing" -) diff --git a/pkg/apis/operatorstatus.openshift.io/v1/zz_generated.deepcopy.go b/pkg/apis/operatorstatus.openshift.io/v1/zz_generated.deepcopy.go deleted file mode 100644 index 400e0e54b..000000000 --- a/pkg/apis/operatorstatus.openshift.io/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,127 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterOperator) DeepCopyInto(out *ClusterOperator) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterOperator. -func (in *ClusterOperator) DeepCopy() *ClusterOperator { - if in == nil { - return nil - } - out := new(ClusterOperator) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ClusterOperator) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterOperatorList) DeepCopyInto(out *ClusterOperatorList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ClusterOperator, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterOperatorList. -func (in *ClusterOperatorList) DeepCopy() *ClusterOperatorList { - if in == nil { - return nil - } - out := new(ClusterOperatorList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ClusterOperatorList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterOperatorStatus) DeepCopyInto(out *ClusterOperatorStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]ClusterOperatorStatusCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.Extension.DeepCopyInto(&out.Extension) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterOperatorStatus. -func (in *ClusterOperatorStatus) DeepCopy() *ClusterOperatorStatus { - if in == nil { - return nil - } - out := new(ClusterOperatorStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterOperatorStatusCondition) DeepCopyInto(out *ClusterOperatorStatusCondition) { - *out = *in - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterOperatorStatusCondition. -func (in *ClusterOperatorStatusCondition) DeepCopy() *ClusterOperatorStatusCondition { - if in == nil { - return nil - } - out := new(ClusterOperatorStatusCondition) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/autoupdate/autoupdate.go b/pkg/autoupdate/autoupdate.go index e06c4ffe1..7c5892f9d 100644 --- a/pkg/autoupdate/autoupdate.go +++ b/pkg/autoupdate/autoupdate.go @@ -13,9 +13,7 @@ import ( clientset "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned" "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned/scheme" cvinformersv1 "github.com/openshift/cluster-version-operator/pkg/generated/informers/externalversions/config.openshift.io/v1" - osinformersv1 "github.com/openshift/cluster-version-operator/pkg/generated/informers/externalversions/operatorstatus.openshift.io/v1" cvlistersv1 "github.com/openshift/cluster-version-operator/pkg/generated/listers/config.openshift.io/v1" - oslistersv1 "github.com/openshift/cluster-version-operator/pkg/generated/listers/operatorstatus.openshift.io/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" utilruntime "k8s.io/apimachinery/pkg/util/runtime" @@ -48,7 +46,7 @@ type Controller struct { statusSyncHandler func(key string) error cvLister cvlistersv1.ClusterVersionLister - clusterOperatorLister oslistersv1.ClusterOperatorLister + clusterOperatorLister cvlistersv1.ClusterOperatorLister cvListerSynced cache.InformerSynced operatorStatusSynced cache.InformerSynced @@ -61,7 +59,7 @@ type Controller struct { func New( namespace, name string, cvInformer cvinformersv1.ClusterVersionInformer, - clusterOperatorInformer osinformersv1.ClusterOperatorInformer, + clusterOperatorInformer cvinformersv1.ClusterOperatorInformer, client clientset.Interface, kubeClient kubernetes.Interface, ) *Controller { diff --git a/pkg/cvo/availableupdates.go b/pkg/cvo/availableupdates.go index acf4103ee..3e8bfde8a 100644 --- a/pkg/cvo/availableupdates.go +++ b/pkg/cvo/availableupdates.go @@ -14,7 +14,6 @@ import ( "github.com/openshift/cluster-version-operator/lib/resourcemerge" cvv1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" - osv1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" "github.com/openshift/cluster-version-operator/pkg/cincinnati" ) @@ -54,7 +53,7 @@ type availableUpdates struct { At time.Time Updates []cvv1.Update - Condition osv1.ClusterOperatorStatusCondition + Condition cvv1.ClusterOperatorStatusCondition } func (u *availableUpdates) RecentlyChanged(interval time.Duration) bool { @@ -95,17 +94,17 @@ func (optr *Operator) getAvailableUpdates() *availableUpdates { return optr.availableUpdates } -func calculateAvailableUpdatesStatus(clusterID, upstream, channel, version string) ([]cvv1.Update, osv1.ClusterOperatorStatusCondition) { +func calculateAvailableUpdatesStatus(clusterID, upstream, channel, version string) ([]cvv1.Update, cvv1.ClusterOperatorStatusCondition) { if len(upstream) == 0 { - return nil, osv1.ClusterOperatorStatusCondition{ - Type: cvv1.RetrievedUpdates, Status: osv1.ConditionFalse, Reason: "NoUpstream", + return nil, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.RetrievedUpdates, Status: cvv1.ConditionFalse, Reason: "NoUpstream", Message: "No upstream server has been set to retrieve updates.", } } if len(version) == 0 { - return nil, osv1.ClusterOperatorStatusCondition{ - Type: cvv1.RetrievedUpdates, Status: osv1.ConditionFalse, Reason: "NoCurrentVersion", + return nil, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.RetrievedUpdates, Status: cvv1.ConditionFalse, Reason: "NoCurrentVersion", Message: "The cluster version does not have a semantic version assigned and cannot calculate valid upgrades.", } } @@ -113,8 +112,8 @@ func calculateAvailableUpdatesStatus(clusterID, upstream, channel, version strin currentVersion, err := semver.Parse(version) if err != nil { glog.V(2).Infof("Unable to parse current semantic version %q: %v", version, err) - return nil, osv1.ClusterOperatorStatusCondition{ - Type: cvv1.RetrievedUpdates, Status: osv1.ConditionFalse, Reason: "InvalidCurrentVersion", + return nil, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.RetrievedUpdates, Status: cvv1.ConditionFalse, Reason: "InvalidCurrentVersion", Message: "The current cluster version is not a valid semantic version and cannot be used to calculate upgrades.", } } @@ -122,8 +121,8 @@ func calculateAvailableUpdatesStatus(clusterID, upstream, channel, version strin updates, err := checkForUpdate(clusterID, upstream, channel, currentVersion) if err != nil { glog.V(2).Infof("Upstream server %s could not return available updates: %v", upstream, err) - return nil, osv1.ClusterOperatorStatusCondition{ - Type: cvv1.RetrievedUpdates, Status: osv1.ConditionFalse, Reason: "RemoteFailed", + return nil, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.RetrievedUpdates, Status: cvv1.ConditionFalse, Reason: "RemoteFailed", Message: fmt.Sprintf("Unable to retrieve available updates: %v", err), } } @@ -136,9 +135,9 @@ func calculateAvailableUpdatesStatus(clusterID, upstream, channel, version strin }) } - return cvoUpdates, osv1.ClusterOperatorStatusCondition{ + return cvoUpdates, cvv1.ClusterOperatorStatusCondition{ Type: cvv1.RetrievedUpdates, - Status: osv1.ConditionTrue, + Status: cvv1.ConditionTrue, LastTransitionTime: metav1.Now(), } diff --git a/pkg/cvo/cvo.go b/pkg/cvo/cvo.go index f18db4d17..7faf3b265 100644 --- a/pkg/cvo/cvo.go +++ b/pkg/cvo/cvo.go @@ -26,12 +26,9 @@ import ( "github.com/openshift/cluster-version-operator/lib/resourceapply" "github.com/openshift/cluster-version-operator/lib/resourcemerge" cvv1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" - osv1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" clientset "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned" cvinformersv1 "github.com/openshift/cluster-version-operator/pkg/generated/informers/externalversions/config.openshift.io/v1" - osinformersv1 "github.com/openshift/cluster-version-operator/pkg/generated/informers/externalversions/operatorstatus.openshift.io/v1" cvlistersv1 "github.com/openshift/cluster-version-operator/pkg/generated/listers/config.openshift.io/v1" - oslistersv1 "github.com/openshift/cluster-version-operator/pkg/generated/listers/operatorstatus.openshift.io/v1" ) const ( @@ -100,7 +97,7 @@ type Operator struct { cvLister cvlistersv1.ClusterVersionLister cvListerSynced cache.InformerSynced - clusterOperatorLister oslistersv1.ClusterOperatorLister + clusterOperatorLister cvlistersv1.ClusterOperatorLister clusterOperatorSynced cache.InformerSynced // queue tracks applying updates to a cluster. @@ -126,7 +123,7 @@ func New( overridePayloadDir string, minimumInterval time.Duration, cvInformer cvinformersv1.ClusterVersionInformer, - clusterOperatorInformer osinformersv1.ClusterOperatorInformer, + clusterOperatorInformer cvinformersv1.ClusterOperatorInformer, restConfig *rest.Config, client clientset.Interface, kubeClient kubernetes.Interface, @@ -152,7 +149,7 @@ func New( apiExtClient: apiExtClient, eventRecorder: eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: "clusterversionoperator"}), - queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "clusterversion"), + queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "clusterversion"), availableUpdatesQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "availableupdates"), } @@ -296,7 +293,7 @@ func (optr *Operator) sync(key string) error { // when we're up to date, limit how frequently we check the payload availableAndUpdated := original.Status.Generation == original.Generation && - resourcemerge.IsOperatorStatusConditionTrue(original.Status.Conditions, osv1.OperatorAvailable) + resourcemerge.IsOperatorStatusConditionTrue(original.Status.Conditions, cvv1.OperatorAvailable) hasRecentlySynced := availableAndUpdated && optr.hasRecentlySynced() if hasRecentlySynced { glog.V(4).Infof("Cluster version has been recently synced and no new changes detected") diff --git a/pkg/cvo/cvo_test.go b/pkg/cvo/cvo_test.go index 0818e7b92..c78052752 100644 --- a/pkg/cvo/cvo_test.go +++ b/pkg/cvo/cvo_test.go @@ -28,10 +28,9 @@ import ( "github.com/google/uuid" cvv1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" - osv1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" clientset "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned" "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned/fake" - oslistersv1 "github.com/openshift/cluster-version-operator/pkg/generated/listers/operatorstatus.openshift.io/v1" + cvlistersv1 "github.com/openshift/cluster-version-operator/pkg/generated/listers/config.openshift.io/v1" apiextv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" apiextclientv1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1" ) @@ -60,20 +59,20 @@ type clientCOLister struct { ns string } -func (c *clientCOLister) ClusterOperators(namespace string) oslistersv1.ClusterOperatorNamespaceLister { +func (c *clientCOLister) ClusterOperators(namespace string) cvlistersv1.ClusterOperatorNamespaceLister { copied := *c copied.ns = namespace return &copied } -func (c *clientCOLister) Get(name string) (*osv1.ClusterOperator, error) { - return c.client.Operatorstatus().ClusterOperators(c.ns).Get(name, metav1.GetOptions{}) +func (c *clientCOLister) Get(name string) (*cvv1.ClusterOperator, error) { + return c.client.Config().ClusterOperators(c.ns).Get(name, metav1.GetOptions{}) } -func (c *clientCOLister) List(selector labels.Selector) (ret []*osv1.ClusterOperator, err error) { - list, err := c.client.Operatorstatus().ClusterOperators(c.ns).List(metav1.ListOptions{LabelSelector: selector.String()}) +func (c *clientCOLister) List(selector labels.Selector) (ret []*cvv1.ClusterOperator, err error) { + list, err := c.client.Config().ClusterOperators(c.ns).List(metav1.ListOptions{LabelSelector: selector.String()}) if err != nil { return nil, err } - var items []*osv1.ClusterOperator + var items []*cvv1.ClusterOperator for i := range list.Items { items = append(items, &list.Items[i]) } @@ -99,13 +98,13 @@ func (r *cvLister) Get(name string) (*cvv1.ClusterVersion, error) { type coLister struct { Err error - Items []*osv1.ClusterOperator + Items []*cvv1.ClusterOperator } -func (r *coLister) List(selector labels.Selector) (ret []*osv1.ClusterOperator, err error) { +func (r *coLister) List(selector labels.Selector) (ret []*cvv1.ClusterOperator, err error) { return r.Items, r.Err } -func (r *coLister) ClusterOperators(namespace string) oslistersv1.ClusterOperatorNamespaceLister { +func (r *coLister) ClusterOperators(namespace string) cvlistersv1.ClusterOperatorNamespaceLister { return &nsClusterOperatorLister{r: r, ns: namespace} } @@ -114,10 +113,10 @@ type nsClusterOperatorLister struct { ns string } -func (r *nsClusterOperatorLister) List(selector labels.Selector) (ret []*osv1.ClusterOperator, err error) { +func (r *nsClusterOperatorLister) List(selector labels.Selector) (ret []*cvv1.ClusterOperator, err error) { return r.r.Items, r.r.Err } -func (r *nsClusterOperatorLister) Get(name string) (*osv1.ClusterOperator, error) { +func (r *nsClusterOperatorLister) Get(name string) (*cvv1.ClusterOperator, error) { for _, s := range r.r.Items { if s.Name == name && r.ns == s.Namespace { return s, nil @@ -280,10 +279,10 @@ func TestOperator_sync(t *testing.T) { Payload: "payload/image:v4.0.1", }, VersionHash: "", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionTrue, Reason: "UpdatePayloadIntegrity", Message: "unable to apply object"}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionTrue, Message: "Working towards 4.0.1"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionTrue, Reason: "UpdatePayloadIntegrity", Message: "unable to apply object"}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionTrue, Message: "Working towards 4.0.1"}, }, }, }, @@ -309,10 +308,10 @@ func TestOperator_sync(t *testing.T) { Payload: "payload/image:v4.0.1", }, VersionHash: "", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionTrue, Reason: "UpdatePayloadIntegrity", Message: "unable to apply object"}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionTrue, Reason: "UpdatePayloadIntegrity", Message: "Unable to apply 4.0.1: the contents of the update are invalid"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionTrue, Reason: "UpdatePayloadIntegrity", Message: "unable to apply object"}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionTrue, Reason: "UpdatePayloadIntegrity", Message: "Unable to apply 4.0.1: the contents of the update are invalid"}, }, }, }) @@ -329,10 +328,10 @@ func TestOperator_sync(t *testing.T) { Payload: "payload/image:v4.0.1", }, VersionHash: "y_Kc5IQiIyU=", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionTrue, Message: "Done applying 0.0.1-abc"}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionTrue, Message: "Done applying 0.0.1-abc"}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, }, }, }) @@ -363,10 +362,10 @@ func TestOperator_sync(t *testing.T) { Payload: "payload/image:v4.0.1", }, VersionHash: "", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionTrue, Message: "unable to apply object"}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionTrue, Message: "Working towards 4.0.1"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionTrue, Message: "unable to apply object"}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionTrue, Message: "Working towards 4.0.1"}, }, }, }, @@ -398,10 +397,10 @@ func TestOperator_sync(t *testing.T) { Payload: "payload/image:v4.0.1", }, VersionHash: "", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionTrue, Message: "unable to apply object"}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionTrue, Message: "Unable to apply 4.0.1: unable to apply object"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionTrue, Message: "unable to apply object"}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionTrue, Message: "Unable to apply 4.0.1: unable to apply object"}, }, }, }) @@ -419,10 +418,10 @@ func TestOperator_sync(t *testing.T) { Payload: "payload/image:v4.0.1", }, VersionHash: "y_Kc5IQiIyU=", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionTrue, Message: "injected error"}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionTrue, Message: "Unable to apply 4.0.1: injected error"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionTrue, Message: "injected error"}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionTrue, Message: "Unable to apply 4.0.1: injected error"}, }, }, }) @@ -473,10 +472,10 @@ func TestOperator_sync(t *testing.T) { Payload: "payload/image:v4.0.1", }, VersionHash: "", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionTrue, Message: "unable to apply object"}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionTrue, Message: "Unable to apply 4.0.1: unable to apply object"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionTrue, Message: "unable to apply object"}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionTrue, Message: "Unable to apply 4.0.1: unable to apply object"}, }, }, }) @@ -494,10 +493,10 @@ func TestOperator_sync(t *testing.T) { Payload: "payload/image:v4.0.1", }, VersionHash: "y_Kc5IQiIyU=", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionTrue, Message: "Done applying 0.0.1-abc"}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionTrue, Message: "Done applying 0.0.1-abc"}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, }, }, }) @@ -525,8 +524,8 @@ func TestOperator_sync(t *testing.T) { Payload: "payload/image:v4.0.1", }, VersionHash: "", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorProgressing, Status: osv1.ConditionTrue, Message: "Unable to apply 4.0.1: unable to apply object"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionTrue, Message: "Unable to apply 4.0.1: unable to apply object"}, }, }, }, @@ -558,10 +557,10 @@ func TestOperator_sync(t *testing.T) { Payload: "payload/image:v4.0.1", }, VersionHash: "", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionTrue, Message: "unable to apply object"}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionTrue, Message: "Unable to apply 4.0.1: unable to apply object"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionTrue, Message: "unable to apply object"}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionTrue, Message: "Unable to apply 4.0.1: unable to apply object"}, }, }, }) @@ -579,10 +578,10 @@ func TestOperator_sync(t *testing.T) { Payload: "payload/image:v4.0.1", }, VersionHash: "y_Kc5IQiIyU=", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionTrue, Message: "Done applying 0.0.1-abc"}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionTrue, Message: "Done applying 0.0.1-abc"}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, }, }, }) @@ -628,10 +627,10 @@ func TestOperator_sync(t *testing.T) { Payload: "payload/image:v4.0.1", }, VersionHash: "", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionTrue, Message: "Working towards payload/image:v4.0.1"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionTrue, Message: "Working towards payload/image:v4.0.1"}, }, }, }) @@ -650,10 +649,10 @@ func TestOperator_sync(t *testing.T) { Version: "0.0.1-abc", }, VersionHash: "y_Kc5IQiIyU=", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionTrue, Message: "Done applying 0.0.1-abc"}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionTrue, Message: "Done applying 0.0.1-abc"}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, }, }, }) @@ -681,10 +680,10 @@ func TestOperator_sync(t *testing.T) { }, Status: cvv1.ClusterVersionStatus{ Generation: 2, - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionTrue}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionTrue}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, }, }, }, @@ -716,10 +715,10 @@ func TestOperator_sync(t *testing.T) { }, Status: cvv1.ClusterVersionStatus{ Generation: 2, - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, }, }, } @@ -751,9 +750,9 @@ func TestOperator_sync(t *testing.T) { {Version: "4.0.2", Payload: "test/image:1"}, {Version: "4.0.3", Payload: "test/image:2"}, }, - Condition: osv1.ClusterOperatorStatusCondition{ + Condition: cvv1.ClusterOperatorStatusCondition{ Type: cvv1.RetrievedUpdates, - Status: osv1.ConditionTrue, + Status: cvv1.ConditionTrue, }, }, }, @@ -781,11 +780,11 @@ func TestOperator_sync(t *testing.T) { }, Current: cvv1.Update{Payload: "payload/image:v4.0.1"}, Generation: 2, - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: cvv1.RetrievedUpdates, Status: osv1.ConditionTrue}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.RetrievedUpdates, Status: cvv1.ConditionTrue}, }, }, }) @@ -817,10 +816,10 @@ func TestOperator_sync(t *testing.T) { }, VersionHash: "y_Kc5IQiIyU=", Generation: 2, - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionTrue, Message: "Done applying 0.0.1-abc"}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionTrue, Message: "Done applying 0.0.1-abc"}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, }, }, }, @@ -861,10 +860,10 @@ func TestOperator_sync(t *testing.T) { }, VersionHash: "unknown_hash", Generation: 2, - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionTrue, Message: "Done applying 0.0.1-abc"}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionTrue, Message: "Done applying 0.0.1-abc"}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, }, }, }, @@ -892,10 +891,10 @@ func TestOperator_sync(t *testing.T) { }, Generation: 2, VersionHash: "unknown_hash", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionTrue, Message: "Working towards payload/image:v4.0.1"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionTrue, Message: "Working towards payload/image:v4.0.1"}, }, }, }) @@ -916,10 +915,10 @@ func TestOperator_sync(t *testing.T) { }, Generation: 2, VersionHash: "y_Kc5IQiIyU=", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionTrue, Message: "Done applying 0.0.1-abc"}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionTrue, Message: "Done applying 0.0.1-abc"}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionFalse, Message: "Cluster version is 0.0.1-abc"}, }, }, }) @@ -1014,9 +1013,9 @@ func TestOperator_availableUpdatesSync(t *testing.T) { wantUpdates: &availableUpdates{ Upstream: "", Channel: "fast", - Condition: osv1.ClusterOperatorStatusCondition{ + Condition: cvv1.ClusterOperatorStatusCondition{ Type: cvv1.RetrievedUpdates, - Status: osv1.ConditionFalse, + Status: cvv1.ConditionFalse, Reason: "NoCurrentVersion", Message: "The cluster version does not have a semantic version assigned and cannot calculate valid upgrades.", }, @@ -1045,10 +1044,10 @@ func TestOperator_availableUpdatesSync(t *testing.T) { Current: cvv1.Update{ Payload: "payload/image:v4.0.1", }, - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionTrue, Message: "Done applying payload/image:v4.0.1"}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionFalse}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionTrue, Message: "Done applying payload/image:v4.0.1"}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionFalse}, }, }, }, @@ -1057,9 +1056,9 @@ func TestOperator_availableUpdatesSync(t *testing.T) { wantUpdates: &availableUpdates{ Upstream: "", Channel: "fast", - Condition: osv1.ClusterOperatorStatusCondition{ + Condition: cvv1.ClusterOperatorStatusCondition{ Type: cvv1.RetrievedUpdates, - Status: osv1.ConditionFalse, + Status: cvv1.ConditionFalse, Reason: "RemoteFailed", Message: "Unable to retrieve available updates: unexpected HTTP status: 500 Internal Server Error", }, @@ -1088,11 +1087,11 @@ func TestOperator_availableUpdatesSync(t *testing.T) { Current: cvv1.Update{ Payload: "payload/image:v4.0.1", }, - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionTrue, Message: "Done applying payload/image:v4.0.1"}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionFalse}, - {Type: cvv1.RetrievedUpdates, Status: osv1.ConditionFalse, Reason: "RemoteFailed", Message: "Unable to retrieve available updates: unexpected HTTP status: 500 Internal Server Error"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionTrue, Message: "Done applying payload/image:v4.0.1"}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionFalse}, + {Type: cvv1.RetrievedUpdates, Status: cvv1.ConditionFalse, Reason: "RemoteFailed", Message: "Unable to retrieve available updates: unexpected HTTP status: 500 Internal Server Error"}, }, }, }, @@ -1101,9 +1100,9 @@ func TestOperator_availableUpdatesSync(t *testing.T) { wantUpdates: &availableUpdates{ Upstream: "", Channel: "fast", - Condition: osv1.ClusterOperatorStatusCondition{ + Condition: cvv1.ClusterOperatorStatusCondition{ Type: cvv1.RetrievedUpdates, - Status: osv1.ConditionTrue, + Status: cvv1.ConditionTrue, }, }, }, @@ -1143,11 +1142,11 @@ func TestOperator_availableUpdatesSync(t *testing.T) { Current: cvv1.Update{ Payload: "payload/image:v4.0.1", }, - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionTrue, Message: "Done applying payload/image:v4.0.1"}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionFalse}, - {Type: cvv1.RetrievedUpdates, Status: osv1.ConditionFalse, Reason: "RemoteFailed", Message: "Unable to retrieve available updates: unexpected HTTP status: 500 Internal Server Error"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionTrue, Message: "Done applying payload/image:v4.0.1"}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionFalse}, + {Type: cvv1.RetrievedUpdates, Status: cvv1.ConditionFalse, Reason: "RemoteFailed", Message: "Unable to retrieve available updates: unexpected HTTP status: 500 Internal Server Error"}, }, }, }, @@ -1160,9 +1159,9 @@ func TestOperator_availableUpdatesSync(t *testing.T) { {Version: "4.0.2-prerelease", Payload: "some.other.registry/payload/image:v4.0.2"}, {Version: "4.0.2", Payload: "payload/image:v4.0.2"}, }, - Condition: osv1.ClusterOperatorStatusCondition{ + Condition: cvv1.ClusterOperatorStatusCondition{ Type: cvv1.RetrievedUpdates, - Status: osv1.ConditionTrue, + Status: cvv1.ConditionTrue, }, }, }, @@ -1199,11 +1198,11 @@ func TestOperator_availableUpdatesSync(t *testing.T) { Payload: "payload/image:v4.0.1", }, Generation: 2, - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionTrue, Message: "Done applying payload/image:v4.0.1"}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionFalse}, - {Type: osv1.OperatorProgressing, Status: osv1.ConditionFalse}, - {Type: cvv1.RetrievedUpdates, Status: osv1.ConditionFalse, Reason: "RemoteFailed", Message: "Unable to retrieve available updates: unexpected HTTP status: 500 Internal Server Error"}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionTrue, Message: "Done applying payload/image:v4.0.1"}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse}, + {Type: cvv1.OperatorProgressing, Status: cvv1.ConditionFalse}, + {Type: cvv1.RetrievedUpdates, Status: cvv1.ConditionFalse, Reason: "RemoteFailed", Message: "Unable to retrieve available updates: unexpected HTTP status: 500 Internal Server Error"}, }, }, }, @@ -1326,7 +1325,7 @@ func expectMutation(t *testing.T, a ktesting.Action, verb string, resource, subr in.Spec.ClusterID = at.GetObject().(*cvv1.ClusterVersion).Spec.ClusterID } } - if in, ok := at.GetObject().(*osv1.ClusterOperator); ok { + if in, ok := at.GetObject().(*cvv1.ClusterOperator); ok { for i := range in.Status.Conditions { in.Status.Conditions[i].LastTransitionTime.Time = time.Time{} } diff --git a/pkg/cvo/internal/operatorstatus.go b/pkg/cvo/internal/operatorstatus.go index 711d40736..a745a416a 100644 --- a/pkg/cvo/internal/operatorstatus.go +++ b/pkg/cvo/internal/operatorstatus.go @@ -14,8 +14,8 @@ import ( "github.com/openshift/cluster-version-operator/lib" "github.com/openshift/cluster-version-operator/lib/resourcebuilder" - osv1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" - osclientv1 "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1" + cvv1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" + cvclientv1 "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned/typed/config.openshift.io/v1" ) var ( @@ -26,32 +26,32 @@ var ( ) func init() { - if err := osv1.AddToScheme(osScheme); err != nil { + if err := cvv1.AddToScheme(osScheme); err != nil { panic(err) } - osMapper.RegisterGVK(osv1.SchemeGroupVersion.WithKind("ClusterOperator"), newClusterOperatorBuilder) + osMapper.RegisterGVK(cvv1.SchemeGroupVersion.WithKind("ClusterOperator"), newClusterOperatorBuilder) osMapper.AddToMap(resourcebuilder.Mapper) } // readClusterOperatorV1OrDie reads clusteroperator object from bytes. Panics on error. -func readClusterOperatorV1OrDie(objBytes []byte) *osv1.ClusterOperator { - requiredObj, err := runtime.Decode(osCodecs.UniversalDecoder(osv1.SchemeGroupVersion), objBytes) +func readClusterOperatorV1OrDie(objBytes []byte) *cvv1.ClusterOperator { + requiredObj, err := runtime.Decode(osCodecs.UniversalDecoder(cvv1.SchemeGroupVersion), objBytes) if err != nil { panic(err) } - return requiredObj.(*osv1.ClusterOperator) + return requiredObj.(*cvv1.ClusterOperator) } type clusterOperatorBuilder struct { - client *osclientv1.OperatorstatusV1Client + client *cvclientv1.ConfigV1Client raw []byte modifier resourcebuilder.MetaV1ObjectModifierFunc } func newClusterOperatorBuilder(config *rest.Config, m lib.Manifest) resourcebuilder.Interface { return &clusterOperatorBuilder{ - client: osclientv1.NewForConfigOrDie(config), + client: cvclientv1.NewForConfigOrDie(config), raw: m.Raw, } } @@ -75,7 +75,7 @@ const ( osPollTimeout = 1 * time.Minute ) -func waitForOperatorStatusToBeDone(client osclientv1.ClusterOperatorsGetter, os *osv1.ClusterOperator) error { +func waitForOperatorStatusToBeDone(client cvclientv1.ClusterOperatorsGetter, os *cvv1.ClusterOperator) error { return wait.Poll(osPollInternal, osPollTimeout, func() (bool, error) { eos, err := client.ClusterOperators(os.Namespace).Get(os.Name, metav1.GetOptions{}) if err != nil { @@ -93,11 +93,11 @@ func waitForOperatorStatusToBeDone(client osclientv1.ClusterOperatorsGetter, os failing := true for _, condition := range eos.Status.Conditions { switch { - case condition.Type == osv1.OperatorAvailable && condition.Status == osv1.ConditionTrue: + case condition.Type == cvv1.OperatorAvailable && condition.Status == cvv1.ConditionTrue: available = true - case condition.Type == osv1.OperatorProgressing && condition.Status == osv1.ConditionFalse: + case condition.Type == cvv1.OperatorProgressing && condition.Status == cvv1.ConditionFalse: progressing = false - case condition.Type == osv1.OperatorFailing && condition.Status == osv1.ConditionFalse: + case condition.Type == cvv1.OperatorFailing && condition.Status == cvv1.ConditionFalse: failing = false } } diff --git a/pkg/cvo/metrics.go b/pkg/cvo/metrics.go index 26b4d33cd..76dd44058 100644 --- a/pkg/cvo/metrics.go +++ b/pkg/cvo/metrics.go @@ -3,7 +3,6 @@ package cvo import ( "github.com/openshift/cluster-version-operator/lib/resourcemerge" cvv1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" - osv1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" "github.com/prometheus/client_golang/prometheus" "k8s.io/apimachinery/pkg/labels" ) @@ -73,7 +72,7 @@ func (m *operatorMetrics) Collect(ch chan<- prometheus.Metric) { ch <- g if cv, err := m.optr.cvLister.Get(m.optr.name); err == nil { // output cluster version - failing := resourcemerge.IsOperatorStatusConditionTrue(cv.Status.Conditions, osv1.OperatorFailing) + failing := resourcemerge.IsOperatorStatusConditionTrue(cv.Status.Conditions, cvv1.OperatorFailing) if update := cv.Spec.DesiredUpdate; update != nil && update.Payload != current.Payload { g := m.version.WithLabelValues("update", update.Version, update.Payload) g.Set(1) @@ -105,8 +104,8 @@ func (m *operatorMetrics) Collect(ch chan<- prometheus.Metric) { operators, _ := m.optr.clusterOperatorLister.List(labels.Everything()) for _, op := range operators { g := m.clusterOperatorUp.WithLabelValues(op.Namespace, op.Name, op.Status.Version) - failing := resourcemerge.IsOperatorStatusConditionTrue(op.Status.Conditions, osv1.OperatorFailing) - available := resourcemerge.IsOperatorStatusConditionTrue(op.Status.Conditions, osv1.OperatorAvailable) + failing := resourcemerge.IsOperatorStatusConditionTrue(op.Status.Conditions, cvv1.OperatorFailing) + available := resourcemerge.IsOperatorStatusConditionTrue(op.Status.Conditions, cvv1.OperatorAvailable) if available && !failing { g.Set(1) } else { @@ -114,11 +113,11 @@ func (m *operatorMetrics) Collect(ch chan<- prometheus.Metric) { } ch <- g for _, condition := range op.Status.Conditions { - if condition.Status == osv1.ConditionUnknown { + if condition.Status == cvv1.ConditionUnknown { continue } g := m.clusterOperatorConditions.WithLabelValues(op.Namespace, op.Name, string(condition.Type)) - if condition.Status == osv1.ConditionTrue { + if condition.Status == cvv1.ConditionTrue { g.Set(1) } else { g.Set(0) diff --git a/pkg/cvo/metrics_test.go b/pkg/cvo/metrics_test.go index 36317ffff..ae6173fe7 100644 --- a/pkg/cvo/metrics_test.go +++ b/pkg/cvo/metrics_test.go @@ -4,7 +4,6 @@ import ( "testing" cvv1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" - osv1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -33,16 +32,16 @@ func Test_operatorMetrics_Collect(t *testing.T) { name: "collects cluster operator status failure", optr: &Operator{ clusterOperatorLister: &coLister{ - Items: []*osv1.ClusterOperator{ + Items: []*cvv1.ClusterOperator{ { ObjectMeta: metav1.ObjectMeta{ Name: "test", }, - Status: osv1.ClusterOperatorStatus{ + Status: cvv1.ClusterOperatorStatus{ Version: "10.1.5-1", - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionTrue}, - {Type: osv1.OperatorFailing, Status: osv1.ConditionTrue}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionTrue}, + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionTrue}, }, }, }, @@ -63,17 +62,17 @@ func Test_operatorMetrics_Collect(t *testing.T) { name: "collects cluster operator status custom", optr: &Operator{ clusterOperatorLister: &coLister{ - Items: []*osv1.ClusterOperator{ + Items: []*cvv1.ClusterOperator{ { ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: "test", }, - Status: osv1.ClusterOperatorStatus{ - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorAvailable, Status: osv1.ConditionTrue}, - {Type: osv1.ClusterStatusConditionType("Custom"), Status: osv1.ConditionFalse}, - {Type: osv1.ClusterStatusConditionType("Unknown"), Status: osv1.ConditionUnknown}, + Status: cvv1.ClusterOperatorStatus{ + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorAvailable, Status: cvv1.ConditionTrue}, + {Type: cvv1.ClusterStatusConditionType("Custom"), Status: cvv1.ConditionFalse}, + {Type: cvv1.ClusterStatusConditionType("Unknown"), Status: cvv1.ConditionUnknown}, }, }, }, @@ -129,8 +128,8 @@ func Test_operatorMetrics_Collect(t *testing.T) { Name: "test", }, Status: cvv1.ClusterVersionStatus{ - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: cvv1.RetrievedUpdates, Status: osv1.ConditionTrue}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.RetrievedUpdates, Status: cvv1.ConditionTrue}, }, }, }, @@ -188,8 +187,8 @@ func Test_operatorMetrics_Collect(t *testing.T) { DesiredUpdate: &cvv1.Update{Version: "1.0.0", Payload: "test/image:2"}, }, Status: cvv1.ClusterVersionStatus{ - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorFailing, Status: osv1.ConditionTrue}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionTrue}, }, }, }, @@ -219,8 +218,8 @@ func Test_operatorMetrics_Collect(t *testing.T) { Name: "test", }, Status: cvv1.ClusterVersionStatus{ - Conditions: []osv1.ClusterOperatorStatusCondition{ - {Type: osv1.OperatorFailing, Status: osv1.ConditionTrue}, + Conditions: []cvv1.ClusterOperatorStatusCondition{ + {Type: cvv1.OperatorFailing, Status: cvv1.ConditionTrue}, }, }, }, diff --git a/pkg/cvo/status.go b/pkg/cvo/status.go index f10be7cd2..e7fac1b37 100644 --- a/pkg/cvo/status.go +++ b/pkg/cvo/status.go @@ -9,7 +9,6 @@ import ( "github.com/openshift/cluster-version-operator/lib/resourcemerge" cvv1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" - osv1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" cvclientv1 "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned/typed/config.openshift.io/v1" ) @@ -35,28 +34,28 @@ func (optr *Operator) syncProgressingStatus(config *cvv1.ClusterVersion) error { now := metav1.Now() // clear the available condition - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{Type: osv1.OperatorAvailable, Status: osv1.ConditionFalse, LastTransitionTime: now}) + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{Type: cvv1.OperatorAvailable, Status: cvv1.ConditionFalse, LastTransitionTime: now}) // preserve the most recent failing condition - if resourcemerge.IsOperatorStatusConditionNotIn(config.Status.Conditions, osv1.OperatorFailing, osv1.ConditionTrue) { - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{Type: osv1.OperatorFailing, Status: osv1.ConditionFalse, LastTransitionTime: now}) + if resourcemerge.IsOperatorStatusConditionNotIn(config.Status.Conditions, cvv1.OperatorFailing, cvv1.ConditionTrue) { + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse, LastTransitionTime: now}) } // set progressing with an accurate summary message - if c := resourcemerge.FindOperatorStatusCondition(config.Status.Conditions, osv1.OperatorFailing); c != nil && c.Status == osv1.ConditionTrue { + if c := resourcemerge.FindOperatorStatusCondition(config.Status.Conditions, cvv1.OperatorFailing); c != nil && c.Status == cvv1.ConditionTrue { reason := c.Reason msg := summaryForReason(reason) - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{ - Type: osv1.OperatorProgressing, - Status: osv1.ConditionTrue, + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.OperatorProgressing, + Status: cvv1.ConditionTrue, Reason: reason, Message: fmt.Sprintf("Unable to apply %s: %s", optr.desiredVersionString(config), msg), LastTransitionTime: now, }) } else { - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{ - Type: osv1.OperatorProgressing, - Status: osv1.ConditionTrue, + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.OperatorProgressing, + Status: cvv1.ConditionTrue, Message: fmt.Sprintf("Working towards %s", optr.desiredVersionString(config)), LastTransitionTime: now, }) @@ -79,21 +78,21 @@ func (optr *Operator) syncAvailableStatus(config *cvv1.ClusterVersion, current c version := optr.currentVersionString(config) // set the available condition - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{ - Type: osv1.OperatorAvailable, - Status: osv1.ConditionTrue, + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.OperatorAvailable, + Status: cvv1.ConditionTrue, Message: fmt.Sprintf("Done applying %s", version), LastTransitionTime: now, }) // clear the failure condition - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{Type: osv1.OperatorFailing, Status: osv1.ConditionFalse, LastTransitionTime: now}) + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{Type: cvv1.OperatorFailing, Status: cvv1.ConditionFalse, LastTransitionTime: now}) // clear the progressing condition - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{ - Type: osv1.OperatorProgressing, - Status: osv1.ConditionFalse, + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.OperatorProgressing, + Status: cvv1.ConditionFalse, Message: fmt.Sprintf("Cluster version is %s", version), LastTransitionTime: now, @@ -121,27 +120,27 @@ func (optr *Operator) syncPayloadFailingStatus(original *cvv1.ClusterVersion, er // leave the available condition alone // set the failing condition - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{ - Type: osv1.OperatorFailing, - Status: osv1.ConditionTrue, + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.OperatorFailing, + Status: cvv1.ConditionTrue, Reason: reason, Message: err.Error(), LastTransitionTime: now, }) // update the progressing condition message to indicate there is an error - if resourcemerge.IsOperatorStatusConditionTrue(config.Status.Conditions, osv1.OperatorProgressing) { - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{ - Type: osv1.OperatorProgressing, - Status: osv1.ConditionTrue, + if resourcemerge.IsOperatorStatusConditionTrue(config.Status.Conditions, cvv1.OperatorProgressing) { + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.OperatorProgressing, + Status: cvv1.ConditionTrue, Reason: reason, Message: fmt.Sprintf("Unable to apply %s: %s", optr.desiredVersionString(config), msg), LastTransitionTime: now, }) } else { - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{ - Type: osv1.OperatorProgressing, - Status: osv1.ConditionFalse, + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.OperatorProgressing, + Status: cvv1.ConditionFalse, Reason: reason, Message: fmt.Sprintf("Error while reconciling %s: %s", optr.desiredVersionString(config), msg), LastTransitionTime: now, @@ -168,30 +167,30 @@ func (optr *Operator) syncUpdateFailingStatus(original *cvv1.ClusterVersion, err } // clear the available condition - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{Type: osv1.OperatorAvailable, Status: osv1.ConditionFalse, LastTransitionTime: now}) + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{Type: cvv1.OperatorAvailable, Status: cvv1.ConditionFalse, LastTransitionTime: now}) // set the failing condition - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{ - Type: osv1.OperatorFailing, - Status: osv1.ConditionTrue, + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.OperatorFailing, + Status: cvv1.ConditionTrue, Reason: reason, Message: err.Error(), LastTransitionTime: now, }) // update the progressing condition message to indicate there is an error - if resourcemerge.IsOperatorStatusConditionTrue(config.Status.Conditions, osv1.OperatorProgressing) { - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{ - Type: osv1.OperatorProgressing, - Status: osv1.ConditionTrue, + if resourcemerge.IsOperatorStatusConditionTrue(config.Status.Conditions, cvv1.OperatorProgressing) { + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.OperatorProgressing, + Status: cvv1.ConditionTrue, Reason: reason, Message: fmt.Sprintf("Unable to apply %s: %s", optr.desiredVersionString(config), msg), LastTransitionTime: now, }) } else { - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{ - Type: osv1.OperatorProgressing, - Status: osv1.ConditionFalse, + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.OperatorProgressing, + Status: cvv1.ConditionFalse, Reason: reason, Message: fmt.Sprintf("Error while reconciling %s: %s", optr.desiredVersionString(config), msg), LastTransitionTime: now, @@ -233,23 +232,23 @@ func (optr *Operator) syncFailingStatus(config *cvv1.ClusterVersion, ierr error) msg := fmt.Sprintf("Error ensuring the cluster version is up to date: %v", ierr) // clear the available condition - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{Type: osv1.OperatorAvailable, Status: osv1.ConditionFalse, LastTransitionTime: now}) + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{Type: cvv1.OperatorAvailable, Status: cvv1.ConditionFalse, LastTransitionTime: now}) // reset the failing message - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{ - Type: osv1.OperatorFailing, - Status: osv1.ConditionTrue, + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.OperatorFailing, + Status: cvv1.ConditionTrue, Message: ierr.Error(), LastTransitionTime: now, }) // preserve the status of the existing progressing condition - progressingStatus := osv1.ConditionFalse - if resourcemerge.IsOperatorStatusConditionTrue(config.Status.Conditions, osv1.OperatorProgressing) { - progressingStatus = osv1.ConditionTrue + progressingStatus := cvv1.ConditionFalse + if resourcemerge.IsOperatorStatusConditionTrue(config.Status.Conditions, cvv1.OperatorProgressing) { + progressingStatus = cvv1.ConditionTrue } - resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, osv1.ClusterOperatorStatusCondition{ - Type: osv1.OperatorProgressing, + resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, cvv1.ClusterOperatorStatusCondition{ + Type: cvv1.OperatorProgressing, Status: progressingStatus, Message: msg, LastTransitionTime: now, diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go index d488a0924..16b38b138 100644 --- a/pkg/generated/clientset/versioned/clientset.go +++ b/pkg/generated/clientset/versioned/clientset.go @@ -20,7 +20,6 @@ package versioned import ( configv1 "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned/typed/config.openshift.io/v1" - operatorstatusv1 "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -31,17 +30,13 @@ type Interface interface { ConfigV1() configv1.ConfigV1Interface // Deprecated: please explicitly pick a version if possible. Config() configv1.ConfigV1Interface - OperatorstatusV1() operatorstatusv1.OperatorstatusV1Interface - // Deprecated: please explicitly pick a version if possible. - Operatorstatus() operatorstatusv1.OperatorstatusV1Interface } // Clientset contains the clients for groups. Each group has exactly one // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - configV1 *configv1.ConfigV1Client - operatorstatusV1 *operatorstatusv1.OperatorstatusV1Client + configV1 *configv1.ConfigV1Client } // ConfigV1 retrieves the ConfigV1Client @@ -55,17 +50,6 @@ func (c *Clientset) Config() configv1.ConfigV1Interface { return c.configV1 } -// OperatorstatusV1 retrieves the OperatorstatusV1Client -func (c *Clientset) OperatorstatusV1() operatorstatusv1.OperatorstatusV1Interface { - return c.operatorstatusV1 -} - -// Deprecated: Operatorstatus retrieves the default version of OperatorstatusClient. -// Please explicitly pick a version. -func (c *Clientset) Operatorstatus() operatorstatusv1.OperatorstatusV1Interface { - return c.operatorstatusV1 -} - // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -86,10 +70,6 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } - cs.operatorstatusV1, err = operatorstatusv1.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) if err != nil { @@ -103,7 +83,6 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset cs.configV1 = configv1.NewForConfigOrDie(c) - cs.operatorstatusV1 = operatorstatusv1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -113,7 +92,6 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.configV1 = configv1.New(c) - cs.operatorstatusV1 = operatorstatusv1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go index 0c703a627..ba49d7d8d 100644 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -22,8 +22,6 @@ import ( clientset "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned" configv1 "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned/typed/config.openshift.io/v1" fakeconfigv1 "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/fake" - operatorstatusv1 "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1" - fakeoperatorstatusv1 "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -82,13 +80,3 @@ func (c *Clientset) ConfigV1() configv1.ConfigV1Interface { func (c *Clientset) Config() configv1.ConfigV1Interface { return &fakeconfigv1.FakeConfigV1{Fake: &c.Fake} } - -// OperatorstatusV1 retrieves the OperatorstatusV1Client -func (c *Clientset) OperatorstatusV1() operatorstatusv1.OperatorstatusV1Interface { - return &fakeoperatorstatusv1.FakeOperatorstatusV1{Fake: &c.Fake} -} - -// Operatorstatus retrieves the OperatorstatusV1Client -func (c *Clientset) Operatorstatus() operatorstatusv1.OperatorstatusV1Interface { - return &fakeoperatorstatusv1.FakeOperatorstatusV1{Fake: &c.Fake} -} diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go index 1121d7d0d..3513e279a 100644 --- a/pkg/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -20,7 +20,6 @@ package fake import ( configv1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" - operatorstatusv1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -52,5 +51,4 @@ func init() { // correctly. func AddToScheme(scheme *runtime.Scheme) { configv1.AddToScheme(scheme) - operatorstatusv1.AddToScheme(scheme) } diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go index 507cdddc0..7fa4dc193 100644 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -20,7 +20,6 @@ package scheme import ( configv1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" - operatorstatusv1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -52,5 +51,4 @@ func init() { // correctly. func AddToScheme(scheme *runtime.Scheme) { configv1.AddToScheme(scheme) - operatorstatusv1.AddToScheme(scheme) } diff --git a/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/clusteroperator.go b/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/clusteroperator.go similarity index 96% rename from pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/clusteroperator.go rename to pkg/generated/clientset/versioned/typed/config.openshift.io/v1/clusteroperator.go index 5694c3f74..0da468e6e 100644 --- a/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/clusteroperator.go +++ b/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/clusteroperator.go @@ -19,7 +19,7 @@ limitations under the License. package v1 import ( - v1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" + v1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" scheme "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -54,7 +54,7 @@ type clusterOperators struct { } // newClusterOperators returns a ClusterOperators -func newClusterOperators(c *OperatorstatusV1Client, namespace string) *clusterOperators { +func newClusterOperators(c *ConfigV1Client, namespace string) *clusterOperators { return &clusterOperators{ client: c.RESTClient(), ns: namespace, diff --git a/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/config.openshift.io_client.go b/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/config.openshift.io_client.go index 95d8b4223..1cf6f434e 100644 --- a/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/config.openshift.io_client.go +++ b/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/config.openshift.io_client.go @@ -27,6 +27,7 @@ import ( type ConfigV1Interface interface { RESTClient() rest.Interface + ClusterOperatorsGetter ClusterVersionsGetter } @@ -35,6 +36,10 @@ type ConfigV1Client struct { restClient rest.Interface } +func (c *ConfigV1Client) ClusterOperators(namespace string) ClusterOperatorInterface { + return newClusterOperators(c, namespace) +} + func (c *ConfigV1Client) ClusterVersions() ClusterVersionInterface { return newClusterVersions(c) } diff --git a/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/fake/fake_clusteroperator.go b/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/fake/fake_clusteroperator.go similarity index 63% rename from pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/fake/fake_clusteroperator.go rename to pkg/generated/clientset/versioned/typed/config.openshift.io/v1/fake/fake_clusteroperator.go index 4f3079510..22a6b0027 100644 --- a/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/fake/fake_clusteroperator.go +++ b/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/fake/fake_clusteroperator.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - operatorstatusopenshiftiov1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" + configopenshiftiov1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -30,29 +30,29 @@ import ( // FakeClusterOperators implements ClusterOperatorInterface type FakeClusterOperators struct { - Fake *FakeOperatorstatusV1 + Fake *FakeConfigV1 ns string } -var clusteroperatorsResource = schema.GroupVersionResource{Group: "operatorstatus.openshift.io", Version: "v1", Resource: "clusteroperators"} +var clusteroperatorsResource = schema.GroupVersionResource{Group: "config.openshift.io", Version: "v1", Resource: "clusteroperators"} -var clusteroperatorsKind = schema.GroupVersionKind{Group: "operatorstatus.openshift.io", Version: "v1", Kind: "ClusterOperator"} +var clusteroperatorsKind = schema.GroupVersionKind{Group: "config.openshift.io", Version: "v1", Kind: "ClusterOperator"} // Get takes name of the clusterOperator, and returns the corresponding clusterOperator object, and an error if there is any. -func (c *FakeClusterOperators) Get(name string, options v1.GetOptions) (result *operatorstatusopenshiftiov1.ClusterOperator, err error) { +func (c *FakeClusterOperators) Get(name string, options v1.GetOptions) (result *configopenshiftiov1.ClusterOperator, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(clusteroperatorsResource, c.ns, name), &operatorstatusopenshiftiov1.ClusterOperator{}) + Invokes(testing.NewGetAction(clusteroperatorsResource, c.ns, name), &configopenshiftiov1.ClusterOperator{}) if obj == nil { return nil, err } - return obj.(*operatorstatusopenshiftiov1.ClusterOperator), err + return obj.(*configopenshiftiov1.ClusterOperator), err } // List takes label and field selectors, and returns the list of ClusterOperators that match those selectors. -func (c *FakeClusterOperators) List(opts v1.ListOptions) (result *operatorstatusopenshiftiov1.ClusterOperatorList, err error) { +func (c *FakeClusterOperators) List(opts v1.ListOptions) (result *configopenshiftiov1.ClusterOperatorList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(clusteroperatorsResource, clusteroperatorsKind, c.ns, opts), &operatorstatusopenshiftiov1.ClusterOperatorList{}) + Invokes(testing.NewListAction(clusteroperatorsResource, clusteroperatorsKind, c.ns, opts), &configopenshiftiov1.ClusterOperatorList{}) if obj == nil { return nil, err @@ -62,8 +62,8 @@ func (c *FakeClusterOperators) List(opts v1.ListOptions) (result *operatorstatus if label == nil { label = labels.Everything() } - list := &operatorstatusopenshiftiov1.ClusterOperatorList{ListMeta: obj.(*operatorstatusopenshiftiov1.ClusterOperatorList).ListMeta} - for _, item := range obj.(*operatorstatusopenshiftiov1.ClusterOperatorList).Items { + list := &configopenshiftiov1.ClusterOperatorList{ListMeta: obj.(*configopenshiftiov1.ClusterOperatorList).ListMeta} + for _, item := range obj.(*configopenshiftiov1.ClusterOperatorList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -79,43 +79,43 @@ func (c *FakeClusterOperators) Watch(opts v1.ListOptions) (watch.Interface, erro } // Create takes the representation of a clusterOperator and creates it. Returns the server's representation of the clusterOperator, and an error, if there is any. -func (c *FakeClusterOperators) Create(clusterOperator *operatorstatusopenshiftiov1.ClusterOperator) (result *operatorstatusopenshiftiov1.ClusterOperator, err error) { +func (c *FakeClusterOperators) Create(clusterOperator *configopenshiftiov1.ClusterOperator) (result *configopenshiftiov1.ClusterOperator, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(clusteroperatorsResource, c.ns, clusterOperator), &operatorstatusopenshiftiov1.ClusterOperator{}) + Invokes(testing.NewCreateAction(clusteroperatorsResource, c.ns, clusterOperator), &configopenshiftiov1.ClusterOperator{}) if obj == nil { return nil, err } - return obj.(*operatorstatusopenshiftiov1.ClusterOperator), err + return obj.(*configopenshiftiov1.ClusterOperator), err } // Update takes the representation of a clusterOperator and updates it. Returns the server's representation of the clusterOperator, and an error, if there is any. -func (c *FakeClusterOperators) Update(clusterOperator *operatorstatusopenshiftiov1.ClusterOperator) (result *operatorstatusopenshiftiov1.ClusterOperator, err error) { +func (c *FakeClusterOperators) Update(clusterOperator *configopenshiftiov1.ClusterOperator) (result *configopenshiftiov1.ClusterOperator, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(clusteroperatorsResource, c.ns, clusterOperator), &operatorstatusopenshiftiov1.ClusterOperator{}) + Invokes(testing.NewUpdateAction(clusteroperatorsResource, c.ns, clusterOperator), &configopenshiftiov1.ClusterOperator{}) if obj == nil { return nil, err } - return obj.(*operatorstatusopenshiftiov1.ClusterOperator), err + return obj.(*configopenshiftiov1.ClusterOperator), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeClusterOperators) UpdateStatus(clusterOperator *operatorstatusopenshiftiov1.ClusterOperator) (*operatorstatusopenshiftiov1.ClusterOperator, error) { +func (c *FakeClusterOperators) UpdateStatus(clusterOperator *configopenshiftiov1.ClusterOperator) (*configopenshiftiov1.ClusterOperator, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(clusteroperatorsResource, "status", c.ns, clusterOperator), &operatorstatusopenshiftiov1.ClusterOperator{}) + Invokes(testing.NewUpdateSubresourceAction(clusteroperatorsResource, "status", c.ns, clusterOperator), &configopenshiftiov1.ClusterOperator{}) if obj == nil { return nil, err } - return obj.(*operatorstatusopenshiftiov1.ClusterOperator), err + return obj.(*configopenshiftiov1.ClusterOperator), err } // Delete takes name of the clusterOperator and deletes it. Returns an error if one occurs. func (c *FakeClusterOperators) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteAction(clusteroperatorsResource, c.ns, name), &operatorstatusopenshiftiov1.ClusterOperator{}) + Invokes(testing.NewDeleteAction(clusteroperatorsResource, c.ns, name), &configopenshiftiov1.ClusterOperator{}) return err } @@ -124,17 +124,17 @@ func (c *FakeClusterOperators) Delete(name string, options *v1.DeleteOptions) er func (c *FakeClusterOperators) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { action := testing.NewDeleteCollectionAction(clusteroperatorsResource, c.ns, listOptions) - _, err := c.Fake.Invokes(action, &operatorstatusopenshiftiov1.ClusterOperatorList{}) + _, err := c.Fake.Invokes(action, &configopenshiftiov1.ClusterOperatorList{}) return err } // Patch applies the patch and returns the patched clusterOperator. -func (c *FakeClusterOperators) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *operatorstatusopenshiftiov1.ClusterOperator, err error) { +func (c *FakeClusterOperators) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *configopenshiftiov1.ClusterOperator, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(clusteroperatorsResource, c.ns, name, data, subresources...), &operatorstatusopenshiftiov1.ClusterOperator{}) + Invokes(testing.NewPatchSubresourceAction(clusteroperatorsResource, c.ns, name, data, subresources...), &configopenshiftiov1.ClusterOperator{}) if obj == nil { return nil, err } - return obj.(*operatorstatusopenshiftiov1.ClusterOperator), err + return obj.(*configopenshiftiov1.ClusterOperator), err } diff --git a/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/fake/fake_config.openshift.io_client.go b/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/fake/fake_config.openshift.io_client.go index 10a33b4f0..ed4514da6 100644 --- a/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/fake/fake_config.openshift.io_client.go +++ b/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/fake/fake_config.openshift.io_client.go @@ -28,6 +28,10 @@ type FakeConfigV1 struct { *testing.Fake } +func (c *FakeConfigV1) ClusterOperators(namespace string) v1.ClusterOperatorInterface { + return &FakeClusterOperators{c, namespace} +} + func (c *FakeConfigV1) ClusterVersions() v1.ClusterVersionInterface { return &FakeClusterVersions{c} } diff --git a/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/generated_expansion.go index ecfcd70d7..468a2ef17 100644 --- a/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/generated_expansion.go +++ b/pkg/generated/clientset/versioned/typed/config.openshift.io/v1/generated_expansion.go @@ -18,4 +18,6 @@ limitations under the License. package v1 +type ClusterOperatorExpansion interface{} + type ClusterVersionExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/doc.go b/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/doc.go deleted file mode 100644 index 3af5d054f..000000000 --- a/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1 diff --git a/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/fake/doc.go b/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/fake/doc.go deleted file mode 100644 index 16f443990..000000000 --- a/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/fake/fake_operatorstatus.openshift.io_client.go b/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/fake/fake_operatorstatus.openshift.io_client.go deleted file mode 100644 index 835fcddc6..000000000 --- a/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/fake/fake_operatorstatus.openshift.io_client.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1 "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeOperatorstatusV1 struct { - *testing.Fake -} - -func (c *FakeOperatorstatusV1) ClusterOperators(namespace string) v1.ClusterOperatorInterface { - return &FakeClusterOperators{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeOperatorstatusV1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/generated_expansion.go deleted file mode 100644 index 468407f3f..000000000 --- a/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/generated_expansion.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -type ClusterOperatorExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/operatorstatus.openshift.io_client.go b/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/operatorstatus.openshift.io_client.go deleted file mode 100644 index c6bba1f4b..000000000 --- a/pkg/generated/clientset/versioned/typed/operatorstatus.openshift.io/v1/operatorstatus.openshift.io_client.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" - "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned/scheme" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - rest "k8s.io/client-go/rest" -) - -type OperatorstatusV1Interface interface { - RESTClient() rest.Interface - ClusterOperatorsGetter -} - -// OperatorstatusV1Client is used to interact with features provided by the operatorstatus.openshift.io group. -type OperatorstatusV1Client struct { - restClient rest.Interface -} - -func (c *OperatorstatusV1Client) ClusterOperators(namespace string) ClusterOperatorInterface { - return newClusterOperators(c, namespace) -} - -// NewForConfig creates a new OperatorstatusV1Client for the given config. -func NewForConfig(c *rest.Config) (*OperatorstatusV1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &OperatorstatusV1Client{client}, nil -} - -// NewForConfigOrDie creates a new OperatorstatusV1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *OperatorstatusV1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new OperatorstatusV1Client for the given RESTClient. -func New(c rest.Interface) *OperatorstatusV1Client { - return &OperatorstatusV1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *OperatorstatusV1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/generated/informers/externalversions/operatorstatus.openshift.io/v1/clusteroperator.go b/pkg/generated/informers/externalversions/config.openshift.io/v1/clusteroperator.go similarity index 88% rename from pkg/generated/informers/externalversions/operatorstatus.openshift.io/v1/clusteroperator.go rename to pkg/generated/informers/externalversions/config.openshift.io/v1/clusteroperator.go index 1f27e4aed..0fb82e2e5 100644 --- a/pkg/generated/informers/externalversions/operatorstatus.openshift.io/v1/clusteroperator.go +++ b/pkg/generated/informers/externalversions/config.openshift.io/v1/clusteroperator.go @@ -21,10 +21,10 @@ package v1 import ( time "time" - operatorstatusopenshiftiov1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" + configopenshiftiov1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" versioned "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned" internalinterfaces "github.com/openshift/cluster-version-operator/pkg/generated/informers/externalversions/internalinterfaces" - v1 "github.com/openshift/cluster-version-operator/pkg/generated/listers/operatorstatus.openshift.io/v1" + v1 "github.com/openshift/cluster-version-operator/pkg/generated/listers/config.openshift.io/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -61,16 +61,16 @@ func NewFilteredClusterOperatorInformer(client versioned.Interface, namespace st if tweakListOptions != nil { tweakListOptions(&options) } - return client.OperatorstatusV1().ClusterOperators(namespace).List(options) + return client.ConfigV1().ClusterOperators(namespace).List(options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.OperatorstatusV1().ClusterOperators(namespace).Watch(options) + return client.ConfigV1().ClusterOperators(namespace).Watch(options) }, }, - &operatorstatusopenshiftiov1.ClusterOperator{}, + &configopenshiftiov1.ClusterOperator{}, resyncPeriod, indexers, ) @@ -81,7 +81,7 @@ func (f *clusterOperatorInformer) defaultInformer(client versioned.Interface, re } func (f *clusterOperatorInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&operatorstatusopenshiftiov1.ClusterOperator{}, f.defaultInformer) + return f.factory.InformerFor(&configopenshiftiov1.ClusterOperator{}, f.defaultInformer) } func (f *clusterOperatorInformer) Lister() v1.ClusterOperatorLister { diff --git a/pkg/generated/informers/externalversions/config.openshift.io/v1/interface.go b/pkg/generated/informers/externalversions/config.openshift.io/v1/interface.go index c4f268054..06bfdc328 100644 --- a/pkg/generated/informers/externalversions/config.openshift.io/v1/interface.go +++ b/pkg/generated/informers/externalversions/config.openshift.io/v1/interface.go @@ -24,6 +24,8 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { + // ClusterOperators returns a ClusterOperatorInformer. + ClusterOperators() ClusterOperatorInformer // ClusterVersions returns a ClusterVersionInformer. ClusterVersions() ClusterVersionInformer } @@ -39,6 +41,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } +// ClusterOperators returns a ClusterOperatorInformer. +func (v *version) ClusterOperators() ClusterOperatorInformer { + return &clusterOperatorInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // ClusterVersions returns a ClusterVersionInformer. func (v *version) ClusterVersions() ClusterVersionInformer { return &clusterVersionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go index 1ff5002ab..9514dee75 100644 --- a/pkg/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -26,7 +26,6 @@ import ( versioned "github.com/openshift/cluster-version-operator/pkg/generated/clientset/versioned" configopenshiftio "github.com/openshift/cluster-version-operator/pkg/generated/informers/externalversions/config.openshift.io" internalinterfaces "github.com/openshift/cluster-version-operator/pkg/generated/informers/externalversions/internalinterfaces" - operatorstatusopenshiftio "github.com/openshift/cluster-version-operator/pkg/generated/informers/externalversions/operatorstatus.openshift.io" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -174,13 +173,8 @@ type SharedInformerFactory interface { WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool Config() configopenshiftio.Interface - Operatorstatus() operatorstatusopenshiftio.Interface } func (f *sharedInformerFactory) Config() configopenshiftio.Interface { return configopenshiftio.New(f, f.namespace, f.tweakListOptions) } - -func (f *sharedInformerFactory) Operatorstatus() operatorstatusopenshiftio.Interface { - return operatorstatusopenshiftio.New(f, f.namespace, f.tweakListOptions) -} diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index d24782825..3a4df3856 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -22,7 +22,6 @@ import ( "fmt" v1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" - operatorstatusopenshiftiov1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -54,13 +53,11 @@ func (f *genericInformer) Lister() cache.GenericLister { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { // Group=config.openshift.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("clusteroperators"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().ClusterOperators().Informer()}, nil case v1.SchemeGroupVersion.WithResource("clusterversions"): return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().ClusterVersions().Informer()}, nil - // Group=operatorstatus.openshift.io, Version=v1 - case operatorstatusopenshiftiov1.SchemeGroupVersion.WithResource("clusteroperators"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Operatorstatus().V1().ClusterOperators().Informer()}, nil - } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/pkg/generated/informers/externalversions/operatorstatus.openshift.io/interface.go b/pkg/generated/informers/externalversions/operatorstatus.openshift.io/interface.go deleted file mode 100644 index b7437c8b6..000000000 --- a/pkg/generated/informers/externalversions/operatorstatus.openshift.io/interface.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package operatorstatus - -import ( - internalinterfaces "github.com/openshift/cluster-version-operator/pkg/generated/informers/externalversions/internalinterfaces" - v1 "github.com/openshift/cluster-version-operator/pkg/generated/informers/externalversions/operatorstatus.openshift.io/v1" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1 provides access to shared informers for resources in V1. - V1() v1.Interface -} - -type group struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// V1 returns a new v1.Interface. -func (g *group) V1() v1.Interface { - return v1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/pkg/generated/informers/externalversions/operatorstatus.openshift.io/v1/interface.go b/pkg/generated/informers/externalversions/operatorstatus.openshift.io/v1/interface.go deleted file mode 100644 index ff746d7bb..000000000 --- a/pkg/generated/informers/externalversions/operatorstatus.openshift.io/v1/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - internalinterfaces "github.com/openshift/cluster-version-operator/pkg/generated/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // ClusterOperators returns a ClusterOperatorInformer. - ClusterOperators() ClusterOperatorInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// ClusterOperators returns a ClusterOperatorInformer. -func (v *version) ClusterOperators() ClusterOperatorInformer { - return &clusterOperatorInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/pkg/generated/listers/operatorstatus.openshift.io/v1/clusteroperator.go b/pkg/generated/listers/config.openshift.io/v1/clusteroperator.go similarity index 97% rename from pkg/generated/listers/operatorstatus.openshift.io/v1/clusteroperator.go rename to pkg/generated/listers/config.openshift.io/v1/clusteroperator.go index 759595382..0ec256d3d 100644 --- a/pkg/generated/listers/operatorstatus.openshift.io/v1/clusteroperator.go +++ b/pkg/generated/listers/config.openshift.io/v1/clusteroperator.go @@ -19,7 +19,7 @@ limitations under the License. package v1 import ( - v1 "github.com/openshift/cluster-version-operator/pkg/apis/operatorstatus.openshift.io/v1" + v1 "github.com/openshift/cluster-version-operator/pkg/apis/config.openshift.io/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" diff --git a/pkg/generated/listers/config.openshift.io/v1/expansion_generated.go b/pkg/generated/listers/config.openshift.io/v1/expansion_generated.go index e167b56eb..e33033ad8 100644 --- a/pkg/generated/listers/config.openshift.io/v1/expansion_generated.go +++ b/pkg/generated/listers/config.openshift.io/v1/expansion_generated.go @@ -18,6 +18,14 @@ limitations under the License. package v1 +// ClusterOperatorListerExpansion allows custom methods to be added to +// ClusterOperatorLister. +type ClusterOperatorListerExpansion interface{} + +// ClusterOperatorNamespaceListerExpansion allows custom methods to be added to +// ClusterOperatorNamespaceLister. +type ClusterOperatorNamespaceListerExpansion interface{} + // ClusterVersionListerExpansion allows custom methods to be added to // ClusterVersionLister. type ClusterVersionListerExpansion interface{} diff --git a/pkg/generated/listers/operatorstatus.openshift.io/v1/expansion_generated.go b/pkg/generated/listers/operatorstatus.openshift.io/v1/expansion_generated.go deleted file mode 100644 index db80edbb8..000000000 --- a/pkg/generated/listers/operatorstatus.openshift.io/v1/expansion_generated.go +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -// ClusterOperatorListerExpansion allows custom methods to be added to -// ClusterOperatorLister. -type ClusterOperatorListerExpansion interface{} - -// ClusterOperatorNamespaceListerExpansion allows custom methods to be added to -// ClusterOperatorNamespaceLister. -type ClusterOperatorNamespaceListerExpansion interface{}