repo
stringclasses
1 value
path
stringlengths
19
155
func_name
stringlengths
1
106
original_string
stringlengths
76
130k
language
stringclasses
1 value
code
stringlengths
76
130k
code_tokens
listlengths
22
32.6k
docstring
stringlengths
13
1.73k
docstring_tokens
listlengths
1
316
sha
stringclasses
1 value
url
stringlengths
114
252
partition
stringclasses
1 value
summary
stringlengths
13
316
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
kubernetes/kubernetes
pkg/kubelet/cm/container_manager.go
ParseQOSReserved
func ParseQOSReserved(m map[string]string) (*map[v1.ResourceName]int64, error) { reservations := make(map[v1.ResourceName]int64) for k, v := range m { switch v1.ResourceName(k) { // Only memory resources are supported. case v1.ResourceMemory: q, err := parsePercentage(v) if err != nil { return nil, err } reservations[v1.ResourceName(k)] = q default: return nil, fmt.Errorf("cannot reserve %q resource", k) } } return &reservations, nil }
go
func ParseQOSReserved(m map[string]string) (*map[v1.ResourceName]int64, error) { reservations := make(map[v1.ResourceName]int64) for k, v := range m { switch v1.ResourceName(k) { // Only memory resources are supported. case v1.ResourceMemory: q, err := parsePercentage(v) if err != nil { return nil, err } reservations[v1.ResourceName(k)] = q default: return nil, fmt.Errorf("cannot reserve %q resource", k) } } return &reservations, nil }
[ "func", "ParseQOSReserved", "(", "m", "map", "[", "string", "]", "string", ")", "(", "*", "map", "[", "v1", ".", "ResourceName", "]", "int64", ",", "error", ")", "{", "reservations", ":=", "make", "(", "map", "[", "v1", ".", "ResourceName", "]", "int...
// ParseQOSReserved parses the --qos-reserve-requests option
[ "ParseQOSReserved", "parses", "the", "--", "qos", "-", "reserve", "-", "requests", "option" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/cm/container_manager.go#L158-L174
train
ParseQOSReserved parses a map of resources to qos reserved resources.
[ 30522, 4569, 2278, 11968, 3366, 4160, 2891, 6072, 25944, 1006, 1049, 4949, 1031, 5164, 1033, 5164, 1007, 1006, 1008, 4949, 1031, 1058, 2487, 1012, 7692, 18442, 1033, 20014, 21084, 1010, 7561, 1007, 1063, 17829, 1024, 1027, 2191, 1006, 4949,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/api/v1/resource/helpers.go
maxResourceList
func maxResourceList(list, new v1.ResourceList) { for name, quantity := range new { if value, ok := list[name]; !ok { list[name] = *quantity.Copy() continue } else { if quantity.Cmp(value) > 0 { list[name] = *quantity.Copy() } } } }
go
func maxResourceList(list, new v1.ResourceList) { for name, quantity := range new { if value, ok := list[name]; !ok { list[name] = *quantity.Copy() continue } else { if quantity.Cmp(value) > 0 { list[name] = *quantity.Copy() } } } }
[ "func", "maxResourceList", "(", "list", ",", "new", "v1", ".", "ResourceList", ")", "{", "for", "name", ",", "quantity", ":=", "range", "new", "{", "if", "value", ",", "ok", ":=", "list", "[", "name", "]", ";", "!", "ok", "{", "list", "[", "name", ...
// maxResourceList sets list to the greater of list/newList for every resource // either list
[ "maxResourceList", "sets", "list", "to", "the", "greater", "of", "list", "/", "newList", "for", "every", "resource", "either", "list" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/api/v1/resource/helpers.go#L42-L53
train
maxResourceList returns the maximum number of items in the list.
[ 30522, 4569, 2278, 4098, 6072, 8162, 29109, 2923, 1006, 2862, 1010, 2047, 1058, 2487, 1012, 7692, 9863, 1007, 1063, 2005, 2171, 1010, 11712, 1024, 1027, 2846, 2047, 1063, 2065, 3643, 1010, 7929, 1024, 1027, 2862, 1031, 2171, 1033, 1025, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
cmd/kubelet/app/auth.go
BuildAuth
func BuildAuth(nodeName types.NodeName, client clientset.Interface, config kubeletconfig.KubeletConfiguration) (server.AuthInterface, error) { // Get clients, if provided var ( tokenClient authenticationclient.TokenReviewInterface sarClient authorizationclient.SubjectAccessReviewInterface ) if client != nil && !reflect.ValueOf(client).IsNil() { tokenClient = client.AuthenticationV1beta1().TokenReviews() sarClient = client.AuthorizationV1beta1().SubjectAccessReviews() } authenticator, err := BuildAuthn(tokenClient, config.Authentication) if err != nil { return nil, err } attributes := server.NewNodeAuthorizerAttributesGetter(nodeName) authorizer, err := BuildAuthz(sarClient, config.Authorization) if err != nil { return nil, err } return server.NewKubeletAuth(authenticator, attributes, authorizer), nil }
go
func BuildAuth(nodeName types.NodeName, client clientset.Interface, config kubeletconfig.KubeletConfiguration) (server.AuthInterface, error) { // Get clients, if provided var ( tokenClient authenticationclient.TokenReviewInterface sarClient authorizationclient.SubjectAccessReviewInterface ) if client != nil && !reflect.ValueOf(client).IsNil() { tokenClient = client.AuthenticationV1beta1().TokenReviews() sarClient = client.AuthorizationV1beta1().SubjectAccessReviews() } authenticator, err := BuildAuthn(tokenClient, config.Authentication) if err != nil { return nil, err } attributes := server.NewNodeAuthorizerAttributesGetter(nodeName) authorizer, err := BuildAuthz(sarClient, config.Authorization) if err != nil { return nil, err } return server.NewKubeletAuth(authenticator, attributes, authorizer), nil }
[ "func", "BuildAuth", "(", "nodeName", "types", ".", "NodeName", ",", "client", "clientset", ".", "Interface", ",", "config", "kubeletconfig", ".", "KubeletConfiguration", ")", "(", "server", ".", "AuthInterface", ",", "error", ")", "{", "// Get clients, if provide...
// BuildAuth creates an authenticator, an authorizer, and a matching authorizer attributes getter compatible with the kubelet's needs
[ "BuildAuth", "creates", "an", "authenticator", "an", "authorizer", "and", "a", "matching", "authorizer", "attributes", "getter", "compatible", "with", "the", "kubelet", "s", "needs" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubelet/app/auth.go#L38-L62
train
BuildAuth builds a new auth interface
[ 30522, 4569, 2278, 3857, 4887, 2705, 1006, 13045, 18442, 4127, 1012, 13045, 18442, 1010, 7396, 7846, 3388, 1012, 8278, 1010, 9530, 8873, 2290, 13970, 8671, 3388, 8663, 8873, 2290, 1012, 13970, 8671, 3388, 8663, 8873, 27390, 3370, 1007, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/informers/apps/v1/deployment.go
NewDeploymentInformer
func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) }
go
func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) }
[ "func", "NewDeploymentInformer", "(", "client", "kubernetes", ".", "Interface", ",", "namespace", "string", ",", "resyncPeriod", "time", ".", "Duration", ",", "indexers", "cache", ".", "Indexers", ")", "cache", ".", "SharedIndexInformer", "{", "return", "NewFilter...
// NewDeploymentInformer constructs a new informer for Deployment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server.
[ "NewDeploymentInformer", "constructs", "a", "new", "informer", "for", "Deployment", "type", ".", "Always", "prefer", "using", "an", "informer", "factory", "to", "get", "a", "shared", "informer", "instead", "of", "getting", "an", "independent", "one", ".", "This"...
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/informers/apps/v1/deployment.go#L50-L52
train
NewDeploymentInformer constructs a new informer for Deployment type. Always prefer using an informer factory to get a shared informer instead of getting an independent one. This reduces memory footprint and number of connections to the server.
[ 30522, 4569, 2278, 2047, 3207, 24759, 6977, 3672, 2378, 14192, 2121, 1006, 7396, 13970, 5677, 7159, 2229, 1012, 8278, 1010, 3415, 15327, 5164, 1010, 24501, 6038, 21906, 11124, 7716, 2051, 1012, 9367, 1010, 5950, 2545, 17053, 1012, 5950, 254...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/authentication/v1/zz_generated.conversion.go
Convert_authentication_BoundObjectReference_To_v1_BoundObjectReference
func Convert_authentication_BoundObjectReference_To_v1_BoundObjectReference(in *authentication.BoundObjectReference, out *v1.BoundObjectReference, s conversion.Scope) error { return autoConvert_authentication_BoundObjectReference_To_v1_BoundObjectReference(in, out, s) }
go
func Convert_authentication_BoundObjectReference_To_v1_BoundObjectReference(in *authentication.BoundObjectReference, out *v1.BoundObjectReference, s conversion.Scope) error { return autoConvert_authentication_BoundObjectReference_To_v1_BoundObjectReference(in, out, s) }
[ "func", "Convert_authentication_BoundObjectReference_To_v1_BoundObjectReference", "(", "in", "*", "authentication", ".", "BoundObjectReference", ",", "out", "*", "v1", ".", "BoundObjectReference", ",", "s", "conversion", ".", "Scope", ")", "error", "{", "return", "autoC...
// Convert_authentication_BoundObjectReference_To_v1_BoundObjectReference is an autogenerated conversion function.
[ "Convert_authentication_BoundObjectReference_To_v1_BoundObjectReference", "is", "an", "autogenerated", "conversion", "function", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/authentication/v1/zz_generated.conversion.go#L146-L148
train
Convert_authentication_BoundObjectReference_To_v1_BoundObjectReference is an autogenerated conversion function.
[ 30522, 4569, 2278, 10463, 1035, 27280, 1035, 5391, 16429, 20614, 2890, 25523, 1035, 2000, 1035, 1058, 2487, 1035, 5391, 16429, 20614, 2890, 25523, 1006, 1999, 1008, 27280, 1012, 5391, 16429, 20614, 2890, 25523, 1010, 2041, 1008, 1058, 2487, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go
CastTypeName
func (p protobufLocator) CastTypeName(name types.Name) string { if name.Package == p.localGoPackage { return name.Name } return name.String() }
go
func (p protobufLocator) CastTypeName(name types.Name) string { if name.Package == p.localGoPackage { return name.Name } return name.String() }
[ "func", "(", "p", "protobufLocator", ")", "CastTypeName", "(", "name", "types", ".", "Name", ")", "string", "{", "if", "name", ".", "Package", "==", "p", ".", "localGoPackage", "{", "return", "name", ".", "Name", "\n", "}", "\n", "return", "name", ".",...
// CastTypeName returns the cast type name of a Go type // TODO: delegate to a new localgo namer?
[ "CastTypeName", "returns", "the", "cast", "type", "name", "of", "a", "Go", "type", "TODO", ":", "delegate", "to", "a", "new", "localgo", "namer?" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go#L211-L216
train
CastTypeName returns the type name of the given name.
[ 30522, 4569, 2278, 1006, 1052, 15053, 8569, 10258, 24755, 4263, 1007, 3459, 13874, 18442, 1006, 2171, 4127, 1012, 2171, 1007, 5164, 1063, 2065, 2171, 1012, 7427, 1027, 1027, 1052, 1012, 2334, 3995, 23947, 4270, 1063, 2709, 2171, 1012, 2171,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/core/v1/zz_generated.conversion.go
Convert_core_NodeSelectorTerm_To_v1_NodeSelectorTerm
func Convert_core_NodeSelectorTerm_To_v1_NodeSelectorTerm(in *core.NodeSelectorTerm, out *v1.NodeSelectorTerm, s conversion.Scope) error { return autoConvert_core_NodeSelectorTerm_To_v1_NodeSelectorTerm(in, out, s) }
go
func Convert_core_NodeSelectorTerm_To_v1_NodeSelectorTerm(in *core.NodeSelectorTerm, out *v1.NodeSelectorTerm, s conversion.Scope) error { return autoConvert_core_NodeSelectorTerm_To_v1_NodeSelectorTerm(in, out, s) }
[ "func", "Convert_core_NodeSelectorTerm_To_v1_NodeSelectorTerm", "(", "in", "*", "core", ".", "NodeSelectorTerm", ",", "out", "*", "v1", ".", "NodeSelectorTerm", ",", "s", "conversion", ".", "Scope", ")", "error", "{", "return", "autoConvert_core_NodeSelectorTerm_To_v1_N...
// Convert_core_NodeSelectorTerm_To_v1_NodeSelectorTerm is an autogenerated conversion function.
[ "Convert_core_NodeSelectorTerm_To_v1_NodeSelectorTerm", "is", "an", "autogenerated", "conversion", "function", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/v1/zz_generated.conversion.go#L4568-L4570
train
Convert_core_NodeSelectorTerm_To_v1_NodeSelectorTerm is an autogenerated conversion function.
[ 30522, 4569, 2278, 10463, 1035, 4563, 1035, 14164, 12260, 16761, 3334, 2213, 1035, 2000, 1035, 1058, 2487, 1035, 14164, 12260, 16761, 3334, 2213, 1006, 1999, 1008, 4563, 1012, 14164, 12260, 16761, 3334, 2213, 1010, 2041, 1008, 1058, 2487, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/controller/volume/attachdetach/cache/actual_state_of_world.go
addVolumeToReportAsAttached
func (asw *actualStateOfWorld) addVolumeToReportAsAttached( volumeName v1.UniqueVolumeName, nodeName types.NodeName) { // In case the volume/node entry is no longer in attachedVolume list, skip the rest if _, _, err := asw.getNodeAndVolume(volumeName, nodeName); err != nil { klog.V(4).Infof("Volume %q is no longer attached to node %q", volumeName, nodeName) return } nodeToUpdate, nodeToUpdateExists := asw.nodesToUpdateStatusFor[nodeName] if !nodeToUpdateExists { // Create object if it doesn't exist nodeToUpdate = nodeToUpdateStatusFor{ nodeName: nodeName, statusUpdateNeeded: true, volumesToReportAsAttached: make(map[v1.UniqueVolumeName]v1.UniqueVolumeName), } asw.nodesToUpdateStatusFor[nodeName] = nodeToUpdate klog.V(4).Infof("Add new node %q to nodesToUpdateStatusFor", nodeName) } _, nodeToUpdateVolumeExists := nodeToUpdate.volumesToReportAsAttached[volumeName] if !nodeToUpdateVolumeExists { nodeToUpdate.statusUpdateNeeded = true nodeToUpdate.volumesToReportAsAttached[volumeName] = volumeName asw.nodesToUpdateStatusFor[nodeName] = nodeToUpdate klog.V(4).Infof("Report volume %q as attached to node %q", volumeName, nodeName) } }
go
func (asw *actualStateOfWorld) addVolumeToReportAsAttached( volumeName v1.UniqueVolumeName, nodeName types.NodeName) { // In case the volume/node entry is no longer in attachedVolume list, skip the rest if _, _, err := asw.getNodeAndVolume(volumeName, nodeName); err != nil { klog.V(4).Infof("Volume %q is no longer attached to node %q", volumeName, nodeName) return } nodeToUpdate, nodeToUpdateExists := asw.nodesToUpdateStatusFor[nodeName] if !nodeToUpdateExists { // Create object if it doesn't exist nodeToUpdate = nodeToUpdateStatusFor{ nodeName: nodeName, statusUpdateNeeded: true, volumesToReportAsAttached: make(map[v1.UniqueVolumeName]v1.UniqueVolumeName), } asw.nodesToUpdateStatusFor[nodeName] = nodeToUpdate klog.V(4).Infof("Add new node %q to nodesToUpdateStatusFor", nodeName) } _, nodeToUpdateVolumeExists := nodeToUpdate.volumesToReportAsAttached[volumeName] if !nodeToUpdateVolumeExists { nodeToUpdate.statusUpdateNeeded = true nodeToUpdate.volumesToReportAsAttached[volumeName] = volumeName asw.nodesToUpdateStatusFor[nodeName] = nodeToUpdate klog.V(4).Infof("Report volume %q as attached to node %q", volumeName, nodeName) } }
[ "func", "(", "asw", "*", "actualStateOfWorld", ")", "addVolumeToReportAsAttached", "(", "volumeName", "v1", ".", "UniqueVolumeName", ",", "nodeName", "types", ".", "NodeName", ")", "{", "// In case the volume/node entry is no longer in attachedVolume list, skip the rest", "if...
// Add the volumeName to the node's volumesToReportAsAttached list // This is an internal function and caller should acquire and release the lock
[ "Add", "the", "volumeName", "to", "the", "node", "s", "volumesToReportAsAttached", "list", "This", "is", "an", "internal", "function", "and", "caller", "should", "acquire", "and", "release", "the", "lock" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/volume/attachdetach/cache/actual_state_of_world.go#L452-L478
train
addVolumeToReportAsAttached adds a volume to the attachedVolume list
[ 30522, 4569, 2278, 1006, 2004, 2860, 1008, 5025, 9153, 2618, 11253, 11108, 1007, 5587, 6767, 12942, 18903, 2890, 6442, 16782, 5946, 7690, 1006, 3872, 18442, 1058, 2487, 1012, 4310, 6767, 12942, 8189, 4168, 1010, 13045, 18442, 4127, 1012, 13...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/apiserver/pkg/server/filters/maxinflight.go
WithMaxInFlightLimit
func WithMaxInFlightLimit( handler http.Handler, nonMutatingLimit int, mutatingLimit int, longRunningRequestCheck apirequest.LongRunningRequestCheck, ) http.Handler { startOnce.Do(startRecordingUsage) if nonMutatingLimit == 0 && mutatingLimit == 0 { return handler } var nonMutatingChan chan bool var mutatingChan chan bool if nonMutatingLimit != 0 { nonMutatingChan = make(chan bool, nonMutatingLimit) } if mutatingLimit != 0 { mutatingChan = make(chan bool, mutatingLimit) } return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := r.Context() requestInfo, ok := apirequest.RequestInfoFrom(ctx) if !ok { handleError(w, r, fmt.Errorf("no RequestInfo found in context, handler chain must be wrong")) return } // Skip tracking long running events. if longRunningRequestCheck != nil && longRunningRequestCheck(r, requestInfo) { handler.ServeHTTP(w, r) return } var c chan bool isMutatingRequest := !nonMutatingRequestVerbs.Has(requestInfo.Verb) if isMutatingRequest { c = mutatingChan } else { c = nonMutatingChan } if c == nil { handler.ServeHTTP(w, r) } else { select { case c <- true: var mutatingLen, readOnlyLen int if isMutatingRequest { mutatingLen = len(mutatingChan) } else { readOnlyLen = len(nonMutatingChan) } defer func() { <-c if isMutatingRequest { watermark.recordMutating(mutatingLen) } else { watermark.recordReadOnly(readOnlyLen) } }() handler.ServeHTTP(w, r) default: // We need to split this data between buckets used for throttling. if isMutatingRequest { metrics.DroppedRequests.WithLabelValues(metrics.MutatingKind).Inc() metrics.DeprecatedDroppedRequests.WithLabelValues(metrics.MutatingKind).Inc() } else { metrics.DroppedRequests.WithLabelValues(metrics.ReadOnlyKind).Inc() metrics.DeprecatedDroppedRequests.WithLabelValues(metrics.ReadOnlyKind).Inc() } // at this point we're about to return a 429, BUT not all actors should be rate limited. A system:master is so powerful // that they should always get an answer. It's a super-admin or a loopback connection. if currUser, ok := apirequest.UserFrom(ctx); ok { for _, group := range currUser.GetGroups() { if group == user.SystemPrivilegedGroup { handler.ServeHTTP(w, r) return } } } metrics.Record(r, requestInfo, metrics.APIServerComponent, "", http.StatusTooManyRequests, 0, 0) tooManyRequests(r, w) } } }) }
go
func WithMaxInFlightLimit( handler http.Handler, nonMutatingLimit int, mutatingLimit int, longRunningRequestCheck apirequest.LongRunningRequestCheck, ) http.Handler { startOnce.Do(startRecordingUsage) if nonMutatingLimit == 0 && mutatingLimit == 0 { return handler } var nonMutatingChan chan bool var mutatingChan chan bool if nonMutatingLimit != 0 { nonMutatingChan = make(chan bool, nonMutatingLimit) } if mutatingLimit != 0 { mutatingChan = make(chan bool, mutatingLimit) } return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := r.Context() requestInfo, ok := apirequest.RequestInfoFrom(ctx) if !ok { handleError(w, r, fmt.Errorf("no RequestInfo found in context, handler chain must be wrong")) return } // Skip tracking long running events. if longRunningRequestCheck != nil && longRunningRequestCheck(r, requestInfo) { handler.ServeHTTP(w, r) return } var c chan bool isMutatingRequest := !nonMutatingRequestVerbs.Has(requestInfo.Verb) if isMutatingRequest { c = mutatingChan } else { c = nonMutatingChan } if c == nil { handler.ServeHTTP(w, r) } else { select { case c <- true: var mutatingLen, readOnlyLen int if isMutatingRequest { mutatingLen = len(mutatingChan) } else { readOnlyLen = len(nonMutatingChan) } defer func() { <-c if isMutatingRequest { watermark.recordMutating(mutatingLen) } else { watermark.recordReadOnly(readOnlyLen) } }() handler.ServeHTTP(w, r) default: // We need to split this data between buckets used for throttling. if isMutatingRequest { metrics.DroppedRequests.WithLabelValues(metrics.MutatingKind).Inc() metrics.DeprecatedDroppedRequests.WithLabelValues(metrics.MutatingKind).Inc() } else { metrics.DroppedRequests.WithLabelValues(metrics.ReadOnlyKind).Inc() metrics.DeprecatedDroppedRequests.WithLabelValues(metrics.ReadOnlyKind).Inc() } // at this point we're about to return a 429, BUT not all actors should be rate limited. A system:master is so powerful // that they should always get an answer. It's a super-admin or a loopback connection. if currUser, ok := apirequest.UserFrom(ctx); ok { for _, group := range currUser.GetGroups() { if group == user.SystemPrivilegedGroup { handler.ServeHTTP(w, r) return } } } metrics.Record(r, requestInfo, metrics.APIServerComponent, "", http.StatusTooManyRequests, 0, 0) tooManyRequests(r, w) } } }) }
[ "func", "WithMaxInFlightLimit", "(", "handler", "http", ".", "Handler", ",", "nonMutatingLimit", "int", ",", "mutatingLimit", "int", ",", "longRunningRequestCheck", "apirequest", ".", "LongRunningRequestCheck", ",", ")", "http", ".", "Handler", "{", "startOnce", "."...
// WithMaxInFlightLimit limits the number of in-flight requests to buffer size of the passed in channel.
[ "WithMaxInFlightLimit", "limits", "the", "number", "of", "in", "-", "flight", "requests", "to", "buffer", "size", "of", "the", "passed", "in", "channel", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiserver/pkg/server/filters/maxinflight.go#L97-L186
train
WithMaxInFlightLimit returns a new handler that will send a response with a max in flight limit.
[ 30522, 4569, 2278, 2007, 17848, 2378, 28968, 17960, 4183, 1006, 28213, 8299, 1012, 28213, 1010, 2512, 28120, 5844, 17960, 4183, 20014, 1010, 14163, 29336, 2075, 17960, 4183, 20014, 1010, 2146, 15532, 5582, 2890, 15500, 5403, 3600, 17928, 2890...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake/fake_lease.go
DeleteCollection
func (c *FakeLeases) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { action := testing.NewDeleteCollectionAction(leasesResource, c.ns, listOptions) _, err := c.Fake.Invokes(action, &v1beta1.LeaseList{}) return err }
go
func (c *FakeLeases) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { action := testing.NewDeleteCollectionAction(leasesResource, c.ns, listOptions) _, err := c.Fake.Invokes(action, &v1beta1.LeaseList{}) return err }
[ "func", "(", "c", "*", "FakeLeases", ")", "DeleteCollection", "(", "options", "*", "v1", ".", "DeleteOptions", ",", "listOptions", "v1", ".", "ListOptions", ")", "error", "{", "action", ":=", "testing", ".", "NewDeleteCollectionAction", "(", "leasesResource", ...
// DeleteCollection deletes a collection of objects.
[ "DeleteCollection", "deletes", "a", "collection", "of", "objects", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/fake/fake_lease.go#L112-L117
train
DeleteCollection takes listOptions and deletes all Leases in the system. Returns an error if one occurs.
[ 30522, 4569, 2278, 1006, 1039, 1008, 8275, 19738, 8583, 1007, 3972, 12870, 26895, 18491, 1006, 7047, 1008, 1058, 2487, 1012, 3972, 12870, 7361, 9285, 1010, 2862, 7361, 9285, 1058, 2487, 1012, 2862, 7361, 9285, 1007, 7561, 1063, 2895, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/validation/validation.go
NewSchemaValidator
func NewSchemaValidator(customResourceValidation *apiextensions.CustomResourceValidation) (*validate.SchemaValidator, *spec.Schema, error) { // Convert CRD schema to openapi schema openapiSchema := &spec.Schema{} if customResourceValidation != nil { if err := ConvertJSONSchemaProps(customResourceValidation.OpenAPIV3Schema, openapiSchema); err != nil { return nil, nil, err } } return validate.NewSchemaValidator(openapiSchema, nil, "", strfmt.Default), openapiSchema, nil }
go
func NewSchemaValidator(customResourceValidation *apiextensions.CustomResourceValidation) (*validate.SchemaValidator, *spec.Schema, error) { // Convert CRD schema to openapi schema openapiSchema := &spec.Schema{} if customResourceValidation != nil { if err := ConvertJSONSchemaProps(customResourceValidation.OpenAPIV3Schema, openapiSchema); err != nil { return nil, nil, err } } return validate.NewSchemaValidator(openapiSchema, nil, "", strfmt.Default), openapiSchema, nil }
[ "func", "NewSchemaValidator", "(", "customResourceValidation", "*", "apiextensions", ".", "CustomResourceValidation", ")", "(", "*", "validate", ".", "SchemaValidator", ",", "*", "spec", ".", "Schema", ",", "error", ")", "{", "// Convert CRD schema to openapi schema", ...
// NewSchemaValidator creates an openapi schema validator for the given CRD validation.
[ "NewSchemaValidator", "creates", "an", "openapi", "schema", "validator", "for", "the", "given", "CRD", "validation", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/validation/validation.go#L28-L37
train
NewSchemaValidator creates a new schema validator based on the provided custom resource validation.
[ 30522, 4569, 2278, 2739, 5403, 2863, 10175, 8524, 4263, 1006, 7661, 6072, 8162, 3401, 10175, 8524, 3508, 1008, 17928, 10288, 29048, 2015, 1012, 7661, 6072, 8162, 3401, 10175, 8524, 3508, 1007, 1006, 1008, 9398, 3686, 1012, 8040, 28433, 1017...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/tools/cache/fake_custom_store.go
Delete
func (f *FakeCustomStore) Delete(obj interface{}) error { if f.DeleteFunc != nil { return f.DeleteFunc(obj) } return nil }
go
func (f *FakeCustomStore) Delete(obj interface{}) error { if f.DeleteFunc != nil { return f.DeleteFunc(obj) } return nil }
[ "func", "(", "f", "*", "FakeCustomStore", ")", "Delete", "(", "obj", "interface", "{", "}", ")", "error", "{", "if", "f", ".", "DeleteFunc", "!=", "nil", "{", "return", "f", ".", "DeleteFunc", "(", "obj", ")", "\n", "}", "\n", "return", "nil", "\n"...
// Delete calls the custom Delete function if defined
[ "Delete", "calls", "the", "custom", "Delete", "function", "if", "defined" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/tools/cache/fake_custom_store.go#L49-L54
train
Delete is a mock
[ 30522, 4569, 2278, 1006, 1042, 1008, 8275, 7874, 20389, 23809, 2063, 1007, 3972, 12870, 1006, 27885, 3501, 8278, 1063, 1065, 1007, 7561, 1063, 2065, 1042, 1012, 3972, 12870, 11263, 12273, 999, 1027, 9152, 2140, 1063, 2709, 1042, 1012, 3972,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/controller/nodeipam/ipam/controller.go
Start
func (c *Controller) Start(nodeInformer informers.NodeInformer) error { klog.V(0).Infof("Starting IPAM controller (config=%+v)", c.config) nodes, err := listNodes(c.adapter.k8s) if err != nil { return err } for _, node := range nodes.Items { if node.Spec.PodCIDR != "" { _, cidrRange, err := net.ParseCIDR(node.Spec.PodCIDR) if err == nil { c.set.Occupy(cidrRange) klog.V(3).Infof("Occupying CIDR for node %q (%v)", node.Name, node.Spec.PodCIDR) } else { klog.Errorf("Node %q has an invalid CIDR (%q): %v", node.Name, node.Spec.PodCIDR, err) } } func() { c.lock.Lock() defer c.lock.Unlock() // XXX/bowei -- stagger the start of each sync cycle. syncer := c.newSyncer(node.Name) c.syncers[node.Name] = syncer go syncer.Loop(nil) }() } nodeInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: nodeutil.CreateAddNodeHandler(c.onAdd), UpdateFunc: nodeutil.CreateUpdateNodeHandler(c.onUpdate), DeleteFunc: nodeutil.CreateDeleteNodeHandler(c.onDelete), }) return nil }
go
func (c *Controller) Start(nodeInformer informers.NodeInformer) error { klog.V(0).Infof("Starting IPAM controller (config=%+v)", c.config) nodes, err := listNodes(c.adapter.k8s) if err != nil { return err } for _, node := range nodes.Items { if node.Spec.PodCIDR != "" { _, cidrRange, err := net.ParseCIDR(node.Spec.PodCIDR) if err == nil { c.set.Occupy(cidrRange) klog.V(3).Infof("Occupying CIDR for node %q (%v)", node.Name, node.Spec.PodCIDR) } else { klog.Errorf("Node %q has an invalid CIDR (%q): %v", node.Name, node.Spec.PodCIDR, err) } } func() { c.lock.Lock() defer c.lock.Unlock() // XXX/bowei -- stagger the start of each sync cycle. syncer := c.newSyncer(node.Name) c.syncers[node.Name] = syncer go syncer.Loop(nil) }() } nodeInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: nodeutil.CreateAddNodeHandler(c.onAdd), UpdateFunc: nodeutil.CreateUpdateNodeHandler(c.onUpdate), DeleteFunc: nodeutil.CreateDeleteNodeHandler(c.onDelete), }) return nil }
[ "func", "(", "c", "*", "Controller", ")", "Start", "(", "nodeInformer", "informers", ".", "NodeInformer", ")", "error", "{", "klog", ".", "V", "(", "0", ")", ".", "Infof", "(", "\"", "\"", ",", "c", ".", "config", ")", "\n\n", "nodes", ",", "err", ...
// Start initializes the Controller with the existing list of nodes and // registers the informers for node changes. This will start synchronization // of the node and cloud CIDR range allocations.
[ "Start", "initializes", "the", "Controller", "with", "the", "existing", "list", "of", "nodes", "and", "registers", "the", "informers", "for", "node", "changes", ".", "This", "will", "start", "synchronization", "of", "the", "node", "and", "cloud", "CIDR", "rang...
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/nodeipam/ipam/controller.go#L101-L137
train
Start starts the controller.
[ 30522, 4569, 2278, 1006, 1039, 1008, 11486, 1007, 2707, 1006, 13045, 2378, 14192, 2121, 12367, 2545, 1012, 13045, 2378, 14192, 2121, 1007, 7561, 1063, 1047, 21197, 1012, 1058, 1006, 1014, 1007, 1012, 18558, 2546, 1006, 1000, 3225, 24531, 22...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/tools/leaderelection/leaderelection.go
Check
func (le *LeaderElector) Check(maxTolerableExpiredLease time.Duration) error { if !le.IsLeader() { // Currently not concerned with the case that we are hot standby return nil } // If we are more than timeout seconds after the lease duration that is past the timeout // on the lease renew. Time to start reporting ourselves as unhealthy. We should have // died but conditions like deadlock can prevent this. (See #70819) if le.clock.Since(le.observedTime) > le.config.LeaseDuration+maxTolerableExpiredLease { return fmt.Errorf("failed election to renew leadership on lease %s", le.config.Name) } return nil }
go
func (le *LeaderElector) Check(maxTolerableExpiredLease time.Duration) error { if !le.IsLeader() { // Currently not concerned with the case that we are hot standby return nil } // If we are more than timeout seconds after the lease duration that is past the timeout // on the lease renew. Time to start reporting ourselves as unhealthy. We should have // died but conditions like deadlock can prevent this. (See #70819) if le.clock.Since(le.observedTime) > le.config.LeaseDuration+maxTolerableExpiredLease { return fmt.Errorf("failed election to renew leadership on lease %s", le.config.Name) } return nil }
[ "func", "(", "le", "*", "LeaderElector", ")", "Check", "(", "maxTolerableExpiredLease", "time", ".", "Duration", ")", "error", "{", "if", "!", "le", ".", "IsLeader", "(", ")", "{", "// Currently not concerned with the case that we are hot standby", "return", "nil", ...
// Check will determine if the current lease is expired by more than timeout.
[ "Check", "will", "determine", "if", "the", "current", "lease", "is", "expired", "by", "more", "than", "timeout", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/tools/leaderelection/leaderelection.go#L360-L373
train
Check checks that the leader is healthy.
[ 30522, 4569, 2278, 1006, 3393, 1008, 3003, 12260, 16761, 1007, 4638, 1006, 4098, 3406, 3917, 3085, 10288, 21649, 19738, 3366, 2051, 1012, 9367, 1007, 7561, 1063, 2065, 999, 3393, 1012, 8842, 9648, 2099, 1006, 1007, 1063, 1013, 1013, 2747, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/metrics/pkg/apis/external_metrics/v1beta1/zz_generated.conversion.go
Convert_external_metrics_ExternalMetricValueList_To_v1beta1_ExternalMetricValueList
func Convert_external_metrics_ExternalMetricValueList_To_v1beta1_ExternalMetricValueList(in *externalmetrics.ExternalMetricValueList, out *ExternalMetricValueList, s conversion.Scope) error { return autoConvert_external_metrics_ExternalMetricValueList_To_v1beta1_ExternalMetricValueList(in, out, s) }
go
func Convert_external_metrics_ExternalMetricValueList_To_v1beta1_ExternalMetricValueList(in *externalmetrics.ExternalMetricValueList, out *ExternalMetricValueList, s conversion.Scope) error { return autoConvert_external_metrics_ExternalMetricValueList_To_v1beta1_ExternalMetricValueList(in, out, s) }
[ "func", "Convert_external_metrics_ExternalMetricValueList_To_v1beta1_ExternalMetricValueList", "(", "in", "*", "externalmetrics", ".", "ExternalMetricValueList", ",", "out", "*", "ExternalMetricValueList", ",", "s", "conversion", ".", "Scope", ")", "error", "{", "return", "...
// Convert_external_metrics_ExternalMetricValueList_To_v1beta1_ExternalMetricValueList is an autogenerated conversion function.
[ "Convert_external_metrics_ExternalMetricValueList_To_v1beta1_ExternalMetricValueList", "is", "an", "autogenerated", "conversion", "function", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/metrics/pkg/apis/external_metrics/v1beta1/zz_generated.conversion.go#L107-L109
train
Convert_external_metrics_ExternalMetricValueList_To_v1beta1_ExternalMetricValueList is an autogenerated conversion function.
[ 30522, 4569, 2278, 10463, 1035, 6327, 1035, 12046, 2015, 1035, 6327, 12589, 10175, 16284, 2923, 1035, 2000, 1035, 1058, 2487, 20915, 27717, 1035, 6327, 12589, 10175, 30524, 1012, 6327, 12589, 10175, 16284, 2923, 1010, 2041, 1008, 6327, 12589,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubelet/cm/devicemanager/manager.go
allocateContainerResources
func (m *ManagerImpl) allocateContainerResources(pod *v1.Pod, container *v1.Container, devicesToReuse map[string]sets.String) error { podUID := string(pod.UID) contName := container.Name allocatedDevicesUpdated := false // Extended resources are not allowed to be overcommitted. // Since device plugin advertises extended resources, // therefore Requests must be equal to Limits and iterating // over the Limits should be sufficient. for k, v := range container.Resources.Limits { resource := string(k) needed := int(v.Value()) klog.V(3).Infof("needs %d %s", needed, resource) if !m.isDevicePluginResource(resource) { continue } // Updates allocatedDevices to garbage collect any stranded resources // before doing the device plugin allocation. if !allocatedDevicesUpdated { m.updateAllocatedDevices(m.activePods()) allocatedDevicesUpdated = true } allocDevices, err := m.devicesToAllocate(podUID, contName, resource, needed, devicesToReuse[resource]) if err != nil { return err } if allocDevices == nil || len(allocDevices) <= 0 { continue } startRPCTime := time.Now() // Manager.Allocate involves RPC calls to device plugin, which // could be heavy-weight. Therefore we want to perform this operation outside // mutex lock. Note if Allocate call fails, we may leave container resources // partially allocated for the failed container. We rely on updateAllocatedDevices() // to garbage collect these resources later. Another side effect is that if // we have X resource A and Y resource B in total, and two containers, container1 // and container2 both require X resource A and Y resource B. Both allocation // requests may fail if we serve them in mixed order. // TODO: may revisit this part later if we see inefficient resource allocation // in real use as the result of this. Should also consider to parallelize device // plugin Allocate grpc calls if it becomes common that a container may require // resources from multiple device plugins. m.mutex.Lock() eI, ok := m.endpoints[resource] m.mutex.Unlock() if !ok { m.mutex.Lock() m.allocatedDevices = m.podDevices.devices() m.mutex.Unlock() return fmt.Errorf("Unknown Device Plugin %s", resource) } devs := allocDevices.UnsortedList() // TODO: refactor this part of code to just append a ContainerAllocationRequest // in a passed in AllocateRequest pointer, and issues a single Allocate call per pod. klog.V(3).Infof("Making allocation request for devices %v for device plugin %s", devs, resource) resp, err := eI.e.allocate(devs) metrics.DevicePluginAllocationDuration.WithLabelValues(resource).Observe(metrics.SinceInSeconds(startRPCTime)) metrics.DeprecatedDevicePluginAllocationLatency.WithLabelValues(resource).Observe(metrics.SinceInMicroseconds(startRPCTime)) if err != nil { // In case of allocation failure, we want to restore m.allocatedDevices // to the actual allocated state from m.podDevices. m.mutex.Lock() m.allocatedDevices = m.podDevices.devices() m.mutex.Unlock() return err } if len(resp.ContainerResponses) == 0 { return fmt.Errorf("No containers return in allocation response %v", resp) } // Update internal cached podDevices state. m.mutex.Lock() m.podDevices.insert(podUID, contName, resource, allocDevices, resp.ContainerResponses[0]) m.mutex.Unlock() } // Checkpoints device to container allocation information. return m.writeCheckpoint() }
go
func (m *ManagerImpl) allocateContainerResources(pod *v1.Pod, container *v1.Container, devicesToReuse map[string]sets.String) error { podUID := string(pod.UID) contName := container.Name allocatedDevicesUpdated := false // Extended resources are not allowed to be overcommitted. // Since device plugin advertises extended resources, // therefore Requests must be equal to Limits and iterating // over the Limits should be sufficient. for k, v := range container.Resources.Limits { resource := string(k) needed := int(v.Value()) klog.V(3).Infof("needs %d %s", needed, resource) if !m.isDevicePluginResource(resource) { continue } // Updates allocatedDevices to garbage collect any stranded resources // before doing the device plugin allocation. if !allocatedDevicesUpdated { m.updateAllocatedDevices(m.activePods()) allocatedDevicesUpdated = true } allocDevices, err := m.devicesToAllocate(podUID, contName, resource, needed, devicesToReuse[resource]) if err != nil { return err } if allocDevices == nil || len(allocDevices) <= 0 { continue } startRPCTime := time.Now() // Manager.Allocate involves RPC calls to device plugin, which // could be heavy-weight. Therefore we want to perform this operation outside // mutex lock. Note if Allocate call fails, we may leave container resources // partially allocated for the failed container. We rely on updateAllocatedDevices() // to garbage collect these resources later. Another side effect is that if // we have X resource A and Y resource B in total, and two containers, container1 // and container2 both require X resource A and Y resource B. Both allocation // requests may fail if we serve them in mixed order. // TODO: may revisit this part later if we see inefficient resource allocation // in real use as the result of this. Should also consider to parallelize device // plugin Allocate grpc calls if it becomes common that a container may require // resources from multiple device plugins. m.mutex.Lock() eI, ok := m.endpoints[resource] m.mutex.Unlock() if !ok { m.mutex.Lock() m.allocatedDevices = m.podDevices.devices() m.mutex.Unlock() return fmt.Errorf("Unknown Device Plugin %s", resource) } devs := allocDevices.UnsortedList() // TODO: refactor this part of code to just append a ContainerAllocationRequest // in a passed in AllocateRequest pointer, and issues a single Allocate call per pod. klog.V(3).Infof("Making allocation request for devices %v for device plugin %s", devs, resource) resp, err := eI.e.allocate(devs) metrics.DevicePluginAllocationDuration.WithLabelValues(resource).Observe(metrics.SinceInSeconds(startRPCTime)) metrics.DeprecatedDevicePluginAllocationLatency.WithLabelValues(resource).Observe(metrics.SinceInMicroseconds(startRPCTime)) if err != nil { // In case of allocation failure, we want to restore m.allocatedDevices // to the actual allocated state from m.podDevices. m.mutex.Lock() m.allocatedDevices = m.podDevices.devices() m.mutex.Unlock() return err } if len(resp.ContainerResponses) == 0 { return fmt.Errorf("No containers return in allocation response %v", resp) } // Update internal cached podDevices state. m.mutex.Lock() m.podDevices.insert(podUID, contName, resource, allocDevices, resp.ContainerResponses[0]) m.mutex.Unlock() } // Checkpoints device to container allocation information. return m.writeCheckpoint() }
[ "func", "(", "m", "*", "ManagerImpl", ")", "allocateContainerResources", "(", "pod", "*", "v1", ".", "Pod", ",", "container", "*", "v1", ".", "Container", ",", "devicesToReuse", "map", "[", "string", "]", "sets", ".", "String", ")", "error", "{", "podUID...
// allocateContainerResources attempts to allocate all of required device // plugin resources for the input container, issues an Allocate rpc request // for each new device resource requirement, processes their AllocateResponses, // and updates the cached containerDevices on success.
[ "allocateContainerResources", "attempts", "to", "allocate", "all", "of", "required", "device", "plugin", "resources", "for", "the", "input", "container", "issues", "an", "Allocate", "rpc", "request", "for", "each", "new", "device", "resource", "requirement", "proces...
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/cm/devicemanager/manager.go#L643-L723
train
allocateContainerResources allocates the container resources for the given pod and container.
[ 30522, 4569, 2278, 1006, 1049, 1008, 3208, 5714, 24759, 1007, 2035, 24755, 26557, 12162, 18175, 14343, 6499, 3126, 9623, 1006, 17491, 1008, 1058, 2487, 1012, 17491, 1010, 11661, 1008, 1058, 2487, 1012, 11661, 1010, 5733, 19277, 8557, 4949, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/apiserver/pkg/registry/rest/update.go
UpdatedObject
func (i *wrappedUpdatedObjectInfo) UpdatedObject(ctx context.Context, oldObj runtime.Object) (runtime.Object, error) { newObj, err := i.objInfo.UpdatedObject(ctx, oldObj) if err != nil { return newObj, err } // Allow any configured transformers to update the new object or error for _, transformer := range i.transformers { newObj, err = transformer(ctx, newObj, oldObj) if err != nil { return nil, err } } return newObj, nil }
go
func (i *wrappedUpdatedObjectInfo) UpdatedObject(ctx context.Context, oldObj runtime.Object) (runtime.Object, error) { newObj, err := i.objInfo.UpdatedObject(ctx, oldObj) if err != nil { return newObj, err } // Allow any configured transformers to update the new object or error for _, transformer := range i.transformers { newObj, err = transformer(ctx, newObj, oldObj) if err != nil { return nil, err } } return newObj, nil }
[ "func", "(", "i", "*", "wrappedUpdatedObjectInfo", ")", "UpdatedObject", "(", "ctx", "context", ".", "Context", ",", "oldObj", "runtime", ".", "Object", ")", "(", "runtime", ".", "Object", ",", "error", ")", "{", "newObj", ",", "err", ":=", "i", ".", "...
// UpdatedObject satisfies the UpdatedObjectInfo interface. // It delegates to the wrapped objInfo and passes the result through any configured transformers.
[ "UpdatedObject", "satisfies", "the", "UpdatedObjectInfo", "interface", ".", "It", "delegates", "to", "the", "wrapped", "objInfo", "and", "passes", "the", "result", "through", "any", "configured", "transformers", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiserver/pkg/registry/rest/update.go#L241-L256
train
UpdatedObject implements the UpdatedObjectInfo interface.
[ 30522, 4569, 2278, 1006, 1045, 1008, 5058, 6279, 13701, 3527, 2497, 20614, 2378, 14876, 1007, 7172, 16429, 20614, 1006, 14931, 2595, 6123, 1012, 6123, 1010, 2214, 16429, 3501, 2448, 7292, 1012, 4874, 1007, 1006, 2448, 7292, 1012, 4874, 1010...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/core/v1/zz_generated.conversion.go
Convert_v1_PersistentVolumeStatus_To_core_PersistentVolumeStatus
func Convert_v1_PersistentVolumeStatus_To_core_PersistentVolumeStatus(in *v1.PersistentVolumeStatus, out *core.PersistentVolumeStatus, s conversion.Scope) error { return autoConvert_v1_PersistentVolumeStatus_To_core_PersistentVolumeStatus(in, out, s) }
go
func Convert_v1_PersistentVolumeStatus_To_core_PersistentVolumeStatus(in *v1.PersistentVolumeStatus, out *core.PersistentVolumeStatus, s conversion.Scope) error { return autoConvert_v1_PersistentVolumeStatus_To_core_PersistentVolumeStatus(in, out, s) }
[ "func", "Convert_v1_PersistentVolumeStatus_To_core_PersistentVolumeStatus", "(", "in", "*", "v1", ".", "PersistentVolumeStatus", ",", "out", "*", "core", ".", "PersistentVolumeStatus", ",", "s", "conversion", ".", "Scope", ")", "error", "{", "return", "autoConvert_v1_Pe...
// Convert_v1_PersistentVolumeStatus_To_core_PersistentVolumeStatus is an autogenerated conversion function.
[ "Convert_v1_PersistentVolumeStatus_To_core_PersistentVolumeStatus", "is", "an", "autogenerated", "conversion", "function", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/v1/zz_generated.conversion.go#L5094-L5096
train
Convert_v1_PersistentVolumeStatus_To_core_PersistentVolumeStatus is an autogenerated conversion function.
[ 30522, 4569, 2278, 10463, 1035, 1058, 2487, 1035, 14516, 6767, 12942, 4355, 15590, 1035, 2000, 1035, 4563, 1035, 14516, 6767, 12942, 4355, 15590, 1006, 1999, 1008, 1058, 2487, 1012, 14516, 6767, 12942, 4355, 15590, 1010, 2041, 1008, 4563, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/apiextensions-apiserver/pkg/controller/openapi/aggregator.go
mergeSpecs
func mergeSpecs(staticSpec *spec.Swagger, crdSpecs ...*spec.Swagger) *spec.Swagger { // create shallow copy of staticSpec, but replace paths and definitions because we modify them. specToReturn := *staticSpec if staticSpec.Definitions != nil { specToReturn.Definitions = spec.Definitions{} for k, s := range staticSpec.Definitions { specToReturn.Definitions[k] = s } } if staticSpec.Paths != nil { specToReturn.Paths = &spec.Paths{ Paths: map[string]spec.PathItem{}, } for k, p := range staticSpec.Paths.Paths { specToReturn.Paths.Paths[k] = p } } for _, s := range crdSpecs { mergeSpec(&specToReturn, s) } return &specToReturn }
go
func mergeSpecs(staticSpec *spec.Swagger, crdSpecs ...*spec.Swagger) *spec.Swagger { // create shallow copy of staticSpec, but replace paths and definitions because we modify them. specToReturn := *staticSpec if staticSpec.Definitions != nil { specToReturn.Definitions = spec.Definitions{} for k, s := range staticSpec.Definitions { specToReturn.Definitions[k] = s } } if staticSpec.Paths != nil { specToReturn.Paths = &spec.Paths{ Paths: map[string]spec.PathItem{}, } for k, p := range staticSpec.Paths.Paths { specToReturn.Paths.Paths[k] = p } } for _, s := range crdSpecs { mergeSpec(&specToReturn, s) } return &specToReturn }
[ "func", "mergeSpecs", "(", "staticSpec", "*", "spec", ".", "Swagger", ",", "crdSpecs", "...", "*", "spec", ".", "Swagger", ")", "*", "spec", ".", "Swagger", "{", "// create shallow copy of staticSpec, but replace paths and definitions because we modify them.", "specToRetu...
// mergeSpecs aggregates all OpenAPI specs, reusing the metadata of the first, static spec as the basis.
[ "mergeSpecs", "aggregates", "all", "OpenAPI", "specs", "reusing", "the", "metadata", "of", "the", "first", "static", "spec", "as", "the", "basis", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiextensions-apiserver/pkg/controller/openapi/aggregator.go#L24-L47
train
mergeSpecs merges staticSpec with crdSpecs.
[ 30522, 4569, 2278, 13590, 13102, 8586, 2015, 1006, 10763, 13102, 8586, 1008, 28699, 1012, 25430, 27609, 1010, 13675, 5104, 5051, 6169, 1012, 1012, 1012, 1008, 28699, 1012, 25430, 27609, 1007, 1008, 28699, 1012, 25430, 27609, 1063, 1013, 1013,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubectl/cmd/config/current_context.go
RunCurrentContext
func RunCurrentContext(out io.Writer, options *CurrentContextOptions) error { config, err := options.ConfigAccess.GetStartingConfig() if err != nil { return err } if config.CurrentContext == "" { err = fmt.Errorf("current-context is not set") return err } fmt.Fprintf(out, "%s\n", config.CurrentContext) return nil }
go
func RunCurrentContext(out io.Writer, options *CurrentContextOptions) error { config, err := options.ConfigAccess.GetStartingConfig() if err != nil { return err } if config.CurrentContext == "" { err = fmt.Errorf("current-context is not set") return err } fmt.Fprintf(out, "%s\n", config.CurrentContext) return nil }
[ "func", "RunCurrentContext", "(", "out", "io", ".", "Writer", ",", "options", "*", "CurrentContextOptions", ")", "error", "{", "config", ",", "err", ":=", "options", ".", "ConfigAccess", ".", "GetStartingConfig", "(", ")", "\n", "if", "err", "!=", "nil", "...
// RunCurrentContext performs the execution of 'config current-context' sub command
[ "RunCurrentContext", "performs", "the", "execution", "of", "config", "current", "-", "context", "sub", "command" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubectl/cmd/config/current_context.go#L63-L76
train
RunCurrentContext runs the current - context command
[ 30522, 4569, 2278, 2448, 10841, 14343, 3372, 8663, 18209, 1006, 2041, 22834, 1012, 3213, 1010, 7047, 1008, 2783, 8663, 18209, 7361, 9285, 1007, 7561, 1063, 9530, 8873, 2290, 1010, 9413, 2099, 1024, 1027, 7047, 1012, 9530, 8873, 3654, 9468, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/api/v1/resource/helpers.go
MergeContainerResourceLimits
func MergeContainerResourceLimits(container *v1.Container, allocatable v1.ResourceList) { if container.Resources.Limits == nil { container.Resources.Limits = make(v1.ResourceList) } for _, resource := range []v1.ResourceName{v1.ResourceCPU, v1.ResourceMemory, v1.ResourceEphemeralStorage} { if quantity, exists := container.Resources.Limits[resource]; !exists || quantity.IsZero() { if cap, exists := allocatable[resource]; exists { container.Resources.Limits[resource] = *cap.Copy() } } } }
go
func MergeContainerResourceLimits(container *v1.Container, allocatable v1.ResourceList) { if container.Resources.Limits == nil { container.Resources.Limits = make(v1.ResourceList) } for _, resource := range []v1.ResourceName{v1.ResourceCPU, v1.ResourceMemory, v1.ResourceEphemeralStorage} { if quantity, exists := container.Resources.Limits[resource]; !exists || quantity.IsZero() { if cap, exists := allocatable[resource]; exists { container.Resources.Limits[resource] = *cap.Copy() } } } }
[ "func", "MergeContainerResourceLimits", "(", "container", "*", "v1", ".", "Container", ",", "allocatable", "v1", ".", "ResourceList", ")", "{", "if", "container", ".", "Resources", ".", "Limits", "==", "nil", "{", "container", ".", "Resources", ".", "Limits", ...
// MergeContainerResourceLimits checks if a limit is applied for // the container, and if not, it sets the limit to the passed resource list.
[ "MergeContainerResourceLimits", "checks", "if", "a", "limit", "is", "applied", "for", "the", "container", "and", "if", "not", "it", "sets", "the", "limit", "to", "the", "passed", "resource", "list", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/api/v1/resource/helpers.go#L185-L197
train
MergeContainerResourceLimits merges container. Resources. Limits with the specified allocationatable.
[ 30522, 4569, 2278, 13590, 8663, 18249, 28849, 6499, 3126, 29109, 27605, 3215, 1006, 11661, 1008, 1058, 2487, 1012, 11661, 1010, 2035, 24755, 10880, 1058, 2487, 1012, 7692, 9863, 1007, 1063, 2065, 11661, 1012, 4219, 1012, 6537, 1027, 1027, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/util/mount/mount_windows.go
isSMBMappingExist
func isSMBMappingExist(remotepath string) bool { cmd := exec.Command("powershell", "/c", `Get-SmbGlobalMapping -RemotePath $Env:smbremotepath`) cmd.Env = append(os.Environ(), fmt.Sprintf("smbremotepath=%s", remotepath)) _, err := cmd.CombinedOutput() return err == nil }
go
func isSMBMappingExist(remotepath string) bool { cmd := exec.Command("powershell", "/c", `Get-SmbGlobalMapping -RemotePath $Env:smbremotepath`) cmd.Env = append(os.Environ(), fmt.Sprintf("smbremotepath=%s", remotepath)) _, err := cmd.CombinedOutput() return err == nil }
[ "func", "isSMBMappingExist", "(", "remotepath", "string", ")", "bool", "{", "cmd", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "`Get-SmbGlobalMapping -RemotePath $Env:smbremotepath`", ")", "\n", "cmd", ".", "Env", "=", "append", "(", ...
// check whether remotepath is already mounted
[ "check", "whether", "remotepath", "is", "already", "mounted" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/util/mount/mount_windows.go#L140-L145
train
isSMBMappingExist returns true if the specified remotepath exists in the system
[ 30522, 4569, 2278, 26354, 14905, 2863, 14853, 30524, 16429, 2389, 2863, 14853, 1011, 6556, 15069, 1002, 4372, 2615, 1024, 15488, 13578, 18938, 13699, 8988, 1036, 1007, 4642, 2094, 1012, 4372, 2615, 1027, 10439, 10497, 1006, 9808, 1012, 4372, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubelet/remote/remote_image.go
PullImage
func (r *RemoteImageService) PullImage(image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig, podSandboxConfig *runtimeapi.PodSandboxConfig) (string, error) { ctx, cancel := getContextWithCancel() defer cancel() resp, err := r.imageClient.PullImage(ctx, &runtimeapi.PullImageRequest{ Image: image, Auth: auth, SandboxConfig: podSandboxConfig, }) if err != nil { klog.Errorf("PullImage %q from image service failed: %v", image.Image, err) return "", err } if resp.ImageRef == "" { errorMessage := fmt.Sprintf("imageRef of image %q is not set", image.Image) klog.Errorf("PullImage failed: %s", errorMessage) return "", errors.New(errorMessage) } return resp.ImageRef, nil }
go
func (r *RemoteImageService) PullImage(image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig, podSandboxConfig *runtimeapi.PodSandboxConfig) (string, error) { ctx, cancel := getContextWithCancel() defer cancel() resp, err := r.imageClient.PullImage(ctx, &runtimeapi.PullImageRequest{ Image: image, Auth: auth, SandboxConfig: podSandboxConfig, }) if err != nil { klog.Errorf("PullImage %q from image service failed: %v", image.Image, err) return "", err } if resp.ImageRef == "" { errorMessage := fmt.Sprintf("imageRef of image %q is not set", image.Image) klog.Errorf("PullImage failed: %s", errorMessage) return "", errors.New(errorMessage) } return resp.ImageRef, nil }
[ "func", "(", "r", "*", "RemoteImageService", ")", "PullImage", "(", "image", "*", "runtimeapi", ".", "ImageSpec", ",", "auth", "*", "runtimeapi", ".", "AuthConfig", ",", "podSandboxConfig", "*", "runtimeapi", ".", "PodSandboxConfig", ")", "(", "string", ",", ...
// PullImage pulls an image with authentication config.
[ "PullImage", "pulls", "an", "image", "with", "authentication", "config", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/remote/remote_image.go#L103-L124
train
PullImage pulls an image from the image service
[ 30522, 4569, 2278, 1006, 1054, 1008, 6556, 9581, 8449, 2121, 7903, 2063, 1007, 4139, 9581, 3351, 1006, 3746, 1008, 2448, 7292, 9331, 2072, 1012, 4871, 5051, 2278, 1010, 8740, 2705, 1008, 2448, 7292, 9331, 2072, 1012, 8740, 2705, 8663, 887...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubelet/cm/cpumanager/cpu_assignment.go
freeSockets
func (a *cpuAccumulator) freeSockets() []int { return a.details.Sockets().Filter(a.isSocketFree).ToSlice() }
go
func (a *cpuAccumulator) freeSockets() []int { return a.details.Sockets().Filter(a.isSocketFree).ToSlice() }
[ "func", "(", "a", "*", "cpuAccumulator", ")", "freeSockets", "(", ")", "[", "]", "int", "{", "return", "a", ".", "details", ".", "Sockets", "(", ")", ".", "Filter", "(", "a", ".", "isSocketFree", ")", ".", "ToSlice", "(", ")", "\n", "}" ]
// Returns free socket IDs as a slice sorted by: // - socket ID, ascending.
[ "Returns", "free", "socket", "IDs", "as", "a", "slice", "sorted", "by", ":", "-", "socket", "ID", "ascending", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/cm/cpumanager/cpu_assignment.go#L63-L65
train
freeSockets returns a slice of the number of free sockets.
[ 30522, 4569, 2278, 1006, 1037, 1008, 17368, 6305, 24894, 20350, 1007, 2489, 6499, 19869, 3215, 1006, 1007, 1031, 1033, 20014, 1063, 2709, 1037, 1012, 4751, 1012, 27540, 1006, 1007, 1012, 11307, 1006, 1037, 1012, 26354, 7432, 3388, 23301, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/volume/util/operationexecutor/operation_executor.go
GenerateError
func (volume *VolumeToAttach) GenerateError(prefixMsg string, err error) (simpleErr, detailedErr error) { simpleMsg, detailedMsg := volume.GenerateMsg(prefixMsg, errSuffix(err)) return fmt.Errorf(simpleMsg), fmt.Errorf(detailedMsg) }
go
func (volume *VolumeToAttach) GenerateError(prefixMsg string, err error) (simpleErr, detailedErr error) { simpleMsg, detailedMsg := volume.GenerateMsg(prefixMsg, errSuffix(err)) return fmt.Errorf(simpleMsg), fmt.Errorf(detailedMsg) }
[ "func", "(", "volume", "*", "VolumeToAttach", ")", "GenerateError", "(", "prefixMsg", "string", ",", "err", "error", ")", "(", "simpleErr", ",", "detailedErr", "error", ")", "{", "simpleMsg", ",", "detailedMsg", ":=", "volume", ".", "GenerateMsg", "(", "pref...
// GenerateError returns simple and detailed errors for volumes to attach
[ "GenerateError", "returns", "simple", "and", "detailed", "errors", "for", "volumes", "to", "attach" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/util/operationexecutor/operation_executor.go#L305-L308
train
GenerateError returns a simple error and detailed error.
[ 30522, 4569, 2278, 1006, 3872, 1008, 3872, 3406, 19321, 6776, 1007, 9699, 2121, 29165, 1006, 17576, 5244, 2290, 5164, 1010, 9413, 2099, 7561, 1007, 1006, 3722, 2121, 2099, 1010, 6851, 2121, 2099, 7561, 1007, 1063, 3722, 5244, 2290, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/fake_poddisruptionbudget.go
Watch
func (c *FakePodDisruptionBudgets) Watch(opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(poddisruptionbudgetsResource, c.ns, opts)) }
go
func (c *FakePodDisruptionBudgets) Watch(opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(poddisruptionbudgetsResource, c.ns, opts)) }
[ "func", "(", "c", "*", "FakePodDisruptionBudgets", ")", "Watch", "(", "opts", "v1", ".", "ListOptions", ")", "(", "watch", ".", "Interface", ",", "error", ")", "{", "return", "c", ".", "Fake", ".", "InvokesWatch", "(", "testing", ".", "NewWatchAction", "...
// Watch returns a watch.Interface that watches the requested podDisruptionBudgets.
[ "Watch", "returns", "a", "watch", ".", "Interface", "that", "watches", "the", "requested", "podDisruptionBudgets", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/fake_poddisruptionbudget.go#L75-L79
train
Watch returns a watch. Interface that watches the requested podDisruptionBudgets.
[ 30522, 4569, 2278, 1006, 1039, 1008, 8275, 27633, 10521, 21531, 3508, 8569, 28682, 1007, 3422, 1006, 23569, 2015, 1058, 2487, 1012, 2862, 30524, 10521, 21531, 3508, 8569, 28682, 6072, 8162, 3401, 1010, 1039, 1012, 24978, 1010, 23569, 2015, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/controller/apis/config/zz_generated.deepcopy.go
DeepCopy
func (in *DeprecatedControllerConfiguration) DeepCopy() *DeprecatedControllerConfiguration { if in == nil { return nil } out := new(DeprecatedControllerConfiguration) in.DeepCopyInto(out) return out }
go
func (in *DeprecatedControllerConfiguration) DeepCopy() *DeprecatedControllerConfiguration { if in == nil { return nil } out := new(DeprecatedControllerConfiguration) in.DeepCopyInto(out) return out }
[ "func", "(", "in", "*", "DeprecatedControllerConfiguration", ")", "DeepCopy", "(", ")", "*", "DeprecatedControllerConfiguration", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "DeprecatedControllerConfiguration", "...
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeprecatedControllerConfiguration.
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "DeprecatedControllerConfiguration", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/apis/config/zz_generated.deepcopy.go#L50-L57
train
DeepCopy is an autogenerated deepcopy function copying the receiver creating a new DeprecatedControllerConfiguration.
[ 30522, 4569, 2278, 1006, 1999, 1008, 2139, 28139, 12921, 8663, 13181, 10820, 8663, 8873, 27390, 3370, 1007, 2784, 3597, 7685, 1006, 1007, 1008, 2139, 28139, 12921, 8663, 13181, 10820, 8663, 8873, 27390, 3370, 1063, 2065, 1999, 1027, 1027, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/core/v1/zz_generated.conversion.go
Convert_v1_ReplicationControllerList_To_core_ReplicationControllerList
func Convert_v1_ReplicationControllerList_To_core_ReplicationControllerList(in *v1.ReplicationControllerList, out *core.ReplicationControllerList, s conversion.Scope) error { return autoConvert_v1_ReplicationControllerList_To_core_ReplicationControllerList(in, out, s) }
go
func Convert_v1_ReplicationControllerList_To_core_ReplicationControllerList(in *v1.ReplicationControllerList, out *core.ReplicationControllerList, s conversion.Scope) error { return autoConvert_v1_ReplicationControllerList_To_core_ReplicationControllerList(in, out, s) }
[ "func", "Convert_v1_ReplicationControllerList_To_core_ReplicationControllerList", "(", "in", "*", "v1", ".", "ReplicationControllerList", ",", "out", "*", "core", ".", "ReplicationControllerList", ",", "s", "conversion", ".", "Scope", ")", "error", "{", "return", "autoC...
// Convert_v1_ReplicationControllerList_To_core_ReplicationControllerList is an autogenerated conversion function.
[ "Convert_v1_ReplicationControllerList_To_core_ReplicationControllerList", "is", "an", "autogenerated", "conversion", "function", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/v1/zz_generated.conversion.go#L6174-L6176
train
Convert_v1_ReplicationControllerList_To_core_ReplicationControllerList is an autogenerated conversion function.
[ 30522, 4569, 2278, 10463, 1035, 1058, 2487, 1035, 21647, 8663, 13181, 10820, 9863, 1035, 2000, 1035, 4563, 1035, 21647, 8663, 13181, 10820, 9863, 1006, 1999, 1008, 1058, 2487, 1012, 21647, 8663, 13181, 10820, 9863, 1010, 2041, 1008, 4563, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/apiserver/pkg/endpoints/request/context.go
UserFrom
func UserFrom(ctx context.Context) (user.Info, bool) { user, ok := ctx.Value(userKey).(user.Info) return user, ok }
go
func UserFrom(ctx context.Context) (user.Info, bool) { user, ok := ctx.Value(userKey).(user.Info) return user, ok }
[ "func", "UserFrom", "(", "ctx", "context", ".", "Context", ")", "(", "user", ".", "Info", ",", "bool", ")", "{", "user", ",", "ok", ":=", "ctx", ".", "Value", "(", "userKey", ")", ".", "(", "user", ".", "Info", ")", "\n", "return", "user", ",", ...
// UserFrom returns the value of the user key on the ctx
[ "UserFrom", "returns", "the", "value", "of", "the", "user", "key", "on", "the", "ctx" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiserver/pkg/endpoints/request/context.go#L82-L85
train
UserFrom returns the user. Info from the context.
[ 30522, 4569, 2278, 5310, 19699, 5358, 1006, 14931, 2595, 6123, 1012, 6123, 1007, 1006, 5310, 1012, 18558, 1010, 22017, 2140, 1007, 1063, 5310, 1010, 7929, 1024, 1027, 14931, 2595, 1012, 3643, 1006, 5310, 14839, 1007, 1012, 1006, 5310, 1012,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/api/extensions/v1beta1/zz_generated.deepcopy.go
DeepCopyObject
func (in *NetworkPolicy) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil }
go
func (in *NetworkPolicy) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil }
[ "func", "(", "in", "*", "NetworkPolicy", ")", "DeepCopyObject", "(", ")", "runtime", ".", "Object", "{", "if", "c", ":=", "in", ".", "DeepCopy", "(", ")", ";", "c", "!=", "nil", "{", "return", "c", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
[ "DeepCopyObject", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "runtime", ".", "Object", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/api/extensions/v1beta1/zz_generated.deepcopy.go#L758-L763
train
DeepCopyObject is an autogenerated deepcopy function copying the receiver creating a new runtime. Object.
[ 30522, 4569, 2278, 1006, 1999, 1008, 2897, 18155, 2594, 2100, 1007, 2784, 3597, 7685, 16429, 20614, 1006, 1007, 2448, 7292, 1012, 4874, 1063, 2065, 1039, 1024, 1027, 1999, 1012, 2784, 3597, 7685, 1006, 1007, 1025, 1039, 999, 1027, 9152, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/volume/glusterfs/glusterfs.go
parseSecret
func parseSecret(namespace, secretName string, kubeClient clientset.Interface) (string, error) { secretMap, err := volutil.GetSecretForPV(namespace, secretName, glusterfsPluginName, kubeClient) if err != nil { klog.Errorf("failed to get secret: %s/%s: %v", namespace, secretName, err) return "", fmt.Errorf("failed to get secret %s/%s: %v", namespace, secretName, err) } if len(secretMap) == 0 { return "", fmt.Errorf("empty secret map") } secret := "" for k, v := range secretMap { if k == secretKeyName { return v, nil } secret = v } // If not found, the last secret in the map wins as done before return secret, nil }
go
func parseSecret(namespace, secretName string, kubeClient clientset.Interface) (string, error) { secretMap, err := volutil.GetSecretForPV(namespace, secretName, glusterfsPluginName, kubeClient) if err != nil { klog.Errorf("failed to get secret: %s/%s: %v", namespace, secretName, err) return "", fmt.Errorf("failed to get secret %s/%s: %v", namespace, secretName, err) } if len(secretMap) == 0 { return "", fmt.Errorf("empty secret map") } secret := "" for k, v := range secretMap { if k == secretKeyName { return v, nil } secret = v } // If not found, the last secret in the map wins as done before return secret, nil }
[ "func", "parseSecret", "(", "namespace", ",", "secretName", "string", ",", "kubeClient", "clientset", ".", "Interface", ")", "(", "string", ",", "error", ")", "{", "secretMap", ",", "err", ":=", "volutil", ".", "GetSecretForPV", "(", "namespace", ",", "secre...
// parseSecret finds a given Secret instance and reads user password from it.
[ "parseSecret", "finds", "a", "given", "Secret", "instance", "and", "reads", "user", "password", "from", "it", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/glusterfs/glusterfs.go#L963-L982
train
parseSecret parses a secret from the namespace and secretName
[ 30522, 4569, 2278, 11968, 8583, 8586, 13465, 1006, 3415, 15327, 1010, 3595, 18442, 5164, 1010, 13970, 4783, 20464, 11638, 7846, 3388, 1012, 8278, 1007, 1006, 5164, 1010, 7561, 1007, 1063, 3595, 2863, 2361, 1010, 9413, 2099, 1024, 1027, 5285...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubelet/envvars/envvars.go
FromServices
func FromServices(services []*v1.Service) []v1.EnvVar { var result []v1.EnvVar for i := range services { service := services[i] // ignore services where ClusterIP is "None" or empty // the services passed to this method should be pre-filtered // only services that have the cluster IP set should be included here if !v1helper.IsServiceIPSet(service) { continue } // Host name := makeEnvVariableName(service.Name) + "_SERVICE_HOST" result = append(result, v1.EnvVar{Name: name, Value: service.Spec.ClusterIP}) // First port - give it the backwards-compatible name name = makeEnvVariableName(service.Name) + "_SERVICE_PORT" result = append(result, v1.EnvVar{Name: name, Value: strconv.Itoa(int(service.Spec.Ports[0].Port))}) // All named ports (only the first may be unnamed, checked in validation) for i := range service.Spec.Ports { sp := &service.Spec.Ports[i] if sp.Name != "" { pn := name + "_" + makeEnvVariableName(sp.Name) result = append(result, v1.EnvVar{Name: pn, Value: strconv.Itoa(int(sp.Port))}) } } // Docker-compatible vars. result = append(result, makeLinkVariables(service)...) } return result }
go
func FromServices(services []*v1.Service) []v1.EnvVar { var result []v1.EnvVar for i := range services { service := services[i] // ignore services where ClusterIP is "None" or empty // the services passed to this method should be pre-filtered // only services that have the cluster IP set should be included here if !v1helper.IsServiceIPSet(service) { continue } // Host name := makeEnvVariableName(service.Name) + "_SERVICE_HOST" result = append(result, v1.EnvVar{Name: name, Value: service.Spec.ClusterIP}) // First port - give it the backwards-compatible name name = makeEnvVariableName(service.Name) + "_SERVICE_PORT" result = append(result, v1.EnvVar{Name: name, Value: strconv.Itoa(int(service.Spec.Ports[0].Port))}) // All named ports (only the first may be unnamed, checked in validation) for i := range service.Spec.Ports { sp := &service.Spec.Ports[i] if sp.Name != "" { pn := name + "_" + makeEnvVariableName(sp.Name) result = append(result, v1.EnvVar{Name: pn, Value: strconv.Itoa(int(sp.Port))}) } } // Docker-compatible vars. result = append(result, makeLinkVariables(service)...) } return result }
[ "func", "FromServices", "(", "services", "[", "]", "*", "v1", ".", "Service", ")", "[", "]", "v1", ".", "EnvVar", "{", "var", "result", "[", "]", "v1", ".", "EnvVar", "\n", "for", "i", ":=", "range", "services", "{", "service", ":=", "services", "[...
// FromServices builds environment variables that a container is started with, // which tell the container where to find the services it may need, which are // provided as an argument.
[ "FromServices", "builds", "environment", "variables", "that", "a", "container", "is", "started", "with", "which", "tell", "the", "container", "where", "to", "find", "the", "services", "it", "may", "need", "which", "are", "provided", "as", "an", "argument", "."...
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/envvars/envvars.go#L32-L62
train
FromServices returns a slice of environment variables for a service
[ 30522, 4569, 2278, 2013, 8043, 7903, 2229, 1006, 2578, 1031, 1033, 1008, 1058, 2487, 1012, 2326, 1007, 1031, 1033, 1058, 2487, 1012, 4372, 2615, 10755, 1063, 13075, 2765, 1031, 1033, 1058, 2487, 1012, 4372, 2615, 10755, 2005, 1045, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
cmd/kubeadm/app/cmd/reset.go
NewReset
func NewReset(in io.Reader, ignorePreflightErrors sets.String, forceReset bool, certsDir, criSocketPath string) (*Reset, error) { if !forceReset { fmt.Println("[reset] WARNING: Changes made to this host by 'kubeadm init' or 'kubeadm join' will be reverted.") fmt.Print("[reset] Are you sure you want to proceed? [y/N]: ") s := bufio.NewScanner(in) s.Scan() if err := s.Err(); err != nil { return nil, err } if strings.ToLower(s.Text()) != "y" { return nil, errors.New("Aborted reset operation") } } fmt.Println("[preflight] Running pre-flight checks") if err := preflight.RunRootCheckOnly(ignorePreflightErrors); err != nil { return nil, err } return &Reset{ certsDir: certsDir, criSocketPath: criSocketPath, }, nil }
go
func NewReset(in io.Reader, ignorePreflightErrors sets.String, forceReset bool, certsDir, criSocketPath string) (*Reset, error) { if !forceReset { fmt.Println("[reset] WARNING: Changes made to this host by 'kubeadm init' or 'kubeadm join' will be reverted.") fmt.Print("[reset] Are you sure you want to proceed? [y/N]: ") s := bufio.NewScanner(in) s.Scan() if err := s.Err(); err != nil { return nil, err } if strings.ToLower(s.Text()) != "y" { return nil, errors.New("Aborted reset operation") } } fmt.Println("[preflight] Running pre-flight checks") if err := preflight.RunRootCheckOnly(ignorePreflightErrors); err != nil { return nil, err } return &Reset{ certsDir: certsDir, criSocketPath: criSocketPath, }, nil }
[ "func", "NewReset", "(", "in", "io", ".", "Reader", ",", "ignorePreflightErrors", "sets", ".", "String", ",", "forceReset", "bool", ",", "certsDir", ",", "criSocketPath", "string", ")", "(", "*", "Reset", ",", "error", ")", "{", "if", "!", "forceReset", ...
// NewReset instantiate Reset struct
[ "NewReset", "instantiate", "Reset", "struct" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/cmd/reset.go#L116-L139
train
NewReset creates a new reset object
[ 30522, 4569, 2278, 2047, 6072, 3388, 1006, 1999, 22834, 1012, 8068, 1010, 8568, 28139, 28968, 2121, 29165, 2015, 4520, 1012, 5164, 1010, 2486, 6072, 3388, 22017, 2140, 1010, 8292, 21217, 4305, 2099, 1010, 13675, 19565, 19869, 25856, 8988, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/apiserver/pkg/endpoints/handlers/watch.go
HandleWS
func (s *WatchServer) HandleWS(ws *websocket.Conn) { defer ws.Close() done := make(chan struct{}) go func() { defer utilruntime.HandleCrash() // This blocks until the connection is closed. // Client should not send anything. wsstream.IgnoreReceives(ws, 0) // Once the client closes, we should also close close(done) }() var unknown runtime.Unknown internalEvent := &metav1.InternalEvent{} buf := &bytes.Buffer{} streamBuf := &bytes.Buffer{} ch := s.Watching.ResultChan() for { select { case <-done: s.Watching.Stop() return case event, ok := <-ch: if !ok { // End of results. return } obj := s.Fixup(event.Object) if err := s.EmbeddedEncoder.Encode(obj, buf); err != nil { // unexpected error utilruntime.HandleError(fmt.Errorf("unable to encode watch object %T: %v", obj, err)) return } // ContentType is not required here because we are defaulting to the serializer // type unknown.Raw = buf.Bytes() event.Object = &unknown // the internal event will be versioned by the encoder // create the external type directly and encode it. Clients will only recognize the serialization we provide. // The internal event is being reused, not reallocated so its just a few extra assignments to do it this way // and we get the benefit of using conversion functions which already have to stay in sync outEvent := &metav1.WatchEvent{} *internalEvent = metav1.InternalEvent(event) err := metav1.Convert_v1_InternalEvent_To_v1_WatchEvent(internalEvent, outEvent, nil) if err != nil { utilruntime.HandleError(fmt.Errorf("unable to convert watch object: %v", err)) // client disconnect. s.Watching.Stop() return } if err := s.Encoder.Encode(outEvent, streamBuf); err != nil { // encoding error utilruntime.HandleError(fmt.Errorf("unable to encode event: %v", err)) s.Watching.Stop() return } if s.UseTextFraming { if err := websocket.Message.Send(ws, streamBuf.String()); err != nil { // Client disconnect. s.Watching.Stop() return } } else { if err := websocket.Message.Send(ws, streamBuf.Bytes()); err != nil { // Client disconnect. s.Watching.Stop() return } } buf.Reset() streamBuf.Reset() } } }
go
func (s *WatchServer) HandleWS(ws *websocket.Conn) { defer ws.Close() done := make(chan struct{}) go func() { defer utilruntime.HandleCrash() // This blocks until the connection is closed. // Client should not send anything. wsstream.IgnoreReceives(ws, 0) // Once the client closes, we should also close close(done) }() var unknown runtime.Unknown internalEvent := &metav1.InternalEvent{} buf := &bytes.Buffer{} streamBuf := &bytes.Buffer{} ch := s.Watching.ResultChan() for { select { case <-done: s.Watching.Stop() return case event, ok := <-ch: if !ok { // End of results. return } obj := s.Fixup(event.Object) if err := s.EmbeddedEncoder.Encode(obj, buf); err != nil { // unexpected error utilruntime.HandleError(fmt.Errorf("unable to encode watch object %T: %v", obj, err)) return } // ContentType is not required here because we are defaulting to the serializer // type unknown.Raw = buf.Bytes() event.Object = &unknown // the internal event will be versioned by the encoder // create the external type directly and encode it. Clients will only recognize the serialization we provide. // The internal event is being reused, not reallocated so its just a few extra assignments to do it this way // and we get the benefit of using conversion functions which already have to stay in sync outEvent := &metav1.WatchEvent{} *internalEvent = metav1.InternalEvent(event) err := metav1.Convert_v1_InternalEvent_To_v1_WatchEvent(internalEvent, outEvent, nil) if err != nil { utilruntime.HandleError(fmt.Errorf("unable to convert watch object: %v", err)) // client disconnect. s.Watching.Stop() return } if err := s.Encoder.Encode(outEvent, streamBuf); err != nil { // encoding error utilruntime.HandleError(fmt.Errorf("unable to encode event: %v", err)) s.Watching.Stop() return } if s.UseTextFraming { if err := websocket.Message.Send(ws, streamBuf.String()); err != nil { // Client disconnect. s.Watching.Stop() return } } else { if err := websocket.Message.Send(ws, streamBuf.Bytes()); err != nil { // Client disconnect. s.Watching.Stop() return } } buf.Reset() streamBuf.Reset() } } }
[ "func", "(", "s", "*", "WatchServer", ")", "HandleWS", "(", "ws", "*", "websocket", ".", "Conn", ")", "{", "defer", "ws", ".", "Close", "(", ")", "\n", "done", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n\n", "go", "func", "(", ")", ...
// HandleWS implements a websocket handler.
[ "HandleWS", "implements", "a", "websocket", "handler", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/watch.go#L268-L344
train
HandleWS is a blocking function that handles websocket requests.
[ 30522, 4569, 2278, 1006, 1055, 1008, 3422, 8043, 6299, 1007, 5047, 9333, 1006, 1059, 2015, 1008, 4773, 6499, 19869, 2102, 1012, 9530, 2078, 1007, 1063, 13366, 2121, 1059, 2015, 1012, 2485, 1006, 1007, 2589, 1024, 1027, 2191, 1006, 9212, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubectl/generate/versioned/env_file.go
proccessEnvFileLine
func proccessEnvFileLine(line []byte, filePath string, currentLine int) (key, value string, err error) { if !utf8.Valid(line) { return ``, ``, fmt.Errorf("env file %s contains invalid utf8 bytes at line %d: %v", filePath, currentLine+1, line) } // We trim UTF8 BOM from the first line of the file but no others if currentLine == 0 { line = bytes.TrimPrefix(line, utf8bom) } // trim the line from all leading whitespace first line = bytes.TrimLeftFunc(line, unicode.IsSpace) // If the line is empty or a comment, we return a blank key/value pair. if len(line) == 0 || line[0] == '#' { return ``, ``, nil } data := strings.SplitN(string(line), "=", 2) key = data[0] if errs := validation.IsEnvVarName(key); len(errs) != 0 { return ``, ``, fmt.Errorf("%q is not a valid key name: %s", key, strings.Join(errs, ";")) } if len(data) == 2 { value = data[1] } else { // No value (no `=` in the line) is a signal to obtain the value // from the environment. value = os.Getenv(key) } return }
go
func proccessEnvFileLine(line []byte, filePath string, currentLine int) (key, value string, err error) { if !utf8.Valid(line) { return ``, ``, fmt.Errorf("env file %s contains invalid utf8 bytes at line %d: %v", filePath, currentLine+1, line) } // We trim UTF8 BOM from the first line of the file but no others if currentLine == 0 { line = bytes.TrimPrefix(line, utf8bom) } // trim the line from all leading whitespace first line = bytes.TrimLeftFunc(line, unicode.IsSpace) // If the line is empty or a comment, we return a blank key/value pair. if len(line) == 0 || line[0] == '#' { return ``, ``, nil } data := strings.SplitN(string(line), "=", 2) key = data[0] if errs := validation.IsEnvVarName(key); len(errs) != 0 { return ``, ``, fmt.Errorf("%q is not a valid key name: %s", key, strings.Join(errs, ";")) } if len(data) == 2 { value = data[1] } else { // No value (no `=` in the line) is a signal to obtain the value // from the environment. value = os.Getenv(key) } return }
[ "func", "proccessEnvFileLine", "(", "line", "[", "]", "byte", ",", "filePath", "string", ",", "currentLine", "int", ")", "(", "key", ",", "value", "string", ",", "err", "error", ")", "{", "if", "!", "utf8", ".", "Valid", "(", "line", ")", "{", "retur...
// proccessEnvFileLine returns a blank key if the line is empty or a comment. // The value will be retrieved from the environment if necessary.
[ "proccessEnvFileLine", "returns", "a", "blank", "key", "if", "the", "line", "is", "empty", "or", "a", "comment", ".", "The", "value", "will", "be", "retrieved", "from", "the", "environment", "if", "necessary", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubectl/generate/versioned/env_file.go#L35-L70
train
proccessEnvFileLine takes a line of a file and returns the key and value pair.
[ 30522, 4569, 2278, 4013, 9468, 7971, 2368, 2615, 8873, 2571, 4179, 1006, 2240, 1031, 1033, 24880, 1010, 5371, 15069, 5164, 1010, 2783, 4179, 20014, 1007, 1006, 3145, 1010, 3643, 5164, 1010, 9413, 2099, 7561, 1007, 1063, 2065, 999, 21183, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/apimachinery/pkg/util/sets/int32.go
NewInt32
func NewInt32(items ...int32) Int32 { ss := Int32{} ss.Insert(items...) return ss }
go
func NewInt32(items ...int32) Int32 { ss := Int32{} ss.Insert(items...) return ss }
[ "func", "NewInt32", "(", "items", "...", "int32", ")", "Int32", "{", "ss", ":=", "Int32", "{", "}", "\n", "ss", ".", "Insert", "(", "items", "...", ")", "\n", "return", "ss", "\n", "}" ]
// NewInt32 creates a Int32 from a list of values.
[ "NewInt32", "creates", "a", "Int32", "from", "a", "list", "of", "values", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/util/sets/int32.go#L30-L34
train
NewInt32 creates a new Int32 slice from a slice of int32
[ 30522, 4569, 2278, 2047, 18447, 16703, 1006, 5167, 1012, 1012, 1012, 20014, 16703, 1007, 20014, 16703, 1063, 7020, 1024, 1027, 20014, 16703, 1063, 1065, 7020, 1012, 19274, 1006, 5167, 1012, 1012, 1012, 1007, 2709, 7020, 1065, 102, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/core/validation/validation.go
validatePodAffinityTerm
func validatePodAffinityTerm(podAffinityTerm core.PodAffinityTerm, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(podAffinityTerm.LabelSelector, fldPath.Child("matchExpressions"))...) for _, name := range podAffinityTerm.Namespaces { for _, msg := range ValidateNamespaceName(name, false) { allErrs = append(allErrs, field.Invalid(fldPath.Child("namespace"), name, msg)) } } if len(podAffinityTerm.TopologyKey) == 0 { allErrs = append(allErrs, field.Required(fldPath.Child("topologyKey"), "can not be empty")) } return append(allErrs, unversionedvalidation.ValidateLabelName(podAffinityTerm.TopologyKey, fldPath.Child("topologyKey"))...) }
go
func validatePodAffinityTerm(podAffinityTerm core.PodAffinityTerm, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(podAffinityTerm.LabelSelector, fldPath.Child("matchExpressions"))...) for _, name := range podAffinityTerm.Namespaces { for _, msg := range ValidateNamespaceName(name, false) { allErrs = append(allErrs, field.Invalid(fldPath.Child("namespace"), name, msg)) } } if len(podAffinityTerm.TopologyKey) == 0 { allErrs = append(allErrs, field.Required(fldPath.Child("topologyKey"), "can not be empty")) } return append(allErrs, unversionedvalidation.ValidateLabelName(podAffinityTerm.TopologyKey, fldPath.Child("topologyKey"))...) }
[ "func", "validatePodAffinityTerm", "(", "podAffinityTerm", "core", ".", "PodAffinityTerm", ",", "fldPath", "*", "field", ".", "Path", ")", "field", ".", "ErrorList", "{", "allErrs", ":=", "field", ".", "ErrorList", "{", "}", "\n\n", "allErrs", "=", "append", ...
// validatePodAffinityTerm tests that the specified podAffinityTerm fields have valid data
[ "validatePodAffinityTerm", "tests", "that", "the", "specified", "podAffinityTerm", "fields", "have", "valid", "data" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/validation/validation.go#L3213-L3226
train
validatePodAffinityTerm validates a PodAffinityTerm
[ 30522, 4569, 2278, 9398, 3686, 27633, 10354, 16294, 3012, 3334, 2213, 1006, 17491, 10354, 16294, 3012, 3334, 2213, 4563, 1012, 17491, 10354, 16294, 3012, 3334, 2213, 1010, 13109, 18927, 8988, 1008, 2492, 1012, 4130, 1007, 2492, 1012, 7561, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go
Filter
func (g *genProtoIDL) Filter(c *generator.Context, t *types.Type) bool { tagVals := types.ExtractCommentTags("+", t.CommentLines)["protobuf"] if tagVals != nil { if tagVals[0] == "false" { // Type specified "false". return false } if tagVals[0] == "true" { // Type specified "true". return true } klog.Fatalf(`Comment tag "protobuf" must be true or false, found: %q`, tagVals[0]) } if !g.generateAll { // We're not generating everything. return false } seen := map[*types.Type]bool{} ok := isProtoable(seen, t) return ok }
go
func (g *genProtoIDL) Filter(c *generator.Context, t *types.Type) bool { tagVals := types.ExtractCommentTags("+", t.CommentLines)["protobuf"] if tagVals != nil { if tagVals[0] == "false" { // Type specified "false". return false } if tagVals[0] == "true" { // Type specified "true". return true } klog.Fatalf(`Comment tag "protobuf" must be true or false, found: %q`, tagVals[0]) } if !g.generateAll { // We're not generating everything. return false } seen := map[*types.Type]bool{} ok := isProtoable(seen, t) return ok }
[ "func", "(", "g", "*", "genProtoIDL", ")", "Filter", "(", "c", "*", "generator", ".", "Context", ",", "t", "*", "types", ".", "Type", ")", "bool", "{", "tagVals", ":=", "types", ".", "ExtractCommentTags", "(", "\"", "\"", ",", "t", ".", "CommentLines...
// Filter ignores types that are identified as not exportable.
[ "Filter", "ignores", "types", "that", "are", "identified", "as", "not", "exportable", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go#L77-L97
train
Filter returns true if the type is a protoable type.
[ 30522, 4569, 2278, 1006, 1043, 1008, 8991, 21572, 3406, 3593, 2140, 1007, 11307, 1006, 1039, 1008, 13103, 1012, 6123, 1010, 1056, 1008, 4127, 1012, 2828, 1007, 22017, 2140, 1063, 6415, 10175, 2015, 1024, 1027, 4127, 1012, 14817, 9006, 3672,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
cmd/kubeadm/app/util/apiclient/idempotency.go
CreateOrRetainConfigMap
func CreateOrRetainConfigMap(client clientset.Interface, cm *v1.ConfigMap, configMapName string) error { if _, err := client.CoreV1().ConfigMaps(cm.ObjectMeta.Namespace).Get(configMapName, metav1.GetOptions{}); err != nil { if !apierrors.IsNotFound(err) { return nil } if _, err := client.CoreV1().ConfigMaps(cm.ObjectMeta.Namespace).Create(cm); err != nil { if !apierrors.IsAlreadyExists(err) { return errors.Wrap(err, "unable to create configmap") } } } return nil }
go
func CreateOrRetainConfigMap(client clientset.Interface, cm *v1.ConfigMap, configMapName string) error { if _, err := client.CoreV1().ConfigMaps(cm.ObjectMeta.Namespace).Get(configMapName, metav1.GetOptions{}); err != nil { if !apierrors.IsNotFound(err) { return nil } if _, err := client.CoreV1().ConfigMaps(cm.ObjectMeta.Namespace).Create(cm); err != nil { if !apierrors.IsAlreadyExists(err) { return errors.Wrap(err, "unable to create configmap") } } } return nil }
[ "func", "CreateOrRetainConfigMap", "(", "client", "clientset", ".", "Interface", ",", "cm", "*", "v1", ".", "ConfigMap", ",", "configMapName", "string", ")", "error", "{", "if", "_", ",", "err", ":=", "client", ".", "CoreV1", "(", ")", ".", "ConfigMaps", ...
// CreateOrRetainConfigMap creates a ConfigMap if the target resource doesn't exist. If the resource exists already, this function will retain the resource instead.
[ "CreateOrRetainConfigMap", "creates", "a", "ConfigMap", "if", "the", "target", "resource", "doesn", "t", "exist", ".", "If", "the", "resource", "exists", "already", "this", "function", "will", "retain", "the", "resource", "instead", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/util/apiclient/idempotency.go#L96-L108
train
CreateOrRetainConfigMap creates or retains a ConfigMap
[ 30522, 4569, 2278, 3443, 2953, 13465, 8113, 8663, 8873, 21693, 9331, 1006, 7396, 7846, 3388, 1012, 8278, 1010, 4642, 1008, 1058, 2487, 1012, 9530, 8873, 21693, 9331, 1010, 9530, 8873, 21693, 9331, 18442, 5164, 1007, 7561, 1063, 2065, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/scheduler/apis/config/scheme/scheme.go
AddToScheme
func AddToScheme(scheme *runtime.Scheme) { utilruntime.Must(kubeschedulerconfig.AddToScheme(Scheme)) utilruntime.Must(kubeschedulerconfigv1alpha1.AddToScheme(Scheme)) utilruntime.Must(scheme.SetVersionPriority(kubeschedulerconfigv1alpha1.SchemeGroupVersion)) }
go
func AddToScheme(scheme *runtime.Scheme) { utilruntime.Must(kubeschedulerconfig.AddToScheme(Scheme)) utilruntime.Must(kubeschedulerconfigv1alpha1.AddToScheme(Scheme)) utilruntime.Must(scheme.SetVersionPriority(kubeschedulerconfigv1alpha1.SchemeGroupVersion)) }
[ "func", "AddToScheme", "(", "scheme", "*", "runtime", ".", "Scheme", ")", "{", "utilruntime", ".", "Must", "(", "kubeschedulerconfig", ".", "AddToScheme", "(", "Scheme", ")", ")", "\n", "utilruntime", ".", "Must", "(", "kubeschedulerconfigv1alpha1", ".", "AddT...
// AddToScheme builds the kubescheduler scheme using all known versions of the kubescheduler api.
[ "AddToScheme", "builds", "the", "kubescheduler", "scheme", "using", "all", "known", "versions", "of", "the", "kubescheduler", "api", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/scheduler/apis/config/scheme/scheme.go#L40-L44
train
AddToScheme adds the kubelet config to the given scheme.
[ 30522, 4569, 2278, 5587, 13122, 5403, 4168, 1006, 5679, 1008, 2448, 7292, 1012, 5679, 1007, 1063, 21183, 4014, 15532, 7292, 1012, 2442, 1006, 13970, 12681, 7690, 9307, 29566, 2078, 8873, 2290, 1012, 5587, 13122, 5403, 4168, 1006, 5679, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubelet/cm/cpuset/cpuset.go
Difference
func (s CPUSet) Difference(s2 CPUSet) CPUSet { return s.FilterNot(func(cpu int) bool { return s2.Contains(cpu) }) }
go
func (s CPUSet) Difference(s2 CPUSet) CPUSet { return s.FilterNot(func(cpu int) bool { return s2.Contains(cpu) }) }
[ "func", "(", "s", "CPUSet", ")", "Difference", "(", "s2", "CPUSet", ")", "CPUSet", "{", "return", "s", ".", "FilterNot", "(", "func", "(", "cpu", "int", ")", "bool", "{", "return", "s2", ".", "Contains", "(", "cpu", ")", "}", ")", "\n", "}" ]
// Difference returns a new CPU set that contains all of the elements that // are present in this set and not the supplied set, without mutating either // source set.
[ "Difference", "returns", "a", "new", "CPU", "set", "that", "contains", "all", "of", "the", "elements", "that", "are", "present", "in", "this", "set", "and", "not", "the", "supplied", "set", "without", "mutating", "either", "source", "set", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/cm/cpuset/cpuset.go#L160-L162
train
Difference returns a new set containing all the elements in s that are not in s2.
[ 30522, 4569, 2278, 1006, 1055, 17368, 13462, 1007, 4489, 1006, 1055, 2475, 17368, 13462, 1007, 17368, 13462, 1063, 2709, 1055, 1012, 11307, 17048, 1006, 4569, 2278, 1006, 17368, 20014, 1007, 22017, 2140, 1063, 2709, 1055, 2475, 1012, 3397, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/core/zz_generated.deepcopy.go
DeepCopyInto
func (in *PodAttachOptions) DeepCopyInto(out *PodAttachOptions) { *out = *in out.TypeMeta = in.TypeMeta return }
go
func (in *PodAttachOptions) DeepCopyInto(out *PodAttachOptions) { *out = *in out.TypeMeta = in.TypeMeta return }
[ "func", "(", "in", "*", "PodAttachOptions", ")", "DeepCopyInto", "(", "out", "*", "PodAttachOptions", ")", "{", "*", "out", "=", "*", "in", "\n", "out", ".", "TypeMeta", "=", "in", ".", "TypeMeta", "\n", "return", "\n", "}" ]
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
[ "DeepCopyInto", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "writing", "into", "out", ".", "in", "must", "be", "non", "-", "nil", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/zz_generated.deepcopy.go#L3172-L3176
train
DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new PodAttachOptions.
[ 30522, 4569, 2278, 1006, 1999, 1008, 17491, 19321, 6776, 7361, 9285, 1007, 2784, 3597, 7685, 18447, 2080, 1006, 2041, 1008, 17491, 19321, 6776, 7361, 9285, 1007, 1063, 1008, 2041, 1027, 1008, 1999, 2041, 1012, 2828, 11368, 2050, 1027, 1999,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/core/v1/zz_generated.conversion.go
Convert_v1_PersistentVolumeClaimVolumeSource_To_core_PersistentVolumeClaimVolumeSource
func Convert_v1_PersistentVolumeClaimVolumeSource_To_core_PersistentVolumeClaimVolumeSource(in *v1.PersistentVolumeClaimVolumeSource, out *core.PersistentVolumeClaimVolumeSource, s conversion.Scope) error { return autoConvert_v1_PersistentVolumeClaimVolumeSource_To_core_PersistentVolumeClaimVolumeSource(in, out, s) }
go
func Convert_v1_PersistentVolumeClaimVolumeSource_To_core_PersistentVolumeClaimVolumeSource(in *v1.PersistentVolumeClaimVolumeSource, out *core.PersistentVolumeClaimVolumeSource, s conversion.Scope) error { return autoConvert_v1_PersistentVolumeClaimVolumeSource_To_core_PersistentVolumeClaimVolumeSource(in, out, s) }
[ "func", "Convert_v1_PersistentVolumeClaimVolumeSource_To_core_PersistentVolumeClaimVolumeSource", "(", "in", "*", "v1", ".", "PersistentVolumeClaimVolumeSource", ",", "out", "*", "core", ".", "PersistentVolumeClaimVolumeSource", ",", "s", "conversion", ".", "Scope", ")", "err...
// Convert_v1_PersistentVolumeClaimVolumeSource_To_core_PersistentVolumeClaimVolumeSource is an autogenerated conversion function.
[ "Convert_v1_PersistentVolumeClaimVolumeSource_To_core_PersistentVolumeClaimVolumeSource", "is", "an", "autogenerated", "conversion", "function", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/v1/zz_generated.conversion.go#L4927-L4929
train
Convert_v1_PersistentVolumeClaimVolumeSource_To_core_PersistentVolumeClaimVolumeSource is an autogenerated conversion function.
[ 30522, 4569, 2278, 10463, 1035, 1058, 2487, 1035, 14516, 6767, 12942, 8586, 19771, 2213, 6767, 12942, 2229, 8162, 3401, 1035, 2000, 1035, 4563, 1035, 14516, 6767, 12942, 8586, 19771, 2213, 6767, 12942, 2229, 8162, 3401, 1006, 1999, 1008, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/api/networking/v1beta1/register.go
addKnownTypes
func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &Ingress{}, &IngressList{}, ) // Add the watch version that applies metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil }
go
func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &Ingress{}, &IngressList{}, ) // Add the watch version that applies metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil }
[ "func", "addKnownTypes", "(", "scheme", "*", "runtime", ".", "Scheme", ")", "error", "{", "scheme", ".", "AddKnownTypes", "(", "SchemeGroupVersion", ",", "&", "Ingress", "{", "}", ",", "&", "IngressList", "{", "}", ",", ")", "\n", "// Add the watch version t...
// Adds the list of known types to the given scheme.
[ "Adds", "the", "list", "of", "known", "types", "to", "the", "given", "scheme", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/api/networking/v1beta1/register.go#L48-L56
train
addKnownTypes adds the known types to the scheme.
[ 30522, 4569, 2278, 5587, 2243, 19779, 29405, 10374, 1006, 5679, 1008, 2448, 7292, 1012, 5679, 1007, 7561, 1063, 5679, 1012, 5587, 2243, 19779, 29405, 10374, 1006, 5679, 17058, 27774, 1010, 1004, 13749, 8303, 1063, 1065, 1010, 1004, 13749, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/volume/gcepd/gce_pd.go
SetUp
func (b *gcePersistentDiskMounter) SetUp(fsGroup *int64) error { return b.SetUpAt(b.GetPath(), fsGroup) }
go
func (b *gcePersistentDiskMounter) SetUp(fsGroup *int64) error { return b.SetUpAt(b.GetPath(), fsGroup) }
[ "func", "(", "b", "*", "gcePersistentDiskMounter", ")", "SetUp", "(", "fsGroup", "*", "int64", ")", "error", "{", "return", "b", ".", "SetUpAt", "(", "b", ".", "GetPath", "(", ")", ",", "fsGroup", ")", "\n", "}" ]
// SetUp bind mounts the disk global mount to the volume path.
[ "SetUp", "bind", "mounts", "the", "disk", "global", "mount", "to", "the", "volume", "path", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/gcepd/gce_pd.go#L357-L359
train
SetUp sets up the disk.
[ 30522, 4569, 2278, 1006, 1038, 1008, 1043, 3401, 7347, 27870, 3372, 10521, 22287, 21723, 2121, 1007, 16437, 1006, 1042, 28745, 22107, 1008, 20014, 21084, 1007, 7561, 1063, 2709, 1038, 1012, 16437, 4017, 1006, 1038, 1012, 2131, 15069, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/tools/clientcmd/client_config.go
makeUserIdentificationConfig
func makeUserIdentificationConfig(info clientauth.Info) *restclient.Config { config := &restclient.Config{} config.Username = info.User config.Password = info.Password config.CertFile = info.CertFile config.KeyFile = info.KeyFile config.BearerToken = info.BearerToken return config }
go
func makeUserIdentificationConfig(info clientauth.Info) *restclient.Config { config := &restclient.Config{} config.Username = info.User config.Password = info.Password config.CertFile = info.CertFile config.KeyFile = info.KeyFile config.BearerToken = info.BearerToken return config }
[ "func", "makeUserIdentificationConfig", "(", "info", "clientauth", ".", "Info", ")", "*", "restclient", ".", "Config", "{", "config", ":=", "&", "restclient", ".", "Config", "{", "}", "\n", "config", ".", "Username", "=", "info", ".", "User", "\n", "config...
// makeUserIdentificationFieldsConfig returns a client.Config capable of being merged using mergo for only user identification information
[ "makeUserIdentificationFieldsConfig", "returns", "a", "client", ".", "Config", "capable", "of", "being", "merged", "using", "mergo", "for", "only", "user", "identification", "information" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/tools/clientcmd/client_config.go#L289-L297
train
makeUserIdentificationConfig returns a config object that can be used to configure a userIdentification
[ 30522, 4569, 2278, 2191, 20330, 5178, 30524, 9530, 8873, 2290, 1024, 1027, 1004, 2717, 20464, 11638, 1012, 9530, 8873, 2290, 1063, 1065, 9530, 8873, 2290, 1012, 5310, 18442, 1027, 18558, 1012, 5310, 9530, 8873, 2290, 1012, 20786, 1027, 1855...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubectl/cmd/util/factory_client_access.go
OpenAPISchema
func (f *factoryImpl) OpenAPISchema() (openapi.Resources, error) { discovery, err := f.clientGetter.ToDiscoveryClient() if err != nil { return nil, err } // Lazily initialize the OpenAPIGetter once f.openAPIGetter.once.Do(func() { // Create the caching OpenAPIGetter f.openAPIGetter.getter = openapi.NewOpenAPIGetter(discovery) }) // Delegate to the OpenAPIGetter return f.openAPIGetter.getter.Get() }
go
func (f *factoryImpl) OpenAPISchema() (openapi.Resources, error) { discovery, err := f.clientGetter.ToDiscoveryClient() if err != nil { return nil, err } // Lazily initialize the OpenAPIGetter once f.openAPIGetter.once.Do(func() { // Create the caching OpenAPIGetter f.openAPIGetter.getter = openapi.NewOpenAPIGetter(discovery) }) // Delegate to the OpenAPIGetter return f.openAPIGetter.getter.Get() }
[ "func", "(", "f", "*", "factoryImpl", ")", "OpenAPISchema", "(", ")", "(", "openapi", ".", "Resources", ",", "error", ")", "{", "discovery", ",", "err", ":=", "f", ".", "clientGetter", ".", "ToDiscoveryClient", "(", ")", "\n", "if", "err", "!=", "nil",...
// OpenAPISchema returns metadata and structural information about Kubernetes object definitions.
[ "OpenAPISchema", "returns", "metadata", "and", "structural", "information", "about", "Kubernetes", "object", "definitions", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubectl/cmd/util/factory_client_access.go#L163-L177
train
OpenAPISchema returns the OpenAPI schema for the factory
[ 30522, 4569, 2278, 1006, 1042, 1008, 4713, 5714, 24759, 1007, 2330, 9331, 13719, 2863, 1006, 1007, 1006, 2330, 9331, 2072, 1012, 4219, 1010, 7561, 1007, 1063, 5456, 1010, 9413, 2099, 1024, 1027, 1042, 1012, 7396, 18150, 3334, 1012, 28681, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/cli-runtime/pkg/printers/json.go
PrintObj
func (p *YAMLPrinter) PrintObj(obj runtime.Object, w io.Writer) error { // we use reflect.Indirect here in order to obtain the actual value from a pointer. // we need an actual value in order to retrieve the package path for an object. // using reflect.Indirect indiscriminately is valid here, as all runtime.Objects are supposed to be pointers. if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) { return fmt.Errorf(InternalObjectPrinterErr) } switch obj := obj.(type) { case *runtime.Unknown: data, err := yaml.JSONToYAML(obj.Raw) if err != nil { return err } _, err = w.Write(data) return err } if obj.GetObjectKind().GroupVersionKind().Empty() { return fmt.Errorf("missing apiVersion or kind; try GetObjectKind().SetGroupVersionKind() if you know the type") } output, err := yaml.Marshal(obj) if err != nil { return err } _, err = fmt.Fprint(w, string(output)) return err }
go
func (p *YAMLPrinter) PrintObj(obj runtime.Object, w io.Writer) error { // we use reflect.Indirect here in order to obtain the actual value from a pointer. // we need an actual value in order to retrieve the package path for an object. // using reflect.Indirect indiscriminately is valid here, as all runtime.Objects are supposed to be pointers. if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) { return fmt.Errorf(InternalObjectPrinterErr) } switch obj := obj.(type) { case *runtime.Unknown: data, err := yaml.JSONToYAML(obj.Raw) if err != nil { return err } _, err = w.Write(data) return err } if obj.GetObjectKind().GroupVersionKind().Empty() { return fmt.Errorf("missing apiVersion or kind; try GetObjectKind().SetGroupVersionKind() if you know the type") } output, err := yaml.Marshal(obj) if err != nil { return err } _, err = fmt.Fprint(w, string(output)) return err }
[ "func", "(", "p", "*", "YAMLPrinter", ")", "PrintObj", "(", "obj", "runtime", ".", "Object", ",", "w", "io", ".", "Writer", ")", "error", "{", "// we use reflect.Indirect here in order to obtain the actual value from a pointer.", "// we need an actual value in order to retr...
// PrintObj prints the data as YAML.
[ "PrintObj", "prints", "the", "data", "as", "YAML", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/cli-runtime/pkg/printers/json.go#L74-L102
train
PrintObj prints an object to the writer
[ 30522, 4569, 2278, 1006, 1052, 1008, 8038, 19968, 16550, 2121, 1007, 6140, 16429, 3501, 1006, 27885, 3501, 2448, 7292, 1012, 4874, 1010, 1059, 22834, 1012, 3213, 1007, 7561, 1063, 1013, 1013, 2057, 2224, 8339, 1012, 14958, 2182, 1999, 2344,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/apimachinery/pkg/util/net/port_range.go
Contains
func (pr *PortRange) Contains(p int) bool { return (p >= pr.Base) && ((p - pr.Base) < pr.Size) }
go
func (pr *PortRange) Contains(p int) bool { return (p >= pr.Base) && ((p - pr.Base) < pr.Size) }
[ "func", "(", "pr", "*", "PortRange", ")", "Contains", "(", "p", "int", ")", "bool", "{", "return", "(", "p", ">=", "pr", ".", "Base", ")", "&&", "(", "(", "p", "-", "pr", ".", "Base", ")", "<", "pr", ".", "Size", ")", "\n", "}" ]
// Contains tests whether a given port falls within the PortRange.
[ "Contains", "tests", "whether", "a", "given", "port", "falls", "within", "the", "PortRange", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/util/net/port_range.go#L33-L35
train
Contains returns true if the port is in the range
[ 30522, 4569, 2278, 1006, 10975, 1008, 3417, 24388, 2063, 1007, 3397, 1006, 1052, 20014, 1007, 22017, 2140, 1063, 2709, 1006, 1052, 1028, 1027, 10975, 1012, 2918, 1007, 1004, 1004, 1006, 1006, 1052, 1011, 10975, 1012, 2918, 1007, 1026, 10975...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/apiserver/pkg/registry/generic/registry/storage_factory.go
StorageWithCacher
func StorageWithCacher(capacity int) generic.StorageDecorator { return func( storageConfig *storagebackend.Config, resourcePrefix string, keyFunc func(obj runtime.Object) (string, error), newFunc func() runtime.Object, newListFunc func() runtime.Object, getAttrsFunc storage.AttrFunc, triggerFunc storage.TriggerPublisherFunc) (storage.Interface, factory.DestroyFunc) { s, d := generic.NewRawStorage(storageConfig) if capacity <= 0 { klog.V(5).Infof("Storage caching is disabled for %T", newFunc()) return s, d } if klog.V(5) { klog.Infof("Storage caching is enabled for %T with capacity %v", newFunc(), capacity) } // TODO: we would change this later to make storage always have cacher and hide low level KV layer inside. // Currently it has two layers of same storage interface -- cacher and low level kv. cacherConfig := cacherstorage.Config{ CacheCapacity: capacity, Storage: s, Versioner: etcdstorage.APIObjectVersioner{}, ResourcePrefix: resourcePrefix, KeyFunc: keyFunc, NewFunc: newFunc, NewListFunc: newListFunc, GetAttrsFunc: getAttrsFunc, TriggerPublisherFunc: triggerFunc, Codec: storageConfig.Codec, } cacher := cacherstorage.NewCacherFromConfig(cacherConfig) destroyFunc := func() { cacher.Stop() d() } // TODO : Remove RegisterStorageCleanup below when PR // https://github.com/kubernetes/kubernetes/pull/50690 // merges as that shuts down storage properly RegisterStorageCleanup(destroyFunc) return cacher, destroyFunc } }
go
func StorageWithCacher(capacity int) generic.StorageDecorator { return func( storageConfig *storagebackend.Config, resourcePrefix string, keyFunc func(obj runtime.Object) (string, error), newFunc func() runtime.Object, newListFunc func() runtime.Object, getAttrsFunc storage.AttrFunc, triggerFunc storage.TriggerPublisherFunc) (storage.Interface, factory.DestroyFunc) { s, d := generic.NewRawStorage(storageConfig) if capacity <= 0 { klog.V(5).Infof("Storage caching is disabled for %T", newFunc()) return s, d } if klog.V(5) { klog.Infof("Storage caching is enabled for %T with capacity %v", newFunc(), capacity) } // TODO: we would change this later to make storage always have cacher and hide low level KV layer inside. // Currently it has two layers of same storage interface -- cacher and low level kv. cacherConfig := cacherstorage.Config{ CacheCapacity: capacity, Storage: s, Versioner: etcdstorage.APIObjectVersioner{}, ResourcePrefix: resourcePrefix, KeyFunc: keyFunc, NewFunc: newFunc, NewListFunc: newListFunc, GetAttrsFunc: getAttrsFunc, TriggerPublisherFunc: triggerFunc, Codec: storageConfig.Codec, } cacher := cacherstorage.NewCacherFromConfig(cacherConfig) destroyFunc := func() { cacher.Stop() d() } // TODO : Remove RegisterStorageCleanup below when PR // https://github.com/kubernetes/kubernetes/pull/50690 // merges as that shuts down storage properly RegisterStorageCleanup(destroyFunc) return cacher, destroyFunc } }
[ "func", "StorageWithCacher", "(", "capacity", "int", ")", "generic", ".", "StorageDecorator", "{", "return", "func", "(", "storageConfig", "*", "storagebackend", ".", "Config", ",", "resourcePrefix", "string", ",", "keyFunc", "func", "(", "obj", "runtime", ".", ...
// Creates a cacher based given storageConfig.
[ "Creates", "a", "cacher", "based", "given", "storageConfig", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiserver/pkg/registry/generic/registry/storage_factory.go#L34-L80
train
StorageWithCacher returns a storage decorator that caches the storage interface.
[ 30522, 4569, 2278, 5527, 24415, 3540, 7474, 1006, 3977, 20014, 1007, 12391, 1012, 5527, 3207, 27108, 8844, 1063, 2709, 4569, 2278, 1006, 5527, 8663, 8873, 2290, 1008, 5527, 5963, 10497, 1012, 9530, 8873, 2290, 1010, 7692, 28139, 8873, 2595,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
cmd/kubeadm/app/apis/kubeadm/validation/validation.go
ValidateClusterConfiguration
func ValidateClusterConfiguration(c *kubeadm.ClusterConfiguration) field.ErrorList { allErrs := field.ErrorList{} allErrs = append(allErrs, ValidateNetworking(&c.Networking, field.NewPath("networking"))...) allErrs = append(allErrs, ValidateAPIServer(&c.APIServer, field.NewPath("apiServer"))...) allErrs = append(allErrs, ValidateAbsolutePath(c.CertificatesDir, field.NewPath("certificatesDir"))...) allErrs = append(allErrs, ValidateFeatureGates(c.FeatureGates, field.NewPath("featureGates"))...) allErrs = append(allErrs, ValidateHostPort(c.ControlPlaneEndpoint, field.NewPath("controlPlaneEndpoint"))...) allErrs = append(allErrs, ValidateEtcd(&c.Etcd, field.NewPath("etcd"))...) allErrs = append(allErrs, componentconfigs.Known.Validate(c)...) return allErrs }
go
func ValidateClusterConfiguration(c *kubeadm.ClusterConfiguration) field.ErrorList { allErrs := field.ErrorList{} allErrs = append(allErrs, ValidateNetworking(&c.Networking, field.NewPath("networking"))...) allErrs = append(allErrs, ValidateAPIServer(&c.APIServer, field.NewPath("apiServer"))...) allErrs = append(allErrs, ValidateAbsolutePath(c.CertificatesDir, field.NewPath("certificatesDir"))...) allErrs = append(allErrs, ValidateFeatureGates(c.FeatureGates, field.NewPath("featureGates"))...) allErrs = append(allErrs, ValidateHostPort(c.ControlPlaneEndpoint, field.NewPath("controlPlaneEndpoint"))...) allErrs = append(allErrs, ValidateEtcd(&c.Etcd, field.NewPath("etcd"))...) allErrs = append(allErrs, componentconfigs.Known.Validate(c)...) return allErrs }
[ "func", "ValidateClusterConfiguration", "(", "c", "*", "kubeadm", ".", "ClusterConfiguration", ")", "field", ".", "ErrorList", "{", "allErrs", ":=", "field", ".", "ErrorList", "{", "}", "\n", "allErrs", "=", "append", "(", "allErrs", ",", "ValidateNetworking", ...
// ValidateClusterConfiguration validates an ClusterConfiguration object and collects all encountered errors
[ "ValidateClusterConfiguration", "validates", "an", "ClusterConfiguration", "object", "and", "collects", "all", "encountered", "errors" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/apis/kubeadm/validation/validation.go#L57-L67
train
ValidateClusterConfiguration validates a ClusterConfiguration
[ 30522, 4569, 2278, 9398, 3686, 20464, 19966, 2121, 8663, 8873, 27390, 3370, 1006, 1039, 1008, 13970, 4783, 4215, 2213, 1012, 9324, 8663, 8873, 27390, 3370, 1007, 2492, 1012, 7561, 9863, 1063, 2035, 2121, 2869, 1024, 1027, 2492, 1012, 7561, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
third_party/forked/golang/expansion/expand.go
syntaxWrap
func syntaxWrap(input string) string { return string(operator) + string(referenceOpener) + input + string(referenceCloser) }
go
func syntaxWrap(input string) string { return string(operator) + string(referenceOpener) + input + string(referenceCloser) }
[ "func", "syntaxWrap", "(", "input", "string", ")", "string", "{", "return", "string", "(", "operator", ")", "+", "string", "(", "referenceOpener", ")", "+", "input", "+", "string", "(", "referenceCloser", ")", "\n", "}" ]
// syntaxWrap returns the input string wrapped by the expansion syntax.
[ "syntaxWrap", "returns", "the", "input", "string", "wrapped", "by", "the", "expansion", "syntax", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/third_party/forked/golang/expansion/expand.go#L14-L16
train
syntaxWrap returns a string that is a syntax wrapper for the input string.
[ 30522, 4569, 2278, 20231, 13088, 9331, 1006, 7953, 5164, 1007, 5164, 1063, 2709, 5164, 1006, 6872, 1007, 1009, 5164, 1006, 4431, 26915, 2121, 1007, 1009, 7953, 1009, 5164, 1006, 4431, 20464, 9232, 2099, 1007, 1065, 102, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
cmd/kubeadm/app/apis/kubeadm/v1beta2/zz_generated.conversion.go
Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration
func Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration(in *ClusterConfiguration, out *kubeadm.ClusterConfiguration, s conversion.Scope) error { return autoConvert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration(in, out, s) }
go
func Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration(in *ClusterConfiguration, out *kubeadm.ClusterConfiguration, s conversion.Scope) error { return autoConvert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration(in, out, s) }
[ "func", "Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration", "(", "in", "*", "ClusterConfiguration", ",", "out", "*", "kubeadm", ".", "ClusterConfiguration", ",", "s", "conversion", ".", "Scope", ")", "error", "{", "return", "autoConvert_v1beta2_ClusterCo...
// Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration is an autogenerated conversion function.
[ "Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration", "is", "an", "autogenerated", "conversion", "function", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/apis/kubeadm/v1beta2/zz_generated.conversion.go#L411-L413
train
Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration is an autogenerated conversion function.
[ 30522, 4569, 2278, 10463, 1035, 1058, 2487, 20915, 2050, 2475, 1035, 9324, 8663, 8873, 27390, 3370, 1035, 2000, 1035, 13970, 4783, 4215, 2213, 1035, 9324, 8663, 8873, 27390, 3370, 1006, 1999, 1008, 9324, 8663, 8873, 27390, 3370, 1010, 2041,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/controller/endpoint/config/v1alpha1/zz_generated.conversion.go
RegisterConversions
func RegisterConversions(s *runtime.Scheme) error { if err := s.AddGeneratedConversionFunc((*v1alpha1.EndpointControllerConfiguration)(nil), (*config.EndpointControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_EndpointControllerConfiguration_To_config_EndpointControllerConfiguration(a.(*v1alpha1.EndpointControllerConfiguration), b.(*config.EndpointControllerConfiguration), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*config.EndpointControllerConfiguration)(nil), (*v1alpha1.EndpointControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_config_EndpointControllerConfiguration_To_v1alpha1_EndpointControllerConfiguration(a.(*config.EndpointControllerConfiguration), b.(*v1alpha1.EndpointControllerConfiguration), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*v1alpha1.GroupResource)(nil), (*v1.GroupResource)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_GroupResource_To_v1_GroupResource(a.(*v1alpha1.GroupResource), b.(*v1.GroupResource), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*v1.GroupResource)(nil), (*v1alpha1.GroupResource)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1_GroupResource_To_v1alpha1_GroupResource(a.(*v1.GroupResource), b.(*v1alpha1.GroupResource), scope) }); err != nil { return err } if err := s.AddConversionFunc((*config.EndpointControllerConfiguration)(nil), (*v1alpha1.EndpointControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_config_EndpointControllerConfiguration_To_v1alpha1_EndpointControllerConfiguration(a.(*config.EndpointControllerConfiguration), b.(*v1alpha1.EndpointControllerConfiguration), scope) }); err != nil { return err } if err := s.AddConversionFunc((*v1alpha1.EndpointControllerConfiguration)(nil), (*config.EndpointControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_EndpointControllerConfiguration_To_config_EndpointControllerConfiguration(a.(*v1alpha1.EndpointControllerConfiguration), b.(*config.EndpointControllerConfiguration), scope) }); err != nil { return err } return nil }
go
func RegisterConversions(s *runtime.Scheme) error { if err := s.AddGeneratedConversionFunc((*v1alpha1.EndpointControllerConfiguration)(nil), (*config.EndpointControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_EndpointControllerConfiguration_To_config_EndpointControllerConfiguration(a.(*v1alpha1.EndpointControllerConfiguration), b.(*config.EndpointControllerConfiguration), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*config.EndpointControllerConfiguration)(nil), (*v1alpha1.EndpointControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_config_EndpointControllerConfiguration_To_v1alpha1_EndpointControllerConfiguration(a.(*config.EndpointControllerConfiguration), b.(*v1alpha1.EndpointControllerConfiguration), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*v1alpha1.GroupResource)(nil), (*v1.GroupResource)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_GroupResource_To_v1_GroupResource(a.(*v1alpha1.GroupResource), b.(*v1.GroupResource), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*v1.GroupResource)(nil), (*v1alpha1.GroupResource)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1_GroupResource_To_v1alpha1_GroupResource(a.(*v1.GroupResource), b.(*v1alpha1.GroupResource), scope) }); err != nil { return err } if err := s.AddConversionFunc((*config.EndpointControllerConfiguration)(nil), (*v1alpha1.EndpointControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_config_EndpointControllerConfiguration_To_v1alpha1_EndpointControllerConfiguration(a.(*config.EndpointControllerConfiguration), b.(*v1alpha1.EndpointControllerConfiguration), scope) }); err != nil { return err } if err := s.AddConversionFunc((*v1alpha1.EndpointControllerConfiguration)(nil), (*config.EndpointControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_EndpointControllerConfiguration_To_config_EndpointControllerConfiguration(a.(*v1alpha1.EndpointControllerConfiguration), b.(*config.EndpointControllerConfiguration), scope) }); err != nil { return err } return nil }
[ "func", "RegisterConversions", "(", "s", "*", "runtime", ".", "Scheme", ")", "error", "{", "if", "err", ":=", "s", ".", "AddGeneratedConversionFunc", "(", "(", "*", "v1alpha1", ".", "EndpointControllerConfiguration", ")", "(", "nil", ")", ",", "(", "*", "c...
// RegisterConversions adds conversion functions to the given scheme. // Public to allow building arbitrary schemes.
[ "RegisterConversions", "adds", "conversion", "functions", "to", "the", "given", "scheme", ".", "Public", "to", "allow", "building", "arbitrary", "schemes", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/endpoint/config/v1alpha1/zz_generated.conversion.go#L37-L69
train
RegisterConversions registers conversion functions to the given scheme.
[ 30522, 4569, 2278, 4236, 8663, 27774, 2015, 1006, 1055, 1008, 2448, 7292, 1012, 5679, 1007, 7561, 1063, 2065, 9413, 2099, 1024, 1027, 1055, 1012, 5587, 6914, 16848, 8663, 27774, 11263, 12273, 1006, 1006, 1008, 1058, 2487, 2389, 21890, 2487,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubelet/dockershim/docker_service.go
effectiveHairpinMode
func effectiveHairpinMode(s *NetworkPluginSettings) error { // The hairpin mode setting doesn't matter if: // - We're not using a bridge network. This is hard to check because we might // be using a plugin. // - It's set to hairpin-veth for a container runtime that doesn't know how // to set the hairpin flag on the veth's of containers. Currently the // docker runtime is the only one that understands this. // - It's set to "none". if s.HairpinMode == kubeletconfig.PromiscuousBridge || s.HairpinMode == kubeletconfig.HairpinVeth { if s.HairpinMode == kubeletconfig.PromiscuousBridge && s.PluginName != "kubenet" { // This is not a valid combination, since promiscuous-bridge only works on kubenet. Users might be using the // default values (from before the hairpin-mode flag existed) and we // should keep the old behavior. klog.Warningf("Hairpin mode set to %q but kubenet is not enabled, falling back to %q", s.HairpinMode, kubeletconfig.HairpinVeth) s.HairpinMode = kubeletconfig.HairpinVeth return nil } } else if s.HairpinMode != kubeletconfig.HairpinNone { return fmt.Errorf("unknown value: %q", s.HairpinMode) } return nil }
go
func effectiveHairpinMode(s *NetworkPluginSettings) error { // The hairpin mode setting doesn't matter if: // - We're not using a bridge network. This is hard to check because we might // be using a plugin. // - It's set to hairpin-veth for a container runtime that doesn't know how // to set the hairpin flag on the veth's of containers. Currently the // docker runtime is the only one that understands this. // - It's set to "none". if s.HairpinMode == kubeletconfig.PromiscuousBridge || s.HairpinMode == kubeletconfig.HairpinVeth { if s.HairpinMode == kubeletconfig.PromiscuousBridge && s.PluginName != "kubenet" { // This is not a valid combination, since promiscuous-bridge only works on kubenet. Users might be using the // default values (from before the hairpin-mode flag existed) and we // should keep the old behavior. klog.Warningf("Hairpin mode set to %q but kubenet is not enabled, falling back to %q", s.HairpinMode, kubeletconfig.HairpinVeth) s.HairpinMode = kubeletconfig.HairpinVeth return nil } } else if s.HairpinMode != kubeletconfig.HairpinNone { return fmt.Errorf("unknown value: %q", s.HairpinMode) } return nil }
[ "func", "effectiveHairpinMode", "(", "s", "*", "NetworkPluginSettings", ")", "error", "{", "// The hairpin mode setting doesn't matter if:", "// - We're not using a bridge network. This is hard to check because we might", "// be using a plugin.", "// - It's set to hairpin-veth for a contai...
// effectiveHairpinMode determines the effective hairpin mode given the // configured mode, and whether cbr0 should be configured.
[ "effectiveHairpinMode", "determines", "the", "effective", "hairpin", "mode", "given", "the", "configured", "mode", "and", "whether", "cbr0", "should", "be", "configured", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/dockershim/docker_service.go#L548-L569
train
effectiveHairpinMode sets the hairpin - mode setting for the plugin.
[ 30522, 4569, 2278, 4621, 26227, 8091, 5302, 3207, 1006, 1055, 1008, 2897, 24759, 15916, 7076, 18319, 3070, 2015, 1007, 7561, 1063, 1013, 1013, 1996, 2606, 8091, 5549, 4292, 2987, 1005, 1056, 3043, 2065, 1024, 1013, 1013, 1011, 2057, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/apimachinery/pkg/util/httpstream/spdy/roundtripper.go
proxyAuth
func (s *SpdyRoundTripper) proxyAuth(proxyURL *url.URL) string { if proxyURL == nil || proxyURL.User == nil { return "" } credentials := proxyURL.User.String() encodedAuth := base64.StdEncoding.EncodeToString([]byte(credentials)) return fmt.Sprintf("Basic %s", encodedAuth) }
go
func (s *SpdyRoundTripper) proxyAuth(proxyURL *url.URL) string { if proxyURL == nil || proxyURL.User == nil { return "" } credentials := proxyURL.User.String() encodedAuth := base64.StdEncoding.EncodeToString([]byte(credentials)) return fmt.Sprintf("Basic %s", encodedAuth) }
[ "func", "(", "s", "*", "SpdyRoundTripper", ")", "proxyAuth", "(", "proxyURL", "*", "url", ".", "URL", ")", "string", "{", "if", "proxyURL", "==", "nil", "||", "proxyURL", ".", "User", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "credenti...
// proxyAuth returns, for a given proxy URL, the value to be used for the Proxy-Authorization header
[ "proxyAuth", "returns", "for", "a", "given", "proxy", "URL", "the", "value", "to", "be", "used", "for", "the", "Proxy", "-", "Authorization", "header" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/util/httpstream/spdy/roundtripper.go#L243-L250
train
proxyAuth returns the auth string for the given proxy URL
[ 30522, 4569, 2278, 1006, 1055, 1008, 23772, 12541, 28819, 24901, 4842, 1007, 24540, 4887, 2705, 1006, 24540, 3126, 2140, 1008, 24471, 2140, 1012, 24471, 2140, 1007, 5164, 1063, 2065, 24540, 3126, 2140, 1027, 1027, 9152, 2140, 1064, 1064, 24...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/printers/tableprinter.go
PrintObj
func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) error { w, found := output.(*tabwriter.Writer) if !found { w = GetNewTabWriter(output) output = w defer w.Flush() } // Case 1: Parameter "obj" is a table from server; print it. // display tables following the rules of options if table, ok := obj.(*metav1beta1.Table); ok { // Do not print headers if this table has no column definitions, or they are the same as the last ones we printed localOptions := h.options if len(table.ColumnDefinitions) == 0 || reflect.DeepEqual(table.ColumnDefinitions, h.lastColumns) { localOptions.NoHeaders = true } if len(table.ColumnDefinitions) == 0 { // If this table has no column definitions, use the columns from the last table we printed for decoration and layout. // This is done when receiving tables in watch events to save bandwidth. localOptions.NoHeaders = true table.ColumnDefinitions = h.lastColumns } else { // If this table has column definitions, remember them for future use. h.lastColumns = table.ColumnDefinitions } if err := decorateTable(table, localOptions); err != nil { return err } return PrintTable(table, output, localOptions) } // Case 2: Parameter "obj" is not a table; search for a handler to print it. // TODO(seans3): Remove this case in 1.16, since table should be returned from server-side printing. // print with a registered handler t := reflect.TypeOf(obj) if handler := h.handlerMap[t]; handler != nil { includeHeaders := h.lastType != t && !h.options.NoHeaders if h.lastType != nil && h.lastType != t && !h.options.NoHeaders { fmt.Fprintln(output) } if err := printRowsForHandlerEntry(output, handler, obj, h.options, includeHeaders); err != nil { return err } h.lastType = t return nil } // Case 3: Could not find print handler for "obj"; use the default print handler. // print with the default handler if set, and use the columns from the last time if h.defaultHandler != nil { includeHeaders := h.lastType != h.defaultHandler && !h.options.NoHeaders if h.lastType != nil && h.lastType != h.defaultHandler && !h.options.NoHeaders { fmt.Fprintln(output) } if err := printRowsForHandlerEntry(output, h.defaultHandler, obj, h.options, includeHeaders); err != nil { return err } h.lastType = h.defaultHandler return nil } // we failed all reasonable printing efforts, report failure return fmt.Errorf("error: unknown type %#v", obj) }
go
func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) error { w, found := output.(*tabwriter.Writer) if !found { w = GetNewTabWriter(output) output = w defer w.Flush() } // Case 1: Parameter "obj" is a table from server; print it. // display tables following the rules of options if table, ok := obj.(*metav1beta1.Table); ok { // Do not print headers if this table has no column definitions, or they are the same as the last ones we printed localOptions := h.options if len(table.ColumnDefinitions) == 0 || reflect.DeepEqual(table.ColumnDefinitions, h.lastColumns) { localOptions.NoHeaders = true } if len(table.ColumnDefinitions) == 0 { // If this table has no column definitions, use the columns from the last table we printed for decoration and layout. // This is done when receiving tables in watch events to save bandwidth. localOptions.NoHeaders = true table.ColumnDefinitions = h.lastColumns } else { // If this table has column definitions, remember them for future use. h.lastColumns = table.ColumnDefinitions } if err := decorateTable(table, localOptions); err != nil { return err } return PrintTable(table, output, localOptions) } // Case 2: Parameter "obj" is not a table; search for a handler to print it. // TODO(seans3): Remove this case in 1.16, since table should be returned from server-side printing. // print with a registered handler t := reflect.TypeOf(obj) if handler := h.handlerMap[t]; handler != nil { includeHeaders := h.lastType != t && !h.options.NoHeaders if h.lastType != nil && h.lastType != t && !h.options.NoHeaders { fmt.Fprintln(output) } if err := printRowsForHandlerEntry(output, handler, obj, h.options, includeHeaders); err != nil { return err } h.lastType = t return nil } // Case 3: Could not find print handler for "obj"; use the default print handler. // print with the default handler if set, and use the columns from the last time if h.defaultHandler != nil { includeHeaders := h.lastType != h.defaultHandler && !h.options.NoHeaders if h.lastType != nil && h.lastType != h.defaultHandler && !h.options.NoHeaders { fmt.Fprintln(output) } if err := printRowsForHandlerEntry(output, h.defaultHandler, obj, h.options, includeHeaders); err != nil { return err } h.lastType = h.defaultHandler return nil } // we failed all reasonable printing efforts, report failure return fmt.Errorf("error: unknown type %#v", obj) }
[ "func", "(", "h", "*", "HumanReadablePrinter", ")", "PrintObj", "(", "obj", "runtime", ".", "Object", ",", "output", "io", ".", "Writer", ")", "error", "{", "w", ",", "found", ":=", "output", ".", "(", "*", "tabwriter", ".", "Writer", ")", "\n", "if"...
// PrintObj prints the obj in a human-friendly format according to the type of the obj.
[ "PrintObj", "prints", "the", "obj", "in", "a", "human", "-", "friendly", "format", "according", "to", "the", "type", "of", "the", "obj", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/printers/tableprinter.go#L55-L124
train
PrintObj prints the object to the given writer.
[ 30522, 4569, 2278, 1006, 1044, 1008, 2529, 16416, 20782, 16550, 2121, 1007, 6140, 16429, 3501, 1006, 27885, 3501, 2448, 7292, 1012, 4874, 1010, 6434, 22834, 1012, 3213, 1007, 7561, 1063, 1059, 1010, 2179, 1024, 1027, 6434, 1012, 1006, 1008,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_persistentvolumeclaim.go
Update
func (c *FakePersistentVolumeClaims) Update(persistentVolumeClaim *corev1.PersistentVolumeClaim) (result *corev1.PersistentVolumeClaim, err error) { obj, err := c.Fake. Invokes(testing.NewUpdateAction(persistentvolumeclaimsResource, c.ns, persistentVolumeClaim), &corev1.PersistentVolumeClaim{}) if obj == nil { return nil, err } return obj.(*corev1.PersistentVolumeClaim), err }
go
func (c *FakePersistentVolumeClaims) Update(persistentVolumeClaim *corev1.PersistentVolumeClaim) (result *corev1.PersistentVolumeClaim, err error) { obj, err := c.Fake. Invokes(testing.NewUpdateAction(persistentvolumeclaimsResource, c.ns, persistentVolumeClaim), &corev1.PersistentVolumeClaim{}) if obj == nil { return nil, err } return obj.(*corev1.PersistentVolumeClaim), err }
[ "func", "(", "c", "*", "FakePersistentVolumeClaims", ")", "Update", "(", "persistentVolumeClaim", "*", "corev1", ".", "PersistentVolumeClaim", ")", "(", "result", "*", "corev1", ".", "PersistentVolumeClaim", ",", "err", "error", ")", "{", "obj", ",", "err", ":...
// Update takes the representation of a persistentVolumeClaim and updates it. Returns the server's representation of the persistentVolumeClaim, and an error, if there is any.
[ "Update", "takes", "the", "representation", "of", "a", "persistentVolumeClaim", "and", "updates", "it", ".", "Returns", "the", "server", "s", "representation", "of", "the", "persistentVolumeClaim", "and", "an", "error", "if", "there", "is", "any", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_persistentvolumeclaim.go#L93-L101
train
Update takes the representation of a persistentVolumeClaim and updates it. Returns the server s representation of the persistentVolumeClaim and an error if there is any.
[ 30522, 4569, 2278, 1006, 1039, 1008, 8275, 7347, 27870, 3372, 6767, 12942, 8586, 19771, 5244, 1007, 10651, 1006, 14516, 6767, 12942, 8586, 19771, 2213, 1008, 4563, 2615, 2487, 1012, 14516, 6767, 12942, 8586, 19771, 2213, 1007, 1006, 2765, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/volume/gcepd/gce_util.go
parseScsiSerial
func parseScsiSerial(output string) (string, error) { substrings := scsiRegex.FindStringSubmatch(output) if substrings == nil { return "", fmt.Errorf("scsi_id output cannot be parsed: %q", output) } return substrings[1], nil }
go
func parseScsiSerial(output string) (string, error) { substrings := scsiRegex.FindStringSubmatch(output) if substrings == nil { return "", fmt.Errorf("scsi_id output cannot be parsed: %q", output) } return substrings[1], nil }
[ "func", "parseScsiSerial", "(", "output", "string", ")", "(", "string", ",", "error", ")", "{", "substrings", ":=", "scsiRegex", ".", "FindStringSubmatch", "(", "output", ")", "\n", "if", "substrings", "==", "nil", "{", "return", "\"", "\"", ",", "fmt", ...
// Parse the output returned by scsi_id and extract the serial number
[ "Parse", "the", "output", "returned", "by", "scsi_id", "and", "extract", "the", "serial", "number" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/gcepd/gce_util.go#L262-L269
train
parseScsiSerial parses the output of a scsi_id command.
[ 30522, 4569, 2278, 11968, 8583, 6169, 17288, 4818, 1006, 6434, 5164, 1007, 1006, 5164, 1010, 7561, 1007, 1063, 4942, 3367, 4892, 2015, 1024, 1027, 8040, 29481, 24746, 2595, 1012, 4858, 18886, 3070, 6342, 25526, 4017, 2818, 1006, 6434, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1/zz_generated.deepcopy.go
DeepCopyInto
func (in *MetricListOptions) DeepCopyInto(out *MetricListOptions) { *out = *in out.TypeMeta = in.TypeMeta return }
go
func (in *MetricListOptions) DeepCopyInto(out *MetricListOptions) { *out = *in out.TypeMeta = in.TypeMeta return }
[ "func", "(", "in", "*", "MetricListOptions", ")", "DeepCopyInto", "(", "out", "*", "MetricListOptions", ")", "{", "*", "out", "=", "*", "in", "\n", "out", ".", "TypeMeta", "=", "in", ".", "TypeMeta", "\n", "return", "\n", "}" ]
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
[ "DeepCopyInto", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "writing", "into", "out", ".", "in", "must", "be", "non", "-", "nil", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1/zz_generated.deepcopy.go#L29-L33
train
DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new MetricListOptions.
[ 30522, 4569, 2278, 1006, 1999, 1008, 12046, 9863, 7361, 9285, 1007, 2784, 3597, 7685, 18447, 2080, 1006, 2041, 1008, 12046, 9863, 7361, 9285, 1007, 1063, 1008, 2041, 1027, 1008, 1999, 2041, 1012, 2828, 11368, 2050, 1027, 1999, 1012, 2828, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
cmd/kubeadm/app/discovery/discovery.go
DiscoverValidatedKubeConfig
func DiscoverValidatedKubeConfig(cfg *kubeadmapi.JoinConfiguration) (*clientcmdapi.Config, error) { switch { case cfg.Discovery.File != nil: kubeConfigPath := cfg.Discovery.File.KubeConfigPath if isHTTPSURL(kubeConfigPath) { return https.RetrieveValidatedConfigInfo(kubeConfigPath, kubeadmapiv1beta2.DefaultClusterName) } return file.RetrieveValidatedConfigInfo(kubeConfigPath, kubeadmapiv1beta2.DefaultClusterName) case cfg.Discovery.BootstrapToken != nil: return token.RetrieveValidatedConfigInfo(cfg) default: return nil, errors.New("couldn't find a valid discovery configuration") } }
go
func DiscoverValidatedKubeConfig(cfg *kubeadmapi.JoinConfiguration) (*clientcmdapi.Config, error) { switch { case cfg.Discovery.File != nil: kubeConfigPath := cfg.Discovery.File.KubeConfigPath if isHTTPSURL(kubeConfigPath) { return https.RetrieveValidatedConfigInfo(kubeConfigPath, kubeadmapiv1beta2.DefaultClusterName) } return file.RetrieveValidatedConfigInfo(kubeConfigPath, kubeadmapiv1beta2.DefaultClusterName) case cfg.Discovery.BootstrapToken != nil: return token.RetrieveValidatedConfigInfo(cfg) default: return nil, errors.New("couldn't find a valid discovery configuration") } }
[ "func", "DiscoverValidatedKubeConfig", "(", "cfg", "*", "kubeadmapi", ".", "JoinConfiguration", ")", "(", "*", "clientcmdapi", ".", "Config", ",", "error", ")", "{", "switch", "{", "case", "cfg", ".", "Discovery", ".", "File", "!=", "nil", ":", "kubeConfigPa...
// DiscoverValidatedKubeConfig returns a validated Config object that specifies where the cluster is and the CA cert to trust
[ "DiscoverValidatedKubeConfig", "returns", "a", "validated", "Config", "object", "that", "specifies", "where", "the", "cluster", "is", "and", "the", "CA", "cert", "to", "trust" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/discovery/discovery.go#L60-L73
train
DiscoverValidatedKubeConfig returns a valid config for the given join configuration.
[ 30522, 4569, 2278, 7523, 10175, 8524, 3064, 5283, 4783, 8663, 8873, 2290, 1006, 12935, 2290, 1008, 13970, 4783, 4215, 2863, 8197, 1012, 3693, 8663, 8873, 27390, 3370, 1007, 1006, 1008, 7396, 27487, 2850, 8197, 1012, 9530, 8873, 2290, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubectl/describe/versioned/describe.go
printAnnotationsMultilineWithFilter
func printAnnotationsMultilineWithFilter(w PrefixWriter, title string, annotations map[string]string, skip sets.String) { printAnnotationsMultilineWithIndent(w, "", title, "\t", annotations, skip) }
go
func printAnnotationsMultilineWithFilter(w PrefixWriter, title string, annotations map[string]string, skip sets.String) { printAnnotationsMultilineWithIndent(w, "", title, "\t", annotations, skip) }
[ "func", "printAnnotationsMultilineWithFilter", "(", "w", "PrefixWriter", ",", "title", "string", ",", "annotations", "map", "[", "string", "]", "string", ",", "skip", "sets", ".", "String", ")", "{", "printAnnotationsMultilineWithIndent", "(", "w", ",", "\"", "\...
// printAnnotationsMultilineWithFilter prints filtered multiple annotations with a proper alignment.
[ "printAnnotationsMultilineWithFilter", "prints", "filtered", "multiple", "annotations", "with", "a", "proper", "alignment", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubectl/describe/versioned/describe.go#L4343-L4345
train
printAnnotationsMultilineWithFilter prints the given annotations as a multiline list of lines with a title and a set of lines to skip.
[ 30522, 4569, 2278, 6140, 11639, 17287, 9285, 12274, 7096, 18622, 2638, 24415, 8873, 21928, 1006, 1059, 17576, 15994, 1010, 2516, 5164, 1010, 5754, 17287, 9285, 4949, 1031, 5164, 1033, 5164, 1010, 13558, 4520, 1012, 5164, 1007, 1063, 6140, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubelet/nodelease/controller.go
Run
func (c *controller) Run(stopCh <-chan struct{}) { if c.leaseClient == nil { klog.Infof("node lease controller has nil lease client, will not claim or renew leases") return } wait.Until(c.sync, c.renewInterval, stopCh) }
go
func (c *controller) Run(stopCh <-chan struct{}) { if c.leaseClient == nil { klog.Infof("node lease controller has nil lease client, will not claim or renew leases") return } wait.Until(c.sync, c.renewInterval, stopCh) }
[ "func", "(", "c", "*", "controller", ")", "Run", "(", "stopCh", "<-", "chan", "struct", "{", "}", ")", "{", "if", "c", ".", "leaseClient", "==", "nil", "{", "klog", ".", "Infof", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "wait", "....
// Run runs the controller
[ "Run", "runs", "the", "controller" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/nodelease/controller.go#L82-L88
train
Run starts the lease controller.
[ 30522, 4569, 2278, 1006, 1039, 1008, 11486, 1007, 2448, 1006, 2644, 2818, 1026, 1011, 9212, 30524, 1039, 1012, 26351, 1010, 1039, 1012, 20687, 18447, 2121, 10175, 1010, 2644, 2818, 1007, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubelet/images/image_gc_manager.go
set
func (i *imageCache) set(images []container.Image) { i.Lock() defer i.Unlock() i.images = images }
go
func (i *imageCache) set(images []container.Image) { i.Lock() defer i.Unlock() i.images = images }
[ "func", "(", "i", "*", "imageCache", ")", "set", "(", "images", "[", "]", "container", ".", "Image", ")", "{", "i", ".", "Lock", "(", ")", "\n", "defer", "i", ".", "Unlock", "(", ")", "\n", "i", ".", "images", "=", "images", "\n", "}" ]
// set updates image cache.
[ "set", "updates", "image", "cache", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/images/image_gc_manager.go#L117-L121
train
set sets the images in the image cache.
[ 30522, 4569, 2278, 1006, 1045, 1008, 3746, 3540, 5403, 1007, 2275, 1006, 4871, 1031, 1033, 11661, 1012, 3746, 1007, 1063, 1045, 1012, 5843, 1006, 1007, 13366, 2121, 1045, 1012, 19829, 1006, 1007, 1045, 1012, 4871, 1027, 4871, 1065, 102, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/core/zz_generated.deepcopy.go
DeepCopyInto
func (in *PodDNSConfig) DeepCopyInto(out *PodDNSConfig) { *out = *in if in.Nameservers != nil { in, out := &in.Nameservers, &out.Nameservers *out = make([]string, len(*in)) copy(*out, *in) } if in.Searches != nil { in, out := &in.Searches, &out.Searches *out = make([]string, len(*in)) copy(*out, *in) } if in.Options != nil { in, out := &in.Options, &out.Options *out = make([]PodDNSConfigOption, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return }
go
func (in *PodDNSConfig) DeepCopyInto(out *PodDNSConfig) { *out = *in if in.Nameservers != nil { in, out := &in.Nameservers, &out.Nameservers *out = make([]string, len(*in)) copy(*out, *in) } if in.Searches != nil { in, out := &in.Searches, &out.Searches *out = make([]string, len(*in)) copy(*out, *in) } if in.Options != nil { in, out := &in.Options, &out.Options *out = make([]PodDNSConfigOption, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return }
[ "func", "(", "in", "*", "PodDNSConfig", ")", "DeepCopyInto", "(", "out", "*", "PodDNSConfig", ")", "{", "*", "out", "=", "*", "in", "\n", "if", "in", ".", "Nameservers", "!=", "nil", "{", "in", ",", "out", ":=", "&", "in", ".", "Nameservers", ",", ...
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
[ "DeepCopyInto", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "writing", "into", "out", ".", "in", "must", "be", "non", "-", "nil", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/zz_generated.deepcopy.go#L3215-L3235
train
DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new PodDNSConfig.
[ 30522, 4569, 2278, 1006, 1999, 1008, 17491, 2094, 3619, 8663, 8873, 2290, 1007, 2784, 3597, 7685, 18447, 2080, 1006, 2041, 1008, 17491, 2094, 3619, 8663, 8873, 2290, 1007, 1063, 1008, 2041, 1027, 1008, 1999, 2065, 1999, 1012, 3415, 2121, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/apps/v1beta2/zz_generated.defaults.go
RegisterDefaults
func RegisterDefaults(scheme *runtime.Scheme) error { scheme.AddTypeDefaultingFunc(&v1beta2.DaemonSet{}, func(obj interface{}) { SetObjectDefaults_DaemonSet(obj.(*v1beta2.DaemonSet)) }) scheme.AddTypeDefaultingFunc(&v1beta2.DaemonSetList{}, func(obj interface{}) { SetObjectDefaults_DaemonSetList(obj.(*v1beta2.DaemonSetList)) }) scheme.AddTypeDefaultingFunc(&v1beta2.Deployment{}, func(obj interface{}) { SetObjectDefaults_Deployment(obj.(*v1beta2.Deployment)) }) scheme.AddTypeDefaultingFunc(&v1beta2.DeploymentList{}, func(obj interface{}) { SetObjectDefaults_DeploymentList(obj.(*v1beta2.DeploymentList)) }) scheme.AddTypeDefaultingFunc(&v1beta2.ReplicaSet{}, func(obj interface{}) { SetObjectDefaults_ReplicaSet(obj.(*v1beta2.ReplicaSet)) }) scheme.AddTypeDefaultingFunc(&v1beta2.ReplicaSetList{}, func(obj interface{}) { SetObjectDefaults_ReplicaSetList(obj.(*v1beta2.ReplicaSetList)) }) scheme.AddTypeDefaultingFunc(&v1beta2.StatefulSet{}, func(obj interface{}) { SetObjectDefaults_StatefulSet(obj.(*v1beta2.StatefulSet)) }) scheme.AddTypeDefaultingFunc(&v1beta2.StatefulSetList{}, func(obj interface{}) { SetObjectDefaults_StatefulSetList(obj.(*v1beta2.StatefulSetList)) }) return nil }
go
func RegisterDefaults(scheme *runtime.Scheme) error { scheme.AddTypeDefaultingFunc(&v1beta2.DaemonSet{}, func(obj interface{}) { SetObjectDefaults_DaemonSet(obj.(*v1beta2.DaemonSet)) }) scheme.AddTypeDefaultingFunc(&v1beta2.DaemonSetList{}, func(obj interface{}) { SetObjectDefaults_DaemonSetList(obj.(*v1beta2.DaemonSetList)) }) scheme.AddTypeDefaultingFunc(&v1beta2.Deployment{}, func(obj interface{}) { SetObjectDefaults_Deployment(obj.(*v1beta2.Deployment)) }) scheme.AddTypeDefaultingFunc(&v1beta2.DeploymentList{}, func(obj interface{}) { SetObjectDefaults_DeploymentList(obj.(*v1beta2.DeploymentList)) }) scheme.AddTypeDefaultingFunc(&v1beta2.ReplicaSet{}, func(obj interface{}) { SetObjectDefaults_ReplicaSet(obj.(*v1beta2.ReplicaSet)) }) scheme.AddTypeDefaultingFunc(&v1beta2.ReplicaSetList{}, func(obj interface{}) { SetObjectDefaults_ReplicaSetList(obj.(*v1beta2.ReplicaSetList)) }) scheme.AddTypeDefaultingFunc(&v1beta2.StatefulSet{}, func(obj interface{}) { SetObjectDefaults_StatefulSet(obj.(*v1beta2.StatefulSet)) }) scheme.AddTypeDefaultingFunc(&v1beta2.StatefulSetList{}, func(obj interface{}) { SetObjectDefaults_StatefulSetList(obj.(*v1beta2.StatefulSetList)) }) return nil }
[ "func", "RegisterDefaults", "(", "scheme", "*", "runtime", ".", "Scheme", ")", "error", "{", "scheme", ".", "AddTypeDefaultingFunc", "(", "&", "v1beta2", ".", "DaemonSet", "{", "}", ",", "func", "(", "obj", "interface", "{", "}", ")", "{", "SetObjectDefaul...
// RegisterDefaults adds defaulters functions to the given scheme. // Public to allow building arbitrary schemes. // All generated defaulters are covering - they call all nested defaulters.
[ "RegisterDefaults", "adds", "defaulters", "functions", "to", "the", "given", "scheme", ".", "Public", "to", "allow", "building", "arbitrary", "schemes", ".", "All", "generated", "defaulters", "are", "covering", "-", "they", "call", "all", "nested", "defaulters", ...
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/apps/v1beta2/zz_generated.defaults.go#L32-L42
train
RegisterDefaults registers default values for the scheme
[ 30522, 4569, 2278, 4236, 3207, 7011, 11314, 2015, 1006, 5679, 1008, 2448, 7292, 1012, 5679, 1007, 7561, 1063, 5679, 1012, 5587, 13874, 3207, 7011, 11314, 2075, 11263, 12273, 1006, 1004, 1058, 2487, 20915, 2050, 2475, 1012, 12828, 13462, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/cloudprovider/providers/aws/aws_fakes.go
CreateRouteTable
func (ec2i *FakeEC2Impl) CreateRouteTable(request *ec2.RouteTable) (*ec2.CreateRouteTableOutput, error) { ec2i.RouteTables = append(ec2i.RouteTables, request) response := &ec2.CreateRouteTableOutput{ RouteTable: request, } return response, nil }
go
func (ec2i *FakeEC2Impl) CreateRouteTable(request *ec2.RouteTable) (*ec2.CreateRouteTableOutput, error) { ec2i.RouteTables = append(ec2i.RouteTables, request) response := &ec2.CreateRouteTableOutput{ RouteTable: request, } return response, nil }
[ "func", "(", "ec2i", "*", "FakeEC2Impl", ")", "CreateRouteTable", "(", "request", "*", "ec2", ".", "RouteTable", ")", "(", "*", "ec2", ".", "CreateRouteTableOutput", ",", "error", ")", "{", "ec2i", ".", "RouteTables", "=", "append", "(", "ec2i", ".", "Ro...
// CreateRouteTable creates fake route tables
[ "CreateRouteTable", "creates", "fake", "route", "tables" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/cloudprovider/providers/aws/aws_fakes.go#L275-L281
train
CreateRouteTable creates a route table
[ 30522, 4569, 2278, 1006, 14925, 2475, 2072, 1008, 8275, 8586, 2475, 5714, 24759, 1007, 3443, 22494, 22513, 3085, 1006, 5227, 1008, 14925, 30524, 2015, 1027, 10439, 10497, 1006, 14925, 2475, 2072, 1012, 2799, 10880, 2015, 1010, 5227, 1007, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/scheduler/algorithm/predicates/predicates.go
PodToleratesNodeTaints
func PodToleratesNodeTaints(pod *v1.Pod, meta PredicateMetadata, nodeInfo *schedulernodeinfo.NodeInfo) (bool, []PredicateFailureReason, error) { if nodeInfo == nil || nodeInfo.Node() == nil { return false, []PredicateFailureReason{ErrNodeUnknownCondition}, nil } return podToleratesNodeTaints(pod, nodeInfo, func(t *v1.Taint) bool { // PodToleratesNodeTaints is only interested in NoSchedule and NoExecute taints. return t.Effect == v1.TaintEffectNoSchedule || t.Effect == v1.TaintEffectNoExecute }) }
go
func PodToleratesNodeTaints(pod *v1.Pod, meta PredicateMetadata, nodeInfo *schedulernodeinfo.NodeInfo) (bool, []PredicateFailureReason, error) { if nodeInfo == nil || nodeInfo.Node() == nil { return false, []PredicateFailureReason{ErrNodeUnknownCondition}, nil } return podToleratesNodeTaints(pod, nodeInfo, func(t *v1.Taint) bool { // PodToleratesNodeTaints is only interested in NoSchedule and NoExecute taints. return t.Effect == v1.TaintEffectNoSchedule || t.Effect == v1.TaintEffectNoExecute }) }
[ "func", "PodToleratesNodeTaints", "(", "pod", "*", "v1", ".", "Pod", ",", "meta", "PredicateMetadata", ",", "nodeInfo", "*", "schedulernodeinfo", ".", "NodeInfo", ")", "(", "bool", ",", "[", "]", "PredicateFailureReason", ",", "error", ")", "{", "if", "nodeI...
// PodToleratesNodeTaints checks if a pod tolerations can tolerate the node taints
[ "PodToleratesNodeTaints", "checks", "if", "a", "pod", "tolerations", "can", "tolerate", "the", "node", "taints" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/scheduler/algorithm/predicates/predicates.go#L1536-L1545
train
PodToleratesNodeTaints checks if a pod is tolerating node taints.
[ 30522, 4569, 2278, 17491, 3406, 3917, 8520, 3630, 3207, 18249, 3215, 1006, 17491, 1008, 1058, 2487, 1012, 17491, 1010, 18804, 3653, 16467, 11368, 8447, 2696, 1010, 13045, 2378, 14876, 1008, 6134, 19139, 3207, 2378, 14876, 1012, 13045, 2378, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubelet/cm/devicemanager/pod_devices.go
fromCheckpointData
func (pdev podDevices) fromCheckpointData(data []checkpoint.PodDevicesEntry) { for _, entry := range data { klog.V(2).Infof("Get checkpoint entry: %v %v %v %v %v\n", entry.PodUID, entry.ContainerName, entry.ResourceName, entry.DeviceIDs, entry.AllocResp) devIDs := sets.NewString() for _, devID := range entry.DeviceIDs { devIDs.Insert(devID) } allocResp := &pluginapi.ContainerAllocateResponse{} err := allocResp.Unmarshal(entry.AllocResp) if err != nil { klog.Errorf("Can't unmarshal allocResp for %v %v %v: %v", entry.PodUID, entry.ContainerName, entry.ResourceName, err) continue } pdev.insert(entry.PodUID, entry.ContainerName, entry.ResourceName, devIDs, allocResp) } }
go
func (pdev podDevices) fromCheckpointData(data []checkpoint.PodDevicesEntry) { for _, entry := range data { klog.V(2).Infof("Get checkpoint entry: %v %v %v %v %v\n", entry.PodUID, entry.ContainerName, entry.ResourceName, entry.DeviceIDs, entry.AllocResp) devIDs := sets.NewString() for _, devID := range entry.DeviceIDs { devIDs.Insert(devID) } allocResp := &pluginapi.ContainerAllocateResponse{} err := allocResp.Unmarshal(entry.AllocResp) if err != nil { klog.Errorf("Can't unmarshal allocResp for %v %v %v: %v", entry.PodUID, entry.ContainerName, entry.ResourceName, err) continue } pdev.insert(entry.PodUID, entry.ContainerName, entry.ResourceName, devIDs, allocResp) } }
[ "func", "(", "pdev", "podDevices", ")", "fromCheckpointData", "(", "data", "[", "]", "checkpoint", ".", "PodDevicesEntry", ")", "{", "for", "_", ",", "entry", ":=", "range", "data", "{", "klog", ".", "V", "(", "2", ")", ".", "Infof", "(", "\"", "\\n"...
// Populates podDevices from the passed in checkpointData.
[ "Populates", "podDevices", "from", "the", "passed", "in", "checkpointData", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/cm/devicemanager/pod_devices.go#L161-L177
train
fromCheckpointData takes a slice of checkpoint. PodDevicesEntry and parses it into a podDevices object
[ 30522, 4569, 2278, 1006, 22851, 6777, 17491, 24844, 23522, 1007, 2013, 5403, 3600, 8400, 2850, 2696, 1006, 2951, 1031, 1033, 26520, 1012, 17491, 24844, 23522, 4765, 2854, 1007, 1063, 2005, 1035, 1010, 4443, 1024, 1027, 2846, 2951, 1063, 104...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubelet/kubeletconfig/controller.go
StartSync
func (cc *Controller) StartSync(client clientset.Interface, eventClient v1core.EventsGetter, nodeName string) error { const errFmt = "cannot start Kubelet config sync: %s" if client == nil { return fmt.Errorf(errFmt, "nil client") } if eventClient == nil { return fmt.Errorf(errFmt, "nil event client") } if nodeName == "" { return fmt.Errorf(errFmt, "empty nodeName") } // Rather than use utilruntime.HandleCrash, which doesn't actually crash in the Kubelet, // we use HandlePanic to manually call the panic handlers and then crash. // We have a better chance of recovering normal operation if we just restart the Kubelet in the event // of a Go runtime error. // NOTE(mtaufen): utilpanic.HandlePanic returns a function and you have to call it for your thing to run! // This was EVIL to debug (difficult to see missing `()`). // The code now uses `go name()` instead of `go utilpanic.HandlePanic(func(){...})()` to avoid confusion. // status sync worker statusSyncLoopFunc := utilpanic.HandlePanic(func() { utillog.Infof("starting status sync loop") wait.JitterUntil(func() { cc.configStatus.Sync(client, nodeName) }, 10*time.Second, 0.2, true, wait.NeverStop) }) // remote config source informer, if we have a remote source to watch assignedSource, err := cc.checkpointStore.Assigned() if err != nil { return fmt.Errorf(errFmt, err) } else if assignedSource == nil { utillog.Infof("local source is assigned, will not start remote config source informer") } else { cc.remoteConfigSourceInformer = assignedSource.Informer(client, cache.ResourceEventHandlerFuncs{ AddFunc: cc.onAddRemoteConfigSourceEvent, UpdateFunc: cc.onUpdateRemoteConfigSourceEvent, DeleteFunc: cc.onDeleteRemoteConfigSourceEvent, }, ) } remoteConfigSourceInformerFunc := utilpanic.HandlePanic(func() { if cc.remoteConfigSourceInformer != nil { utillog.Infof("starting remote config source informer") cc.remoteConfigSourceInformer.Run(wait.NeverStop) } }) // node informer cc.nodeInformer = newSharedNodeInformer(client, nodeName, cc.onAddNodeEvent, cc.onUpdateNodeEvent, cc.onDeleteNodeEvent) nodeInformerFunc := utilpanic.HandlePanic(func() { utillog.Infof("starting Node informer") cc.nodeInformer.Run(wait.NeverStop) }) // config sync worker configSyncLoopFunc := utilpanic.HandlePanic(func() { utillog.Infof("starting Kubelet config sync loop") wait.JitterUntil(func() { cc.syncConfigSource(client, eventClient, nodeName) }, 10*time.Second, 0.2, true, wait.NeverStop) }) go statusSyncLoopFunc() go remoteConfigSourceInformerFunc() go nodeInformerFunc() go configSyncLoopFunc() return nil }
go
func (cc *Controller) StartSync(client clientset.Interface, eventClient v1core.EventsGetter, nodeName string) error { const errFmt = "cannot start Kubelet config sync: %s" if client == nil { return fmt.Errorf(errFmt, "nil client") } if eventClient == nil { return fmt.Errorf(errFmt, "nil event client") } if nodeName == "" { return fmt.Errorf(errFmt, "empty nodeName") } // Rather than use utilruntime.HandleCrash, which doesn't actually crash in the Kubelet, // we use HandlePanic to manually call the panic handlers and then crash. // We have a better chance of recovering normal operation if we just restart the Kubelet in the event // of a Go runtime error. // NOTE(mtaufen): utilpanic.HandlePanic returns a function and you have to call it for your thing to run! // This was EVIL to debug (difficult to see missing `()`). // The code now uses `go name()` instead of `go utilpanic.HandlePanic(func(){...})()` to avoid confusion. // status sync worker statusSyncLoopFunc := utilpanic.HandlePanic(func() { utillog.Infof("starting status sync loop") wait.JitterUntil(func() { cc.configStatus.Sync(client, nodeName) }, 10*time.Second, 0.2, true, wait.NeverStop) }) // remote config source informer, if we have a remote source to watch assignedSource, err := cc.checkpointStore.Assigned() if err != nil { return fmt.Errorf(errFmt, err) } else if assignedSource == nil { utillog.Infof("local source is assigned, will not start remote config source informer") } else { cc.remoteConfigSourceInformer = assignedSource.Informer(client, cache.ResourceEventHandlerFuncs{ AddFunc: cc.onAddRemoteConfigSourceEvent, UpdateFunc: cc.onUpdateRemoteConfigSourceEvent, DeleteFunc: cc.onDeleteRemoteConfigSourceEvent, }, ) } remoteConfigSourceInformerFunc := utilpanic.HandlePanic(func() { if cc.remoteConfigSourceInformer != nil { utillog.Infof("starting remote config source informer") cc.remoteConfigSourceInformer.Run(wait.NeverStop) } }) // node informer cc.nodeInformer = newSharedNodeInformer(client, nodeName, cc.onAddNodeEvent, cc.onUpdateNodeEvent, cc.onDeleteNodeEvent) nodeInformerFunc := utilpanic.HandlePanic(func() { utillog.Infof("starting Node informer") cc.nodeInformer.Run(wait.NeverStop) }) // config sync worker configSyncLoopFunc := utilpanic.HandlePanic(func() { utillog.Infof("starting Kubelet config sync loop") wait.JitterUntil(func() { cc.syncConfigSource(client, eventClient, nodeName) }, 10*time.Second, 0.2, true, wait.NeverStop) }) go statusSyncLoopFunc() go remoteConfigSourceInformerFunc() go nodeInformerFunc() go configSyncLoopFunc() return nil }
[ "func", "(", "cc", "*", "Controller", ")", "StartSync", "(", "client", "clientset", ".", "Interface", ",", "eventClient", "v1core", ".", "EventsGetter", ",", "nodeName", "string", ")", "error", "{", "const", "errFmt", "=", "\"", "\"", "\n", "if", "client",...
// StartSync tells the controller to start the goroutines that sync status/config to/from the API server. // The clients must be non-nil, and the nodeName must be non-empty.
[ "StartSync", "tells", "the", "controller", "to", "start", "the", "goroutines", "that", "sync", "status", "/", "config", "to", "/", "from", "the", "API", "server", ".", "The", "clients", "must", "be", "non", "-", "nil", "and", "the", "nodeName", "must", "...
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/kubeletconfig/controller.go#L175-L242
train
StartSync starts the config sync loop.
[ 30522, 4569, 2278, 1006, 10507, 1008, 11486, 1007, 4627, 6038, 2278, 1006, 7396, 7846, 3388, 1012, 8278, 1010, 2724, 20464, 11638, 1058, 2487, 17345, 1012, 2824, 18150, 3334, 1010, 13045, 18442, 5164, 1007, 7561, 1063, 9530, 3367, 9413, 128...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/core/zz_generated.deepcopy.go
DeepCopy
func (in *WeightedPodAffinityTerm) DeepCopy() *WeightedPodAffinityTerm { if in == nil { return nil } out := new(WeightedPodAffinityTerm) in.DeepCopyInto(out) return out }
go
func (in *WeightedPodAffinityTerm) DeepCopy() *WeightedPodAffinityTerm { if in == nil { return nil } out := new(WeightedPodAffinityTerm) in.DeepCopyInto(out) return out }
[ "func", "(", "in", "*", "WeightedPodAffinityTerm", ")", "DeepCopy", "(", ")", "*", "WeightedPodAffinityTerm", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "WeightedPodAffinityTerm", ")", "\n", "in", ".", "...
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WeightedPodAffinityTerm.
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "WeightedPodAffinityTerm", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/zz_generated.deepcopy.go#L5461-L5468
train
DeepCopy is an autogenerated deepcopy function copying the receiver creating a new WeightedPodAffinityTerm.
[ 30522, 4569, 2278, 1006, 1999, 1008, 18215, 27633, 10354, 16294, 3012, 3334, 2213, 1007, 2784, 3597, 7685, 1006, 1007, 1008, 18215, 27633, 10354, 16294, 3012, 3334, 2213, 1063, 2065, 1999, 1027, 1027, 9152, 2140, 1063, 2709, 9152, 2140, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/autoscaling/v2beta1/zz_generated.conversion.go
Convert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalPodAutoscalerCondition
func Convert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalPodAutoscalerCondition(in *autoscaling.HorizontalPodAutoscalerCondition, out *v2beta1.HorizontalPodAutoscalerCondition, s conversion.Scope) error { return autoConvert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalPodAutoscalerCondition(in, out, s) }
go
func Convert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalPodAutoscalerCondition(in *autoscaling.HorizontalPodAutoscalerCondition, out *v2beta1.HorizontalPodAutoscalerCondition, s conversion.Scope) error { return autoConvert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalPodAutoscalerCondition(in, out, s) }
[ "func", "Convert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalPodAutoscalerCondition", "(", "in", "*", "autoscaling", ".", "HorizontalPodAutoscalerCondition", ",", "out", "*", "v2beta1", ".", "HorizontalPodAutoscalerCondition", ",", "s", "conversion", ".", "S...
// Convert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalPodAutoscalerCondition is an autogenerated conversion function.
[ "Convert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalPodAutoscalerCondition", "is", "an", "autogenerated", "conversion", "function", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/autoscaling/v2beta1/zz_generated.conversion.go#L403-L405
train
Convert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalPodAutoscalerCondition is an autogenerated conversion function.
[ 30522, 4569, 2278, 10463, 1035, 8285, 15782, 2989, 1035, 9876, 27633, 4887, 13122, 30524, 1012, 9876, 27633, 4887, 13122, 9289, 2121, 8663, 20562, 1010, 2041, 1008, 1058, 2475, 20915, 27717, 1012, 9876, 27633, 4887, 13122, 9289, 2121, 8663, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubectl/cmd/rollout/rollout_status.go
Run
func (o *RolloutStatusOptions) Run() error { r := o.Builder(). WithScheme(scheme.Scheme, scheme.Scheme.PrioritizedVersionsAllGroups()...). NamespaceParam(o.Namespace).DefaultNamespace(). FilenameParam(o.EnforceNamespace, o.FilenameOptions). ResourceTypeOrNameArgs(true, o.BuilderArgs...). SingleResourceType(). Latest(). Do() err := r.Err() if err != nil { return err } infos, err := r.Infos() if err != nil { return err } if len(infos) != 1 { return fmt.Errorf("rollout status is only supported on individual resources and resource collections - %d resources were found", len(infos)) } info := infos[0] mapping := info.ResourceMapping() statusViewer, err := o.StatusViewerFn(mapping) if err != nil { return err } fieldSelector := fields.OneTermEqualSelector("metadata.name", info.Name).String() lw := &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { options.FieldSelector = fieldSelector return o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).List(options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { options.FieldSelector = fieldSelector return o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).Watch(options) }, } preconditionFunc := func(store cache.Store) (bool, error) { _, exists, err := store.Get(&metav1.ObjectMeta{Namespace: info.Namespace, Name: info.Name}) if err != nil { return true, err } if !exists { // We need to make sure we see the object in the cache before we start waiting for events // or we would be waiting for the timeout if such object didn't exist. return true, apierrors.NewNotFound(mapping.Resource.GroupResource(), info.Name) } return false, nil } // if the rollout isn't done yet, keep watching deployment status ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), o.Timeout) intr := interrupt.New(nil, cancel) return intr.Run(func() error { _, err = watchtools.UntilWithSync(ctx, lw, &unstructured.Unstructured{}, preconditionFunc, func(e watch.Event) (bool, error) { switch t := e.Type; t { case watch.Added, watch.Modified: status, done, err := statusViewer.Status(e.Object.(runtime.Unstructured), o.Revision) if err != nil { return false, err } fmt.Fprintf(o.Out, "%s", status) // Quit waiting if the rollout is done if done { return true, nil } shouldWatch := o.Watch if !shouldWatch { return true, nil } return false, nil case watch.Deleted: // We need to abort to avoid cases of recreation and not to silently watch the wrong (new) object return true, fmt.Errorf("object has been deleted") default: return true, fmt.Errorf("internal error: unexpected event %#v", e) } }) return err }) }
go
func (o *RolloutStatusOptions) Run() error { r := o.Builder(). WithScheme(scheme.Scheme, scheme.Scheme.PrioritizedVersionsAllGroups()...). NamespaceParam(o.Namespace).DefaultNamespace(). FilenameParam(o.EnforceNamespace, o.FilenameOptions). ResourceTypeOrNameArgs(true, o.BuilderArgs...). SingleResourceType(). Latest(). Do() err := r.Err() if err != nil { return err } infos, err := r.Infos() if err != nil { return err } if len(infos) != 1 { return fmt.Errorf("rollout status is only supported on individual resources and resource collections - %d resources were found", len(infos)) } info := infos[0] mapping := info.ResourceMapping() statusViewer, err := o.StatusViewerFn(mapping) if err != nil { return err } fieldSelector := fields.OneTermEqualSelector("metadata.name", info.Name).String() lw := &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { options.FieldSelector = fieldSelector return o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).List(options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { options.FieldSelector = fieldSelector return o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).Watch(options) }, } preconditionFunc := func(store cache.Store) (bool, error) { _, exists, err := store.Get(&metav1.ObjectMeta{Namespace: info.Namespace, Name: info.Name}) if err != nil { return true, err } if !exists { // We need to make sure we see the object in the cache before we start waiting for events // or we would be waiting for the timeout if such object didn't exist. return true, apierrors.NewNotFound(mapping.Resource.GroupResource(), info.Name) } return false, nil } // if the rollout isn't done yet, keep watching deployment status ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), o.Timeout) intr := interrupt.New(nil, cancel) return intr.Run(func() error { _, err = watchtools.UntilWithSync(ctx, lw, &unstructured.Unstructured{}, preconditionFunc, func(e watch.Event) (bool, error) { switch t := e.Type; t { case watch.Added, watch.Modified: status, done, err := statusViewer.Status(e.Object.(runtime.Unstructured), o.Revision) if err != nil { return false, err } fmt.Fprintf(o.Out, "%s", status) // Quit waiting if the rollout is done if done { return true, nil } shouldWatch := o.Watch if !shouldWatch { return true, nil } return false, nil case watch.Deleted: // We need to abort to avoid cases of recreation and not to silently watch the wrong (new) object return true, fmt.Errorf("object has been deleted") default: return true, fmt.Errorf("internal error: unexpected event %#v", e) } }) return err }) }
[ "func", "(", "o", "*", "RolloutStatusOptions", ")", "Run", "(", ")", "error", "{", "r", ":=", "o", ".", "Builder", "(", ")", ".", "WithScheme", "(", "scheme", ".", "Scheme", ",", "scheme", ".", "Scheme", ".", "PrioritizedVersionsAllGroups", "(", ")", "...
// Run performs the execution of 'rollout status' sub command
[ "Run", "performs", "the", "execution", "of", "rollout", "status", "sub", "command" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubectl/cmd/rollout/rollout_status.go#L163-L252
train
Run runs the rollout status command.
[ 30522, 4569, 2278, 1006, 1051, 1008, 4897, 12166, 29336, 26658, 16790, 2015, 1007, 2448, 1006, 1007, 7561, 1063, 1054, 1024, 1027, 1051, 1012, 12508, 1006, 1007, 1012, 2007, 22842, 4168, 1006, 5679, 1012, 5679, 1010, 5679, 1012, 5679, 1012,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
third_party/forked/gonum/graph/simple/undirected.go
NewNodeID
func (g *UndirectedGraph) NewNodeID() int { if len(g.nodes) == 0 { return 0 } if len(g.nodes) == maxInt { panic(fmt.Sprintf("simple: cannot allocate node: no slot")) } var id int if g.freeIDs.Len() != 0 && g.freeIDs.TakeMin(&id) { return id } if id = g.usedIDs.Max(); id < maxInt { return id + 1 } for id = 0; id < maxInt; id++ { if !g.usedIDs.Has(id) { return id } } panic("unreachable") }
go
func (g *UndirectedGraph) NewNodeID() int { if len(g.nodes) == 0 { return 0 } if len(g.nodes) == maxInt { panic(fmt.Sprintf("simple: cannot allocate node: no slot")) } var id int if g.freeIDs.Len() != 0 && g.freeIDs.TakeMin(&id) { return id } if id = g.usedIDs.Max(); id < maxInt { return id + 1 } for id = 0; id < maxInt; id++ { if !g.usedIDs.Has(id) { return id } } panic("unreachable") }
[ "func", "(", "g", "*", "UndirectedGraph", ")", "NewNodeID", "(", ")", "int", "{", "if", "len", "(", "g", ".", "nodes", ")", "==", "0", "{", "return", "0", "\n", "}", "\n", "if", "len", "(", "g", ".", "nodes", ")", "==", "maxInt", "{", "panic", ...
// NewNodeID returns a new unique ID for a node to be added to g. The returned ID does // not become a valid ID in g until it is added to g.
[ "NewNodeID", "returns", "a", "new", "unique", "ID", "for", "a", "node", "to", "be", "added", "to", "g", ".", "The", "returned", "ID", "does", "not", "become", "a", "valid", "ID", "in", "g", "until", "it", "is", "added", "to", "g", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/third_party/forked/gonum/graph/simple/undirected.go#L40-L61
train
NewNodeID returns a new node ID.
[ 30522, 4569, 2278, 1006, 1043, 1008, 6151, 7442, 10985, 14413, 1007, 2047, 3630, 3207, 3593, 1006, 1007, 20014, 1063, 2065, 18798, 1006, 1043, 1012, 14164, 1007, 1027, 1027, 1014, 1063, 2709, 1014, 1065, 2065, 18798, 1006, 1043, 1012, 14164...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/cli-runtime/pkg/kustomize/k8sdeps/transformer/patch/patch.go
NewPatchTransformer
func NewPatchTransformer( slice []*resource.Resource, rf *resource.Factory) (transformers.Transformer, error) { if len(slice) == 0 { return transformers.NewNoOpTransformer(), nil } return &patchTransformer{patches: slice, rf: rf}, nil }
go
func NewPatchTransformer( slice []*resource.Resource, rf *resource.Factory) (transformers.Transformer, error) { if len(slice) == 0 { return transformers.NewNoOpTransformer(), nil } return &patchTransformer{patches: slice, rf: rf}, nil }
[ "func", "NewPatchTransformer", "(", "slice", "[", "]", "*", "resource", ".", "Resource", ",", "rf", "*", "resource", ".", "Factory", ")", "(", "transformers", ".", "Transformer", ",", "error", ")", "{", "if", "len", "(", "slice", ")", "==", "0", "{", ...
// NewPatchTransformer constructs a patchTransformer.
[ "NewPatchTransformer", "constructs", "a", "patchTransformer", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/cli-runtime/pkg/kustomize/k8sdeps/transformer/patch/patch.go#L43-L49
train
NewPatchTransformer returns a new patch transformer.
[ 30522, 4569, 2278, 2047, 4502, 10649, 6494, 3619, 14192, 2121, 1006, 14704, 1031, 1033, 1008, 7692, 1012, 7692, 1010, 21792, 1008, 7692, 1012, 4713, 1007, 1006, 19081, 1012, 10938, 2121, 1010, 7561, 1007, 1063, 2065, 18798, 1006, 14704, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/core/zz_generated.deepcopy.go
DeepCopy
func (in *ConfigMapProjection) DeepCopy() *ConfigMapProjection { if in == nil { return nil } out := new(ConfigMapProjection) in.DeepCopyInto(out) return out }
go
func (in *ConfigMapProjection) DeepCopy() *ConfigMapProjection { if in == nil { return nil } out := new(ConfigMapProjection) in.DeepCopyInto(out) return out }
[ "func", "(", "in", "*", "ConfigMapProjection", ")", "DeepCopy", "(", ")", "*", "ConfigMapProjection", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "ConfigMapProjection", ")", "\n", "in", ".", "DeepCopyInto...
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapProjection.
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "ConfigMapProjection", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/zz_generated.deepcopy.go#L673-L680
train
DeepCopy is an autogenerated deepcopy function copying the receiver creating a new ConfigMapProjection.
[ 30522, 4569, 2278, 1006, 1999, 1008, 9530, 8873, 21693, 29098, 3217, 20614, 3258, 1007, 2784, 3597, 7685, 1006, 1007, 1008, 9530, 8873, 21693, 29098, 3217, 20614, 3258, 1063, 2065, 1999, 1027, 1027, 9152, 2140, 1063, 2709, 9152, 2140, 1065,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
cmd/kubeadm/app/cmd/phases/init/preflight.go
NewPreflightPhase
func NewPreflightPhase() workflow.Phase { return workflow.Phase{ Name: "preflight", Short: "Run pre-flight checks", Long: "Run pre-flight checks for kubeadm init.", Example: preflightExample, Run: runPreflight, InheritFlags: []string{ options.CfgPath, options.IgnorePreflightErrors, }, } }
go
func NewPreflightPhase() workflow.Phase { return workflow.Phase{ Name: "preflight", Short: "Run pre-flight checks", Long: "Run pre-flight checks for kubeadm init.", Example: preflightExample, Run: runPreflight, InheritFlags: []string{ options.CfgPath, options.IgnorePreflightErrors, }, } }
[ "func", "NewPreflightPhase", "(", ")", "workflow", ".", "Phase", "{", "return", "workflow", ".", "Phase", "{", "Name", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Long", ":", "\"", "\"", ",", "Example", ":", "preflightExample", ",", "Run", ...
// NewPreflightPhase creates a kubeadm workflow phase that implements preflight checks for a new control-plane node.
[ "NewPreflightPhase", "creates", "a", "kubeadm", "workflow", "phase", "that", "implements", "preflight", "checks", "for", "a", "new", "control", "-", "plane", "node", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/cmd/phases/init/preflight.go#L38-L50
train
NewPreflightPhase returns a new workflow phase for pre - flight checks
[ 30522, 4569, 2278, 2047, 28139, 28968, 21890, 3366, 1006, 1007, 2147, 12314, 1012, 4403, 1063, 2709, 2147, 12314, 1012, 4403, 1063, 2171, 1024, 1000, 3653, 28968, 1000, 1010, 2460, 1024, 1000, 2448, 3653, 1011, 3462, 14148, 1000, 1010, 2146...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/tools/cache/fake_custom_store.go
Replace
func (f *FakeCustomStore) Replace(list []interface{}, resourceVersion string) error { if f.ReplaceFunc != nil { return f.ReplaceFunc(list, resourceVersion) } return nil }
go
func (f *FakeCustomStore) Replace(list []interface{}, resourceVersion string) error { if f.ReplaceFunc != nil { return f.ReplaceFunc(list, resourceVersion) } return nil }
[ "func", "(", "f", "*", "FakeCustomStore", ")", "Replace", "(", "list", "[", "]", "interface", "{", "}", ",", "resourceVersion", "string", ")", "error", "{", "if", "f", ".", "ReplaceFunc", "!=", "nil", "{", "return", "f", ".", "ReplaceFunc", "(", "list"...
// Replace calls the custom Replace function if defined
[ "Replace", "calls", "the", "custom", "Replace", "function", "if", "defined" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/tools/cache/fake_custom_store.go#L89-L94
train
Replace is a mock
[ 30522, 4569, 2278, 1006, 1042, 1008, 8275, 7874, 20389, 23809, 2063, 1007, 5672, 1006, 2862, 1031, 1033, 8278, 1063, 1065, 1010, 7692, 27774, 5164, 1007, 7561, 1063, 2065, 1042, 1012, 5672, 11263, 12273, 999, 1027, 9152, 2140, 1063, 2709, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_storageclass.go
Watch
func (c *FakeStorageClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewRootWatchAction(storageclassesResource, opts)) }
go
func (c *FakeStorageClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewRootWatchAction(storageclassesResource, opts)) }
[ "func", "(", "c", "*", "FakeStorageClasses", ")", "Watch", "(", "opts", "v1", ".", "ListOptions", ")", "(", "watch", ".", "Interface", ",", "error", ")", "{", "return", "c", ".", "Fake", ".", "InvokesWatch", "(", "testing", ".", "NewRootWatchAction", "("...
// Watch returns a watch.Interface that watches the requested storageClasses.
[ "Watch", "returns", "a", "watch", ".", "Interface", "that", "watches", "the", "requested", "storageClasses", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_storageclass.go#L72-L75
train
Watch returns a watch. Interface that watches the requested storageClasses.
[ 30522, 4569, 2278, 1006, 1039, 1008, 8275, 23809, 4270, 26266, 2229, 1007, 3422, 1006, 23569, 2015, 1058, 2487, 1012, 2862, 7361, 9285, 1007, 1006, 3422, 1012, 8278, 1010, 7561, 1007, 1063, 2709, 1039, 1012, 8275, 1012, 1999, 6767, 9681, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
cmd/kubelet/app/server.go
RunKubelet
func RunKubelet(kubeServer *options.KubeletServer, kubeDeps *kubelet.Dependencies, runOnce bool) error { hostname, err := nodeutil.GetHostname(kubeServer.HostnameOverride) if err != nil { return err } // Query the cloud provider for our node name, default to hostname if kubeDeps.Cloud == nil nodeName, err := getNodeName(kubeDeps.Cloud, hostname) if err != nil { return err } // Setup event recorder if required. makeEventRecorder(kubeDeps, nodeName) // TODO(mtaufen): I moved the validation of these fields here, from UnsecuredKubeletConfig, // so that I could remove the associated fields from KubeletConfiginternal. I would // prefer this to be done as part of an independent validation step on the // KubeletConfiguration. But as far as I can tell, we don't have an explicit // place for validation of the KubeletConfiguration yet. hostNetworkSources, err := kubetypes.GetValidatedSources(kubeServer.HostNetworkSources) if err != nil { return err } hostPIDSources, err := kubetypes.GetValidatedSources(kubeServer.HostPIDSources) if err != nil { return err } hostIPCSources, err := kubetypes.GetValidatedSources(kubeServer.HostIPCSources) if err != nil { return err } privilegedSources := capabilities.PrivilegedSources{ HostNetworkSources: hostNetworkSources, HostPIDSources: hostPIDSources, HostIPCSources: hostIPCSources, } capabilities.Setup(kubeServer.AllowPrivileged, privilegedSources, 0) credentialprovider.SetPreferredDockercfgPath(kubeServer.RootDirectory) klog.V(2).Infof("Using root directory: %v", kubeServer.RootDirectory) if kubeDeps.OSInterface == nil { kubeDeps.OSInterface = kubecontainer.RealOS{} } k, err := createAndInitKubelet(&kubeServer.KubeletConfiguration, kubeDeps, &kubeServer.ContainerRuntimeOptions, kubeServer.ContainerRuntime, kubeServer.RuntimeCgroups, kubeServer.HostnameOverride, kubeServer.NodeIP, kubeServer.ProviderID, kubeServer.CloudProvider, kubeServer.CertDirectory, kubeServer.RootDirectory, kubeServer.RegisterNode, kubeServer.RegisterWithTaints, kubeServer.AllowedUnsafeSysctls, kubeServer.RemoteRuntimeEndpoint, kubeServer.RemoteImageEndpoint, kubeServer.ExperimentalMounterPath, kubeServer.ExperimentalKernelMemcgNotification, kubeServer.ExperimentalCheckNodeCapabilitiesBeforeMount, kubeServer.ExperimentalNodeAllocatableIgnoreEvictionThreshold, kubeServer.MinimumGCAge, kubeServer.MaxPerPodContainerCount, kubeServer.MaxContainerCount, kubeServer.MasterServiceNamespace, kubeServer.RegisterSchedulable, kubeServer.NonMasqueradeCIDR, kubeServer.KeepTerminatedPodVolumes, kubeServer.NodeLabels, kubeServer.SeccompProfileRoot, kubeServer.BootstrapCheckpointPath, kubeServer.NodeStatusMaxImages) if err != nil { return fmt.Errorf("failed to create kubelet: %v", err) } // NewMainKubelet should have set up a pod source config if one didn't exist // when the builder was run. This is just a precaution. if kubeDeps.PodConfig == nil { return fmt.Errorf("failed to create kubelet, pod source config was nil") } podCfg := kubeDeps.PodConfig rlimit.RlimitNumFiles(uint64(kubeServer.MaxOpenFiles)) // process pods and exit. if runOnce { if _, err := k.RunOnce(podCfg.Updates()); err != nil { return fmt.Errorf("runonce failed: %v", err) } klog.Info("Started kubelet as runonce") } else { startKubelet(k, podCfg, &kubeServer.KubeletConfiguration, kubeDeps, kubeServer.EnableServer) klog.Info("Started kubelet") } return nil }
go
func RunKubelet(kubeServer *options.KubeletServer, kubeDeps *kubelet.Dependencies, runOnce bool) error { hostname, err := nodeutil.GetHostname(kubeServer.HostnameOverride) if err != nil { return err } // Query the cloud provider for our node name, default to hostname if kubeDeps.Cloud == nil nodeName, err := getNodeName(kubeDeps.Cloud, hostname) if err != nil { return err } // Setup event recorder if required. makeEventRecorder(kubeDeps, nodeName) // TODO(mtaufen): I moved the validation of these fields here, from UnsecuredKubeletConfig, // so that I could remove the associated fields from KubeletConfiginternal. I would // prefer this to be done as part of an independent validation step on the // KubeletConfiguration. But as far as I can tell, we don't have an explicit // place for validation of the KubeletConfiguration yet. hostNetworkSources, err := kubetypes.GetValidatedSources(kubeServer.HostNetworkSources) if err != nil { return err } hostPIDSources, err := kubetypes.GetValidatedSources(kubeServer.HostPIDSources) if err != nil { return err } hostIPCSources, err := kubetypes.GetValidatedSources(kubeServer.HostIPCSources) if err != nil { return err } privilegedSources := capabilities.PrivilegedSources{ HostNetworkSources: hostNetworkSources, HostPIDSources: hostPIDSources, HostIPCSources: hostIPCSources, } capabilities.Setup(kubeServer.AllowPrivileged, privilegedSources, 0) credentialprovider.SetPreferredDockercfgPath(kubeServer.RootDirectory) klog.V(2).Infof("Using root directory: %v", kubeServer.RootDirectory) if kubeDeps.OSInterface == nil { kubeDeps.OSInterface = kubecontainer.RealOS{} } k, err := createAndInitKubelet(&kubeServer.KubeletConfiguration, kubeDeps, &kubeServer.ContainerRuntimeOptions, kubeServer.ContainerRuntime, kubeServer.RuntimeCgroups, kubeServer.HostnameOverride, kubeServer.NodeIP, kubeServer.ProviderID, kubeServer.CloudProvider, kubeServer.CertDirectory, kubeServer.RootDirectory, kubeServer.RegisterNode, kubeServer.RegisterWithTaints, kubeServer.AllowedUnsafeSysctls, kubeServer.RemoteRuntimeEndpoint, kubeServer.RemoteImageEndpoint, kubeServer.ExperimentalMounterPath, kubeServer.ExperimentalKernelMemcgNotification, kubeServer.ExperimentalCheckNodeCapabilitiesBeforeMount, kubeServer.ExperimentalNodeAllocatableIgnoreEvictionThreshold, kubeServer.MinimumGCAge, kubeServer.MaxPerPodContainerCount, kubeServer.MaxContainerCount, kubeServer.MasterServiceNamespace, kubeServer.RegisterSchedulable, kubeServer.NonMasqueradeCIDR, kubeServer.KeepTerminatedPodVolumes, kubeServer.NodeLabels, kubeServer.SeccompProfileRoot, kubeServer.BootstrapCheckpointPath, kubeServer.NodeStatusMaxImages) if err != nil { return fmt.Errorf("failed to create kubelet: %v", err) } // NewMainKubelet should have set up a pod source config if one didn't exist // when the builder was run. This is just a precaution. if kubeDeps.PodConfig == nil { return fmt.Errorf("failed to create kubelet, pod source config was nil") } podCfg := kubeDeps.PodConfig rlimit.RlimitNumFiles(uint64(kubeServer.MaxOpenFiles)) // process pods and exit. if runOnce { if _, err := k.RunOnce(podCfg.Updates()); err != nil { return fmt.Errorf("runonce failed: %v", err) } klog.Info("Started kubelet as runonce") } else { startKubelet(k, podCfg, &kubeServer.KubeletConfiguration, kubeDeps, kubeServer.EnableServer) klog.Info("Started kubelet") } return nil }
[ "func", "RunKubelet", "(", "kubeServer", "*", "options", ".", "KubeletServer", ",", "kubeDeps", "*", "kubelet", ".", "Dependencies", ",", "runOnce", "bool", ")", "error", "{", "hostname", ",", "err", ":=", "nodeutil", ".", "GetHostname", "(", "kubeServer", "...
// RunKubelet is responsible for setting up and running a kubelet. It is used in three different applications: // 1 Integration tests // 2 Kubelet binary // 3 Standalone 'kubernetes' binary // Eventually, #2 will be replaced with instances of #3
[ "RunKubelet", "is", "responsible", "for", "setting", "up", "and", "running", "a", "kubelet", ".", "It", "is", "used", "in", "three", "different", "applications", ":", "1", "Integration", "tests", "2", "Kubelet", "binary", "3", "Standalone", "kubernetes", "bina...
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubelet/app/server.go#L960-L1062
train
RunKubelet runs the kubelet
[ 30522, 4569, 2278, 2448, 5283, 8671, 3388, 1006, 13970, 12681, 2121, 6299, 1008, 7047, 1012, 13970, 8671, 8454, 2121, 6299, 1010, 13970, 8270, 13699, 2015, 1008, 13970, 8671, 3388, 1012, 12530, 15266, 1010, 2448, 2239, 3401, 22017, 2140, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/core/v1/zz_generated.conversion.go
Convert_core_LimitRange_To_v1_LimitRange
func Convert_core_LimitRange_To_v1_LimitRange(in *core.LimitRange, out *v1.LimitRange, s conversion.Scope) error { return autoConvert_core_LimitRange_To_v1_LimitRange(in, out, s) }
go
func Convert_core_LimitRange_To_v1_LimitRange(in *core.LimitRange, out *v1.LimitRange, s conversion.Scope) error { return autoConvert_core_LimitRange_To_v1_LimitRange(in, out, s) }
[ "func", "Convert_core_LimitRange_To_v1_LimitRange", "(", "in", "*", "core", ".", "LimitRange", ",", "out", "*", "v1", ".", "LimitRange", ",", "s", "conversion", ".", "Scope", ")", "error", "{", "return", "autoConvert_core_LimitRange_To_v1_LimitRange", "(", "in", "...
// Convert_core_LimitRange_To_v1_LimitRange is an autogenerated conversion function.
[ "Convert_core_LimitRange_To_v1_LimitRange", "is", "an", "autogenerated", "conversion", "function", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/v1/zz_generated.conversion.go#L3948-L3950
train
Convert_core_LimitRange_To_v1_LimitRange is an autogenerated conversion function.
[ 30522, 4569, 2278, 10463, 1035, 4563, 1035, 5787, 24388, 2063, 1035, 2000, 1035, 1058, 2487, 1035, 5787, 24388, 2063, 1006, 1999, 1008, 4563, 1012, 5787, 24388, 2063, 1010, 2041, 1008, 1058, 2487, 1012, 5787, 24388, 2063, 1010, 1055, 7584, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/rest/request.go
Stream
func (r *Request) Stream() (io.ReadCloser, error) { if r.err != nil { return nil, r.err } r.tryThrottle() url := r.URL().String() req, err := http.NewRequest(r.verb, url, nil) if err != nil { return nil, err } if r.ctx != nil { req = req.WithContext(r.ctx) } req.Header = r.headers client := r.client if client == nil { client = http.DefaultClient } r.backoffMgr.Sleep(r.backoffMgr.CalculateBackoff(r.URL())) resp, err := client.Do(req) updateURLMetrics(r, resp, err) if r.baseURL != nil { if err != nil { r.backoffMgr.UpdateBackoff(r.URL(), err, 0) } else { r.backoffMgr.UpdateBackoff(r.URL(), err, resp.StatusCode) } } if err != nil { return nil, err } switch { case (resp.StatusCode >= 200) && (resp.StatusCode < 300): return resp.Body, nil default: // ensure we close the body before returning the error defer resp.Body.Close() result := r.transformResponse(resp, req) err := result.Error() if err == nil { err = fmt.Errorf("%d while accessing %v: %s", result.statusCode, url, string(result.body)) } return nil, err } }
go
func (r *Request) Stream() (io.ReadCloser, error) { if r.err != nil { return nil, r.err } r.tryThrottle() url := r.URL().String() req, err := http.NewRequest(r.verb, url, nil) if err != nil { return nil, err } if r.ctx != nil { req = req.WithContext(r.ctx) } req.Header = r.headers client := r.client if client == nil { client = http.DefaultClient } r.backoffMgr.Sleep(r.backoffMgr.CalculateBackoff(r.URL())) resp, err := client.Do(req) updateURLMetrics(r, resp, err) if r.baseURL != nil { if err != nil { r.backoffMgr.UpdateBackoff(r.URL(), err, 0) } else { r.backoffMgr.UpdateBackoff(r.URL(), err, resp.StatusCode) } } if err != nil { return nil, err } switch { case (resp.StatusCode >= 200) && (resp.StatusCode < 300): return resp.Body, nil default: // ensure we close the body before returning the error defer resp.Body.Close() result := r.transformResponse(resp, req) err := result.Error() if err == nil { err = fmt.Errorf("%d while accessing %v: %s", result.statusCode, url, string(result.body)) } return nil, err } }
[ "func", "(", "r", "*", "Request", ")", "Stream", "(", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "if", "r", ".", "err", "!=", "nil", "{", "return", "nil", ",", "r", ".", "err", "\n", "}", "\n\n", "r", ".", "tryThrottle", "(", ...
// Stream formats and executes the request, and offers streaming of the response. // Returns io.ReadCloser which could be used for streaming of the response, or an error // Any non-2xx http status code causes an error. If we get a non-2xx code, we try to convert the body into an APIStatus object. // If we can, we return that as an error. Otherwise, we create an error that lists the http status and the content of the response.
[ "Stream", "formats", "and", "executes", "the", "request", "and", "offers", "streaming", "of", "the", "response", ".", "Returns", "io", ".", "ReadCloser", "which", "could", "be", "used", "for", "streaming", "of", "the", "response", "or", "an", "error", "Any",...
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/rest/request.go#L628-L677
train
Stream returns a stream of the response.
[ 30522, 4569, 2278, 1006, 1054, 1008, 5227, 1007, 5460, 1006, 1007, 1006, 22834, 1012, 3191, 20464, 9232, 2099, 1010, 7561, 1007, 1063, 2065, 1054, 1012, 9413, 2099, 999, 1027, 9152, 2140, 1063, 2709, 9152, 2140, 1010, 1054, 1012, 9413, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/authentication/v1/zz_generated.conversion.go
Convert_v1_TokenReviewStatus_To_authentication_TokenReviewStatus
func Convert_v1_TokenReviewStatus_To_authentication_TokenReviewStatus(in *v1.TokenReviewStatus, out *authentication.TokenReviewStatus, s conversion.Scope) error { return autoConvert_v1_TokenReviewStatus_To_authentication_TokenReviewStatus(in, out, s) }
go
func Convert_v1_TokenReviewStatus_To_authentication_TokenReviewStatus(in *v1.TokenReviewStatus, out *authentication.TokenReviewStatus, s conversion.Scope) error { return autoConvert_v1_TokenReviewStatus_To_authentication_TokenReviewStatus(in, out, s) }
[ "func", "Convert_v1_TokenReviewStatus_To_authentication_TokenReviewStatus", "(", "in", "*", "v1", ".", "TokenReviewStatus", ",", "out", "*", "authentication", ".", "TokenReviewStatus", ",", "s", "conversion", ".", "Scope", ")", "error", "{", "return", "autoConvert_v1_To...
// Convert_v1_TokenReviewStatus_To_authentication_TokenReviewStatus is an autogenerated conversion function.
[ "Convert_v1_TokenReviewStatus_To_authentication_TokenReviewStatus", "is", "an", "autogenerated", "conversion", "function", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/authentication/v1/zz_generated.conversion.go#L297-L299
train
Convert_v1_TokenReviewStatus_To_authentication_TokenReviewStatus is an autogenerated conversion function.
[ 30522, 4569, 2278, 10463, 1035, 1058, 2487, 1035, 19204, 2890, 8584, 9153, 5809, 1035, 2000, 1035, 27280, 1035, 19204, 2890, 8584, 9153, 5809, 1006, 1999, 1008, 1058, 2487, 1012, 19204, 2890, 8584, 9153, 5809, 1010, 2041, 1008, 27280, 1012,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/master/tunneler/ssh.go
Run
func (c *SSHTunneler) Run(getAddresses AddressFunc) { if c.stopChan != nil { return } c.stopChan = make(chan struct{}) // Save the address getter if getAddresses != nil { c.getAddresses = getAddresses } // Usernames are capped @ 32 if len(c.SSHUser) > 32 { klog.Warning("SSH User is too long, truncating to 32 chars") c.SSHUser = c.SSHUser[0:32] } klog.Infof("Setting up proxy: %s %s", c.SSHUser, c.SSHKeyfile) // public keyfile is written last, so check for that. publicKeyFile := c.SSHKeyfile + ".pub" exists, err := utilpath.Exists(utilpath.CheckFollowSymlink, publicKeyFile) if err != nil { klog.Errorf("Error detecting if key exists: %v", err) } else if !exists { klog.Infof("Key doesn't exist, attempting to create") if err := generateSSHKey(c.SSHKeyfile, publicKeyFile); err != nil { klog.Errorf("Failed to create key pair: %v", err) } } c.tunnels = ssh.NewSSHTunnelList(c.SSHUser, c.SSHKeyfile, c.HealthCheckURL, c.stopChan) // Sync loop to ensure that the SSH key has been installed. c.lastSSHKeySync = c.clock.Now().Unix() c.installSSHKeySyncLoop(c.SSHUser, publicKeyFile) // Sync tunnelList w/ nodes. c.lastSync = c.clock.Now().Unix() c.nodesSyncLoop() }
go
func (c *SSHTunneler) Run(getAddresses AddressFunc) { if c.stopChan != nil { return } c.stopChan = make(chan struct{}) // Save the address getter if getAddresses != nil { c.getAddresses = getAddresses } // Usernames are capped @ 32 if len(c.SSHUser) > 32 { klog.Warning("SSH User is too long, truncating to 32 chars") c.SSHUser = c.SSHUser[0:32] } klog.Infof("Setting up proxy: %s %s", c.SSHUser, c.SSHKeyfile) // public keyfile is written last, so check for that. publicKeyFile := c.SSHKeyfile + ".pub" exists, err := utilpath.Exists(utilpath.CheckFollowSymlink, publicKeyFile) if err != nil { klog.Errorf("Error detecting if key exists: %v", err) } else if !exists { klog.Infof("Key doesn't exist, attempting to create") if err := generateSSHKey(c.SSHKeyfile, publicKeyFile); err != nil { klog.Errorf("Failed to create key pair: %v", err) } } c.tunnels = ssh.NewSSHTunnelList(c.SSHUser, c.SSHKeyfile, c.HealthCheckURL, c.stopChan) // Sync loop to ensure that the SSH key has been installed. c.lastSSHKeySync = c.clock.Now().Unix() c.installSSHKeySyncLoop(c.SSHUser, publicKeyFile) // Sync tunnelList w/ nodes. c.lastSync = c.clock.Now().Unix() c.nodesSyncLoop() }
[ "func", "(", "c", "*", "SSHTunneler", ")", "Run", "(", "getAddresses", "AddressFunc", ")", "{", "if", "c", ".", "stopChan", "!=", "nil", "{", "return", "\n", "}", "\n", "c", ".", "stopChan", "=", "make", "(", "chan", "struct", "{", "}", ")", "\n\n"...
// Run establishes tunnel loops and returns
[ "Run", "establishes", "tunnel", "loops", "and", "returns" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/master/tunneler/ssh.go#L102-L139
train
Run starts the tunneler
[ 30522, 4569, 2278, 1006, 1039, 1008, 7020, 11039, 4609, 11877, 2121, 1007, 2448, 1006, 2131, 4215, 16200, 11393, 2015, 4769, 11263, 12273, 1007, 1063, 2065, 1039, 1012, 2644, 14856, 999, 1027, 9152, 2140, 1063, 2709, 1065, 1039, 1012, 2644,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/cloudprovider/providers/gce/gce_address_manager.go
HoldAddress
func (am *addressManager) HoldAddress() (string, error) { // HoldAddress starts with retrieving the address that we use for this load balancer (by name). // Retrieving an address by IP will indicate if the IP is reserved and if reserved by the user // or the controller, but won't tell us the current state of the controller's IP. The address // could be reserving another address; therefore, it would need to be deleted. In the normal // case of using a controller address, retrieving the address by name results in the fewest API // calls since it indicates whether a Delete is necessary before Reserve. klog.V(4).Infof("%v: attempting hold of IP %q Type %q", am.logPrefix, am.targetIP, am.addressType) // Get the address in case it was orphaned earlier addr, err := am.svc.GetRegionAddress(am.name, am.region) if err != nil && !isNotFound(err) { return "", err } if addr != nil { // If address exists, check if the address had the expected attributes. validationError := am.validateAddress(addr) if validationError == nil { klog.V(4).Infof("%v: address %q already reserves IP %q Type %q. No further action required.", am.logPrefix, addr.Name, addr.Address, addr.AddressType) return addr.Address, nil } klog.V(2).Infof("%v: deleting existing address because %v", am.logPrefix, validationError) err := am.svc.DeleteRegionAddress(addr.Name, am.region) if err != nil { if isNotFound(err) { klog.V(4).Infof("%v: address %q was not found. Ignoring.", am.logPrefix, addr.Name) } else { return "", err } } else { klog.V(4).Infof("%v: successfully deleted previous address %q", am.logPrefix, addr.Name) } } return am.ensureAddressReservation() }
go
func (am *addressManager) HoldAddress() (string, error) { // HoldAddress starts with retrieving the address that we use for this load balancer (by name). // Retrieving an address by IP will indicate if the IP is reserved and if reserved by the user // or the controller, but won't tell us the current state of the controller's IP. The address // could be reserving another address; therefore, it would need to be deleted. In the normal // case of using a controller address, retrieving the address by name results in the fewest API // calls since it indicates whether a Delete is necessary before Reserve. klog.V(4).Infof("%v: attempting hold of IP %q Type %q", am.logPrefix, am.targetIP, am.addressType) // Get the address in case it was orphaned earlier addr, err := am.svc.GetRegionAddress(am.name, am.region) if err != nil && !isNotFound(err) { return "", err } if addr != nil { // If address exists, check if the address had the expected attributes. validationError := am.validateAddress(addr) if validationError == nil { klog.V(4).Infof("%v: address %q already reserves IP %q Type %q. No further action required.", am.logPrefix, addr.Name, addr.Address, addr.AddressType) return addr.Address, nil } klog.V(2).Infof("%v: deleting existing address because %v", am.logPrefix, validationError) err := am.svc.DeleteRegionAddress(addr.Name, am.region) if err != nil { if isNotFound(err) { klog.V(4).Infof("%v: address %q was not found. Ignoring.", am.logPrefix, addr.Name) } else { return "", err } } else { klog.V(4).Infof("%v: successfully deleted previous address %q", am.logPrefix, addr.Name) } } return am.ensureAddressReservation() }
[ "func", "(", "am", "*", "addressManager", ")", "HoldAddress", "(", ")", "(", "string", ",", "error", ")", "{", "// HoldAddress starts with retrieving the address that we use for this load balancer (by name).", "// Retrieving an address by IP will indicate if the IP is reserved and if...
// HoldAddress will ensure that the IP is reserved with an address - either owned by the controller // or by a user. If the address is not the addressManager.name, then it's assumed to be a user's address. // The string returned is the reserved IP address.
[ "HoldAddress", "will", "ensure", "that", "the", "IP", "is", "reserved", "with", "an", "address", "-", "either", "owned", "by", "the", "controller", "or", "by", "a", "user", ".", "If", "the", "address", "is", "not", "the", "addressManager", ".", "name", "...
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/cloudprovider/providers/gce/gce_address_manager.go#L58-L94
train
HoldAddress returns the address that was previously allocated.
[ 30522, 4569, 2278, 1006, 2572, 1008, 4769, 24805, 4590, 1007, 2907, 4215, 16200, 4757, 1006, 1007, 1006, 5164, 1010, 7561, 1007, 1063, 1013, 1013, 2907, 4215, 16200, 4757, 4627, 2007, 2128, 18886, 23559, 1996, 4769, 2008, 2057, 2224, 2005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/apimachinery/pkg/api/meta/meta.go
extractFromOwnerReference
func extractFromOwnerReference(v reflect.Value, o *metav1.OwnerReference) error { if err := runtime.Field(v, "APIVersion", &o.APIVersion); err != nil { return err } if err := runtime.Field(v, "Kind", &o.Kind); err != nil { return err } if err := runtime.Field(v, "Name", &o.Name); err != nil { return err } if err := runtime.Field(v, "UID", &o.UID); err != nil { return err } var controllerPtr *bool if err := runtime.Field(v, "Controller", &controllerPtr); err != nil { return err } if controllerPtr != nil { controller := *controllerPtr o.Controller = &controller } var blockOwnerDeletionPtr *bool if err := runtime.Field(v, "BlockOwnerDeletion", &blockOwnerDeletionPtr); err != nil { return err } if blockOwnerDeletionPtr != nil { block := *blockOwnerDeletionPtr o.BlockOwnerDeletion = &block } return nil }
go
func extractFromOwnerReference(v reflect.Value, o *metav1.OwnerReference) error { if err := runtime.Field(v, "APIVersion", &o.APIVersion); err != nil { return err } if err := runtime.Field(v, "Kind", &o.Kind); err != nil { return err } if err := runtime.Field(v, "Name", &o.Name); err != nil { return err } if err := runtime.Field(v, "UID", &o.UID); err != nil { return err } var controllerPtr *bool if err := runtime.Field(v, "Controller", &controllerPtr); err != nil { return err } if controllerPtr != nil { controller := *controllerPtr o.Controller = &controller } var blockOwnerDeletionPtr *bool if err := runtime.Field(v, "BlockOwnerDeletion", &blockOwnerDeletionPtr); err != nil { return err } if blockOwnerDeletionPtr != nil { block := *blockOwnerDeletionPtr o.BlockOwnerDeletion = &block } return nil }
[ "func", "extractFromOwnerReference", "(", "v", "reflect", ".", "Value", ",", "o", "*", "metav1", ".", "OwnerReference", ")", "error", "{", "if", "err", ":=", "runtime", ".", "Field", "(", "v", ",", "\"", "\"", ",", "&", "o", ".", "APIVersion", ")", "...
// extractFromOwnerReference extracts v to o. v is the OwnerReferences field of an object.
[ "extractFromOwnerReference", "extracts", "v", "to", "o", ".", "v", "is", "the", "OwnerReferences", "field", "of", "an", "object", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/api/meta/meta.go#L385-L415
train
extractFromOwnerReference extracts the fields from the given owner reference.
[ 30522, 30524, 1027, 2448, 7292, 1012, 2492, 1006, 1058, 1010, 1000, 17928, 27774, 1000, 1010, 1004, 1051, 1012, 17928, 27774, 1007, 1025, 9413, 2099, 999, 1027, 9152, 2140, 1063, 2709, 9413, 2099, 1065, 2065, 9413, 2099, 1024, 1027, 2448, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
cmd/kubeadm/app/phases/markcontrolplane/markcontrolplane.go
MarkControlPlane
func MarkControlPlane(client clientset.Interface, controlPlaneName string, taints []v1.Taint) error { fmt.Printf("[mark-control-plane] Marking the node %s as control-plane by adding the label \"%s=''\"\n", controlPlaneName, constants.LabelNodeRoleMaster) if len(taints) > 0 { taintStrs := []string{} for _, taint := range taints { taintStrs = append(taintStrs, taint.ToString()) } fmt.Printf("[mark-control-plane] Marking the node %s as control-plane by adding the taints %v\n", controlPlaneName, taintStrs) } return apiclient.PatchNode(client, controlPlaneName, func(n *v1.Node) { markControlPlaneNode(n, taints) }) }
go
func MarkControlPlane(client clientset.Interface, controlPlaneName string, taints []v1.Taint) error { fmt.Printf("[mark-control-plane] Marking the node %s as control-plane by adding the label \"%s=''\"\n", controlPlaneName, constants.LabelNodeRoleMaster) if len(taints) > 0 { taintStrs := []string{} for _, taint := range taints { taintStrs = append(taintStrs, taint.ToString()) } fmt.Printf("[mark-control-plane] Marking the node %s as control-plane by adding the taints %v\n", controlPlaneName, taintStrs) } return apiclient.PatchNode(client, controlPlaneName, func(n *v1.Node) { markControlPlaneNode(n, taints) }) }
[ "func", "MarkControlPlane", "(", "client", "clientset", ".", "Interface", ",", "controlPlaneName", "string", ",", "taints", "[", "]", "v1", ".", "Taint", ")", "error", "{", "fmt", ".", "Printf", "(", "\"", "\\\"", "\\\"", "\\n", "\"", ",", "controlPlaneNam...
// MarkControlPlane taints the control-plane and sets the control-plane label
[ "MarkControlPlane", "taints", "the", "control", "-", "plane", "and", "sets", "the", "control", "-", "plane", "label" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/phases/markcontrolplane/markcontrolplane.go#L29-L44
train
MarkControlPlane marks a control - plane node.
[ 30522, 4569, 2278, 2928, 8663, 13181, 14277, 20644, 1006, 7396, 7846, 3388, 1012, 8278, 1010, 2491, 11751, 18442, 5164, 1010, 13843, 7666, 1031, 1033, 1058, 2487, 1012, 13843, 3372, 1007, 7561, 1063, 4718, 2102, 1012, 6140, 2546, 1006, 1000...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/controller/podautoscaler/config/zz_generated.deepcopy.go
DeepCopy
func (in *HPAControllerConfiguration) DeepCopy() *HPAControllerConfiguration { if in == nil { return nil } out := new(HPAControllerConfiguration) in.DeepCopyInto(out) return out }
go
func (in *HPAControllerConfiguration) DeepCopy() *HPAControllerConfiguration { if in == nil { return nil } out := new(HPAControllerConfiguration) in.DeepCopyInto(out) return out }
[ "func", "(", "in", "*", "HPAControllerConfiguration", ")", "DeepCopy", "(", ")", "*", "HPAControllerConfiguration", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "HPAControllerConfiguration", ")", "\n", "in", ...
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HPAControllerConfiguration.
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "HPAControllerConfiguration", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/podautoscaler/config/zz_generated.deepcopy.go#L36-L43
train
DeepCopy is an autogenerated deepcopy function copying the receiver creating a new HPAControllerConfiguration.
[ 30522, 4569, 2278, 1006, 1999, 1008, 6522, 22684, 3372, 26611, 8663, 8873, 27390, 3370, 1007, 2784, 3597, 7685, 1006, 1007, 1008, 6522, 22684, 3372, 26611, 8663, 8873, 27390, 3370, 1063, 2065, 1999, 1027, 1027, 9152, 2140, 1063, 2709, 9152,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/util/workqueue/queue.go
ShutDown
func (q *Type) ShutDown() { q.cond.L.Lock() defer q.cond.L.Unlock() q.shuttingDown = true q.cond.Broadcast() }
go
func (q *Type) ShutDown() { q.cond.L.Lock() defer q.cond.L.Unlock() q.shuttingDown = true q.cond.Broadcast() }
[ "func", "(", "q", "*", "Type", ")", "ShutDown", "(", ")", "{", "q", ".", "cond", ".", "L", ".", "Lock", "(", ")", "\n", "defer", "q", ".", "cond", ".", "L", ".", "Unlock", "(", ")", "\n", "q", ".", "shuttingDown", "=", "true", "\n", "q", "....
// ShutDown will cause q to ignore all new items added to it. As soon as the // worker goroutines have drained the existing items in the queue, they will be // instructed to exit.
[ "ShutDown", "will", "cause", "q", "to", "ignore", "all", "new", "items", "added", "to", "it", ".", "As", "soon", "as", "the", "worker", "goroutines", "have", "drained", "the", "existing", "items", "in", "the", "queue", "they", "will", "be", "instructed", ...
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/util/workqueue/queue.go#L181-L186
train
ShutDown shuts down the transaction.
[ 30522, 4569, 2278, 1006, 1053, 1008, 2828, 1007, 3844, 7698, 1006, 1007, 1063, 1053, 1012, 9530, 2094, 1012, 1048, 1012, 5843, 1006, 1007, 13366, 2121, 1053, 1012, 9530, 2094, 1012, 1048, 1012, 19829, 1006, 1007, 1053, 1012, 17521, 7698, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/clientset/versioned/typed/cr/v1/fake/fake_example.go
Patch
func (c *FakeExamples) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *crv1.Example, err error) { obj, err := c.Fake. Invokes(testing.NewPatchSubresourceAction(examplesResource, c.ns, name, pt, data, subresources...), &crv1.Example{}) if obj == nil { return nil, err } return obj.(*crv1.Example), err }
go
func (c *FakeExamples) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *crv1.Example, err error) { obj, err := c.Fake. Invokes(testing.NewPatchSubresourceAction(examplesResource, c.ns, name, pt, data, subresources...), &crv1.Example{}) if obj == nil { return nil, err } return obj.(*crv1.Example), err }
[ "func", "(", "c", "*", "FakeExamples", ")", "Patch", "(", "name", "string", ",", "pt", "types", ".", "PatchType", ",", "data", "[", "]", "byte", ",", "subresources", "...", "string", ")", "(", "result", "*", "crv1", ".", "Example", ",", "err", "error...
// Patch applies the patch and returns the patched example.
[ "Patch", "applies", "the", "patch", "and", "returns", "the", "patched", "example", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/clientset/versioned/typed/cr/v1/fake/fake_example.go#L120-L128
train
Patch applies the patch and returns the patched example.
[ 30522, 4569, 2278, 1006, 1039, 1008, 8275, 10288, 16613, 4244, 1007, 8983, 1006, 2171, 5164, 1010, 13866, 4127, 1012, 8983, 13874, 1010, 2951, 1031, 1033, 24880, 1010, 4942, 6072, 8162, 9623, 1012, 1012, 1012, 5164, 1007, 1006, 2765, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubectl/cmd/util/kubectl_match_version.go
ToRESTConfig
func (f *MatchVersionFlags) ToRESTConfig() (*rest.Config, error) { if err := f.checkMatchingServerVersion(); err != nil { return nil, err } clientConfig, err := f.Delegate.ToRESTConfig() if err != nil { return nil, err } // TODO we should not have to do this. It smacks of something going wrong. setKubernetesDefaults(clientConfig) return clientConfig, nil }
go
func (f *MatchVersionFlags) ToRESTConfig() (*rest.Config, error) { if err := f.checkMatchingServerVersion(); err != nil { return nil, err } clientConfig, err := f.Delegate.ToRESTConfig() if err != nil { return nil, err } // TODO we should not have to do this. It smacks of something going wrong. setKubernetesDefaults(clientConfig) return clientConfig, nil }
[ "func", "(", "f", "*", "MatchVersionFlags", ")", "ToRESTConfig", "(", ")", "(", "*", "rest", ".", "Config", ",", "error", ")", "{", "if", "err", ":=", "f", ".", "checkMatchingServerVersion", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",...
// ToRESTConfig implements RESTClientGetter. // Returns a REST client configuration based on a provided path // to a .kubeconfig file, loading rules, and config flag overrides. // Expects the AddFlags method to have been called.
[ "ToRESTConfig", "implements", "RESTClientGetter", ".", "Returns", "a", "REST", "client", "configuration", "based", "on", "a", "provided", "path", "to", "a", ".", "kubeconfig", "file", "loading", "rules", "and", "config", "flag", "overrides", ".", "Expects", "the...
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubectl/cmd/util/kubectl_match_version.go#L70-L81
train
ToRESTConfig returns the RESTConfig for the server
[ 30522, 4569, 2278, 1006, 1042, 1008, 2674, 27774, 10258, 26454, 1007, 9538, 3367, 8663, 8873, 2290, 1006, 1007, 1006, 1008, 2717, 1012, 9530, 8873, 2290, 1010, 7561, 1007, 1063, 2065, 9413, 2099, 1024, 1027, 1042, 1012, 4638, 18900, 8450, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/controller/volume/persistentvolume/pv_controller_base.go
deleteVolume
func (ctrl *PersistentVolumeController) deleteVolume(volume *v1.PersistentVolume) { _ = ctrl.volumes.store.Delete(volume) klog.V(4).Infof("volume %q deleted", volume.Name) if volume.Spec.ClaimRef == nil { return } // sync the claim when its volume is deleted. Explicitly syncing the // claim here in response to volume deletion prevents the claim from // waiting until the next sync period for its Lost status. claimKey := claimrefToClaimKey(volume.Spec.ClaimRef) klog.V(5).Infof("deleteVolume[%s]: scheduling sync of claim %q", volume.Name, claimKey) ctrl.claimQueue.Add(claimKey) }
go
func (ctrl *PersistentVolumeController) deleteVolume(volume *v1.PersistentVolume) { _ = ctrl.volumes.store.Delete(volume) klog.V(4).Infof("volume %q deleted", volume.Name) if volume.Spec.ClaimRef == nil { return } // sync the claim when its volume is deleted. Explicitly syncing the // claim here in response to volume deletion prevents the claim from // waiting until the next sync period for its Lost status. claimKey := claimrefToClaimKey(volume.Spec.ClaimRef) klog.V(5).Infof("deleteVolume[%s]: scheduling sync of claim %q", volume.Name, claimKey) ctrl.claimQueue.Add(claimKey) }
[ "func", "(", "ctrl", "*", "PersistentVolumeController", ")", "deleteVolume", "(", "volume", "*", "v1", ".", "PersistentVolume", ")", "{", "_", "=", "ctrl", ".", "volumes", ".", "store", ".", "Delete", "(", "volume", ")", "\n", "klog", ".", "V", "(", "4...
// deleteVolume runs in worker thread and handles "volume deleted" event.
[ "deleteVolume", "runs", "in", "worker", "thread", "and", "handles", "volume", "deleted", "event", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/volume/persistentvolume/pv_controller_base.go#L208-L221
train
deleteVolume deletes a volume from the store.
[ 30522, 4569, 2278, 1006, 14931, 12190, 1008, 14516, 6767, 12942, 8586, 12162, 26611, 1007, 3972, 12870, 6767, 12942, 2063, 1006, 3872, 1008, 1058, 2487, 1012, 14516, 6767, 12942, 2063, 1007, 1063, 1035, 1027, 14931, 12190, 1012, 6702, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/util/jsonpath/jsonpath.go
evalFloat
func (j *JSONPath) evalFloat(input []reflect.Value, node *FloatNode) ([]reflect.Value, error) { result := make([]reflect.Value, len(input)) for i := range input { result[i] = reflect.ValueOf(node.Value) } return result, nil }
go
func (j *JSONPath) evalFloat(input []reflect.Value, node *FloatNode) ([]reflect.Value, error) { result := make([]reflect.Value, len(input)) for i := range input { result[i] = reflect.ValueOf(node.Value) } return result, nil }
[ "func", "(", "j", "*", "JSONPath", ")", "evalFloat", "(", "input", "[", "]", "reflect", ".", "Value", ",", "node", "*", "FloatNode", ")", "(", "[", "]", "reflect", ".", "Value", ",", "error", ")", "{", "result", ":=", "make", "(", "[", "]", "refl...
// evalFloat evaluates FloatNode
[ "evalFloat", "evaluates", "FloatNode" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/util/jsonpath/jsonpath.go#L180-L186
train
evalFloat evaluates a float value
[ 30522, 4569, 2278, 1006, 1046, 1008, 1046, 3385, 15069, 1007, 9345, 10270, 4135, 4017, 1006, 7953, 1031, 1033, 8339, 1012, 3643, 1010, 13045, 1008, 14257, 3630, 3207, 1007, 1006, 1031, 1033, 8339, 1012, 3643, 1010, 7561, 1007, 1063, 2765, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_service.go
Get
func (c *FakeServices) Get(name string, options v1.GetOptions) (result *corev1.Service, err error) { obj, err := c.Fake. Invokes(testing.NewGetAction(servicesResource, c.ns, name), &corev1.Service{}) if obj == nil { return nil, err } return obj.(*corev1.Service), err }
go
func (c *FakeServices) Get(name string, options v1.GetOptions) (result *corev1.Service, err error) { obj, err := c.Fake. Invokes(testing.NewGetAction(servicesResource, c.ns, name), &corev1.Service{}) if obj == nil { return nil, err } return obj.(*corev1.Service), err }
[ "func", "(", "c", "*", "FakeServices", ")", "Get", "(", "name", "string", ",", "options", "v1", ".", "GetOptions", ")", "(", "result", "*", "corev1", ".", "Service", ",", "err", "error", ")", "{", "obj", ",", "err", ":=", "c", ".", "Fake", ".", "...
// Get takes name of the service, and returns the corresponding service object, and an error if there is any.
[ "Get", "takes", "name", "of", "the", "service", "and", "returns", "the", "corresponding", "service", "object", "and", "an", "error", "if", "there", "is", "any", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_service.go#L42-L50
train
Get takes name of the service and returns the corresponding service object and an error if there is any.
[ 30522, 4569, 2278, 1006, 1039, 1008, 8275, 8043, 7903, 2229, 1007, 2131, 1006, 2171, 5164, 1010, 7047, 1058, 2487, 1012, 2131, 7361, 9285, 1007, 1006, 2765, 1008, 4563, 2615, 2487, 1012, 2326, 1010, 9413, 2099, 7561, 1007, 1063, 27885, 35...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/apimachinery/pkg/util/errors/errors.go
matchesError
func matchesError(err error, fns ...Matcher) bool { for _, fn := range fns { if fn(err) { return true } } return false }
go
func matchesError(err error, fns ...Matcher) bool { for _, fn := range fns { if fn(err) { return true } } return false }
[ "func", "matchesError", "(", "err", "error", ",", "fns", "...", "Matcher", ")", "bool", "{", "for", "_", ",", "fn", ":=", "range", "fns", "{", "if", "fn", "(", "err", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n"...
// matchesError returns true if any Matcher returns true
[ "matchesError", "returns", "true", "if", "any", "Matcher", "returns", "true" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/util/errors/errors.go#L135-L142
train
matchesError returns true if the error matches any of the matchers.
[ 30522, 4569, 2278, 3503, 2121, 29165, 1006, 9413, 2099, 7561, 1010, 1042, 3619, 1012, 1012, 1012, 2674, 2121, 1007, 22017, 2140, 1063, 2005, 1035, 1010, 1042, 2078, 1024, 1027, 2846, 1042, 3619, 1063, 2065, 1042, 2078, 1006, 9413, 2099, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/core/v1/zz_generated.conversion.go
Convert_core_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource
func Convert_core_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in *core.AWSElasticBlockStoreVolumeSource, out *v1.AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { return autoConvert_core_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in, out, s) }
go
func Convert_core_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in *core.AWSElasticBlockStoreVolumeSource, out *v1.AWSElasticBlockStoreVolumeSource, s conversion.Scope) error { return autoConvert_core_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource(in, out, s) }
[ "func", "Convert_core_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource", "(", "in", "*", "core", ".", "AWSElasticBlockStoreVolumeSource", ",", "out", "*", "v1", ".", "AWSElasticBlockStoreVolumeSource", ",", "s", "conversion", ".", "Scope", ")", "error",...
// Convert_core_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource is an autogenerated conversion function.
[ "Convert_core_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource", "is", "an", "autogenerated", "conversion", "function", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/v1/zz_generated.conversion.go#L2128-L2130
train
Convert_core_AWSElasticBlockStoreVolumeSource_To_v1_AWSElasticBlockStoreVolumeSource is an autogenerated conversion function.
[ 30522, 4569, 2278, 10463, 1035, 4563, 1035, 22091, 11246, 20875, 23467, 23809, 6777, 4747, 17897, 6499, 3126, 3401, 1035, 2000, 1035, 1058, 2487, 1035, 22091, 11246, 20875, 23467, 23809, 6777, 4747, 17897, 6499, 3126, 3401, 1006, 1999, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
cmd/kubeadm/app/phases/certs/certs.go
writeCSRFilesIfNotExist
func writeCSRFilesIfNotExist(csrDir string, baseName string, csr *x509.CertificateRequest, key crypto.Signer) error { if pkiutil.CSROrKeyExist(csrDir, baseName) { _, _, err := pkiutil.TryLoadCSRAndKeyFromDisk(csrDir, baseName) if err != nil { return errors.Wrapf(err, "%s CSR existed but it could not be loaded properly", baseName) } fmt.Printf("[certs] Using the existing %q CSR\n", baseName) } else { // Write .key and .csr files to disk fmt.Printf("[certs] Generating %q key and CSR\n", baseName) if err := pkiutil.WriteKey(csrDir, baseName, key); err != nil { return errors.Wrapf(err, "failure while saving %s key", baseName) } if err := pkiutil.WriteCSR(csrDir, baseName, csr); err != nil { return errors.Wrapf(err, "failure while saving %s CSR", baseName) } } return nil }
go
func writeCSRFilesIfNotExist(csrDir string, baseName string, csr *x509.CertificateRequest, key crypto.Signer) error { if pkiutil.CSROrKeyExist(csrDir, baseName) { _, _, err := pkiutil.TryLoadCSRAndKeyFromDisk(csrDir, baseName) if err != nil { return errors.Wrapf(err, "%s CSR existed but it could not be loaded properly", baseName) } fmt.Printf("[certs] Using the existing %q CSR\n", baseName) } else { // Write .key and .csr files to disk fmt.Printf("[certs] Generating %q key and CSR\n", baseName) if err := pkiutil.WriteKey(csrDir, baseName, key); err != nil { return errors.Wrapf(err, "failure while saving %s key", baseName) } if err := pkiutil.WriteCSR(csrDir, baseName, csr); err != nil { return errors.Wrapf(err, "failure while saving %s CSR", baseName) } } return nil }
[ "func", "writeCSRFilesIfNotExist", "(", "csrDir", "string", ",", "baseName", "string", ",", "csr", "*", "x509", ".", "CertificateRequest", ",", "key", "crypto", ".", "Signer", ")", "error", "{", "if", "pkiutil", ".", "CSROrKeyExist", "(", "csrDir", ",", "bas...
// writeCSRFilesIfNotExist writes a new CSR to the given path. // If there already is a CSR file at the given path; kubeadm tries to load it and check if it's a valid certificate. // otherwise this function returns an error.
[ "writeCSRFilesIfNotExist", "writes", "a", "new", "CSR", "to", "the", "given", "path", ".", "If", "there", "already", "is", "a", "CSR", "file", "at", "the", "given", "path", ";", "kubeadm", "tries", "to", "load", "it", "and", "check", "if", "it", "s", "...
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/phases/certs/certs.go#L257-L279
train
writeCSRFilesIfNotExist writes the given CSR to disk if it does not exist.
[ 30522, 4569, 2278, 4339, 6169, 12881, 9463, 5332, 2546, 22074, 9048, 3367, 1006, 20116, 17080, 2099, 5164, 1010, 2918, 18442, 5164, 1010, 20116, 2099, 1008, 1060, 12376, 2683, 1012, 8196, 2890, 15500, 1010, 3145, 19888, 2080, 1012, 3696, 21...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubelet/cm/cpuset/cpuset.go
Equals
func (s CPUSet) Equals(s2 CPUSet) bool { return reflect.DeepEqual(s.elems, s2.elems) }
go
func (s CPUSet) Equals(s2 CPUSet) bool { return reflect.DeepEqual(s.elems, s2.elems) }
[ "func", "(", "s", "CPUSet", ")", "Equals", "(", "s2", "CPUSet", ")", "bool", "{", "return", "reflect", ".", "DeepEqual", "(", "s", ".", "elems", ",", "s2", ".", "elems", ")", "\n", "}" ]
// Equals returns true if the supplied set contains exactly the same elements // as this set (s IsSubsetOf s2 and s2 IsSubsetOf s).
[ "Equals", "returns", "true", "if", "the", "supplied", "set", "contains", "exactly", "the", "same", "elements", "as", "this", "set", "(", "s", "IsSubsetOf", "s2", "and", "s2", "IsSubsetOf", "s", ")", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/cm/cpuset/cpuset.go#L95-L97
train
Equals returns true if the two CPU sets are equal.
[ 30522, 4569, 2278, 1006, 1055, 17368, 13462, 1007, 19635, 1006, 1055, 2475, 17368, 13462, 1007, 22017, 2140, 1063, 2709, 8339, 1012, 2784, 2063, 26426, 1006, 1055, 1012, 3449, 6633, 2015, 1010, 1055, 2475, 1012, 3449, 6633, 2015, 1007, 1065...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
cmd/kubeadm/app/cmd/upgrade/apply.go
DryRunStaticPodUpgrade
func DryRunStaticPodUpgrade(internalcfg *kubeadmapi.InitConfiguration) error { dryRunManifestDir, err := constants.CreateTempDirForKubeadm("kubeadm-upgrade-dryrun") if err != nil { return err } defer os.RemoveAll(dryRunManifestDir) if err := controlplane.CreateInitStaticPodManifestFiles(dryRunManifestDir, internalcfg); err != nil { return err } // Print the contents of the upgraded manifests and pretend like they were in /etc/kubernetes/manifests files := []dryrunutil.FileToPrint{} for _, component := range constants.ControlPlaneComponents { realPath := constants.GetStaticPodFilepath(component, dryRunManifestDir) outputPath := constants.GetStaticPodFilepath(component, constants.GetStaticPodDirectory()) files = append(files, dryrunutil.NewFileToPrint(realPath, outputPath)) } return dryrunutil.PrintDryRunFiles(files, os.Stdout) }
go
func DryRunStaticPodUpgrade(internalcfg *kubeadmapi.InitConfiguration) error { dryRunManifestDir, err := constants.CreateTempDirForKubeadm("kubeadm-upgrade-dryrun") if err != nil { return err } defer os.RemoveAll(dryRunManifestDir) if err := controlplane.CreateInitStaticPodManifestFiles(dryRunManifestDir, internalcfg); err != nil { return err } // Print the contents of the upgraded manifests and pretend like they were in /etc/kubernetes/manifests files := []dryrunutil.FileToPrint{} for _, component := range constants.ControlPlaneComponents { realPath := constants.GetStaticPodFilepath(component, dryRunManifestDir) outputPath := constants.GetStaticPodFilepath(component, constants.GetStaticPodDirectory()) files = append(files, dryrunutil.NewFileToPrint(realPath, outputPath)) } return dryrunutil.PrintDryRunFiles(files, os.Stdout) }
[ "func", "DryRunStaticPodUpgrade", "(", "internalcfg", "*", "kubeadmapi", ".", "InitConfiguration", ")", "error", "{", "dryRunManifestDir", ",", "err", ":=", "constants", ".", "CreateTempDirForKubeadm", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", ...
// DryRunStaticPodUpgrade fakes an upgrade of the control plane
[ "DryRunStaticPodUpgrade", "fakes", "an", "upgrade", "of", "the", "control", "plane" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/cmd/upgrade/apply.go#L258-L279
train
DryRunStaticPodUpgrade upgrades the static pod manifest files
[ 30522, 4569, 2278, 4318, 15532, 16677, 27633, 6279, 24170, 1006, 4722, 2278, 2546, 2290, 1008, 13970, 4783, 4215, 2863, 8197, 1012, 1999, 4183, 8663, 8873, 27390, 3370, 1007, 7561, 1063, 4318, 15532, 20799, 14081, 4305, 2099, 1010, 9413, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/tools/leaderelection/leaderelection.go
IsLeader
func (le *LeaderElector) IsLeader() bool { return le.observedRecord.HolderIdentity == le.config.Lock.Identity() }
go
func (le *LeaderElector) IsLeader() bool { return le.observedRecord.HolderIdentity == le.config.Lock.Identity() }
[ "func", "(", "le", "*", "LeaderElector", ")", "IsLeader", "(", ")", "bool", "{", "return", "le", ".", "observedRecord", ".", "HolderIdentity", "==", "le", ".", "config", ".", "Lock", ".", "Identity", "(", ")", "\n", "}" ]
// IsLeader returns true if the last observed leader was this client else returns false.
[ "IsLeader", "returns", "true", "if", "the", "last", "observed", "leader", "was", "this", "client", "else", "returns", "false", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/tools/leaderelection/leaderelection.go#L206-L208
train
IsLeader returns true if the leader is the leader.
[ 30522, 4569, 2278, 1006, 3393, 1008, 3003, 12260, 16761, 1007, 8842, 9648, 2099, 1006, 1007, 22017, 2140, 1063, 2709, 3393, 1012, 5159, 2890, 27108, 2094, 1012, 9111, 5178, 16778, 3723, 1027, 1027, 3393, 1012, 9530, 8873, 2290, 1012, 5843, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...