mirror of https://github.com/knative/caching.git
Auto-update dependencies (#210)
Produced via: `dep ensure -update knative.dev/test-infra knative.dev/pkg` /assign n3wscott /cc n3wscott
This commit is contained in:
parent
9d84bba4b6
commit
926e84e7b9
|
@ -966,7 +966,7 @@
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
digest = "1:1e7838d5007ae0a2f64d99f5a2c216749a03247b85b4a7d741c6ae3c4fe14e0a"
|
digest = "1:f44b87ebe4aefb51530107b1d09dce6b81fc35c45117e4025f1dbcb33315a4a8"
|
||||||
name = "knative.dev/pkg"
|
name = "knative.dev/pkg"
|
||||||
packages = [
|
packages = [
|
||||||
"apis",
|
"apis",
|
||||||
|
@ -986,18 +986,18 @@
|
||||||
"reconciler",
|
"reconciler",
|
||||||
]
|
]
|
||||||
pruneopts = "T"
|
pruneopts = "T"
|
||||||
revision = "5c9bc970ce963ddad76a59b289ba90d5b118d98f"
|
revision = "d9a38f13e8b9aa736f714b793ee28788de1b30e0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
digest = "1:043997c1e0120a3c74c981acf40438f54db2753a756e8896fc67fd9edb9ccea9"
|
digest = "1:e7ea104eff9c91ce48f1730ab8b4098faa1ea519162ccbbbca68c205428f0e21"
|
||||||
name = "knative.dev/test-infra"
|
name = "knative.dev/test-infra"
|
||||||
packages = [
|
packages = [
|
||||||
"scripts",
|
"scripts",
|
||||||
"tools/dep-collector",
|
"tools/dep-collector",
|
||||||
]
|
]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "359e2ba3ab51221e4a91e78f4031361306bbba0d"
|
revision = "0a90cb89503890eab3452dac905b54c67c53145f"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c"
|
digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c"
|
||||||
|
|
|
@ -242,10 +242,6 @@ func (r conditionsImpl) ClearCondition(t ConditionType) error {
|
||||||
// MarkTrue sets the status of t to true, and then marks the happy condition to
|
// MarkTrue sets the status of t to true, and then marks the happy condition to
|
||||||
// true if all other dependents are also true.
|
// true if all other dependents are also true.
|
||||||
func (r conditionsImpl) MarkTrue(t ConditionType) {
|
func (r conditionsImpl) MarkTrue(t ConditionType) {
|
||||||
// Save the original status of t.
|
|
||||||
org := r.GetCondition(t).DeepCopy()
|
|
||||||
orgTL := r.GetTopLevelCondition().DeepCopy()
|
|
||||||
|
|
||||||
// Set the specified condition.
|
// Set the specified condition.
|
||||||
r.SetCondition(Condition{
|
r.SetCondition(Condition{
|
||||||
Type: t,
|
Type: t,
|
||||||
|
@ -253,32 +249,72 @@ func (r conditionsImpl) MarkTrue(t ConditionType) {
|
||||||
Severity: r.severity(t),
|
Severity: r.severity(t),
|
||||||
})
|
})
|
||||||
|
|
||||||
// Check the dependents.
|
if c := r.findUnhappyDependent(); c != nil {
|
||||||
for _, cond := range r.dependents {
|
// Propagate unhappy dependent to happy condition.
|
||||||
c := r.GetCondition(cond)
|
r.SetCondition(Condition{
|
||||||
// Failed or Unknown conditions trump true conditions.
|
Type: r.happy,
|
||||||
if !c.IsTrue() {
|
Status: c.Status,
|
||||||
// Update the happy condition if the current ready condition is
|
Reason: c.Reason,
|
||||||
// marked not ready because of this condition.
|
Message: c.Message,
|
||||||
if org.Reason == orgTL.Reason && org.Message == orgTL.Message {
|
Severity: r.severity(r.happy),
|
||||||
r.SetCondition(Condition{
|
})
|
||||||
Type: r.happy,
|
} else if t != r.happy {
|
||||||
Status: c.Status,
|
// Set the happy condition to true.
|
||||||
Reason: c.Reason,
|
r.SetCondition(Condition{
|
||||||
Message: c.Message,
|
Type: r.happy,
|
||||||
Severity: r.severity(r.happy),
|
Status: corev1.ConditionTrue,
|
||||||
})
|
Severity: r.severity(r.happy),
|
||||||
}
|
})
|
||||||
return
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r conditionsImpl) findUnhappyDependent() *Condition {
|
||||||
|
// This only works if there are dependents.
|
||||||
|
if len(r.dependents) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not modify the accessors condition order.
|
||||||
|
conditions := r.accessor.GetConditions().DeepCopy()
|
||||||
|
|
||||||
|
// Filter based on terminal status.
|
||||||
|
n := 0
|
||||||
|
for _, c := range conditions {
|
||||||
|
if c.Severity == ConditionSeverityError && c.Type != r.happy {
|
||||||
|
conditions[n] = c
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
conditions = conditions[:n]
|
||||||
|
|
||||||
|
// Sort set conditions by time.
|
||||||
|
sort.Slice(conditions, func(i, j int) bool {
|
||||||
|
return conditions[i].LastTransitionTime.Inner.Time.After(conditions[j].LastTransitionTime.Inner.Time)
|
||||||
|
})
|
||||||
|
|
||||||
|
// First check the conditions with Status == False.
|
||||||
|
for _, c := range conditions {
|
||||||
|
// False conditions trump Unknown.
|
||||||
|
if c.IsFalse() {
|
||||||
|
return &c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Second check for conditions with Status == Unknown.
|
||||||
|
for _, c := range conditions {
|
||||||
|
if c.IsUnknown() {
|
||||||
|
return &c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the happy condition.
|
// If something was not initialized.
|
||||||
r.SetCondition(Condition{
|
if len(r.dependents) != len(conditions) {
|
||||||
Type: r.happy,
|
return &Condition{
|
||||||
Status: corev1.ConditionTrue,
|
Status: corev1.ConditionUnknown,
|
||||||
Severity: r.severity(r.happy),
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
|
// All dependents are fine.
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarkUnknown sets the status of t to Unknown and also sets the happy condition
|
// MarkUnknown sets the status of t to Unknown and also sets the happy condition
|
||||||
|
|
|
@ -107,3 +107,19 @@ func (c *Condition) IsUnknown() bool {
|
||||||
}
|
}
|
||||||
return c.Status == corev1.ConditionUnknown
|
return c.Status == corev1.ConditionUnknown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetReason returns a nil save string of Reason
|
||||||
|
func (c *Condition) GetReason() string {
|
||||||
|
if c == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return c.Reason
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMessage returns a nil save string of Message
|
||||||
|
func (c *Condition) GetMessage() string {
|
||||||
|
if c == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return c.Message
|
||||||
|
}
|
||||||
|
|
|
@ -1,384 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2018 The Knative 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"reflect"
|
|
||||||
"sort"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"knative.dev/pkg/apis"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Conditions is the interface for a Resource that implements the getter and
|
|
||||||
// setter for accessing a Condition collection.
|
|
||||||
// +k8s:deepcopy-gen=true
|
|
||||||
type ConditionsAccessor interface {
|
|
||||||
GetConditions() Conditions
|
|
||||||
SetConditions(Conditions)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ConditionSet is an abstract collection of the possible ConditionType values
|
|
||||||
// that a particular resource might expose. It also holds the "happy condition"
|
|
||||||
// for that resource, which we define to be one of Ready or Succeeded depending
|
|
||||||
// on whether it is a Living or Batch process respectively.
|
|
||||||
// +k8s:deepcopy-gen=false
|
|
||||||
type ConditionSet struct {
|
|
||||||
happy ConditionType
|
|
||||||
dependents []ConditionType
|
|
||||||
}
|
|
||||||
|
|
||||||
// ConditionManager allows a resource to operate on its Conditions using higher
|
|
||||||
// order operations.
|
|
||||||
type ConditionManager interface {
|
|
||||||
// IsHappy looks at the happy condition and returns true if that condition is
|
|
||||||
// set to true.
|
|
||||||
IsHappy() bool
|
|
||||||
|
|
||||||
// GetCondition finds and returns the Condition that matches the ConditionType
|
|
||||||
// previously set on Conditions.
|
|
||||||
GetCondition(t ConditionType) *Condition
|
|
||||||
|
|
||||||
// SetCondition sets or updates the Condition on Conditions for Condition.Type.
|
|
||||||
// If there is an update, Conditions are stored back sorted.
|
|
||||||
SetCondition(new Condition)
|
|
||||||
|
|
||||||
// MarkTrue sets the status of t to true, and then marks the happy condition to
|
|
||||||
// true if all dependents are true.
|
|
||||||
MarkTrue(t ConditionType)
|
|
||||||
|
|
||||||
// MarkUnknown sets the status of t to Unknown and also sets the happy condition
|
|
||||||
// to Unknown if no other dependent condition is in an error state.
|
|
||||||
MarkUnknown(t ConditionType, reason, messageFormat string, messageA ...interface{})
|
|
||||||
|
|
||||||
// MarkFalse sets the status of t and the happy condition to False.
|
|
||||||
MarkFalse(t ConditionType, reason, messageFormat string, messageA ...interface{})
|
|
||||||
|
|
||||||
// InitializeConditions updates all Conditions in the ConditionSet to Unknown
|
|
||||||
// if not set.
|
|
||||||
InitializeConditions()
|
|
||||||
|
|
||||||
// InitializeCondition updates a Condition to Unknown if not set.
|
|
||||||
InitializeCondition(t ConditionType)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewLivingConditionSet returns a ConditionSet to hold the conditions for the
|
|
||||||
// living resource. ConditionReady is used as the happy condition.
|
|
||||||
// The set of condition types provided are those of the terminal subconditions.
|
|
||||||
func NewLivingConditionSet(d ...ConditionType) ConditionSet {
|
|
||||||
return newConditionSet(ConditionReady, d...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewBatchConditionSet returns a ConditionSet to hold the conditions for the
|
|
||||||
// batch resource. ConditionSucceeded is used as the happy condition.
|
|
||||||
// The set of condition types provided are those of the terminal subconditions.
|
|
||||||
func NewBatchConditionSet(d ...ConditionType) ConditionSet {
|
|
||||||
return newConditionSet(ConditionSucceeded, d...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// newConditionSet returns a ConditionSet to hold the conditions that are
|
|
||||||
// important for the caller. The first ConditionType is the overarching status
|
|
||||||
// for that will be used to signal the resources' status is Ready or Succeeded.
|
|
||||||
func newConditionSet(happy ConditionType, dependents ...ConditionType) ConditionSet {
|
|
||||||
var deps []ConditionType
|
|
||||||
for _, d := range dependents {
|
|
||||||
// Skip duplicates
|
|
||||||
if d == happy || contains(deps, d) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
deps = append(deps, d)
|
|
||||||
}
|
|
||||||
return ConditionSet{
|
|
||||||
happy: happy,
|
|
||||||
dependents: deps,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func contains(ct []ConditionType, t ConditionType) bool {
|
|
||||||
for _, c := range ct {
|
|
||||||
if c == t {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that conditionsImpl implements ConditionManager.
|
|
||||||
var _ ConditionManager = (*conditionsImpl)(nil)
|
|
||||||
|
|
||||||
// conditionsImpl implements the helper methods for evaluating Conditions.
|
|
||||||
// +k8s:deepcopy-gen=false
|
|
||||||
type conditionsImpl struct {
|
|
||||||
ConditionSet
|
|
||||||
accessor ConditionsAccessor
|
|
||||||
}
|
|
||||||
|
|
||||||
// Manage creates a ConditionManager from a accessor object using the original
|
|
||||||
// ConditionSet as a reference. Status must be or point to a struct.
|
|
||||||
func (r ConditionSet) Manage(status interface{}) ConditionManager {
|
|
||||||
|
|
||||||
// First try to see if status implements ConditionsAccessor
|
|
||||||
ca, ok := status.(ConditionsAccessor)
|
|
||||||
if ok {
|
|
||||||
return conditionsImpl{
|
|
||||||
accessor: ca,
|
|
||||||
ConditionSet: r,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Next see if we can use reflection to gain access to Conditions
|
|
||||||
ca = NewReflectedConditionsAccessor(status)
|
|
||||||
if ca != nil {
|
|
||||||
return conditionsImpl{
|
|
||||||
accessor: ca,
|
|
||||||
ConditionSet: r,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We tried. This object is not understood by the condition manager.
|
|
||||||
//panic(fmt.Sprintf("Error converting %T into a ConditionsAccessor", status))
|
|
||||||
// TODO: not sure which way. using panic above means passing nil status panics the system.
|
|
||||||
return conditionsImpl{
|
|
||||||
ConditionSet: r,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsHappy looks at the happy condition and returns true if that condition is
|
|
||||||
// set to true.
|
|
||||||
func (r conditionsImpl) IsHappy() bool {
|
|
||||||
if c := r.GetCondition(r.happy); c == nil || !c.IsTrue() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetCondition finds and returns the Condition that matches the ConditionType
|
|
||||||
// previously set on Conditions.
|
|
||||||
func (r conditionsImpl) GetCondition(t ConditionType) *Condition {
|
|
||||||
if r.accessor == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, c := range r.accessor.GetConditions() {
|
|
||||||
if c.Type == t {
|
|
||||||
return &c
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetCondition sets or updates the Condition on Conditions for Condition.Type.
|
|
||||||
// If there is an update, Conditions are stored back sorted.
|
|
||||||
func (r conditionsImpl) SetCondition(new Condition) {
|
|
||||||
if r.accessor == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
t := new.Type
|
|
||||||
var conditions Conditions
|
|
||||||
for _, c := range r.accessor.GetConditions() {
|
|
||||||
if c.Type != t {
|
|
||||||
conditions = append(conditions, c)
|
|
||||||
} else {
|
|
||||||
// If we'd only update the LastTransitionTime, then return.
|
|
||||||
new.LastTransitionTime = c.LastTransitionTime
|
|
||||||
if reflect.DeepEqual(&new, &c) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
new.LastTransitionTime = apis.VolatileTime{Inner: metav1.NewTime(time.Now())}
|
|
||||||
conditions = append(conditions, new)
|
|
||||||
// Sorted for convenience of the consumer, i.e. kubectl.
|
|
||||||
sort.Slice(conditions, func(i, j int) bool { return conditions[i].Type < conditions[j].Type })
|
|
||||||
r.accessor.SetConditions(conditions)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r conditionsImpl) isTerminal(t ConditionType) bool {
|
|
||||||
for _, cond := range r.dependents {
|
|
||||||
if cond == t {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return t == r.happy
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r conditionsImpl) severity(t ConditionType) ConditionSeverity {
|
|
||||||
if r.isTerminal(t) {
|
|
||||||
return ConditionSeverityError
|
|
||||||
}
|
|
||||||
return ConditionSeverityInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarkTrue sets the status of t to true, and then marks the happy condition to
|
|
||||||
// true if all other dependents are also true.
|
|
||||||
func (r conditionsImpl) MarkTrue(t ConditionType) {
|
|
||||||
// set the specified condition
|
|
||||||
r.SetCondition(Condition{
|
|
||||||
Type: t,
|
|
||||||
Status: corev1.ConditionTrue,
|
|
||||||
Severity: r.severity(t),
|
|
||||||
})
|
|
||||||
|
|
||||||
// check the dependents.
|
|
||||||
for _, cond := range r.dependents {
|
|
||||||
c := r.GetCondition(cond)
|
|
||||||
// Failed or Unknown conditions trump true conditions
|
|
||||||
if !c.IsTrue() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the happy condition
|
|
||||||
r.SetCondition(Condition{
|
|
||||||
Type: r.happy,
|
|
||||||
Status: corev1.ConditionTrue,
|
|
||||||
Severity: r.severity(r.happy),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarkUnknown sets the status of t to Unknown and also sets the happy condition
|
|
||||||
// to Unknown if no other dependent condition is in an error state.
|
|
||||||
func (r conditionsImpl) MarkUnknown(t ConditionType, reason, messageFormat string, messageA ...interface{}) {
|
|
||||||
// set the specified condition
|
|
||||||
r.SetCondition(Condition{
|
|
||||||
Type: t,
|
|
||||||
Status: corev1.ConditionUnknown,
|
|
||||||
Reason: reason,
|
|
||||||
Message: fmt.Sprintf(messageFormat, messageA...),
|
|
||||||
Severity: r.severity(t),
|
|
||||||
})
|
|
||||||
|
|
||||||
// check the dependents.
|
|
||||||
isDependent := false
|
|
||||||
for _, cond := range r.dependents {
|
|
||||||
c := r.GetCondition(cond)
|
|
||||||
// Failed conditions trump Unknown conditions
|
|
||||||
if c.IsFalse() {
|
|
||||||
// Double check that the happy condition is also false.
|
|
||||||
happy := r.GetCondition(r.happy)
|
|
||||||
if !happy.IsFalse() {
|
|
||||||
r.MarkFalse(r.happy, reason, messageFormat, messageA...)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if cond == t {
|
|
||||||
isDependent = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if isDependent {
|
|
||||||
// set the happy condition, if it is one of our dependent subconditions.
|
|
||||||
r.SetCondition(Condition{
|
|
||||||
Type: r.happy,
|
|
||||||
Status: corev1.ConditionUnknown,
|
|
||||||
Reason: reason,
|
|
||||||
Message: fmt.Sprintf(messageFormat, messageA...),
|
|
||||||
Severity: r.severity(r.happy),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarkFalse sets the status of t and the happy condition to False.
|
|
||||||
func (r conditionsImpl) MarkFalse(t ConditionType, reason, messageFormat string, messageA ...interface{}) {
|
|
||||||
types := []ConditionType{t}
|
|
||||||
for _, cond := range r.dependents {
|
|
||||||
if cond == t {
|
|
||||||
types = append(types, r.happy)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, t := range types {
|
|
||||||
r.SetCondition(Condition{
|
|
||||||
Type: t,
|
|
||||||
Status: corev1.ConditionFalse,
|
|
||||||
Reason: reason,
|
|
||||||
Message: fmt.Sprintf(messageFormat, messageA...),
|
|
||||||
Severity: r.severity(t),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// InitializeConditions updates all Conditions in the ConditionSet to Unknown
|
|
||||||
// if not set.
|
|
||||||
func (r conditionsImpl) InitializeConditions() {
|
|
||||||
for _, t := range r.dependents {
|
|
||||||
r.InitializeCondition(t)
|
|
||||||
}
|
|
||||||
r.InitializeCondition(r.happy)
|
|
||||||
}
|
|
||||||
|
|
||||||
// InitializeCondition updates a Condition to Unknown if not set.
|
|
||||||
func (r conditionsImpl) InitializeCondition(t ConditionType) {
|
|
||||||
if c := r.GetCondition(t); c == nil {
|
|
||||||
r.SetCondition(Condition{
|
|
||||||
Type: t,
|
|
||||||
Status: corev1.ConditionUnknown,
|
|
||||||
Severity: r.severity(t),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewReflectedConditionsAccessor uses reflection to return a ConditionsAccessor
|
|
||||||
// to access the field called "Conditions".
|
|
||||||
func NewReflectedConditionsAccessor(status interface{}) ConditionsAccessor {
|
|
||||||
statusValue := reflect.Indirect(reflect.ValueOf(status))
|
|
||||||
|
|
||||||
// If status is not a struct, don't even try to use it.
|
|
||||||
if statusValue.Kind() != reflect.Struct {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
conditionsField := statusValue.FieldByName("Conditions")
|
|
||||||
|
|
||||||
if conditionsField.IsValid() && conditionsField.CanInterface() && conditionsField.CanSet() {
|
|
||||||
if _, ok := conditionsField.Interface().(Conditions); ok {
|
|
||||||
return &reflectedConditionsAccessor{
|
|
||||||
conditions: conditionsField,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// reflectedConditionsAccessor is an internal wrapper object to act as the
|
|
||||||
// ConditionsAccessor for status objects that do not implement ConditionsAccessor
|
|
||||||
// directly, but do expose the field using the "Conditions" field name.
|
|
||||||
type reflectedConditionsAccessor struct {
|
|
||||||
conditions reflect.Value
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetConditions uses reflection to return Conditions from the held status object.
|
|
||||||
func (r *reflectedConditionsAccessor) GetConditions() Conditions {
|
|
||||||
if r != nil && r.conditions.IsValid() && r.conditions.CanInterface() {
|
|
||||||
if conditions, ok := r.conditions.Interface().(Conditions); ok {
|
|
||||||
return conditions
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Conditions(nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetConditions uses reflection to set Conditions on the held status object.
|
|
||||||
func (r *reflectedConditionsAccessor) SetConditions(conditions Conditions) {
|
|
||||||
if r != nil && r.conditions.IsValid() && r.conditions.CanSet() {
|
|
||||||
r.conditions.Set(reflect.ValueOf(conditions))
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,203 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2018 The Knative 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
|
||||||
|
|
||||||
"knative.dev/pkg/apis"
|
|
||||||
"knative.dev/pkg/apis/duck"
|
|
||||||
)
|
|
||||||
|
|
||||||
// +genduck
|
|
||||||
|
|
||||||
// Conditions is the schema for the conditions portion of the payload
|
|
||||||
type Conditions []Condition
|
|
||||||
|
|
||||||
// ConditionType is a camel-cased condition type.
|
|
||||||
type ConditionType string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// ConditionReady specifies that the resource is ready.
|
|
||||||
// For long-running resources.
|
|
||||||
ConditionReady ConditionType = "Ready"
|
|
||||||
// ConditionSucceeded specifies that the resource has finished.
|
|
||||||
// For resource which run to completion.
|
|
||||||
ConditionSucceeded ConditionType = "Succeeded"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ConditionSeverity expresses the severity of a Condition Type failing.
|
|
||||||
type ConditionSeverity string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// ConditionSeverityError specifies that a failure of a condition type
|
|
||||||
// should be viewed as an error. As "Error" is the default for conditions
|
|
||||||
// we use the empty string (coupled with omitempty) to avoid confusion in
|
|
||||||
// the case where the condition is in state "True" (aka nothing is wrong).
|
|
||||||
ConditionSeverityError ConditionSeverity = ""
|
|
||||||
// ConditionSeverityWarning specifies that a failure of a condition type
|
|
||||||
// should be viewed as a warning, but that things could still work.
|
|
||||||
ConditionSeverityWarning ConditionSeverity = "Warning"
|
|
||||||
// ConditionSeverityInfo specifies that a failure of a condition type
|
|
||||||
// should be viewed as purely informational, and that things could still work.
|
|
||||||
ConditionSeverityInfo ConditionSeverity = "Info"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Conditions defines a readiness condition for a Knative resource.
|
|
||||||
// See: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
|
|
||||||
// +k8s:deepcopy-gen=true
|
|
||||||
type Condition struct {
|
|
||||||
// Type of condition.
|
|
||||||
// +required
|
|
||||||
Type ConditionType `json:"type" description:"type of status condition"`
|
|
||||||
|
|
||||||
// Status of the condition, one of True, False, Unknown.
|
|
||||||
// +required
|
|
||||||
Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"`
|
|
||||||
|
|
||||||
// Severity with which to treat failures of this type of condition.
|
|
||||||
// When this is not specified, it defaults to Error.
|
|
||||||
// +optional
|
|
||||||
Severity ConditionSeverity `json:"severity,omitempty" description:"how to interpret failures of this condition, one of Error, Warning, Info"`
|
|
||||||
|
|
||||||
// LastTransitionTime is the last time the condition transitioned from one status to another.
|
|
||||||
// We use VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic
|
|
||||||
// differences (all other things held constant).
|
|
||||||
// +optional
|
|
||||||
LastTransitionTime apis.VolatileTime `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"`
|
|
||||||
|
|
||||||
// The reason for the condition's last transition.
|
|
||||||
// +optional
|
|
||||||
Reason string `json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"`
|
|
||||||
|
|
||||||
// A human readable message indicating details about the transition.
|
|
||||||
// +optional
|
|
||||||
Message string `json:"message,omitempty" description:"human-readable message indicating details about last transition"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsTrue is true if the condition is True
|
|
||||||
func (c *Condition) IsTrue() bool {
|
|
||||||
if c == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return c.Status == corev1.ConditionTrue
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsFalse is true if the condition is False
|
|
||||||
func (c *Condition) IsFalse() bool {
|
|
||||||
if c == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return c.Status == corev1.ConditionFalse
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsUnknown is true if the condition is Unknown
|
|
||||||
func (c *Condition) IsUnknown() bool {
|
|
||||||
if c == nil {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return c.Status == corev1.ConditionUnknown
|
|
||||||
}
|
|
||||||
|
|
||||||
// Conditions is an Implementable "duck type".
|
|
||||||
var _ duck.Implementable = (*Conditions)(nil)
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
|
|
||||||
// KResource is a skeleton type wrapping Conditions in the manner we expect
|
|
||||||
// resource writers defining compatible resources to embed it. We will
|
|
||||||
// typically use this type to deserialize Conditions ObjectReferences and
|
|
||||||
// access the Conditions data. This is not a real resource.
|
|
||||||
type KResource struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
|
||||||
|
|
||||||
Status Status `json:"status"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Status shows how we expect folks to embed Conditions in
|
|
||||||
// their Status field.
|
|
||||||
// WARNING: Adding fields to this struct will add them to all Knative resources.
|
|
||||||
type Status struct {
|
|
||||||
// ObservedGeneration is the 'Generation' of the Service that
|
|
||||||
// was last processed by the controller.
|
|
||||||
// +optional
|
|
||||||
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
|
||||||
|
|
||||||
// Conditions the latest available observations of a resource's current state.
|
|
||||||
// +optional
|
|
||||||
// +patchMergeKey=type
|
|
||||||
// +patchStrategy=merge
|
|
||||||
Conditions Conditions `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: KResourceStatus is added for backwards compatibility for <= 0.4.0 releases. Remove later.
|
|
||||||
// KResourceStatus [Deprecated] use Status directly. Will be deleted ~0.6.0 release.
|
|
||||||
type KResourceStatus Status
|
|
||||||
|
|
||||||
// In order for Conditions to be Implementable, KResource must be Populatable.
|
|
||||||
var _ duck.Populatable = (*KResource)(nil)
|
|
||||||
|
|
||||||
// Ensure KResource satisfies apis.Listable
|
|
||||||
var _ apis.Listable = (*KResource)(nil)
|
|
||||||
|
|
||||||
// GetFullType implements duck.Implementable
|
|
||||||
func (*Conditions) GetFullType() duck.Populatable {
|
|
||||||
return &KResource{}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetCondition fetches the condition of the specified type.
|
|
||||||
func (s *Status) GetCondition(t ConditionType) *Condition {
|
|
||||||
for _, cond := range s.Conditions {
|
|
||||||
if cond.Type == t {
|
|
||||||
return &cond
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Populate implements duck.Populatable
|
|
||||||
func (t *KResource) Populate() {
|
|
||||||
t.Status.ObservedGeneration = 42
|
|
||||||
t.Status.Conditions = Conditions{{
|
|
||||||
// Populate ALL fields
|
|
||||||
Type: "Birthday",
|
|
||||||
Status: corev1.ConditionTrue,
|
|
||||||
LastTransitionTime: apis.VolatileTime{Inner: metav1.NewTime(time.Date(1984, 02, 28, 18, 52, 00, 00, time.UTC))},
|
|
||||||
Reason: "Celebrate",
|
|
||||||
Message: "n3wScott, find your party hat :tada:",
|
|
||||||
}}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetListType implements apis.Listable
|
|
||||||
func (*KResource) GetListType() runtime.Object {
|
|
||||||
return &KResourceList{}
|
|
||||||
}
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
|
|
||||||
// KResourceList is a list of KResource resources
|
|
||||||
type KResourceList struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
metav1.ListMeta `json:"metadata"`
|
|
||||||
|
|
||||||
Items []KResource `json:"items"`
|
|
||||||
}
|
|
|
@ -45,8 +45,6 @@ var (
|
||||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||||
scheme.AddKnownTypes(
|
scheme.AddKnownTypes(
|
||||||
SchemeGroupVersion,
|
SchemeGroupVersion,
|
||||||
&KResource{},
|
|
||||||
(&KResource{}).GetListType(),
|
|
||||||
&AddressableType{},
|
&AddressableType{},
|
||||||
(&AddressableType{}).GetListType(),
|
(&AddressableType{}).GetListType(),
|
||||||
&Target{},
|
&Target{},
|
||||||
|
|
|
@ -199,128 +199,6 @@ func (in *BindingSpec) DeepCopy() *BindingSpec {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *Condition) DeepCopyInto(out *Condition) {
|
|
||||||
*out = *in
|
|
||||||
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.
|
|
||||||
func (in *Condition) DeepCopy() *Condition {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(Condition)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in Conditions) DeepCopyInto(out *Conditions) {
|
|
||||||
{
|
|
||||||
in := &in
|
|
||||||
*out = make(Conditions, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Conditions.
|
|
||||||
func (in Conditions) DeepCopy() Conditions {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(Conditions)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return *out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *KResource) DeepCopyInto(out *KResource) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
|
||||||
in.Status.DeepCopyInto(&out.Status)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KResource.
|
|
||||||
func (in *KResource) DeepCopy() *KResource {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(KResource)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *KResource) 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 *KResourceList) DeepCopyInto(out *KResourceList) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
|
||||||
if in.Items != nil {
|
|
||||||
in, out := &in.Items, &out.Items
|
|
||||||
*out = make([]KResource, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KResourceList.
|
|
||||||
func (in *KResourceList) DeepCopy() *KResourceList {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(KResourceList)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *KResourceList) 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 *KResourceStatus) DeepCopyInto(out *KResourceStatus) {
|
|
||||||
*out = *in
|
|
||||||
if in.Conditions != nil {
|
|
||||||
in, out := &in.Conditions, &out.Conditions
|
|
||||||
*out = make(Conditions, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KResourceStatus.
|
|
||||||
func (in *KResourceStatus) DeepCopy() *KResourceStatus {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(KResourceStatus)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *LegacyTarget) DeepCopyInto(out *LegacyTarget) {
|
func (in *LegacyTarget) DeepCopyInto(out *LegacyTarget) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
@ -397,29 +275,6 @@ func (in *LegacyTargetable) DeepCopy() *LegacyTargetable {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *Status) DeepCopyInto(out *Status) {
|
|
||||||
*out = *in
|
|
||||||
if in.Conditions != nil {
|
|
||||||
in, out := &in.Conditions, &out.Conditions
|
|
||||||
*out = make(Conditions, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Status.
|
|
||||||
func (in *Status) DeepCopy() *Status {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(Status)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *Target) DeepCopyInto(out *Target) {
|
func (in *Target) DeepCopyInto(out *Target) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
60
vendor/knative.dev/pkg/client/injection/ducks/duck/v1alpha1/conditions/conditions.go
generated
vendored
60
vendor/knative.dev/pkg/client/injection/ducks/duck/v1alpha1/conditions/conditions.go
generated
vendored
|
@ -1,60 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2020 The Knative 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 injection-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package conditions
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
duck "knative.dev/pkg/apis/duck"
|
|
||||||
v1alpha1 "knative.dev/pkg/apis/duck/v1alpha1"
|
|
||||||
controller "knative.dev/pkg/controller"
|
|
||||||
injection "knative.dev/pkg/injection"
|
|
||||||
dynamicclient "knative.dev/pkg/injection/clients/dynamicclient"
|
|
||||||
logging "knative.dev/pkg/logging"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
injection.Default.RegisterDuck(WithDuck)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Key is used for associating the Informer inside the context.Context.
|
|
||||||
type Key struct{}
|
|
||||||
|
|
||||||
func WithDuck(ctx context.Context) context.Context {
|
|
||||||
dc := dynamicclient.Get(ctx)
|
|
||||||
dif := &duck.CachedInformerFactory{
|
|
||||||
Delegate: &duck.TypedInformerFactory{
|
|
||||||
Client: dc,
|
|
||||||
Type: (&v1alpha1.Conditions{}).GetFullType(),
|
|
||||||
ResyncPeriod: controller.GetResyncPeriod(ctx),
|
|
||||||
StopChannel: ctx.Done(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return context.WithValue(ctx, Key{}, dif)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get extracts the typed informer from the context.
|
|
||||||
func Get(ctx context.Context) duck.InformerFactory {
|
|
||||||
untyped := ctx.Value(Key{})
|
|
||||||
if untyped == nil {
|
|
||||||
logging.FromContext(ctx).Panic(
|
|
||||||
"Unable to fetch knative.dev/pkg/apis/duck.InformerFactory from context.")
|
|
||||||
}
|
|
||||||
return untyped.(duck.InformerFactory)
|
|
||||||
}
|
|
30
vendor/knative.dev/pkg/client/injection/ducks/duck/v1alpha1/conditions/fake/fake.go
generated
vendored
30
vendor/knative.dev/pkg/client/injection/ducks/duck/v1alpha1/conditions/fake/fake.go
generated
vendored
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2020 The Knative 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 injection-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package fake
|
|
||||||
|
|
||||||
import (
|
|
||||||
conditions "knative.dev/pkg/client/injection/ducks/duck/v1alpha1/conditions"
|
|
||||||
injection "knative.dev/pkg/injection"
|
|
||||||
)
|
|
||||||
|
|
||||||
var Get = conditions.Get
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
injection.Fake.RegisterDuck(conditions.WithDuck)
|
|
||||||
}
|
|
|
@ -127,9 +127,9 @@ function report_build_test() {
|
||||||
# Perform markdown build tests if necessary, unless disabled.
|
# Perform markdown build tests if necessary, unless disabled.
|
||||||
function markdown_build_tests() {
|
function markdown_build_tests() {
|
||||||
(( DISABLE_MD_LINTING && DISABLE_MD_LINK_CHECK )) && return 0
|
(( DISABLE_MD_LINTING && DISABLE_MD_LINK_CHECK )) && return 0
|
||||||
# Get changed markdown files (ignore /vendor and deleted files)
|
# Get changed markdown files (ignore /vendor, github templates, and deleted files)
|
||||||
local mdfiles=""
|
local mdfiles=""
|
||||||
for file in $(echo "${CHANGED_FILES}" | grep \.md$ | grep -v ^vendor/); do
|
for file in $(echo "${CHANGED_FILES}" | grep \.md$ | grep -v ^vendor/ | grep -v ^.github/); do
|
||||||
[[ -f "${file}" ]] && mdfiles="${mdfiles} ${file}"
|
[[ -f "${file}" ]] && mdfiles="${mdfiles} ${file}"
|
||||||
done
|
done
|
||||||
[[ -z "${mdfiles}" ]] && return 0
|
[[ -z "${mdfiles}" ]] && return 0
|
||||||
|
|
Loading…
Reference in New Issue