Skip to content

Commit

Permalink
Update deps
Browse files Browse the repository at this point in the history
/cherry-pick

Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed Aug 14, 2023
1 parent 537439d commit 5243359
Show file tree
Hide file tree
Showing 12 changed files with 302 additions and 339 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
go.bytebuilders.dev/license-verifier/kubernetes v0.13.2
gomodules.xyz/flags v0.1.3
gomodules.xyz/go-sh v0.1.0
gomodules.xyz/logs v0.0.6
gomodules.xyz/logs v0.0.7
gomodules.xyz/password-generator v0.2.9
gomodules.xyz/pointer v0.1.0
gomodules.xyz/x v0.0.15
Expand All @@ -23,7 +23,7 @@ require (
k8s.io/apimachinery v0.25.3
k8s.io/client-go v0.25.1
k8s.io/klog/v2 v2.80.1
kmodules.xyz/client-go v0.25.23
kmodules.xyz/client-go v0.25.29
kmodules.xyz/custom-resources v0.25.2
kmodules.xyz/offshoot-api v0.25.4
kubevault.dev/apimachinery v0.12.0
Expand Down Expand Up @@ -133,7 +133,7 @@ require (
golang.org/x/time v0.1.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gomodules.xyz/clock v0.0.0-20200817085942-06523dba733f // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
gomodules.xyz/mergo v0.3.13 // indirect
gomodules.xyz/sets v0.2.1 // indirect
gomodules.xyz/wait v0.2.0 // indirect
Expand Down
15 changes: 7 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
Expand Down Expand Up @@ -435,6 +434,7 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
Expand Down Expand Up @@ -640,10 +640,10 @@ gomodules.xyz/flags v0.1.3 h1:jQ06+EfmoMv5NvjXvJon03dOhLU+FF0TQMWN7I6qpzs=
gomodules.xyz/flags v0.1.3/go.mod h1:e+kvBLnqdEWGG670SKOYag1CXStM2Slrxq01OIK3tFs=
gomodules.xyz/go-sh v0.1.0 h1:1BJAuGREh2RhePt7HRrpmjnkbgfpXlCzc42SiyZ5dkc=
gomodules.xyz/go-sh v0.1.0/go.mod h1:N8IrjNiYppUI/rxENYrWD6FOrSxSyEZnIekPEWM7LP0=
gomodules.xyz/jsonpatch/v2 v2.3.0 h1:8NFhfS6gzxNqjLIYnZxg319wZ5Qjnx4m/CcX+Klzazc=
gomodules.xyz/jsonpatch/v2 v2.3.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY=
gomodules.xyz/logs v0.0.6 h1:8+9Wkud5yBPtIvkVszubyTeFxNII30lWODom0+GZD8U=
gomodules.xyz/logs v0.0.6/go.mod h1:Q+fFtZFLEB5q86KmDehXCGuMP72Rv+Rwz0KuVxK+Gi4=
gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw=
gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY=
gomodules.xyz/logs v0.0.7 h1:dkhpdQuzj+pOS3S7VaOq+JV7BVU7f68/k3uDYufhPow=
gomodules.xyz/logs v0.0.7/go.mod h1:IEIZbRl9zua2jb35NU4KoqxUEDPmKvem3PhfRHqQI54=
gomodules.xyz/mergo v0.3.13 h1:q6cL/MMXZH/MrR2+yjSihFFq6UifXqjwaqI48B6cMEM=
gomodules.xyz/mergo v0.3.13/go.mod h1:F/2rKC7j0URTnHUKDiTiLcGdLMhdv8jK2Za3cRTUVmc=
gomodules.xyz/password-generator v0.2.9 h1:qYoXoA61+9zs9A1scffefCgcRGpi9Tw1LsTkIe4bEno=
Expand Down Expand Up @@ -753,7 +753,6 @@ k8s.io/apiserver v0.25.1/go.mod h1:IB1EhM28U3cCrV+VNC06p1/YSZMCNYiH+P5sI5yLaZY=
k8s.io/client-go v0.25.1 h1:uFj4AJKtE1/ckcSKz8IhgAuZTdRXZDKev8g387ndD58=
k8s.io/client-go v0.25.1/go.mod h1:rdFWTLV/uj2C74zGbQzOsmXPUtMAjSf7ajil4iJUNKo=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kube-aggregator v0.25.1 h1:XJajtusVLQ13kRPFL1xeQ2cHIzGTuXgOet1lMRF89+o=
Expand All @@ -764,8 +763,8 @@ k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73 h1:H9TCJUUx+2VA0ZiD9lvtaX8fthFsM
k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk=
kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80=
kmodules.xyz/client-go v0.25.23 h1:qz5XJYHLVZUowqfRXEJD7JQ4iaLLzQ1O1zPMmsdrkJw=
kmodules.xyz/client-go v0.25.23/go.mod h1:wbdzLEoDYiCPI6dTW0mIAGNwkwFV4lC5BN1FJxiDsbw=
kmodules.xyz/client-go v0.25.29 h1:6CYoTJdLBqdXAaNtWJb1LLowG6KuDwb53ey8u7DS88Y=
kmodules.xyz/client-go v0.25.29/go.mod h1:r/Va2Y6t1G8X1sPRjrQC6FWB3oh/i6rjssmlfJnbCmg=
kmodules.xyz/custom-resources v0.25.2 h1:+PJgUZvbbSgyNT7EX9gUZ3PIzY2LAW03TDW8cevvXqo=
kmodules.xyz/custom-resources v0.25.2/go.mod h1:b9XjjKQMZ6KrLHXKqQz7YwV3M3BK8Hwi4KEwu5RadCo=
kmodules.xyz/monitoring-agent-api v0.25.0 h1:RU9RBeCqQdoS381xXy8cM1aqT+7qmtuPI3KxNQoX16Y=
Expand Down
4 changes: 4 additions & 0 deletions vendor/gomodules.xyz/jsonpatch/v2/jsonpatch.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package jsonpatch

import (
"bytes"
"encoding/json"
"fmt"
"reflect"
Expand Down Expand Up @@ -64,6 +65,9 @@ func NewOperation(op, path string, value interface{}) Operation {
//
// An error will be returned if any of the two documents are invalid.
func CreatePatch(a, b []byte) ([]Operation, error) {
if bytes.Equal(a, b) {
return []Operation{}, nil
}
var aI interface{}
var bI interface{}
err := json.Unmarshal(a, &aI)
Expand Down
9 changes: 6 additions & 3 deletions vendor/gomodules.xyz/logs/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ const logFlushFreqFlagName = "log-flush-frequency"

var logFlushFreq = pflag.Duration(logFlushFreqFlagName, 5*time.Second, "Maximum number of seconds between log flushes")

func init() {
_ = flag.Set("stderrthreshold", "INFO")
}
/*
panic: flag stderrthreshold set before being defined
*/
// func init() {
// _ = flag.Set("stderrthreshold", "INFO")
// }

// AddFlags registers this package's flags on arbitrary FlagSets, such that they point to the
// same value as the global flags.
Expand Down
4 changes: 2 additions & 2 deletions vendor/kmodules.xyz/client-go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ endif
### These variables should not need tweaking.
###

SRC_PKGS := admissionregistration api apiextensions apiregistration apps batch certificates client core discovery dynamic extensions meta networking openapi policy rbac storage tools
SRC_PKGS := admissionregistration api apiextensions apiregistration apps batch certificates client conditions core discovery dynamic extensions meta networking openapi policy rbac storage tools
SRC_DIRS := $(SRC_PKGS) *.go

DOCKER_PLATFORMS := linux/amd64 linux/arm linux/arm64
Expand Down Expand Up @@ -154,7 +154,7 @@ gen-crd-protos:
--packages=-k8s.io/api/core/v1,kmodules.xyz/client-go/api/v1

.PHONY: gen-enum
gen-enum:
gen-enum: $(BUILD_DIRS)
@docker run \
-i \
--rm \
Expand Down
216 changes: 49 additions & 167 deletions vendor/kmodules.xyz/client-go/api/v1/conditions.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright AppsCode Inc. and Contributors
Copyright 2020 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.
Expand All @@ -17,190 +17,72 @@ limitations under the License.
package v1

import (
"fmt"

core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// KEP: https://github.com/kubernetes/enhancements/blob/ced773ab59f0ff080888a912ab99474245623dad/keps/sig-api-machinery/1623-standardize-conditions/README.md
// ConditionSeverity expresses the severity of a Condition Type failing.
type ConditionSeverity string

// List of common condition types
const (
ConditionProgressing = "Progressing"
ConditionInitialized = "Initialized"
ConditionReady = "Ready"
ConditionAvailable = "Available"
ConditionFailed = "Failed"

ConditionRequestApproved = "Approved"
ConditionRequestDenied = "Denied"
// ConditionSeverityError specifies that a condition with `Status=False` is an error.
ConditionSeverityError ConditionSeverity = "Error"

// ConditionSeverityWarning specifies that a condition with `Status=False` is a warning.
ConditionSeverityWarning ConditionSeverity = "Warning"

// ConditionSeverityInfo specifies that a condition with `Status=False` is informative.
ConditionSeverityInfo ConditionSeverity = "Info"

// ConditionSeverityNone should apply only to util with `Status=True`.
ConditionSeverityNone ConditionSeverity = ""
)

// ConditionType is a valid value for Condition.Type.
type ConditionType string

const (
// ReadyCondition defines the Ready condition type that summarizes the operational state of an object.
ReadyCondition ConditionType = "Ready"
)

// Condition defines an observation of a object operational state.
type Condition struct {
// 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.
// +required
Type string `json:"type" protobuf:"bytes,1,opt,name=type"`
// Many .condition.type values are consistent across resources like Available, but because arbitrary util
// can be useful (see .node.status.util), the ability to deconflict is important.
Type ConditionType `json:"type" protobuf:"bytes,4,opt,name=type,casttype=ConditionType"`

// Status of the condition, one of True, False, Unknown.
// +required
Status core.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
Status metav1.ConditionStatus `json:"status" protobuf:"bytes,5,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`

// If set, this represents the .metadata.generation that the condition was set based upon.
// For instance, if .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date
// with respect to the current state of the instance.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`
// 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.
// +required
LastTransitionTime metav1.Time `json:"lastTransitionTime" protobuf:"bytes,4,opt,name=lastTransitionTime"`
// The reason for the condition's last transition in CamelCase.
// The specific API may choose whether or not this field is considered a guaranteed API.
// This field may not be empty.
// +required
Reason string `json:"reason" protobuf:"bytes,5,opt,name=reason"`
// A human readable message indicating details about the transition.
// This field may be empty.
// +required
Message string `json:"message" protobuf:"bytes,6,opt,name=message"`
}

func NewCondition(reason string, message string, generation int64, conditionStatus ...bool) Condition {
cs := core.ConditionTrue
if len(conditionStatus) > 0 && !conditionStatus[0] {
cs = core.ConditionFalse
}

return Condition{
Type: reason,
Reason: reason,
Message: message,
Status: cs,
LastTransitionTime: metav1.Now(),
ObservedGeneration: generation,
}
}

// HasCondition returns "true" if the desired condition provided in "condType" is present in the condition list.
// Otherwise, it returns "false".
func HasCondition(conditions []Condition, condType string) bool {
for i := range conditions {
if conditions[i].Type == condType {
return true
}
}
return false
}

// GetCondition returns a pointer to the desired condition referred by "condType". Otherwise, it returns nil.
func GetCondition(conditions []Condition, condType string) (int, *Condition) {
for i := range conditions {
c := conditions[i]
if c.Type == condType {
return i, &c
}
}
return -1, nil
}

// SetCondition add/update the desired condition to the condition list. It does nothing if the condition is already in
// its desired state.
func SetCondition(conditions []Condition, newCondition Condition) []Condition {
idx, curCond := GetCondition(conditions, newCondition.Type)
// If the current condition is in its desired state, we have nothing to do. Just return the original condition list.
if curCond != nil &&
curCond.Status == newCondition.Status &&
curCond.Reason == newCondition.Reason &&
curCond.Message == newCondition.Message &&
curCond.ObservedGeneration == newCondition.ObservedGeneration {
return conditions
}
// The desired conditions is not in the condition list or is not in its desired state.
// Update it if present in the condition list, or append the new condition if it does not present.
newCondition.LastTransitionTime = metav1.Now()
if idx == -1 {
conditions = append(conditions, newCondition)
} else if newCondition.ObservedGeneration >= curCond.ObservedGeneration {
// only update if the new condition is based on observed generation at least as updated as the current condition
conditions[idx] = newCondition
}
return conditions
}

// RemoveCondition remove a condition from the condition list referred by "condType" parameter.
func RemoveCondition(conditions []Condition, condType string) []Condition {
idx, _ := GetCondition(conditions, condType)
if idx == -1 {
// The desired condition is not present in the condition list. So, nothing to do.
return conditions
}
return append(conditions[:idx], conditions[idx+1:]...)
}

// IsConditionTrue returns "true" if the desired condition is in true state.
// It returns "false" if the desired condition is not in "true" state or is not in the condition list.
func IsConditionTrue(conditions []Condition, condType string) bool {
for i := range conditions {
if conditions[i].Type == condType && conditions[i].Status == core.ConditionTrue {
return true
}
}
return false
}

// IsConditionFalse returns "true" if the desired condition is in false state.
// It returns "false" if the desired condition is not in "false" state or is not in the condition list.
func IsConditionFalse(conditions []Condition, condType string) bool {
for i := range conditions {
if conditions[i].Type == condType && conditions[i].Status == core.ConditionFalse {
return true
}
}
return false
}

// IsConditionUnknown returns "true" if the desired condition is in unknown state.
// It returns "false" if the desired condition is not in "unknown" state or is not in the condition list.
func IsConditionUnknown(conditions []Condition, condType string) bool {
for i := range conditions {
if conditions[i].Type == condType && conditions[i].Status == core.ConditionUnknown {
return true
}
}
return false
}

// Status defines the set of statuses a resource can have.
// Based on kstatus: https://github.com/kubernetes-sigs/cli-utils/tree/master/pkg/kstatus
// +kubebuilder:validation:Enum=InProgress;Failed;Current;Terminating;NotFound;Unknown
type Status string
// Severity provides an explicit classification of Reason code, so the users or machines can immediately
// understand the current situation and act accordingly.
// The Severity field MUST be set only when Status=False.
// +optional
Severity ConditionSeverity `json:"severity,omitempty" protobuf:"bytes,6,opt,name=severity,casttype=ConditionSeverity"`

const (
// The set of status conditions which can be assigned to resources.
InProgressStatus Status = "InProgress"
FailedStatus Status = "Failed"
CurrentStatus Status = "Current"
TerminatingStatus Status = "Terminating"
NotFoundStatus Status = "NotFound"
UnknownStatus Status = "Unknown"
)
// 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.
LastTransitionTime metav1.Time `json:"lastTransitionTime" protobuf:"bytes,7,opt,name=lastTransitionTime"`

var Statuses = []Status{InProgressStatus, FailedStatus, CurrentStatus, TerminatingStatus, UnknownStatus}
// The reason for the condition's last transition in CamelCase.
// The specific API may choose whether this field is considered a guaranteed API.
// This field may not be empty.
// +optional
Reason string `json:"reason,omitempty" protobuf:"bytes,8,opt,name=reason"`

// String returns the status as a string.
func (s Status) String() string {
return string(s)
// A human-readable message indicating details about the transition.
// This field may be empty.
// +optional
Message string `json:"message,omitempty" protobuf:"bytes,9,opt,name=message"`
}

// StatusFromStringOrDie turns a string into a Status. Will panic if the provided string is
// not a valid status.
func StatusFromStringOrDie(text string) Status {
s := Status(text)
for _, r := range Statuses {
if s == r {
return s
}
}
panic(fmt.Errorf("string has invalid status: %s", s))
}
// Conditions provide observations of the operational state of a object.
type Conditions []Condition

0 comments on commit 5243359

Please sign in to comment.