Skip to content

Commit

Permalink
Drop usage of github.com/operator-framework/operator-lib/status in fa…
Browse files Browse the repository at this point in the history
…vour of k8s.io/apimachinery/pkg/api/meta
  • Loading branch information
roivaz committed Nov 2, 2022
1 parent 5c84dbe commit b886ba8
Show file tree
Hide file tree
Showing 26 changed files with 462 additions and 446 deletions.
7 changes: 3 additions & 4 deletions apis/marin3r/v1alpha1/envoyconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/3scale-ops/marin3r/pkg/envoy"
envoy_serializer "github.com/3scale-ops/marin3r/pkg/envoy/serializer"
"github.com/3scale-ops/marin3r/pkg/util"
"github.com/operator-framework/operator-lib/status"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
Expand All @@ -35,12 +34,12 @@ const (
// envoyconfig cannot reach the desired status specified in the spec,
// usually because the config in the spec is incorrect or has caused failures
// in the envoy clients
CacheOutOfSyncCondition status.ConditionType = "CacheOutOfSync"
CacheOutOfSyncCondition string = "CacheOutOfSync"

// RollbackFailedCondition indicates that the EnvoyConfig object
// is not able to publish a config revision because all revisions are
// tainted
RollbackFailedCondition status.ConditionType = "RollbackFailed"
RollbackFailedCondition string = "RollbackFailed"

/* State */

Expand Down Expand Up @@ -187,7 +186,7 @@ type EnvoyConfigStatus struct {
// Conditions represent the latest available observations of an object's state
// +operator-sdk:csv:customresourcedefinitions:type=status
// +optional
Conditions status.Conditions `json:"conditions,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
// ConfigRevisions is an ordered list of references to EnvoyConfigRevision
// objects
// +operator-sdk:csv:customresourcedefinitions:type=status
Expand Down
9 changes: 4 additions & 5 deletions apis/marin3r/v1alpha1/envoyconfigrevision_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package v1alpha1
import (
"github.com/3scale-ops/marin3r/pkg/envoy"
envoy_serializer "github.com/3scale-ops/marin3r/pkg/envoy/serializer"
"github.com/operator-framework/operator-lib/status"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand All @@ -29,15 +28,15 @@ const (

// RevisionPublishedCondition is a condition that marks the EnvoyConfigRevision object
// as the one that should be published in the xds server cache
RevisionPublishedCondition status.ConditionType = "RevisionPublished"
RevisionPublishedCondition string = "RevisionPublished"

// ResourcesInSyncCondition is a condition that other controllers can use to indicate
// that the respurces need resync
ResourcesInSyncCondition status.ConditionType = "ResourcesInSync"
ResourcesInSyncCondition string = "ResourcesInSync"

// RevisionTaintedCondition is a condition type that's used to report that this
// problems have been observed with this revision and should not be published
RevisionTaintedCondition status.ConditionType = "RevisionTainted"
RevisionTaintedCondition string = "RevisionTainted"

/* Finalizers */

Expand Down Expand Up @@ -96,7 +95,7 @@ type EnvoyConfigRevisionStatus struct {
// Conditions represent the latest available observations of an object's state
// +operator-sdk:csv:customresourcedefinitions:type=status
// +optional
Conditions status.Conditions `json:"conditions,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// IsPublished returns true if this revision is published, false otherwise
Expand Down
6 changes: 3 additions & 3 deletions apis/marin3r/v1alpha1/zz_generated.deepcopy.go

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

3 changes: 1 addition & 2 deletions apis/operator.marin3r/v1alpha1/discoveryservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"time"

"github.com/3scale-ops/marin3r/pkg/image"
"github.com/operator-framework/operator-lib/status"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -115,7 +114,7 @@ type DiscoveryServiceStatus struct {
// Conditions represent the latest available observations of an object's state
// +operator-sdk:csv:customresourcedefinitions:type=status
// +optional
Conditions status.Conditions `json:"conditions,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// PKIConfig has configuration for the PKI that marin3r manages for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package v1alpha1

import (
"github.com/operator-framework/operator-lib/status"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand All @@ -27,7 +26,7 @@ const (
DiscoveryServiceCertificateKind string = "DiscoveryServiceCertificate"
// CertificateNeedsRenewalCondition is a condition that indicates that a
// DiscoveryServiceCertificate is invalid and needs replacement
CertificateNeedsRenewalCondition status.ConditionType = "CertificateNeedsRenewal"
CertificateNeedsRenewalCondition string = "CertificateNeedsRenewal"
// CertificateHashLabelKey is the label that stores the hash of the certificate managed
// by the DiscoveryServiceCertificate resource
CertificateHashLabelKey string = "certificate-hash"
Expand Down Expand Up @@ -167,7 +166,7 @@ type DiscoveryServiceCertificateStatus struct {
// Conditions represent the latest available observations of an object's state
// +operator-sdk:csv:customresourcedefinitions:type=status
// +optional
Conditions status.Conditions `json:"conditions,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// IsReady returns true if the certificate is ready to use, false otherwise
Expand Down
5 changes: 2 additions & 3 deletions apis/operator.marin3r/v1alpha1/zz_generated.deepcopy.go

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

118 changes: 91 additions & 27 deletions config/crd/bases/marin3r.3scale.net_envoyconfigrevisions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ spec:
an envoy resource
properties:
name:
description: Name of the envoy resource
description: 'Name of the envoy resource. DEPRECATED: this
field has no effect and will be removed in an upcoming
release. The name of the resources for discovery purposes
is included in the resource itself. Refer to the envoy
API reference to check how the name is specified for each
resource type.'
type: string
value:
description: Value is the serialized representation of the
Expand All @@ -100,7 +105,12 @@ spec:
an envoy resource
properties:
name:
description: Name of the envoy resource
description: 'Name of the envoy resource. DEPRECATED: this
field has no effect and will be removed in an upcoming
release. The name of the resources for discovery purposes
is included in the resource itself. Refer to the envoy
API reference to check how the name is specified for each
resource type.'
type: string
value:
description: Value is the serialized representation of the
Expand All @@ -118,7 +128,12 @@ spec:
an envoy resource
properties:
name:
description: Name of the envoy resource
description: 'Name of the envoy resource. DEPRECATED: this
field has no effect and will be removed in an upcoming
release. The name of the resources for discovery purposes
is included in the resource itself. Refer to the envoy
API reference to check how the name is specified for each
resource type.'
type: string
value:
description: Value is the serialized representation of the
Expand All @@ -136,7 +151,12 @@ spec:
an envoy resource
properties:
name:
description: Name of the envoy resource
description: 'Name of the envoy resource. DEPRECATED: this
field has no effect and will be removed in an upcoming
release. The name of the resources for discovery purposes
is included in the resource itself. Refer to the envoy
API reference to check how the name is specified for each
resource type.'
type: string
value:
description: Value is the serialized representation of the
Expand All @@ -154,7 +174,12 @@ spec:
an envoy resource
properties:
name:
description: Name of the envoy resource
description: 'Name of the envoy resource. DEPRECATED: this
field has no effect and will be removed in an upcoming
release. The name of the resources for discovery purposes
is included in the resource itself. Refer to the envoy
API reference to check how the name is specified for each
resource type.'
type: string
value:
description: Value is the serialized representation of the
Expand All @@ -172,7 +197,12 @@ spec:
an envoy resource
properties:
name:
description: Name of the envoy resource
description: 'Name of the envoy resource. DEPRECATED: this
field has no effect and will be removed in an upcoming
release. The name of the resources for discovery purposes
is included in the resource itself. Refer to the envoy
API reference to check how the name is specified for each
resource type.'
type: string
value:
description: Value is the serialized representation of the
Expand All @@ -190,7 +220,12 @@ spec:
an envoy resource
properties:
name:
description: Name of the envoy resource
description: 'Name of the envoy resource. DEPRECATED: this
field has no effect and will be removed in an upcoming
release. The name of the resources for discovery purposes
is included in the resource itself. Refer to the envoy
API reference to check how the name is specified for each
resource type.'
type: string
value:
description: Value is the serialized representation of the
Expand Down Expand Up @@ -262,39 +297,68 @@ spec:
description: Conditions represent the latest available observations
of an object's state
items:
description: "Condition represents an observation of an object's
state. Conditions are an extension mechanism intended to be used
when the details of an observation are not a priori known or would
not apply to all instances of a given Kind. \n Conditions should
be added to explicitly convey properties that users and components
care about rather than requiring those properties to be inferred
from other observations. Once defined, the meaning of a Condition
can not be changed arbitrarily - it becomes part of the API, and
has the same backwards- and forwards-compatibility concerns of
any other part of the API."
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a foo's
current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
// +listType=map // +listMapKey=type Conditions []metav1.Condition
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: ConditionReason is intended to be a one-word, CamelCase
representation of the category of cause of the current status.
It is intended to be used in concise output, such as one-line
kubectl get output, and in summarizing occurrences of causes.
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: "ConditionType is the type of the condition and
is typically a CamelCased word or short phrase. \n Condition
types should indicate state in the \"abnormal-true\" polarity.
For example, if the condition indicates when a policy is invalid,
the \"is valid\" case is probably the norm, so the condition
should be called \"Invalid\"."
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
Expand Down
Loading

0 comments on commit b886ba8

Please sign in to comment.