Skip to content

Commit

Permalink
Update to Kubernetes v1.18.3 (#72)
Browse files Browse the repository at this point in the history
Signed-off-by: 1gtm <[email protected]>
  • Loading branch information
1gtm authored Jun 30, 2020
1 parent 4318306 commit 9b7a4e0
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ require (
k8s.io/apimachinery v0.18.3
k8s.io/client-go v12.0.0+incompatible
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6
kmodules.xyz/client-go v0.0.0-20200525195850-2fd180961371
kmodules.xyz/client-go v0.0.0-20200630053911-20d035822d35
kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95
sigs.k8s.io/yaml v1.2.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,8 @@ k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 h1:Oh3Mzx5pJ+yIumsAD0MOEC
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 h1:d4vVOjXm687F1iLSP2q3lyPPuyvTUt3aVoBpi2DqRsU=
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
kmodules.xyz/client-go v0.0.0-20200525195850-2fd180961371 h1:PPawDOMyDHGeDPN8j1epNozaIB/Z7MlJsXpwm/r4jgk=
kmodules.xyz/client-go v0.0.0-20200525195850-2fd180961371/go.mod h1:sY/eoe4ktxZEoHpr5NpAQ5s22VSwTE8psJtKVeVgLRY=
kmodules.xyz/client-go v0.0.0-20200630053911-20d035822d35 h1:gDzZWVvgAaEBzo4lxMGhPUWqySgFyFDkcqw3NskZiwQ=
kmodules.xyz/client-go v0.0.0-20200630053911-20d035822d35/go.mod h1:sY/eoe4ktxZEoHpr5NpAQ5s22VSwTE8psJtKVeVgLRY=
kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95 h1:v0S/+ftzL6Xrs9XevgchAOJyPKlRQXPiZf87xotj3X4=
kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95/go.mod h1:jpu8xFsDKd6kAWUAKk8oTu/GQGBWqhrcaDeOJdaCJnk=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
Expand Down
8 changes: 4 additions & 4 deletions vendor/kmodules.xyz/client-go/apiextensions/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ func RegisterCRDs(client crd_cs.Interface, crds []*CustomResourceDefinition) err
client,
crd.V1.Name,
func(in *crdv1.CustomResourceDefinition) *crdv1.CustomResourceDefinition {
in.Labels = meta_util.MergeKeys(in.Labels, crd.V1.Labels)
in.Annotations = meta_util.MergeKeys(in.Annotations, crd.V1.Annotations)
in.Labels = meta_util.OverwriteKeys(in.Labels, crd.V1.Labels)
in.Annotations = meta_util.OverwriteKeys(in.Annotations, crd.V1.Annotations)

in.Spec = crd.V1.Spec
return in
Expand Down Expand Up @@ -86,8 +86,8 @@ func RegisterCRDs(client crd_cs.Interface, crds []*CustomResourceDefinition) err
client,
crd.V1beta1.Name,
func(in *crdv1beta1.CustomResourceDefinition) *crdv1beta1.CustomResourceDefinition {
in.Labels = meta_util.MergeKeys(in.Labels, crd.V1beta1.Labels)
in.Annotations = meta_util.MergeKeys(in.Annotations, crd.V1beta1.Annotations)
in.Labels = meta_util.OverwriteKeys(in.Labels, crd.V1beta1.Labels)
in.Annotations = meta_util.OverwriteKeys(in.Annotations, crd.V1beta1.Annotations)

in.Spec = crd.V1beta1.Spec
return in
Expand Down
39 changes: 36 additions & 3 deletions vendor/kmodules.xyz/client-go/meta/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,32 @@ func MergeKeys(out, in map[string]string) map[string]string {
out = make(map[string]string, len(in))
}

for k, v := range in {
if _, ok := out[k]; !ok {
out[k] = v
}
}
return out
}

func OverwriteKeys(out, in map[string]string) map[string]string {
if in == nil {
return out
}
if out == nil {
out = make(map[string]string, len(in))
}

for k, v := range in {
out[k] = v
}
return out
}

func NameWithPrefix(prefix, name string, customLength ...int) string {
return ValidNameWithPrefix(prefix, name, customLength...)
}

func ValidNameWithPrefix(prefix, name string, customLength ...int) string {
maxLength := validation.DNS1123LabelMaxLength
if len(customLength) != 0 {
Expand All @@ -124,6 +144,19 @@ func ValidNameWithPrefix(prefix, name string, customLength ...int) string {
return strings.Trim(out[:min(maxLength, len(out))], "-")
}

func NameWithSuffix(name, suffix string, customLength ...int) string {
maxLength := validation.DNS1123LabelMaxLength
if len(customLength) != 0 {
maxLength = customLength[0]
}
if len(suffix) >= maxLength {
return strings.Trim(suffix[max(0, len(suffix)-maxLength):], "-")
}
out := fmt.Sprintf("%s-%s", name[:min(len(name), maxLength-len(suffix)-1)], suffix)
return strings.Trim(out, "-")
}

// Deprecated: Use NameWithSuffix in new code
func ValidNameWithSuffix(name, suffix string, customLength ...int) string {
maxLength := validation.DNS1123LabelMaxLength
if len(customLength) != 0 {
Expand All @@ -133,7 +166,7 @@ func ValidNameWithSuffix(name, suffix string, customLength ...int) string {
return strings.Trim(out[max(0, len(out)-maxLength):], "-")
}

func ValidNameWithPefixNSuffix(prefix, name, suffix string, customLength ...int) string {
func ValidNameWithPrefixNSuffix(prefix, name, suffix string, customLength ...int) string {
maxLength := validation.DNS1123LabelMaxLength
if len(customLength) != 0 {
maxLength = customLength[0]
Expand All @@ -154,8 +187,8 @@ func ValidCronJobNameWithSuffix(name, suffix string) string {
return ValidNameWithSuffix(name, suffix, MaxCronJobNameLength)
}

func ValidCronJobNameWithPefixNSuffix(prefix, name, suffix string) string {
return ValidNameWithPefixNSuffix(prefix, name, suffix, MaxCronJobNameLength)
func ValidCronJobNameWithPrefixNSuffix(prefix, name, suffix string) string {
return ValidNameWithPrefixNSuffix(prefix, name, suffix, MaxCronJobNameLength)
}

func min(x, y int) int {
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ k8s.io/utils/net
k8s.io/utils/path
k8s.io/utils/pointer
k8s.io/utils/trace
# kmodules.xyz/client-go v0.0.0-20200525195850-2fd180961371
# kmodules.xyz/client-go v0.0.0-20200630053911-20d035822d35
kmodules.xyz/client-go
kmodules.xyz/client-go/apiextensions
kmodules.xyz/client-go/apiextensions/v1
Expand Down

0 comments on commit 9b7a4e0

Please sign in to comment.