Merge pull request #82705 from deads2k/agg-authn-publish

use controller to publish cluster authentication info

Kubernetes-commit: a5fe905be420d518892e8e8b682902deef82d1c6
This commit is contained in:
Kubernetes Publisher 2019-11-07 09:03:10 -08:00
commit e55a71a3e0
4 changed files with 16 additions and 4 deletions

2
Godeps/Godeps.json generated
View File

@ -352,7 +352,7 @@
},
{
"ImportPath": "k8s.io/apimachinery",
"Rev": "670e6d490571"
"Rev": "2c7f8d2b0fd8"
},
{
"ImportPath": "k8s.io/gengo",

4
go.mod
View File

@ -29,7 +29,7 @@ require (
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
google.golang.org/appengine v1.5.0 // indirect
k8s.io/api v0.0.0-20191107030003-665c8a257c1a
k8s.io/apimachinery v0.0.0-20191107025710-670e6d490571
k8s.io/apimachinery v0.0.0-20191107105744-2c7f8d2b0fd8
k8s.io/klog v1.0.0
k8s.io/utils v0.0.0-20191030222137-2b95a09bc58d
sigs.k8s.io/yaml v1.1.0
@ -39,5 +39,5 @@ replace (
golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a
golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7
k8s.io/api => k8s.io/api v0.0.0-20191107030003-665c8a257c1a
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20191107025710-670e6d490571
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20191107105744-2c7f8d2b0fd8
)

2
go.sum
View File

@ -192,7 +192,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/api v0.0.0-20191107030003-665c8a257c1a/go.mod h1:gBpbNJH4JlHuCXtSTkFwvuGtM+dvyfLKuFOTt1WtKAM=
k8s.io/apimachinery v0.0.0-20191107025710-670e6d490571/go.mod h1:DJOb3m0kw91A0YaUsaoYChi4d7xVF84HLiuRCxGsV04=
k8s.io/apimachinery v0.0.0-20191107105744-2c7f8d2b0fd8/go.mod h1:DJOb3m0kw91A0YaUsaoYChi4d7xVF84HLiuRCxGsV04=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=

View File

@ -17,6 +17,7 @@ limitations under the License.
package cert
import (
"bytes"
"crypto/x509"
"encoding/pem"
"errors"
@ -59,3 +60,14 @@ func ParseCertsPEM(pemCerts []byte) ([]*x509.Certificate, error) {
}
return certs, nil
}
// EncodeCertificates returns the PEM-encoded byte array that represents by the specified certs.
func EncodeCertificates(certs ...*x509.Certificate) ([]byte, error) {
b := bytes.Buffer{}
for _, cert := range certs {
if err := pem.Encode(&b, &pem.Block{Type: CertificateBlockType, Bytes: cert.Raw}); err != nil {
return []byte{}, err
}
}
return b.Bytes(), nil
}