diff --git a/go.mod b/go.mod index 94e1b5e00..b135720bd 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( k8s.io/client-go v12.0.0+incompatible k8s.io/kube-aggregator v0.18.3 k8s.io/kubernetes v1.18.3 - kmodules.xyz/client-go v0.0.0-20200805154632-5bf10f227624 + kmodules.xyz/client-go v0.0.0-20200807031423-96aa0172979c kmodules.xyz/constants v0.0.0-20200506032633-a21e58ceec72 kmodules.xyz/custom-resources v0.0.0-20200604135349-9e9f5c4fdba9 kmodules.xyz/objectstore-api v0.0.0-20200521103120-92080446e04d diff --git a/go.sum b/go.sum index a000aa9e9..c0d09fedb 100644 --- a/go.sum +++ b/go.sum @@ -980,8 +980,8 @@ kmodules.xyz/client-go v0.0.0-20200525195850-2fd180961371 h1:PPawDOMyDHGeDPN8j1e 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/client-go v0.0.0-20200805154632-5bf10f227624 h1:ZIyizuhoEmGNdrlZTks8smohLJe/UpHqfOSj4yMGL7M= -kmodules.xyz/client-go v0.0.0-20200805154632-5bf10f227624/go.mod h1:sY/eoe4ktxZEoHpr5NpAQ5s22VSwTE8psJtKVeVgLRY= +kmodules.xyz/client-go v0.0.0-20200807031423-96aa0172979c h1:L2S0IoDmESgIs72MKfY2Sb3xjOw1oOrrzgrtzNKcSBg= +kmodules.xyz/client-go v0.0.0-20200807031423-96aa0172979c/go.mod h1:sY/eoe4ktxZEoHpr5NpAQ5s22VSwTE8psJtKVeVgLRY= kmodules.xyz/constants v0.0.0-20200506032633-a21e58ceec72 h1:0sM6nE7aJon/PSdqZTj0bKJlPyzobXkG0wVYKpjcJJE= kmodules.xyz/constants v0.0.0-20200506032633-a21e58ceec72/go.mod h1:DbiFk1bJ1KEO94t1SlAn7tzc+Zz95rSXgyUKa2nzPmY= kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95/go.mod h1:jpu8xFsDKd6kAWUAKk8oTu/GQGBWqhrcaDeOJdaCJnk= diff --git a/vendor/kmodules.xyz/client-go/api/v1/certificates.go b/vendor/kmodules.xyz/client-go/api/v1/certificates.go index 54d1ff7c0..c47f52d51 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/certificates.go +++ b/vendor/kmodules.xyz/client-go/api/v1/certificates.go @@ -123,6 +123,15 @@ func SetCertificate(certificates []CertificateSpec, newCertificate CertificateSp return certificates } +// GetCertificateSecretName returns the name of secret for a certificate alias. +func GetCertificateSecretName(certificates []CertificateSpec, alias string) (string, bool) { + idx, cert := GetCertificate(certificates, alias) + if idx == -1 { + return "", false + } + return cert.SecretName, cert.SecretName != "" +} + // SetMissingSecretNameForCertificate sets the missing secret name for a certificate. // If the certificate does not exist, it will add a new certificate with the desired secret name. func SetMissingSecretNameForCertificate(certificates []CertificateSpec, alias, secretName string) []CertificateSpec { @@ -140,6 +149,22 @@ func SetMissingSecretNameForCertificate(certificates []CertificateSpec, alias, s return certificates } +// SetSecretNameForCertificate sets the secret name for a certificate. +// If the certificate does not exist, it will add a new certificate with the desired secret name. +// Otherwise, the secret name will be overwritten. +func SetSecretNameForCertificate(certificates []CertificateSpec, alias, secretName string) []CertificateSpec { + idx, _ := GetCertificate(certificates, alias) + if idx != -1 { + certificates[idx].SecretName = secretName + } else { + certificates = append(certificates, CertificateSpec{ + Alias: alias, + SecretName: secretName, + }) + } + return certificates +} + // RemoveCertificate remove a certificate from the certificate list referred by "aliaS" parameter. func RemoveCertificate(certificates []CertificateSpec, alias string) []CertificateSpec { idx, _ := GetCertificate(certificates, alias) diff --git a/vendor/modules.txt b/vendor/modules.txt index d6a47be1f..bd85d8856 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1045,7 +1045,7 @@ k8s.io/utils/net k8s.io/utils/path k8s.io/utils/pointer k8s.io/utils/trace -# kmodules.xyz/client-go v0.0.0-20200805154632-5bf10f227624 +# kmodules.xyz/client-go v0.0.0-20200807031423-96aa0172979c kmodules.xyz/client-go kmodules.xyz/client-go/admissionregistration/v1beta1 kmodules.xyz/client-go/api/v1