mirror of
https://github.com/kubernetes/sample-controller.git
synced 2026-05-01 00:00:03 +08:00
Merge pull request #57243 from munnerz/fix-sample-ctrl
Automatic merge from submit-queue (batch tested with PRs 56403, 57243). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Register metav1 types into samplecontroller api scheme **What this PR does / why we need it**: Registers metav1 resource types (e.g. ListOptions) with sample-controller scheme. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #57205 **Release note**: ```release-note NONE ``` /cc @sttts @nikhita Kubernetes-commit: 0d42e742da14f9659ebeb80e7fe375a58add04c4
This commit is contained in:
+1
-1
@@ -618,7 +618,7 @@ message Container {
|
||||
// Describe a container image
|
||||
message ContainerImage {
|
||||
// Names by which this image is known.
|
||||
// e.g. ["gcr.io/google_containers/hyperkube:v1.0.7", "dockerhub.io/google_containers/hyperkube:v1.0.7"]
|
||||
// e.g. ["k8s.gcr.io/hyperkube:v1.0.7", "dockerhub.io/google_containers/hyperkube:v1.0.7"]
|
||||
repeated string names = 1;
|
||||
|
||||
// The size of the image in bytes.
|
||||
|
||||
+5
-1
@@ -2459,7 +2459,11 @@ const (
|
||||
// parameters such as nameservers and search paths should be defined via
|
||||
// DNSConfig.
|
||||
DNSNone DNSPolicy = "None"
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultTerminationGracePeriodSeconds indicates the default duration in
|
||||
// seconds a pod needs to terminate gracefully.
|
||||
DefaultTerminationGracePeriodSeconds = 30
|
||||
)
|
||||
|
||||
@@ -3906,7 +3910,7 @@ type PodSignature struct {
|
||||
// Describe a container image
|
||||
type ContainerImage struct {
|
||||
// Names by which this image is known.
|
||||
// e.g. ["gcr.io/google_containers/hyperkube:v1.0.7", "dockerhub.io/google_containers/hyperkube:v1.0.7"]
|
||||
// e.g. ["k8s.gcr.io/hyperkube:v1.0.7", "dockerhub.io/google_containers/hyperkube:v1.0.7"]
|
||||
Names []string `json:"names" protobuf:"bytes,1,rep,name=names"`
|
||||
// The size of the image in bytes.
|
||||
// +optional
|
||||
|
||||
+1
-1
@@ -308,7 +308,7 @@ func (Container) SwaggerDoc() map[string]string {
|
||||
|
||||
var map_ContainerImage = map[string]string{
|
||||
"": "Describe a container image",
|
||||
"names": "Names by which this image is known. e.g. [\"gcr.io/google_containers/hyperkube:v1.0.7\", \"dockerhub.io/google_containers/hyperkube:v1.0.7\"]",
|
||||
"names": "Names by which this image is known. e.g. [\"k8s.gcr.io/hyperkube:v1.0.7\", \"dockerhub.io/google_containers/hyperkube:v1.0.7\"]",
|
||||
"sizeBytes": "The size of the image in bytes.",
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ func (d *YAMLDecoder) Read(data []byte) (n int, err error) {
|
||||
if left <= len(data) {
|
||||
copy(data, d.remaining)
|
||||
d.remaining = nil
|
||||
return len(d.remaining), nil
|
||||
return left, nil
|
||||
}
|
||||
|
||||
// caller will need to reread
|
||||
|
||||
+27
-6
@@ -31,12 +31,28 @@ import (
|
||||
// the config has no custom TLS options, http.DefaultTransport is returned.
|
||||
type tlsTransportCache struct {
|
||||
mu sync.Mutex
|
||||
transports map[string]*http.Transport
|
||||
transports map[tlsCacheKey]*http.Transport
|
||||
}
|
||||
|
||||
const idleConnsPerHost = 25
|
||||
|
||||
var tlsCache = &tlsTransportCache{transports: make(map[string]*http.Transport)}
|
||||
var tlsCache = &tlsTransportCache{transports: make(map[tlsCacheKey]*http.Transport)}
|
||||
|
||||
type tlsCacheKey struct {
|
||||
insecure bool
|
||||
caData string
|
||||
certData string
|
||||
keyData string
|
||||
serverName string
|
||||
}
|
||||
|
||||
func (t tlsCacheKey) String() string {
|
||||
keyText := "<none>"
|
||||
if len(t.keyData) > 0 {
|
||||
keyText = "<redacted>"
|
||||
}
|
||||
return fmt.Sprintf("insecure:%v, caData:%#v, certData:%#v, keyData:%s, serverName:%s", t.insecure, t.caData, t.certData, keyText, t.serverName)
|
||||
}
|
||||
|
||||
func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) {
|
||||
key, err := tlsConfigKey(config)
|
||||
@@ -82,11 +98,16 @@ func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) {
|
||||
}
|
||||
|
||||
// tlsConfigKey returns a unique key for tls.Config objects returned from TLSConfigFor
|
||||
func tlsConfigKey(c *Config) (string, error) {
|
||||
func tlsConfigKey(c *Config) (tlsCacheKey, error) {
|
||||
// Make sure ca/key/cert content is loaded
|
||||
if err := loadTLSFiles(c); err != nil {
|
||||
return "", err
|
||||
return tlsCacheKey{}, err
|
||||
}
|
||||
// Only include the things that actually affect the tls.Config
|
||||
return fmt.Sprintf("%v/%x/%x/%x/%v", c.TLS.Insecure, c.TLS.CAData, c.TLS.CertData, c.TLS.KeyData, c.TLS.ServerName), nil
|
||||
return tlsCacheKey{
|
||||
insecure: c.TLS.Insecure,
|
||||
caData: string(c.TLS.CAData),
|
||||
certData: string(c.TLS.CertData),
|
||||
keyData: string(c.TLS.KeyData),
|
||||
serverName: c.TLS.ServerName,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user