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 | staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/internalclientset/clientset.go | New | func New(c rest.Interface) *Clientset {
var cs Clientset
cs.apiextensions = apiextensionsinternalversion.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs
} | go | func New(c rest.Interface) *Clientset {
var cs Clientset
cs.apiextensions = apiextensionsinternalversion.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs
} | [
"func",
"New",
"(",
"c",
"rest",
".",
"Interface",
")",
"*",
"Clientset",
"{",
"var",
"cs",
"Clientset",
"\n",
"cs",
".",
"apiextensions",
"=",
"apiextensionsinternalversion",
".",
"New",
"(",
"c",
")",
"\n\n",
"cs",
".",
"DiscoveryClient",
"=",
"discovery... | // New creates a new Clientset for the given RESTClient. | [
"New",
"creates",
"a",
"new",
"Clientset",
"for",
"the",
"given",
"RESTClient",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/internalclientset/clientset.go#L84-L90 | train | New returns a new Clientset object | [
30522,
4569,
2278,
2047,
1006,
1039,
2717,
1012,
8278,
1007,
1008,
7846,
3388,
1063,
13075,
20116,
7846,
3388,
20116,
1012,
17928,
10288,
29048,
2015,
1027,
17928,
10288,
29048,
11493,
16451,
2389,
27774,
1012,
2047,
1006,
1039,
1007,
20116,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/auditregistration/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *AuditSinkSpec) DeepCopy() *AuditSinkSpec {
if in == nil {
return nil
}
out := new(AuditSinkSpec)
in.DeepCopyInto(out)
return out
} | go | func (in *AuditSinkSpec) DeepCopy() *AuditSinkSpec {
if in == nil {
return nil
}
out := new(AuditSinkSpec)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"AuditSinkSpec",
")",
"DeepCopy",
"(",
")",
"*",
"AuditSinkSpec",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"AuditSinkSpec",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuditSinkSpec. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"AuditSinkSpec",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/api/auditregistration/v1alpha1/zz_generated.deepcopy.go#L96-L103 | train | DeepCopy is an autogenerated deepcopy function copying the receiver creating a new AuditSinkSpec. | [
30522,
4569,
2278,
1006,
1999,
1008,
15727,
11493,
5705,
5051,
2278,
1007,
2784,
3597,
7685,
1006,
1007,
1008,
15727,
11493,
5705,
5051,
2278,
1063,
2065,
1999,
1027,
1027,
9152,
2140,
1063,
2709,
9152,
2140,
1065,
2041,
1024,
1027,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/kubeapiserver/options/admission.go | NewAdmissionOptions | func NewAdmissionOptions() *AdmissionOptions {
options := genericoptions.NewAdmissionOptions()
// register all admission plugins
RegisterAllAdmissionPlugins(options.Plugins)
// set RecommendedPluginOrder
options.RecommendedPluginOrder = AllOrderedPlugins
// set DefaultOffPlugins
options.DefaultOffPlugins = DefaultOffAdmissionPlugins()
return &AdmissionOptions{
GenericAdmission: options,
}
} | go | func NewAdmissionOptions() *AdmissionOptions {
options := genericoptions.NewAdmissionOptions()
// register all admission plugins
RegisterAllAdmissionPlugins(options.Plugins)
// set RecommendedPluginOrder
options.RecommendedPluginOrder = AllOrderedPlugins
// set DefaultOffPlugins
options.DefaultOffPlugins = DefaultOffAdmissionPlugins()
return &AdmissionOptions{
GenericAdmission: options,
}
} | [
"func",
"NewAdmissionOptions",
"(",
")",
"*",
"AdmissionOptions",
"{",
"options",
":=",
"genericoptions",
".",
"NewAdmissionOptions",
"(",
")",
"\n",
"// register all admission plugins",
"RegisterAllAdmissionPlugins",
"(",
"options",
".",
"Plugins",
")",
"\n",
"// set R... | // NewAdmissionOptions creates a new instance of AdmissionOptions
// Note:
// In addition it calls RegisterAllAdmissionPlugins to register
// all kube-apiserver admission plugins.
//
// Provides the list of RecommendedPluginOrder that holds sane values
// that can be used by servers that don't care about admission chain.
// Servers that do care can overwrite/append that field after creation. | [
"NewAdmissionOptions",
"creates",
"a",
"new",
"instance",
"of",
"AdmissionOptions",
"Note",
":",
"In",
"addition",
"it",
"calls",
"RegisterAllAdmissionPlugins",
"to",
"register",
"all",
"kube",
"-",
"apiserver",
"admission",
"plugins",
".",
"Provides",
"the",
"list"... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubeapiserver/options/admission.go#L51-L63 | train | NewAdmissionOptions returns a new admission options object | [
30522,
4569,
2278,
2047,
4215,
25481,
7361,
9285,
1006,
1007,
1008,
9634,
7361,
9285,
1063,
7047,
1024,
1027,
12391,
7361,
9285,
1012,
2047,
4215,
25481,
7361,
9285,
1006,
1007,
1013,
1013,
4236,
2035,
9634,
13354,
7076,
4236,
25425,
22117,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/crypto/crypto.go | EncryptBytes | func EncryptBytes(data, key []byte) ([]byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
gcm, err := cipher.NewGCM(block)
if err != nil {
return nil, err
}
nonce, err := CreateRandBytes(uint32(gcm.NonceSize()))
if err != nil {
return nil, err
}
return gcm.Seal(nonce, nonce, data, nil), nil
} | go | func EncryptBytes(data, key []byte) ([]byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
gcm, err := cipher.NewGCM(block)
if err != nil {
return nil, err
}
nonce, err := CreateRandBytes(uint32(gcm.NonceSize()))
if err != nil {
return nil, err
}
return gcm.Seal(nonce, nonce, data, nil), nil
} | [
"func",
"EncryptBytes",
"(",
"data",
",",
"key",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"block",
",",
"err",
":=",
"aes",
".",
"NewCipher",
"(",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",... | // EncryptBytes takes a byte slice of raw data and an encryption key and returns an encrypted byte slice of data.
// The key must be an AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256 | [
"EncryptBytes",
"takes",
"a",
"byte",
"slice",
"of",
"raw",
"data",
"and",
"an",
"encryption",
"key",
"and",
"returns",
"an",
"encrypted",
"byte",
"slice",
"of",
"data",
".",
"The",
"key",
"must",
"be",
"an",
"AES",
"key",
"either",
"16",
"24",
"or",
"... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/util/crypto/crypto.go#L38-L52 | train | EncryptBytes encrypts data using the given key. | [
30522,
4569,
2278,
4372,
26775,
22571,
2102,
3762,
4570,
1006,
2951,
1010,
3145,
1031,
1033,
24880,
1007,
1006,
1031,
1033,
24880,
1010,
7561,
1007,
1063,
3796,
30524,
1010,
9413,
2099,
1065,
1043,
27487,
1010,
9413,
2099,
1024,
1027,
27715... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/resource/builder.go | LabelSelectorParam | func (b *Builder) LabelSelectorParam(s string) *Builder {
selector := strings.TrimSpace(s)
if len(selector) == 0 {
return b
}
if b.selectAll {
b.errs = append(b.errs, fmt.Errorf("found non-empty label selector %q with previously set 'all' parameter. ", s))
return b
}
return b.LabelSelector(selector)
} | go | func (b *Builder) LabelSelectorParam(s string) *Builder {
selector := strings.TrimSpace(s)
if len(selector) == 0 {
return b
}
if b.selectAll {
b.errs = append(b.errs, fmt.Errorf("found non-empty label selector %q with previously set 'all' parameter. ", s))
return b
}
return b.LabelSelector(selector)
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"LabelSelectorParam",
"(",
"s",
"string",
")",
"*",
"Builder",
"{",
"selector",
":=",
"strings",
".",
"TrimSpace",
"(",
"s",
")",
"\n",
"if",
"len",
"(",
"selector",
")",
"==",
"0",
"{",
"return",
"b",
"\n",
"... | // LabelSelectorParam defines a selector that should be applied to the object types to load.
// This will not affect files loaded from disk or URL. If the parameter is empty it is
// a no-op - to select all resources invoke `b.LabelSelector(labels.Everything.String)`. | [
"LabelSelectorParam",
"defines",
"a",
"selector",
"that",
"should",
"be",
"applied",
"to",
"the",
"object",
"types",
"to",
"load",
".",
"This",
"will",
"not",
"affect",
"files",
"loaded",
"from",
"disk",
"or",
"URL",
".",
"If",
"the",
"parameter",
"is",
"e... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/cli-runtime/pkg/resource/builder.go#L425-L435 | train | LabelSelectorParam returns a builder with the given label selector parameter. | [
30522,
4569,
2278,
1006,
1038,
1008,
12508,
1007,
10873,
12260,
16761,
28689,
2213,
1006,
1055,
5164,
1007,
1008,
12508,
1063,
27000,
1024,
1027,
7817,
1012,
12241,
23058,
1006,
1055,
1007,
2065,
18798,
1006,
27000,
1007,
1027,
1027,
1014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/storage/etcd/metrics/metrics.go | Register | func Register() {
// Register the metrics.
registerMetrics.Do(func() {
prometheus.MustRegister(cacheHitCounter)
prometheus.MustRegister(cacheMissCounter)
prometheus.MustRegister(cacheEntryCounter)
prometheus.MustRegister(cacheAddLatency)
prometheus.MustRegister(cacheGetLatency)
prometheus.MustRegister(etcdRequestLatency)
prometheus.MustRegister(objectCounts)
// TODO(danielqsj): Remove the following metrics, they are deprecated
prometheus.MustRegister(deprecatedCacheHitCounter)
prometheus.MustRegister(deprecatedCacheMissCounter)
prometheus.MustRegister(deprecatedCacheEntryCounter)
prometheus.MustRegister(deprecatedCacheAddLatency)
prometheus.MustRegister(deprecatedCacheGetLatency)
prometheus.MustRegister(deprecatedEtcdRequestLatenciesSummary)
})
} | go | func Register() {
// Register the metrics.
registerMetrics.Do(func() {
prometheus.MustRegister(cacheHitCounter)
prometheus.MustRegister(cacheMissCounter)
prometheus.MustRegister(cacheEntryCounter)
prometheus.MustRegister(cacheAddLatency)
prometheus.MustRegister(cacheGetLatency)
prometheus.MustRegister(etcdRequestLatency)
prometheus.MustRegister(objectCounts)
// TODO(danielqsj): Remove the following metrics, they are deprecated
prometheus.MustRegister(deprecatedCacheHitCounter)
prometheus.MustRegister(deprecatedCacheMissCounter)
prometheus.MustRegister(deprecatedCacheEntryCounter)
prometheus.MustRegister(deprecatedCacheAddLatency)
prometheus.MustRegister(deprecatedCacheGetLatency)
prometheus.MustRegister(deprecatedEtcdRequestLatenciesSummary)
})
} | [
"func",
"Register",
"(",
")",
"{",
"// Register the metrics.",
"registerMetrics",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"prometheus",
".",
"MustRegister",
"(",
"cacheHitCounter",
")",
"\n",
"prometheus",
".",
"MustRegister",
"(",
"cacheMissCounter",
")",
"\n",
... | // Register all metrics. | [
"Register",
"all",
"metrics",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiserver/pkg/storage/etcd/metrics/metrics.go#L110-L129 | train | Register registers the metrics. | [
30522,
4569,
2278,
4236,
1006,
1007,
1063,
1013,
1013,
4236,
1996,
12046,
2015,
1012,
4236,
12589,
2015,
1012,
2079,
1006,
4569,
2278,
1006,
1007,
1063,
20877,
11031,
10600,
1012,
2442,
2890,
24063,
2121,
1006,
17053,
16584,
3597,
16671,
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 | cmd/kubelet/app/server.go | InitializeTLS | func InitializeTLS(kf *options.KubeletFlags, kc *kubeletconfiginternal.KubeletConfiguration) (*server.TLSOptions, error) {
if !kc.ServerTLSBootstrap && kc.TLSCertFile == "" && kc.TLSPrivateKeyFile == "" {
kc.TLSCertFile = path.Join(kf.CertDirectory, "kubelet.crt")
kc.TLSPrivateKeyFile = path.Join(kf.CertDirectory, "kubelet.key")
canReadCertAndKey, err := certutil.CanReadCertAndKey(kc.TLSCertFile, kc.TLSPrivateKeyFile)
if err != nil {
return nil, err
}
if !canReadCertAndKey {
hostName, err := nodeutil.GetHostname(kf.HostnameOverride)
if err != nil {
return nil, err
}
cert, key, err := certutil.GenerateSelfSignedCertKey(hostName, nil, nil)
if err != nil {
return nil, fmt.Errorf("unable to generate self signed cert: %v", err)
}
if err := certutil.WriteCert(kc.TLSCertFile, cert); err != nil {
return nil, err
}
if err := keyutil.WriteKey(kc.TLSPrivateKeyFile, key); err != nil {
return nil, err
}
klog.V(4).Infof("Using self-signed cert (%s, %s)", kc.TLSCertFile, kc.TLSPrivateKeyFile)
}
}
tlsCipherSuites, err := cliflag.TLSCipherSuites(kc.TLSCipherSuites)
if err != nil {
return nil, err
}
minTLSVersion, err := cliflag.TLSVersion(kc.TLSMinVersion)
if err != nil {
return nil, err
}
tlsOptions := &server.TLSOptions{
Config: &tls.Config{
MinVersion: minTLSVersion,
CipherSuites: tlsCipherSuites,
},
CertFile: kc.TLSCertFile,
KeyFile: kc.TLSPrivateKeyFile,
}
if len(kc.Authentication.X509.ClientCAFile) > 0 {
clientCAs, err := certutil.NewPool(kc.Authentication.X509.ClientCAFile)
if err != nil {
return nil, fmt.Errorf("unable to load client CA file %s: %v", kc.Authentication.X509.ClientCAFile, err)
}
// Specify allowed CAs for client certificates
tlsOptions.Config.ClientCAs = clientCAs
// Populate PeerCertificates in requests, but don't reject connections without verified certificates
tlsOptions.Config.ClientAuth = tls.RequestClientCert
}
return tlsOptions, nil
} | go | func InitializeTLS(kf *options.KubeletFlags, kc *kubeletconfiginternal.KubeletConfiguration) (*server.TLSOptions, error) {
if !kc.ServerTLSBootstrap && kc.TLSCertFile == "" && kc.TLSPrivateKeyFile == "" {
kc.TLSCertFile = path.Join(kf.CertDirectory, "kubelet.crt")
kc.TLSPrivateKeyFile = path.Join(kf.CertDirectory, "kubelet.key")
canReadCertAndKey, err := certutil.CanReadCertAndKey(kc.TLSCertFile, kc.TLSPrivateKeyFile)
if err != nil {
return nil, err
}
if !canReadCertAndKey {
hostName, err := nodeutil.GetHostname(kf.HostnameOverride)
if err != nil {
return nil, err
}
cert, key, err := certutil.GenerateSelfSignedCertKey(hostName, nil, nil)
if err != nil {
return nil, fmt.Errorf("unable to generate self signed cert: %v", err)
}
if err := certutil.WriteCert(kc.TLSCertFile, cert); err != nil {
return nil, err
}
if err := keyutil.WriteKey(kc.TLSPrivateKeyFile, key); err != nil {
return nil, err
}
klog.V(4).Infof("Using self-signed cert (%s, %s)", kc.TLSCertFile, kc.TLSPrivateKeyFile)
}
}
tlsCipherSuites, err := cliflag.TLSCipherSuites(kc.TLSCipherSuites)
if err != nil {
return nil, err
}
minTLSVersion, err := cliflag.TLSVersion(kc.TLSMinVersion)
if err != nil {
return nil, err
}
tlsOptions := &server.TLSOptions{
Config: &tls.Config{
MinVersion: minTLSVersion,
CipherSuites: tlsCipherSuites,
},
CertFile: kc.TLSCertFile,
KeyFile: kc.TLSPrivateKeyFile,
}
if len(kc.Authentication.X509.ClientCAFile) > 0 {
clientCAs, err := certutil.NewPool(kc.Authentication.X509.ClientCAFile)
if err != nil {
return nil, fmt.Errorf("unable to load client CA file %s: %v", kc.Authentication.X509.ClientCAFile, err)
}
// Specify allowed CAs for client certificates
tlsOptions.Config.ClientCAs = clientCAs
// Populate PeerCertificates in requests, but don't reject connections without verified certificates
tlsOptions.Config.ClientAuth = tls.RequestClientCert
}
return tlsOptions, nil
} | [
"func",
"InitializeTLS",
"(",
"kf",
"*",
"options",
".",
"KubeletFlags",
",",
"kc",
"*",
"kubeletconfiginternal",
".",
"KubeletConfiguration",
")",
"(",
"*",
"server",
".",
"TLSOptions",
",",
"error",
")",
"{",
"if",
"!",
"kc",
".",
"ServerTLSBootstrap",
"&&... | // InitializeTLS checks for a configured TLSCertFile and TLSPrivateKeyFile: if unspecified a new self-signed
// certificate and key file are generated. Returns a configured server.TLSOptions object. | [
"InitializeTLS",
"checks",
"for",
"a",
"configured",
"TLSCertFile",
"and",
"TLSPrivateKeyFile",
":",
"if",
"unspecified",
"a",
"new",
"self",
"-",
"signed",
"certificate",
"and",
"key",
"file",
"are",
"generated",
".",
"Returns",
"a",
"configured",
"server",
"."... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubelet/app/server.go#L876-L938 | train | InitializeTLS initializes the TLS options for the server. | [
30522,
4569,
2278,
3988,
4697,
19646,
2015,
1006,
1047,
2546,
1008,
7047,
1012,
13970,
8671,
3388,
10258,
26454,
1010,
21117,
1008,
13970,
8671,
3388,
8663,
8873,
11528,
16451,
2389,
1012,
13970,
8671,
3388,
8663,
8873,
27390,
3370,
1007,
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 | plugin/pkg/auth/authorizer/node/intset.go | has | func (s *intSet) has(i int) bool {
if s == nil {
return false
}
_, present := s.members[i]
return present
} | go | func (s *intSet) has(i int) bool {
if s == nil {
return false
}
_, present := s.members[i]
return present
} | [
"func",
"(",
"s",
"*",
"intSet",
")",
"has",
"(",
"i",
"int",
")",
"bool",
"{",
"if",
"s",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"_",
",",
"present",
":=",
"s",
".",
"members",
"[",
"i",
"]",
"\n",
"return",
"present",
"\n",
"... | // has returns true if the specified int is in the set.
// it is safe to call concurrently, but must not be called concurrently with any of the other methods. | [
"has",
"returns",
"true",
"if",
"the",
"specified",
"int",
"is",
"in",
"the",
"set",
".",
"it",
"is",
"safe",
"to",
"call",
"concurrently",
"but",
"must",
"not",
"be",
"called",
"concurrently",
"with",
"any",
"of",
"the",
"other",
"methods",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/plugin/pkg/auth/authorizer/node/intset.go#L32-L38 | train | has returns true if the given index is in the set. | [
30522,
4569,
2278,
1006,
1055,
1008,
20014,
13462,
1007,
2038,
1006,
1045,
20014,
1007,
22017,
2140,
1063,
2065,
1055,
1027,
1027,
9152,
2140,
1063,
2709,
6270,
1065,
1035,
1010,
2556,
1024,
1027,
1055,
1012,
2372,
1031,
1045,
1033,
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/cli-runtime/pkg/resource/builder.go | WithScheme | func (b *Builder) WithScheme(scheme *runtime.Scheme, decodingVersions ...schema.GroupVersion) *Builder {
if b.mapper != nil {
b.errs = append(b.errs, fmt.Errorf("another mapper was already selected, cannot use internal types"))
return b
}
b.objectTyper = scheme
codecFactory := serializer.NewCodecFactory(scheme)
negotiatedSerializer := runtime.NegotiatedSerializer(codecFactory)
// if you specified versions, you're specifying a desire for external types, which you don't want to round-trip through
// internal types
if len(decodingVersions) > 0 {
negotiatedSerializer = codecFactory.WithoutConversion()
}
b.negotiatedSerializer = negotiatedSerializer
b.mapper = &mapper{
localFn: b.isLocal,
restMapperFn: b.restMapperFn,
clientFn: b.getClient,
decoder: codecFactory.UniversalDecoder(decodingVersions...),
}
return b
} | go | func (b *Builder) WithScheme(scheme *runtime.Scheme, decodingVersions ...schema.GroupVersion) *Builder {
if b.mapper != nil {
b.errs = append(b.errs, fmt.Errorf("another mapper was already selected, cannot use internal types"))
return b
}
b.objectTyper = scheme
codecFactory := serializer.NewCodecFactory(scheme)
negotiatedSerializer := runtime.NegotiatedSerializer(codecFactory)
// if you specified versions, you're specifying a desire for external types, which you don't want to round-trip through
// internal types
if len(decodingVersions) > 0 {
negotiatedSerializer = codecFactory.WithoutConversion()
}
b.negotiatedSerializer = negotiatedSerializer
b.mapper = &mapper{
localFn: b.isLocal,
restMapperFn: b.restMapperFn,
clientFn: b.getClient,
decoder: codecFactory.UniversalDecoder(decodingVersions...),
}
return b
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"WithScheme",
"(",
"scheme",
"*",
"runtime",
".",
"Scheme",
",",
"decodingVersions",
"...",
"schema",
".",
"GroupVersion",
")",
"*",
"Builder",
"{",
"if",
"b",
".",
"mapper",
"!=",
"nil",
"{",
"b",
".",
"errs",
... | // WithScheme uses the scheme to manage typing, conversion (optional), and decoding. If decodingVersions
// is empty, then you can end up with internal types. You have been warned. | [
"WithScheme",
"uses",
"the",
"scheme",
"to",
"manage",
"typing",
"conversion",
"(",
"optional",
")",
"and",
"decoding",
".",
"If",
"decodingVersions",
"is",
"empty",
"then",
"you",
"can",
"end",
"up",
"with",
"internal",
"types",
".",
"You",
"have",
"been",
... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/cli-runtime/pkg/resource/builder.go#L276-L299 | train | WithScheme sets the object type to the given scheme. | [
30522,
4569,
2278,
1006,
1038,
1008,
12508,
1007,
2007,
22842,
4168,
1006,
5679,
1008,
2448,
7292,
1012,
5679,
1010,
21933,
4667,
27774,
2015,
1012,
1012,
1012,
8040,
28433,
1012,
2177,
27774,
1007,
1008,
12508,
1063,
2065,
1038,
1012,
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 | cmd/kubeadm/app/preflight/checks.go | Name | func (dac DirAvailableCheck) Name() string {
if dac.Label != "" {
return dac.Label
}
return fmt.Sprintf("DirAvailable-%s", strings.Replace(dac.Path, "/", "-", -1))
} | go | func (dac DirAvailableCheck) Name() string {
if dac.Label != "" {
return dac.Label
}
return fmt.Sprintf("DirAvailable-%s", strings.Replace(dac.Path, "/", "-", -1))
} | [
"func",
"(",
"dac",
"DirAvailableCheck",
")",
"Name",
"(",
")",
"string",
"{",
"if",
"dac",
".",
"Label",
"!=",
"\"",
"\"",
"{",
"return",
"dac",
".",
"Label",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
... | // Name returns label for individual DirAvailableChecks. If not known, will return based on path. | [
"Name",
"returns",
"label",
"for",
"individual",
"DirAvailableChecks",
".",
"If",
"not",
"known",
"will",
"return",
"based",
"on",
"path",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/preflight/checks.go#L245-L250 | train | Name returns the name of the directory available check | [
30522,
4569,
2278,
1006,
4830,
2278,
16101,
12462,
11733,
3468,
5403,
3600,
1007,
2171,
1006,
1007,
5164,
1063,
2065,
4830,
2278,
1012,
3830,
999,
1027,
1000,
1000,
1063,
2709,
4830,
2278,
1012,
3830,
30524,
1003,
1055,
1000,
1010,
7817,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_stub.go | Start | func (h *ManagerStub) Start(activePods ActivePodsFunc, sourcesReady config.SourcesReady) error {
return nil
} | go | func (h *ManagerStub) Start(activePods ActivePodsFunc, sourcesReady config.SourcesReady) error {
return nil
} | [
"func",
"(",
"h",
"*",
"ManagerStub",
")",
"Start",
"(",
"activePods",
"ActivePodsFunc",
",",
"sourcesReady",
"config",
".",
"SourcesReady",
")",
"error",
"{",
"return",
"nil",
"\n",
"}"
] | // Start simply returns nil. | [
"Start",
"simply",
"returns",
"nil",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/cm/devicemanager/manager_stub.go#L37-L39 | train | Start is part of the Manager interface. | [
30522,
4569,
2278,
1006,
1044,
1008,
10489,
28251,
1007,
2707,
1006,
3161,
22925,
3161,
22925,
11263,
12273,
1010,
4216,
16416,
5149,
9530,
8873,
2290,
1012,
4216,
16416,
5149,
1007,
7561,
1063,
2709,
9152,
2140,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 | NewDockerClientFromConfig | func NewDockerClientFromConfig(config *ClientConfig) libdocker.Interface {
if config != nil {
// Create docker client.
client := libdocker.ConnectToDockerOrDie(
config.DockerEndpoint,
config.RuntimeRequestTimeout,
config.ImagePullProgressDeadline,
config.WithTraceDisabled,
config.EnableSleep,
)
return client
}
return nil
} | go | func NewDockerClientFromConfig(config *ClientConfig) libdocker.Interface {
if config != nil {
// Create docker client.
client := libdocker.ConnectToDockerOrDie(
config.DockerEndpoint,
config.RuntimeRequestTimeout,
config.ImagePullProgressDeadline,
config.WithTraceDisabled,
config.EnableSleep,
)
return client
}
return nil
} | [
"func",
"NewDockerClientFromConfig",
"(",
"config",
"*",
"ClientConfig",
")",
"libdocker",
".",
"Interface",
"{",
"if",
"config",
"!=",
"nil",
"{",
"// Create docker client.",
"client",
":=",
"libdocker",
".",
"ConnectToDockerOrDie",
"(",
"config",
".",
"DockerEndpo... | // NewDockerClientFromConfig create a docker client from given configure
// return nil if nil configure is given. | [
"NewDockerClientFromConfig",
"create",
"a",
"docker",
"client",
"from",
"given",
"configure",
"return",
"nil",
"if",
"nil",
"configure",
"is",
"given",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/dockershim/docker_service.go#L173-L187 | train | NewDockerClientFromConfig creates a new libdocker client from a config | [
30522,
4569,
2278,
2047,
14647,
2121,
20464,
11638,
19699,
5358,
8663,
8873,
2290,
1006,
9530,
8873,
2290,
1008,
7396,
8663,
8873,
2290,
1007,
5622,
2497,
14647,
2121,
1012,
8278,
1063,
2065,
9530,
8873,
2290,
999,
1027,
9152,
2140,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/fake/fake_runtime.go | Exec | func (f *RemoteRuntime) Exec(ctx context.Context, req *kubeapi.ExecRequest) (*kubeapi.ExecResponse, error) {
return f.RuntimeService.Exec(req)
} | go | func (f *RemoteRuntime) Exec(ctx context.Context, req *kubeapi.ExecRequest) (*kubeapi.ExecResponse, error) {
return f.RuntimeService.Exec(req)
} | [
"func",
"(",
"f",
"*",
"RemoteRuntime",
")",
"Exec",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"kubeapi",
".",
"ExecRequest",
")",
"(",
"*",
"kubeapi",
".",
"ExecResponse",
",",
"error",
")",
"{",
"return",
"f",
".",
"RuntimeService",
"."... | // Exec prepares a streaming endpoint to execute a command in the container. | [
"Exec",
"prepares",
"a",
"streaming",
"endpoint",
"to",
"execute",
"a",
"command",
"in",
"the",
"container",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/remote/fake/fake_runtime.go#L223-L225 | train | Exec executes a command in the remote container. | [
30522,
4569,
2278,
1006,
1042,
1008,
6556,
15532,
7292,
1007,
4654,
8586,
1006,
14931,
2595,
6123,
1012,
6123,
1010,
2128,
4160,
1008,
13970,
4783,
9331,
2072,
1012,
4654,
8586,
2890,
15500,
1007,
1006,
1008,
13970,
4783,
9331,
2072,
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/kubemark/controller.go | Run | func (kubemarkController *KubemarkController) Run(stopCh chan struct{}) {
nodeTemplate, err := kubemarkController.getNodeTemplate()
if err != nil {
klog.Fatalf("failed to get node template: %s", err)
}
kubemarkController.nodeTemplate = nodeTemplate
go kubemarkController.runNodeCreation(stopCh)
<-stopCh
} | go | func (kubemarkController *KubemarkController) Run(stopCh chan struct{}) {
nodeTemplate, err := kubemarkController.getNodeTemplate()
if err != nil {
klog.Fatalf("failed to get node template: %s", err)
}
kubemarkController.nodeTemplate = nodeTemplate
go kubemarkController.runNodeCreation(stopCh)
<-stopCh
} | [
"func",
"(",
"kubemarkController",
"*",
"KubemarkController",
")",
"Run",
"(",
"stopCh",
"chan",
"struct",
"{",
"}",
")",
"{",
"nodeTemplate",
",",
"err",
":=",
"kubemarkController",
".",
"getNodeTemplate",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"k... | // Run populates the node template needed for creation of kubemark nodes and
// starts the worker routine for creating new nodes. | [
"Run",
"populates",
"the",
"node",
"template",
"needed",
"for",
"creation",
"of",
"kubemark",
"nodes",
"and",
"starts",
"the",
"worker",
"routine",
"for",
"creating",
"new",
"nodes",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubemark/controller.go#L125-L134 | train | Run starts the kubelet controller | [
30522,
4569,
2278,
1006,
13970,
4783,
10665,
8663,
13181,
10820,
1008,
13970,
4783,
10665,
8663,
13181,
10820,
1007,
2448,
1006,
2644,
2818,
9212,
2358,
6820,
6593,
1063,
1065,
1007,
1063,
13045,
18532,
15725,
1010,
9413,
2099,
1024,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/winstats/network_stats.go | mergeCollectedData | func (n *networkCounter) mergeCollectedData(packetsReceivedPerSecondData,
packetsSentPerSecondData,
bytesReceivedPerSecondData,
bytesSentPerSecondData,
packetsReceivedDiscardedData,
packetsReceivedErrorsData,
packetsOutboundDiscardedData,
packetsOutboundErrorsData map[string]uint64) {
adapters := sets.NewString()
// merge the collected data and list of adapters.
adapters.Insert(n.mergePacketsReceivedPerSecondData(packetsReceivedPerSecondData)...)
adapters.Insert(n.mergePacketsSentPerSecondData(packetsSentPerSecondData)...)
adapters.Insert(n.mergeBytesReceivedPerSecondData(bytesReceivedPerSecondData)...)
adapters.Insert(n.mergeBytesSentPerSecondData(bytesSentPerSecondData)...)
adapters.Insert(n.mergePacketsReceivedDiscardedData(packetsReceivedDiscardedData)...)
adapters.Insert(n.mergePacketsReceivedErrorsData(packetsReceivedErrorsData)...)
adapters.Insert(n.mergePacketsOutboundDiscardedData(packetsOutboundDiscardedData)...)
adapters.Insert(n.mergePacketsOutboundErrorsData(packetsOutboundErrorsData)...)
// delete the cache for non-existing adapters.
for adapter := range n.adapterStats {
if !adapters.Has(adapter) {
delete(n.adapterStats, adapter)
}
}
} | go | func (n *networkCounter) mergeCollectedData(packetsReceivedPerSecondData,
packetsSentPerSecondData,
bytesReceivedPerSecondData,
bytesSentPerSecondData,
packetsReceivedDiscardedData,
packetsReceivedErrorsData,
packetsOutboundDiscardedData,
packetsOutboundErrorsData map[string]uint64) {
adapters := sets.NewString()
// merge the collected data and list of adapters.
adapters.Insert(n.mergePacketsReceivedPerSecondData(packetsReceivedPerSecondData)...)
adapters.Insert(n.mergePacketsSentPerSecondData(packetsSentPerSecondData)...)
adapters.Insert(n.mergeBytesReceivedPerSecondData(bytesReceivedPerSecondData)...)
adapters.Insert(n.mergeBytesSentPerSecondData(bytesSentPerSecondData)...)
adapters.Insert(n.mergePacketsReceivedDiscardedData(packetsReceivedDiscardedData)...)
adapters.Insert(n.mergePacketsReceivedErrorsData(packetsReceivedErrorsData)...)
adapters.Insert(n.mergePacketsOutboundDiscardedData(packetsOutboundDiscardedData)...)
adapters.Insert(n.mergePacketsOutboundErrorsData(packetsOutboundErrorsData)...)
// delete the cache for non-existing adapters.
for adapter := range n.adapterStats {
if !adapters.Has(adapter) {
delete(n.adapterStats, adapter)
}
}
} | [
"func",
"(",
"n",
"*",
"networkCounter",
")",
"mergeCollectedData",
"(",
"packetsReceivedPerSecondData",
",",
"packetsSentPerSecondData",
",",
"bytesReceivedPerSecondData",
",",
"bytesSentPerSecondData",
",",
"packetsReceivedDiscardedData",
",",
"packetsReceivedErrorsData",
","... | // mergeCollectedData merges the collected data into cache. It should be invoked under lock protected. | [
"mergeCollectedData",
"merges",
"the",
"collected",
"data",
"into",
"cache",
".",
"It",
"should",
"be",
"invoked",
"under",
"lock",
"protected",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/winstats/network_stats.go#L174-L200 | train | mergeCollectedData merges the collected data into the networkCounter. | [
30522,
4569,
2278,
1006,
1050,
1008,
2897,
3597,
16671,
2121,
1007,
13590,
26895,
22471,
22367,
6790,
1006,
23730,
2890,
3401,
3512,
18927,
2545,
8586,
15422,
2850,
2696,
1010,
23730,
5054,
25856,
2545,
8586,
15422,
2850,
2696,
1010,
27507,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/kube-aggregator/pkg/apis/apiregistration/v1/zz_generated.conversion.go | Convert_apiregistration_ServiceReference_To_v1_ServiceReference | func Convert_apiregistration_ServiceReference_To_v1_ServiceReference(in *apiregistration.ServiceReference, out *ServiceReference, s conversion.Scope) error {
return autoConvert_apiregistration_ServiceReference_To_v1_ServiceReference(in, out, s)
} | go | func Convert_apiregistration_ServiceReference_To_v1_ServiceReference(in *apiregistration.ServiceReference, out *ServiceReference, s conversion.Scope) error {
return autoConvert_apiregistration_ServiceReference_To_v1_ServiceReference(in, out, s)
} | [
"func",
"Convert_apiregistration_ServiceReference_To_v1_ServiceReference",
"(",
"in",
"*",
"apiregistration",
".",
"ServiceReference",
",",
"out",
"*",
"ServiceReference",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoConvert_apiregistration_Servic... | // Convert_apiregistration_ServiceReference_To_v1_ServiceReference is an autogenerated conversion function. | [
"Convert_apiregistration_ServiceReference_To_v1_ServiceReference",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/zz_generated.conversion.go#L296-L298 | train | Convert_apiregistration_ServiceReference_To_v1_ServiceReference is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
17928,
2890,
24063,
8156,
1035,
2326,
2890,
25523,
1035,
2000,
1035,
1058,
2487,
1035,
2326,
2890,
25523,
1006,
1999,
1008,
17928,
2890,
24063,
8156,
1012,
2326,
2890,
25523,
1010,
2041,
1008,
2326,
2890,
255... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/legacy-cloud-providers/vsphere/vclib/volumeoptions.go | VerifyVolumeOptions | func (volumeOptions VolumeOptions) VerifyVolumeOptions() bool {
// Validate only if SCSIControllerType is set by user.
// Default value is set later in virtualDiskManager.Create and vmDiskManager.Create
if volumeOptions.SCSIControllerType != "" {
isValid := CheckControllerSupported(volumeOptions.SCSIControllerType)
if !isValid {
return false
}
}
// ThinDiskType is the default, so skip the validation.
if volumeOptions.DiskFormat != ThinDiskType {
isValid := CheckDiskFormatSupported(volumeOptions.DiskFormat)
if !isValid {
return false
}
}
return true
} | go | func (volumeOptions VolumeOptions) VerifyVolumeOptions() bool {
// Validate only if SCSIControllerType is set by user.
// Default value is set later in virtualDiskManager.Create and vmDiskManager.Create
if volumeOptions.SCSIControllerType != "" {
isValid := CheckControllerSupported(volumeOptions.SCSIControllerType)
if !isValid {
return false
}
}
// ThinDiskType is the default, so skip the validation.
if volumeOptions.DiskFormat != ThinDiskType {
isValid := CheckDiskFormatSupported(volumeOptions.DiskFormat)
if !isValid {
return false
}
}
return true
} | [
"func",
"(",
"volumeOptions",
"VolumeOptions",
")",
"VerifyVolumeOptions",
"(",
")",
"bool",
"{",
"// Validate only if SCSIControllerType is set by user.",
"// Default value is set later in virtualDiskManager.Create and vmDiskManager.Create",
"if",
"volumeOptions",
".",
"SCSIController... | // VerifyVolumeOptions checks if volumeOptions.SCIControllerType is valid controller type | [
"VerifyVolumeOptions",
"checks",
"if",
"volumeOptions",
".",
"SCIControllerType",
"is",
"valid",
"controller",
"type"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/volumeoptions.go#L91-L108 | train | VerifyVolumeOptions checks if volumeOptions is valid | [
30522,
4569,
2278,
1006,
3872,
7361,
9285,
3872,
7361,
9285,
1007,
20410,
6767,
12942,
8780,
16790,
2015,
1006,
1007,
22017,
2140,
1063,
1013,
1013,
9398,
3686,
2069,
2065,
8040,
19570,
12162,
26611,
13874,
2003,
2275,
2011,
5310,
1012,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/config.go | NewCmdConfigUpload | func NewCmdConfigUpload(out io.Writer, kubeConfigFile *string) *cobra.Command {
cmd := &cobra.Command{
Use: "upload",
Short: "Upload configuration about the current state, so that 'kubeadm upgrade' can later know how to configure the upgraded cluster",
RunE: cmdutil.SubCmdRunE("upload"),
}
cmd.AddCommand(NewCmdConfigUploadFromFile(out, kubeConfigFile))
cmd.AddCommand(NewCmdConfigUploadFromFlags(out, kubeConfigFile))
return cmd
} | go | func NewCmdConfigUpload(out io.Writer, kubeConfigFile *string) *cobra.Command {
cmd := &cobra.Command{
Use: "upload",
Short: "Upload configuration about the current state, so that 'kubeadm upgrade' can later know how to configure the upgraded cluster",
RunE: cmdutil.SubCmdRunE("upload"),
}
cmd.AddCommand(NewCmdConfigUploadFromFile(out, kubeConfigFile))
cmd.AddCommand(NewCmdConfigUploadFromFlags(out, kubeConfigFile))
return cmd
} | [
"func",
"NewCmdConfigUpload",
"(",
"out",
"io",
".",
"Writer",
",",
"kubeConfigFile",
"*",
"string",
")",
"*",
"cobra",
".",
"Command",
"{",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
... | // NewCmdConfigUpload returns cobra.Command for "kubeadm config upload" command | [
"NewCmdConfigUpload",
"returns",
"cobra",
".",
"Command",
"for",
"kubeadm",
"config",
"upload",
"command"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/cmd/config.go#L267-L277 | train | NewCmdConfigUpload creates a new command to upload a config file | [
30522,
4569,
2278,
2047,
27487,
16409,
2239,
8873,
12193,
24759,
10441,
2094,
1006,
2041,
22834,
1012,
3213,
1010,
13970,
4783,
8663,
8873,
25708,
9463,
1008,
5164,
1007,
1008,
30524,
1005,
13970,
4783,
4215,
2213,
12200,
1005,
2064,
2101,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_NodeConfigStatus_To_v1_NodeConfigStatus | func Convert_core_NodeConfigStatus_To_v1_NodeConfigStatus(in *core.NodeConfigStatus, out *v1.NodeConfigStatus, s conversion.Scope) error {
return autoConvert_core_NodeConfigStatus_To_v1_NodeConfigStatus(in, out, s)
} | go | func Convert_core_NodeConfigStatus_To_v1_NodeConfigStatus(in *core.NodeConfigStatus, out *v1.NodeConfigStatus, s conversion.Scope) error {
return autoConvert_core_NodeConfigStatus_To_v1_NodeConfigStatus(in, out, s)
} | [
"func",
"Convert_core_NodeConfigStatus_To_v1_NodeConfigStatus",
"(",
"in",
"*",
"core",
".",
"NodeConfigStatus",
",",
"out",
"*",
"v1",
".",
"NodeConfigStatus",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoConvert_core_NodeConfigStatus_To_v1_N... | // Convert_core_NodeConfigStatus_To_v1_NodeConfigStatus is an autogenerated conversion function. | [
"Convert_core_NodeConfigStatus_To_v1_NodeConfigStatus",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/v1/zz_generated.conversion.go#L4416-L4418 | train | Convert_core_NodeConfigStatus_To_v1_NodeConfigStatus is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
4563,
1035,
13045,
8663,
8873,
5620,
29336,
2271,
1035,
2000,
1035,
1058,
2487,
1035,
13045,
8663,
8873,
5620,
29336,
2271,
1006,
1999,
1008,
4563,
1012,
13045,
8663,
8873,
5620,
29336,
2271,
1010,
2041,
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/cloudprovider/providers/gce/gce_util.go | firstIPInRange | func firstIPInRange(ipNet *net.IPNet) net.IP {
return ipNet.IP.Mask(ipNet.Mask)
} | go | func firstIPInRange(ipNet *net.IPNet) net.IP {
return ipNet.IP.Mask(ipNet.Mask)
} | [
"func",
"firstIPInRange",
"(",
"ipNet",
"*",
"net",
".",
"IPNet",
")",
"net",
".",
"IP",
"{",
"return",
"ipNet",
".",
"IP",
".",
"Mask",
"(",
"ipNet",
".",
"Mask",
")",
"\n",
"}"
] | // firstIPInRange returns the first IP in a given IP range. | [
"firstIPInRange",
"returns",
"the",
"first",
"IP",
"in",
"a",
"given",
"IP",
"range",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/cloudprovider/providers/gce/gce_util.go#L265-L267 | train | firstIPInRange returns the first IP in the given IPNet. | [
30522,
4569,
2278,
2034,
11514,
2378,
24388,
2063,
1006,
12997,
7159,
1008,
5658,
1012,
12997,
7159,
1007,
5658,
1012,
12997,
1063,
2709,
12997,
7159,
1012,
12997,
1012,
7308,
1006,
12997,
7159,
1012,
7308,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/genericclioptions/config_flags.go | WithDeprecatedPasswordFlag | func (f *ConfigFlags) WithDeprecatedPasswordFlag() *ConfigFlags {
f.Username = stringptr("")
f.Password = stringptr("")
return f
} | go | func (f *ConfigFlags) WithDeprecatedPasswordFlag() *ConfigFlags {
f.Username = stringptr("")
f.Password = stringptr("")
return f
} | [
"func",
"(",
"f",
"*",
"ConfigFlags",
")",
"WithDeprecatedPasswordFlag",
"(",
")",
"*",
"ConfigFlags",
"{",
"f",
".",
"Username",
"=",
"stringptr",
"(",
"\"",
"\"",
")",
"\n",
"f",
".",
"Password",
"=",
"stringptr",
"(",
"\"",
"\"",
")",
"\n",
"return"... | // WithDeprecatedPasswordFlag enables the username and password config flags | [
"WithDeprecatedPasswordFlag",
"enables",
"the",
"username",
"and",
"password",
"config",
"flags"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/cli-runtime/pkg/genericclioptions/config_flags.go#L310-L314 | train | WithDeprecatedPasswordFlag returns a new ConfigFlags with deprecated password flag set | [
30522,
4569,
2278,
1006,
1042,
1008,
9530,
8873,
25708,
17802,
2015,
1007,
2007,
3207,
28139,
12921,
15194,
18351,
10258,
8490,
1006,
1007,
1008,
9530,
8873,
25708,
17802,
2015,
1063,
1042,
1012,
5310,
18442,
1027,
5164,
13876,
2099,
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 | pkg/apis/core/v1/zz_generated.conversion.go | Convert_v1_RBDPersistentVolumeSource_To_core_RBDPersistentVolumeSource | func Convert_v1_RBDPersistentVolumeSource_To_core_RBDPersistentVolumeSource(in *v1.RBDPersistentVolumeSource, out *core.RBDPersistentVolumeSource, s conversion.Scope) error {
return autoConvert_v1_RBDPersistentVolumeSource_To_core_RBDPersistentVolumeSource(in, out, s)
} | go | func Convert_v1_RBDPersistentVolumeSource_To_core_RBDPersistentVolumeSource(in *v1.RBDPersistentVolumeSource, out *core.RBDPersistentVolumeSource, s conversion.Scope) error {
return autoConvert_v1_RBDPersistentVolumeSource_To_core_RBDPersistentVolumeSource(in, out, s)
} | [
"func",
"Convert_v1_RBDPersistentVolumeSource_To_core_RBDPersistentVolumeSource",
"(",
"in",
"*",
"v1",
".",
"RBDPersistentVolumeSource",
",",
"out",
"*",
"core",
".",
"RBDPersistentVolumeSource",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoC... | // Convert_v1_RBDPersistentVolumeSource_To_core_RBDPersistentVolumeSource is an autogenerated conversion function. | [
"Convert_v1_RBDPersistentVolumeSource_To_core_RBDPersistentVolumeSource",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/v1/zz_generated.conversion.go#L6018-L6020 | train | Convert_v1_RBDPersistentVolumeSource_To_core_RBDPersistentVolumeSource is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
1058,
2487,
1035,
21144,
18927,
2545,
27870,
3372,
6767,
12942,
2229,
8162,
3401,
1035,
2000,
1035,
4563,
1035,
21144,
18927,
2545,
27870,
3372,
6767,
12942,
2229,
8162,
3401,
1006,
1999,
1008,
1058,
2487,
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/component-base/config/validation/validation.go | ValidateClientConnectionConfiguration | func ValidateClientConnectionConfiguration(cc *config.ClientConnectionConfiguration, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if cc.Burst < 0 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("burst"), cc.Burst, "must be non-negative"))
}
return allErrs
} | go | func ValidateClientConnectionConfiguration(cc *config.ClientConnectionConfiguration, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if cc.Burst < 0 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("burst"), cc.Burst, "must be non-negative"))
}
return allErrs
} | [
"func",
"ValidateClientConnectionConfiguration",
"(",
"cc",
"*",
"config",
".",
"ClientConnectionConfiguration",
",",
"fldPath",
"*",
"field",
".",
"Path",
")",
"field",
".",
"ErrorList",
"{",
"allErrs",
":=",
"field",
".",
"ErrorList",
"{",
"}",
"\n",
"if",
"... | // ValidateClientConnectionConfiguration ensures validation of the ClientConnectionConfiguration struct | [
"ValidateClientConnectionConfiguration",
"ensures",
"validation",
"of",
"the",
"ClientConnectionConfiguration",
"struct"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/component-base/config/validation/validation.go#L25-L31 | train | ValidateClientConnectionConfiguration tests that the ClientConnectionConfiguration is valid. | [
30522,
4569,
2278,
9398,
3686,
20464,
11638,
8663,
2638,
7542,
8663,
8873,
27390,
3370,
1006,
10507,
1008,
9530,
8873,
2290,
1012,
7396,
8663,
2638,
7542,
8663,
8873,
27390,
3370,
1010,
13109,
18927,
8988,
1008,
2492,
1012,
4130,
1007,
2492... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | ValidateAbsolutePath | func ValidateAbsolutePath(path string, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if !filepath.IsAbs(path) {
allErrs = append(allErrs, field.Invalid(fldPath, path, "path is not absolute"))
}
return allErrs
} | go | func ValidateAbsolutePath(path string, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if !filepath.IsAbs(path) {
allErrs = append(allErrs, field.Invalid(fldPath, path, "path is not absolute"))
}
return allErrs
} | [
"func",
"ValidateAbsolutePath",
"(",
"path",
"string",
",",
"fldPath",
"*",
"field",
".",
"Path",
")",
"field",
".",
"ErrorList",
"{",
"allErrs",
":=",
"field",
".",
"ErrorList",
"{",
"}",
"\n",
"if",
"!",
"filepath",
".",
"IsAbs",
"(",
"path",
")",
"{... | // ValidateAbsolutePath validates whether provided path is absolute or not | [
"ValidateAbsolutePath",
"validates",
"whether",
"provided",
"path",
"is",
"absolute",
"or",
"not"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/apis/kubeadm/validation/validation.go#L394-L400 | train | ValidateAbsolutePath validates that the given path is absolute. | [
30522,
4569,
2278,
9398,
3686,
7875,
19454,
10421,
15069,
1006,
4130,
5164,
1010,
13109,
18927,
8988,
1008,
2492,
1012,
4130,
1007,
2492,
1012,
7561,
9863,
1063,
2035,
2121,
2869,
1024,
1027,
2492,
1012,
7561,
9863,
1063,
1065,
2065,
999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/framework/v1alpha1/context.go | Write | func (c *PluginContext) Write(key ContextKey, val ContextData) {
c.storage[key] = val
} | go | func (c *PluginContext) Write(key ContextKey, val ContextData) {
c.storage[key] = val
} | [
"func",
"(",
"c",
"*",
"PluginContext",
")",
"Write",
"(",
"key",
"ContextKey",
",",
"val",
"ContextData",
")",
"{",
"c",
".",
"storage",
"[",
"key",
"]",
"=",
"val",
"\n",
"}"
] | // Write stores the given "val" in PluginContext with the given "key".
// This function is not thread safe. In multi-threaded code, lock should be
// acquired first. | [
"Write",
"stores",
"the",
"given",
"val",
"in",
"PluginContext",
"with",
"the",
"given",
"key",
".",
"This",
"function",
"is",
"not",
"thread",
"safe",
".",
"In",
"multi",
"-",
"threaded",
"code",
"lock",
"should",
"be",
"acquired",
"first",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/scheduler/framework/v1alpha1/context.go#L65-L67 | train | Write sets the value of the given key to the given value. | [
30522,
4569,
2278,
1006,
1039,
1008,
13354,
2378,
8663,
18209,
1007,
4339,
1006,
3145,
6123,
14839,
1010,
11748,
6123,
2850,
2696,
1007,
1063,
1039,
1012,
5527,
1031,
3145,
1033,
1027,
11748,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/rbac/v1alpha1/rolebinding.go | newRoleBindings | func newRoleBindings(c *RbacV1alpha1Client, namespace string) *roleBindings {
return &roleBindings{
client: c.RESTClient(),
ns: namespace,
}
} | go | func newRoleBindings(c *RbacV1alpha1Client, namespace string) *roleBindings {
return &roleBindings{
client: c.RESTClient(),
ns: namespace,
}
} | [
"func",
"newRoleBindings",
"(",
"c",
"*",
"RbacV1alpha1Client",
",",
"namespace",
"string",
")",
"*",
"roleBindings",
"{",
"return",
"&",
"roleBindings",
"{",
"client",
":",
"c",
".",
"RESTClient",
"(",
")",
",",
"ns",
":",
"namespace",
",",
"}",
"\n",
"... | // newRoleBindings returns a RoleBindings | [
"newRoleBindings",
"returns",
"a",
"RoleBindings"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/rolebinding.go#L58-L63 | train | newRoleBindings returns a RoleBindings | [
30522,
4569,
2278,
2047,
13153,
15878,
22254,
8613,
1006,
1039,
1008,
21144,
6305,
2615,
2487,
2389,
21890,
2487,
20464,
11638,
1010,
3415,
15327,
5164,
1007,
1008,
2535,
8428,
4667,
2015,
1063,
2709,
1004,
2535,
8428,
4667,
2015,
1063,
739... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/plugin/pkg/client/auth/openstack/openstack.go | Token | func (c *cachedGetter) Token() (string, error) {
c.mutex.Lock()
defer c.mutex.Unlock()
var err error
// no token or exceeds the TTL
if c.token == "" || time.Since(c.born) > c.ttl {
c.token, err = c.tokenGetter.Token()
if err != nil {
return "", fmt.Errorf("failed to get token: %s", err)
}
c.born = time.Now()
}
return c.token, nil
} | go | func (c *cachedGetter) Token() (string, error) {
c.mutex.Lock()
defer c.mutex.Unlock()
var err error
// no token or exceeds the TTL
if c.token == "" || time.Since(c.born) > c.ttl {
c.token, err = c.tokenGetter.Token()
if err != nil {
return "", fmt.Errorf("failed to get token: %s", err)
}
c.born = time.Now()
}
return c.token, nil
} | [
"func",
"(",
"c",
"*",
"cachedGetter",
")",
"Token",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n\n",
"var",
"err",
"error",
"\n",
"// ... | // Token returns the current available token, create a new one if expired. | [
"Token",
"returns",
"the",
"current",
"available",
"token",
"create",
"a",
"new",
"one",
"if",
"expired",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/plugin/pkg/client/auth/openstack/openstack.go#L92-L106 | train | Token returns the token from the cache. | [
30522,
4569,
2278,
1006,
1039,
1008,
17053,
24291,
3334,
1007,
19204,
1006,
1007,
1006,
5164,
1010,
7561,
1007,
1063,
1039,
1012,
20101,
2595,
1012,
5843,
1006,
1007,
13366,
2121,
1039,
1012,
20101,
2595,
1012,
19829,
1006,
1007,
13075,
941... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | ValidateProcMountType | func ValidateProcMountType(fldPath *field.Path, procMountType core.ProcMountType) *field.Error {
switch procMountType {
case core.DefaultProcMount, core.UnmaskedProcMount:
return nil
default:
return field.NotSupported(fldPath, procMountType, []string{string(core.DefaultProcMount), string(core.UnmaskedProcMount)})
}
} | go | func ValidateProcMountType(fldPath *field.Path, procMountType core.ProcMountType) *field.Error {
switch procMountType {
case core.DefaultProcMount, core.UnmaskedProcMount:
return nil
default:
return field.NotSupported(fldPath, procMountType, []string{string(core.DefaultProcMount), string(core.UnmaskedProcMount)})
}
} | [
"func",
"ValidateProcMountType",
"(",
"fldPath",
"*",
"field",
".",
"Path",
",",
"procMountType",
"core",
".",
"ProcMountType",
")",
"*",
"field",
".",
"Error",
"{",
"switch",
"procMountType",
"{",
"case",
"core",
".",
"DefaultProcMount",
",",
"core",
".",
"... | // ValidateProcMountType tests that the argument is a valid ProcMountType. | [
"ValidateProcMountType",
"tests",
"that",
"the",
"argument",
"is",
"a",
"valid",
"ProcMountType",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/validation/validation.go#L5274-L5281 | train | ValidateProcMountType validates the procMountType | [
30522,
4569,
2278,
9398,
3686,
21572,
27487,
21723,
13874,
1006,
13109,
18927,
8988,
1008,
2492,
1012,
4130,
1010,
4013,
27487,
21723,
13874,
4563,
1012,
4013,
27487,
21723,
13874,
1007,
1008,
2492,
1012,
7561,
1063,
6942,
4013,
27487,
21723,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/metrics/v1alpha1/zz_generated.conversion.go | Convert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics | func Convert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics(in *ContainerMetrics, out *metrics.ContainerMetrics, s conversion.Scope) error {
return autoConvert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics(in, out, s)
} | go | func Convert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics(in *ContainerMetrics, out *metrics.ContainerMetrics, s conversion.Scope) error {
return autoConvert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics(in, out, s)
} | [
"func",
"Convert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics",
"(",
"in",
"*",
"ContainerMetrics",
",",
"out",
"*",
"metrics",
".",
"ContainerMetrics",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoConvert_v1alpha1_ContainerMetrics_To_met... | // Convert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics is an autogenerated conversion function. | [
"Convert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/metrics/pkg/apis/metrics/v1alpha1/zz_generated.conversion.go#L99-L101 | train | Convert_v1alpha1_ContainerMetrics_To_metrics_ContainerMetrics is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
1058,
2487,
2389,
21890,
2487,
1035,
11661,
12589,
2015,
1035,
2000,
1035,
12046,
2015,
1035,
11661,
12589,
2015,
1006,
1999,
1008,
11661,
12589,
2015,
1010,
2041,
1008,
12046,
2015,
1012,
11661,
12589,
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 | staging/src/k8s.io/client-go/tools/cache/fake_custom_store.go | GetByKey | func (f *FakeCustomStore) GetByKey(key string) (item interface{}, exists bool, err error) {
if f.GetByKeyFunc != nil {
return f.GetByKeyFunc(key)
}
return nil, false, nil
} | go | func (f *FakeCustomStore) GetByKey(key string) (item interface{}, exists bool, err error) {
if f.GetByKeyFunc != nil {
return f.GetByKeyFunc(key)
}
return nil, false, nil
} | [
"func",
"(",
"f",
"*",
"FakeCustomStore",
")",
"GetByKey",
"(",
"key",
"string",
")",
"(",
"item",
"interface",
"{",
"}",
",",
"exists",
"bool",
",",
"err",
"error",
")",
"{",
"if",
"f",
".",
"GetByKeyFunc",
"!=",
"nil",
"{",
"return",
"f",
".",
"G... | // GetByKey calls the custom GetByKey function if defined | [
"GetByKey",
"calls",
"the",
"custom",
"GetByKey",
"function",
"if",
"defined"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/tools/cache/fake_custom_store.go#L81-L86 | train | GetByKey is a mock | [
30522,
4569,
2278,
1006,
1042,
1008,
8275,
7874,
20389,
23809,
2063,
1007,
2131,
3762,
14839,
1006,
3145,
5164,
1007,
1006,
8875,
8278,
1063,
1065,
1010,
6526,
22017,
2140,
1010,
9413,
2099,
7561,
1007,
1063,
2065,
1042,
1012,
2131,
3762,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/pod_container_deletor.go | getContainersToDeleteInPod | func getContainersToDeleteInPod(filterContainerID string, podStatus *kubecontainer.PodStatus, containersToKeep int) containerStatusbyCreatedList {
matchedContainer := func(filterContainerId string, podStatus *kubecontainer.PodStatus) *kubecontainer.ContainerStatus {
if filterContainerId == "" {
return nil
}
for _, containerStatus := range podStatus.ContainerStatuses {
if containerStatus.ID.ID == filterContainerId {
return containerStatus
}
}
return nil
}(filterContainerID, podStatus)
if filterContainerID != "" && matchedContainer == nil {
klog.Warningf("Container %q not found in pod's containers", filterContainerID)
return containerStatusbyCreatedList{}
}
// Find the exited containers whose name matches the name of the container with id being filterContainerId
var candidates containerStatusbyCreatedList
for _, containerStatus := range podStatus.ContainerStatuses {
if containerStatus.State != kubecontainer.ContainerStateExited {
continue
}
if matchedContainer == nil || matchedContainer.Name == containerStatus.Name {
candidates = append(candidates, containerStatus)
}
}
if len(candidates) <= containersToKeep {
return containerStatusbyCreatedList{}
}
sort.Sort(candidates)
return candidates[containersToKeep:]
} | go | func getContainersToDeleteInPod(filterContainerID string, podStatus *kubecontainer.PodStatus, containersToKeep int) containerStatusbyCreatedList {
matchedContainer := func(filterContainerId string, podStatus *kubecontainer.PodStatus) *kubecontainer.ContainerStatus {
if filterContainerId == "" {
return nil
}
for _, containerStatus := range podStatus.ContainerStatuses {
if containerStatus.ID.ID == filterContainerId {
return containerStatus
}
}
return nil
}(filterContainerID, podStatus)
if filterContainerID != "" && matchedContainer == nil {
klog.Warningf("Container %q not found in pod's containers", filterContainerID)
return containerStatusbyCreatedList{}
}
// Find the exited containers whose name matches the name of the container with id being filterContainerId
var candidates containerStatusbyCreatedList
for _, containerStatus := range podStatus.ContainerStatuses {
if containerStatus.State != kubecontainer.ContainerStateExited {
continue
}
if matchedContainer == nil || matchedContainer.Name == containerStatus.Name {
candidates = append(candidates, containerStatus)
}
}
if len(candidates) <= containersToKeep {
return containerStatusbyCreatedList{}
}
sort.Sort(candidates)
return candidates[containersToKeep:]
} | [
"func",
"getContainersToDeleteInPod",
"(",
"filterContainerID",
"string",
",",
"podStatus",
"*",
"kubecontainer",
".",
"PodStatus",
",",
"containersToKeep",
"int",
")",
"containerStatusbyCreatedList",
"{",
"matchedContainer",
":=",
"func",
"(",
"filterContainerId",
"strin... | // getContainersToDeleteInPod returns the exited containers in a pod whose name matches the name inferred from filterContainerId (if not empty), ordered by the creation time from the latest to the earliest.
// If filterContainerID is empty, all dead containers in the pod are returned. | [
"getContainersToDeleteInPod",
"returns",
"the",
"exited",
"containers",
"in",
"a",
"pod",
"whose",
"name",
"matches",
"the",
"name",
"inferred",
"from",
"filterContainerId",
"(",
"if",
"not",
"empty",
")",
"ordered",
"by",
"the",
"creation",
"time",
"from",
"the... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/pod_container_deletor.go#L61-L95 | train | getContainersToDeleteInPod returns a list of containers that are deleted in the pod. | [
30522,
4569,
2278,
2131,
8663,
18249,
2545,
3406,
9247,
12870,
2378,
27633,
1006,
11307,
8663,
18249,
11124,
2094,
5164,
1010,
26723,
29336,
2271,
1008,
13970,
4783,
8663,
18249,
2121,
1012,
26723,
29336,
2271,
1010,
16143,
18715,
4402,
2361,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_addresses.go | GetRegionAddressByIP | func (g *Cloud) GetRegionAddressByIP(region, ipAddress string) (*compute.Address, error) {
ctx, cancel := cloud.ContextWithCallTimeout()
defer cancel()
mc := newAddressMetricContext("list", region)
addrs, err := g.c.Addresses().List(ctx, region, filter.Regexp("address", ipAddress))
mc.Observe(err)
if err != nil {
return nil, err
}
if len(addrs) > 1 {
klog.Warningf("More than one addresses matching the IP %q: %v", ipAddress, addrNames(addrs))
}
for _, addr := range addrs {
if addr.Address == ipAddress {
return addr, nil
}
}
return nil, makeGoogleAPINotFoundError(fmt.Sprintf("Address with IP %q was not found in region %q", ipAddress, region))
} | go | func (g *Cloud) GetRegionAddressByIP(region, ipAddress string) (*compute.Address, error) {
ctx, cancel := cloud.ContextWithCallTimeout()
defer cancel()
mc := newAddressMetricContext("list", region)
addrs, err := g.c.Addresses().List(ctx, region, filter.Regexp("address", ipAddress))
mc.Observe(err)
if err != nil {
return nil, err
}
if len(addrs) > 1 {
klog.Warningf("More than one addresses matching the IP %q: %v", ipAddress, addrNames(addrs))
}
for _, addr := range addrs {
if addr.Address == ipAddress {
return addr, nil
}
}
return nil, makeGoogleAPINotFoundError(fmt.Sprintf("Address with IP %q was not found in region %q", ipAddress, region))
} | [
"func",
"(",
"g",
"*",
"Cloud",
")",
"GetRegionAddressByIP",
"(",
"region",
",",
"ipAddress",
"string",
")",
"(",
"*",
"compute",
".",
"Address",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"cloud",
".",
"ContextWithCallTimeout",
"(",
")",
"\n",
... | // GetRegionAddressByIP returns the regional address matching the given IP address. | [
"GetRegionAddressByIP",
"returns",
"the",
"regional",
"address",
"matching",
"the",
"given",
"IP",
"address",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/cloudprovider/providers/gce/gce_addresses.go#L139-L160 | train | GetRegionAddressByIP returns the address for the given IP address in the given region. | [
30522,
4569,
2278,
1006,
1043,
1008,
6112,
1007,
2131,
23784,
4215,
16200,
4757,
3762,
11514,
1006,
2555,
1010,
25249,
16200,
4757,
5164,
1007,
1006,
1008,
24134,
1012,
4769,
1010,
7561,
1007,
1063,
14931,
2595,
1010,
17542,
1024,
1027,
611... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/sample-controller/pkg/apis/samplecontroller/v1alpha1/zz_generated.deepcopy.go | DeepCopyInto | func (in *FooList) DeepCopyInto(out *FooList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Foo, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
} | go | func (in *FooList) DeepCopyInto(out *FooList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Foo, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
} | [
"func",
"(",
"in",
"*",
"FooList",
")",
"DeepCopyInto",
"(",
"out",
"*",
"FooList",
")",
"{",
"*",
"out",
"=",
"*",
"in",
"\n",
"out",
".",
"TypeMeta",
"=",
"in",
".",
"TypeMeta",
"\n",
"out",
".",
"ListMeta",
"=",
"in",
".",
"ListMeta",
"\n",
"i... | // 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/sample-controller/pkg/apis/samplecontroller/v1alpha1/zz_generated.deepcopy.go#L56-L68 | train | DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new FooList. | [
30522,
4569,
2278,
1006,
1999,
1008,
7966,
2923,
1007,
2784,
3597,
7685,
18447,
2080,
1006,
2041,
1008,
7966,
2923,
1007,
1063,
1008,
2041,
1027,
1008,
1999,
2041,
1012,
2828,
11368,
2050,
1027,
1999,
1012,
2828,
11368,
2050,
2041,
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/controller/volume/persistentvolume/pv_controller.go | provisionClaimOperation | func (ctrl *PersistentVolumeController) provisionClaimOperation(claim *v1.PersistentVolumeClaim) (string, error) {
claimClass := v1helper.GetPersistentVolumeClaimClass(claim)
klog.V(4).Infof("provisionClaimOperation [%s] started, class: %q", claimToClaimKey(claim), claimClass)
plugin, storageClass, err := ctrl.findProvisionablePlugin(claim)
if err != nil {
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, err.Error())
klog.V(2).Infof("error finding provisioning plugin for claim %s: %v", claimToClaimKey(claim), err)
// The controller will retry provisioning the volume in every
// syncVolume() call.
return "", err
}
var pluginName string
provisionerName := storageClass.Provisioner
if plugin != nil {
if plugin.IsMigratedToCSI() {
// pluginName is not set here to align with existing behavior
// of not setting pluginName for external provisioners (including CSI)
// Set provisionerName to CSI plugin name for setClaimProvisioner
provisionerName, err = ctrl.getCSINameFromIntreeName(storageClass.Provisioner)
if err != nil {
strerr := fmt.Sprintf("error getting CSI name for In tree plugin %s: %v", storageClass.Provisioner, err)
klog.V(2).Infof("%s", strerr)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, strerr)
return "", err
}
} else {
pluginName = plugin.GetPluginName()
}
}
// Add provisioner annotation so external provisioners know when to start
newClaim, err := ctrl.setClaimProvisioner(claim, provisionerName)
if err != nil {
// Save failed, the controller will retry in the next sync
klog.V(2).Infof("error saving claim %s: %v", claimToClaimKey(claim), err)
return pluginName, err
}
claim = newClaim
if plugin == nil || plugin.IsMigratedToCSI() {
// findProvisionablePlugin returned no error nor plugin.
// This means that an unknown provisioner is requested. Report an event
// and wait for the external provisioner
msg := fmt.Sprintf("waiting for a volume to be created, either by external provisioner %q or manually created by system administrator", storageClass.Provisioner)
ctrl.eventRecorder.Event(claim, v1.EventTypeNormal, events.ExternalProvisioning, msg)
klog.V(3).Infof("provisioning claim %q: %s", claimToClaimKey(claim), msg)
return pluginName, nil
}
// internal provisioning
// A previous doProvisionClaim may just have finished while we were waiting for
// the locks. Check that PV (with deterministic name) hasn't been provisioned
// yet.
pvName := ctrl.getProvisionedVolumeNameForClaim(claim)
volume, err := ctrl.kubeClient.CoreV1().PersistentVolumes().Get(pvName, metav1.GetOptions{})
if err == nil && volume != nil {
// Volume has been already provisioned, nothing to do.
klog.V(4).Infof("provisionClaimOperation [%s]: volume already exists, skipping", claimToClaimKey(claim))
return pluginName, err
}
// Prepare a claimRef to the claim early (to fail before a volume is
// provisioned)
claimRef, err := ref.GetReference(scheme.Scheme, claim)
if err != nil {
klog.V(3).Infof("unexpected error getting claim reference: %v", err)
return pluginName, err
}
// Gather provisioning options
tags := make(map[string]string)
tags[CloudVolumeCreatedForClaimNamespaceTag] = claim.Namespace
tags[CloudVolumeCreatedForClaimNameTag] = claim.Name
tags[CloudVolumeCreatedForVolumeNameTag] = pvName
options := vol.VolumeOptions{
PersistentVolumeReclaimPolicy: *storageClass.ReclaimPolicy,
MountOptions: storageClass.MountOptions,
CloudTags: &tags,
ClusterName: ctrl.clusterName,
PVName: pvName,
PVC: claim,
Parameters: storageClass.Parameters,
}
// Refuse to provision if the plugin doesn't support mount options, creation
// of PV would be rejected by validation anyway
if !plugin.SupportsMountOption() && len(options.MountOptions) > 0 {
strerr := fmt.Sprintf("Mount options are not supported by the provisioner but StorageClass %q has mount options %v", storageClass.Name, options.MountOptions)
klog.V(2).Infof("Mount options are not supported by the provisioner but claim %q's StorageClass %q has mount options %v", claimToClaimKey(claim), storageClass.Name, options.MountOptions)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, strerr)
return pluginName, fmt.Errorf("provisioner %q doesn't support mount options", plugin.GetPluginName())
}
// Provision the volume
provisioner, err := plugin.NewProvisioner(options)
if err != nil {
strerr := fmt.Sprintf("Failed to create provisioner: %v", err)
klog.V(2).Infof("failed to create provisioner for claim %q with StorageClass %q: %v", claimToClaimKey(claim), storageClass.Name, err)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, strerr)
return pluginName, err
}
var selectedNode *v1.Node = nil
if nodeName, ok := claim.Annotations[annSelectedNode]; ok {
selectedNode, err = ctrl.NodeLister.Get(nodeName)
if err != nil {
strerr := fmt.Sprintf("Failed to get target node: %v", err)
klog.V(3).Infof("unexpected error getting target node %q for claim %q: %v", nodeName, claimToClaimKey(claim), err)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, strerr)
return pluginName, err
}
}
allowedTopologies := storageClass.AllowedTopologies
opComplete := util.OperationCompleteHook(plugin.GetPluginName(), "volume_provision")
volume, err = provisioner.Provision(selectedNode, allowedTopologies)
opComplete(&err)
if err != nil {
// Other places of failure have nothing to do with VolumeScheduling,
// so just let controller retry in the next sync. We'll only call func
// rescheduleProvisioning here when the underlying provisioning actually failed.
ctrl.rescheduleProvisioning(claim)
strerr := fmt.Sprintf("Failed to provision volume with StorageClass %q: %v", storageClass.Name, err)
klog.V(2).Infof("failed to provision volume for claim %q with StorageClass %q: %v", claimToClaimKey(claim), storageClass.Name, err)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, strerr)
return pluginName, err
}
klog.V(3).Infof("volume %q for claim %q created", volume.Name, claimToClaimKey(claim))
// Create Kubernetes PV object for the volume.
if volume.Name == "" {
volume.Name = pvName
}
// Bind it to the claim
volume.Spec.ClaimRef = claimRef
volume.Status.Phase = v1.VolumeBound
volume.Spec.StorageClassName = claimClass
// Add annBoundByController (used in deleting the volume)
metav1.SetMetaDataAnnotation(&volume.ObjectMeta, annBoundByController, "yes")
metav1.SetMetaDataAnnotation(&volume.ObjectMeta, annDynamicallyProvisioned, plugin.GetPluginName())
// Try to create the PV object several times
for i := 0; i < ctrl.createProvisionedPVRetryCount; i++ {
klog.V(4).Infof("provisionClaimOperation [%s]: trying to save volume %s", claimToClaimKey(claim), volume.Name)
var newVol *v1.PersistentVolume
if newVol, err = ctrl.kubeClient.CoreV1().PersistentVolumes().Create(volume); err == nil || apierrs.IsAlreadyExists(err) {
// Save succeeded.
if err != nil {
klog.V(3).Infof("volume %q for claim %q already exists, reusing", volume.Name, claimToClaimKey(claim))
err = nil
} else {
klog.V(3).Infof("volume %q for claim %q saved", volume.Name, claimToClaimKey(claim))
_, updateErr := ctrl.storeVolumeUpdate(newVol)
if updateErr != nil {
// We will get an "volume added" event soon, this is not a big error
klog.V(4).Infof("provisionClaimOperation [%s]: cannot update internal cache: %v", volume.Name, updateErr)
}
}
break
}
// Save failed, try again after a while.
klog.V(3).Infof("failed to save volume %q for claim %q: %v", volume.Name, claimToClaimKey(claim), err)
time.Sleep(ctrl.createProvisionedPVInterval)
}
if err != nil {
// Save failed. Now we have a storage asset outside of Kubernetes,
// but we don't have appropriate PV object for it.
// Emit some event here and try to delete the storage asset several
// times.
strerr := fmt.Sprintf("Error creating provisioned PV object for claim %s: %v. Deleting the volume.", claimToClaimKey(claim), err)
klog.V(3).Info(strerr)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, strerr)
var deleteErr error
var deleted bool
for i := 0; i < ctrl.createProvisionedPVRetryCount; i++ {
_, deleted, deleteErr = ctrl.doDeleteVolume(volume)
if deleteErr == nil && deleted {
// Delete succeeded
klog.V(4).Infof("provisionClaimOperation [%s]: cleaning volume %s succeeded", claimToClaimKey(claim), volume.Name)
break
}
if !deleted {
// This is unreachable code, the volume was provisioned by an
// internal plugin and therefore there MUST be an internal
// plugin that deletes it.
klog.Errorf("Error finding internal deleter for volume plugin %q", plugin.GetPluginName())
break
}
// Delete failed, try again after a while.
klog.V(3).Infof("failed to delete volume %q: %v", volume.Name, deleteErr)
time.Sleep(ctrl.createProvisionedPVInterval)
}
if deleteErr != nil {
// Delete failed several times. There is an orphaned volume and there
// is nothing we can do about it.
strerr := fmt.Sprintf("Error cleaning provisioned volume for claim %s: %v. Please delete manually.", claimToClaimKey(claim), deleteErr)
klog.V(2).Info(strerr)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningCleanupFailed, strerr)
}
} else {
klog.V(2).Infof("volume %q provisioned for claim %q", volume.Name, claimToClaimKey(claim))
msg := fmt.Sprintf("Successfully provisioned volume %s using %s", volume.Name, plugin.GetPluginName())
ctrl.eventRecorder.Event(claim, v1.EventTypeNormal, events.ProvisioningSucceeded, msg)
}
return pluginName, nil
} | go | func (ctrl *PersistentVolumeController) provisionClaimOperation(claim *v1.PersistentVolumeClaim) (string, error) {
claimClass := v1helper.GetPersistentVolumeClaimClass(claim)
klog.V(4).Infof("provisionClaimOperation [%s] started, class: %q", claimToClaimKey(claim), claimClass)
plugin, storageClass, err := ctrl.findProvisionablePlugin(claim)
if err != nil {
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, err.Error())
klog.V(2).Infof("error finding provisioning plugin for claim %s: %v", claimToClaimKey(claim), err)
// The controller will retry provisioning the volume in every
// syncVolume() call.
return "", err
}
var pluginName string
provisionerName := storageClass.Provisioner
if plugin != nil {
if plugin.IsMigratedToCSI() {
// pluginName is not set here to align with existing behavior
// of not setting pluginName for external provisioners (including CSI)
// Set provisionerName to CSI plugin name for setClaimProvisioner
provisionerName, err = ctrl.getCSINameFromIntreeName(storageClass.Provisioner)
if err != nil {
strerr := fmt.Sprintf("error getting CSI name for In tree plugin %s: %v", storageClass.Provisioner, err)
klog.V(2).Infof("%s", strerr)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, strerr)
return "", err
}
} else {
pluginName = plugin.GetPluginName()
}
}
// Add provisioner annotation so external provisioners know when to start
newClaim, err := ctrl.setClaimProvisioner(claim, provisionerName)
if err != nil {
// Save failed, the controller will retry in the next sync
klog.V(2).Infof("error saving claim %s: %v", claimToClaimKey(claim), err)
return pluginName, err
}
claim = newClaim
if plugin == nil || plugin.IsMigratedToCSI() {
// findProvisionablePlugin returned no error nor plugin.
// This means that an unknown provisioner is requested. Report an event
// and wait for the external provisioner
msg := fmt.Sprintf("waiting for a volume to be created, either by external provisioner %q or manually created by system administrator", storageClass.Provisioner)
ctrl.eventRecorder.Event(claim, v1.EventTypeNormal, events.ExternalProvisioning, msg)
klog.V(3).Infof("provisioning claim %q: %s", claimToClaimKey(claim), msg)
return pluginName, nil
}
// internal provisioning
// A previous doProvisionClaim may just have finished while we were waiting for
// the locks. Check that PV (with deterministic name) hasn't been provisioned
// yet.
pvName := ctrl.getProvisionedVolumeNameForClaim(claim)
volume, err := ctrl.kubeClient.CoreV1().PersistentVolumes().Get(pvName, metav1.GetOptions{})
if err == nil && volume != nil {
// Volume has been already provisioned, nothing to do.
klog.V(4).Infof("provisionClaimOperation [%s]: volume already exists, skipping", claimToClaimKey(claim))
return pluginName, err
}
// Prepare a claimRef to the claim early (to fail before a volume is
// provisioned)
claimRef, err := ref.GetReference(scheme.Scheme, claim)
if err != nil {
klog.V(3).Infof("unexpected error getting claim reference: %v", err)
return pluginName, err
}
// Gather provisioning options
tags := make(map[string]string)
tags[CloudVolumeCreatedForClaimNamespaceTag] = claim.Namespace
tags[CloudVolumeCreatedForClaimNameTag] = claim.Name
tags[CloudVolumeCreatedForVolumeNameTag] = pvName
options := vol.VolumeOptions{
PersistentVolumeReclaimPolicy: *storageClass.ReclaimPolicy,
MountOptions: storageClass.MountOptions,
CloudTags: &tags,
ClusterName: ctrl.clusterName,
PVName: pvName,
PVC: claim,
Parameters: storageClass.Parameters,
}
// Refuse to provision if the plugin doesn't support mount options, creation
// of PV would be rejected by validation anyway
if !plugin.SupportsMountOption() && len(options.MountOptions) > 0 {
strerr := fmt.Sprintf("Mount options are not supported by the provisioner but StorageClass %q has mount options %v", storageClass.Name, options.MountOptions)
klog.V(2).Infof("Mount options are not supported by the provisioner but claim %q's StorageClass %q has mount options %v", claimToClaimKey(claim), storageClass.Name, options.MountOptions)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, strerr)
return pluginName, fmt.Errorf("provisioner %q doesn't support mount options", plugin.GetPluginName())
}
// Provision the volume
provisioner, err := plugin.NewProvisioner(options)
if err != nil {
strerr := fmt.Sprintf("Failed to create provisioner: %v", err)
klog.V(2).Infof("failed to create provisioner for claim %q with StorageClass %q: %v", claimToClaimKey(claim), storageClass.Name, err)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, strerr)
return pluginName, err
}
var selectedNode *v1.Node = nil
if nodeName, ok := claim.Annotations[annSelectedNode]; ok {
selectedNode, err = ctrl.NodeLister.Get(nodeName)
if err != nil {
strerr := fmt.Sprintf("Failed to get target node: %v", err)
klog.V(3).Infof("unexpected error getting target node %q for claim %q: %v", nodeName, claimToClaimKey(claim), err)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, strerr)
return pluginName, err
}
}
allowedTopologies := storageClass.AllowedTopologies
opComplete := util.OperationCompleteHook(plugin.GetPluginName(), "volume_provision")
volume, err = provisioner.Provision(selectedNode, allowedTopologies)
opComplete(&err)
if err != nil {
// Other places of failure have nothing to do with VolumeScheduling,
// so just let controller retry in the next sync. We'll only call func
// rescheduleProvisioning here when the underlying provisioning actually failed.
ctrl.rescheduleProvisioning(claim)
strerr := fmt.Sprintf("Failed to provision volume with StorageClass %q: %v", storageClass.Name, err)
klog.V(2).Infof("failed to provision volume for claim %q with StorageClass %q: %v", claimToClaimKey(claim), storageClass.Name, err)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, strerr)
return pluginName, err
}
klog.V(3).Infof("volume %q for claim %q created", volume.Name, claimToClaimKey(claim))
// Create Kubernetes PV object for the volume.
if volume.Name == "" {
volume.Name = pvName
}
// Bind it to the claim
volume.Spec.ClaimRef = claimRef
volume.Status.Phase = v1.VolumeBound
volume.Spec.StorageClassName = claimClass
// Add annBoundByController (used in deleting the volume)
metav1.SetMetaDataAnnotation(&volume.ObjectMeta, annBoundByController, "yes")
metav1.SetMetaDataAnnotation(&volume.ObjectMeta, annDynamicallyProvisioned, plugin.GetPluginName())
// Try to create the PV object several times
for i := 0; i < ctrl.createProvisionedPVRetryCount; i++ {
klog.V(4).Infof("provisionClaimOperation [%s]: trying to save volume %s", claimToClaimKey(claim), volume.Name)
var newVol *v1.PersistentVolume
if newVol, err = ctrl.kubeClient.CoreV1().PersistentVolumes().Create(volume); err == nil || apierrs.IsAlreadyExists(err) {
// Save succeeded.
if err != nil {
klog.V(3).Infof("volume %q for claim %q already exists, reusing", volume.Name, claimToClaimKey(claim))
err = nil
} else {
klog.V(3).Infof("volume %q for claim %q saved", volume.Name, claimToClaimKey(claim))
_, updateErr := ctrl.storeVolumeUpdate(newVol)
if updateErr != nil {
// We will get an "volume added" event soon, this is not a big error
klog.V(4).Infof("provisionClaimOperation [%s]: cannot update internal cache: %v", volume.Name, updateErr)
}
}
break
}
// Save failed, try again after a while.
klog.V(3).Infof("failed to save volume %q for claim %q: %v", volume.Name, claimToClaimKey(claim), err)
time.Sleep(ctrl.createProvisionedPVInterval)
}
if err != nil {
// Save failed. Now we have a storage asset outside of Kubernetes,
// but we don't have appropriate PV object for it.
// Emit some event here and try to delete the storage asset several
// times.
strerr := fmt.Sprintf("Error creating provisioned PV object for claim %s: %v. Deleting the volume.", claimToClaimKey(claim), err)
klog.V(3).Info(strerr)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, strerr)
var deleteErr error
var deleted bool
for i := 0; i < ctrl.createProvisionedPVRetryCount; i++ {
_, deleted, deleteErr = ctrl.doDeleteVolume(volume)
if deleteErr == nil && deleted {
// Delete succeeded
klog.V(4).Infof("provisionClaimOperation [%s]: cleaning volume %s succeeded", claimToClaimKey(claim), volume.Name)
break
}
if !deleted {
// This is unreachable code, the volume was provisioned by an
// internal plugin and therefore there MUST be an internal
// plugin that deletes it.
klog.Errorf("Error finding internal deleter for volume plugin %q", plugin.GetPluginName())
break
}
// Delete failed, try again after a while.
klog.V(3).Infof("failed to delete volume %q: %v", volume.Name, deleteErr)
time.Sleep(ctrl.createProvisionedPVInterval)
}
if deleteErr != nil {
// Delete failed several times. There is an orphaned volume and there
// is nothing we can do about it.
strerr := fmt.Sprintf("Error cleaning provisioned volume for claim %s: %v. Please delete manually.", claimToClaimKey(claim), deleteErr)
klog.V(2).Info(strerr)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningCleanupFailed, strerr)
}
} else {
klog.V(2).Infof("volume %q provisioned for claim %q", volume.Name, claimToClaimKey(claim))
msg := fmt.Sprintf("Successfully provisioned volume %s using %s", volume.Name, plugin.GetPluginName())
ctrl.eventRecorder.Event(claim, v1.EventTypeNormal, events.ProvisioningSucceeded, msg)
}
return pluginName, nil
} | [
"func",
"(",
"ctrl",
"*",
"PersistentVolumeController",
")",
"provisionClaimOperation",
"(",
"claim",
"*",
"v1",
".",
"PersistentVolumeClaim",
")",
"(",
"string",
",",
"error",
")",
"{",
"claimClass",
":=",
"v1helper",
".",
"GetPersistentVolumeClaimClass",
"(",
"c... | // provisionClaimOperation provisions a volume. This method is running in
// standalone goroutine and already has all necessary locks. | [
"provisionClaimOperation",
"provisions",
"a",
"volume",
".",
"This",
"method",
"is",
"running",
"in",
"standalone",
"goroutine",
"and",
"already",
"has",
"all",
"necessary",
"locks",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/volume/persistentvolume/pv_controller.go#L1363-L1580 | train | provisionClaimOperation is called to provision a claim | [
30522,
4569,
2278,
1006,
14931,
12190,
1008,
14516,
6767,
12942,
8586,
12162,
26611,
1007,
9347,
25154,
25918,
3370,
1006,
4366,
1008,
1058,
2487,
1012,
14516,
6767,
12942,
8586,
19771,
2213,
1007,
1006,
5164,
1010,
7561,
1007,
1063,
4366,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_PodDNSConfigOption_To_core_PodDNSConfigOption | func Convert_v1_PodDNSConfigOption_To_core_PodDNSConfigOption(in *v1.PodDNSConfigOption, out *core.PodDNSConfigOption, s conversion.Scope) error {
return autoConvert_v1_PodDNSConfigOption_To_core_PodDNSConfigOption(in, out, s)
} | go | func Convert_v1_PodDNSConfigOption_To_core_PodDNSConfigOption(in *v1.PodDNSConfigOption, out *core.PodDNSConfigOption, s conversion.Scope) error {
return autoConvert_v1_PodDNSConfigOption_To_core_PodDNSConfigOption(in, out, s)
} | [
"func",
"Convert_v1_PodDNSConfigOption_To_core_PodDNSConfigOption",
"(",
"in",
"*",
"v1",
".",
"PodDNSConfigOption",
",",
"out",
"*",
"core",
".",
"PodDNSConfigOption",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoConvert_v1_PodDNSConfigOption... | // Convert_v1_PodDNSConfigOption_To_core_PodDNSConfigOption is an autogenerated conversion function. | [
"Convert_v1_PodDNSConfigOption_To_core_PodDNSConfigOption",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/v1/zz_generated.conversion.go#L5311-L5313 | train | Convert_v1_PodDNSConfigOption_To_core_PodDNSConfigOption is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
1058,
2487,
1035,
17491,
2094,
3619,
8663,
8873,
3995,
16790,
1035,
2000,
1035,
4563,
1035,
17491,
2094,
3619,
8663,
8873,
3995,
16790,
1006,
1999,
1008,
1058,
2487,
1012,
17491,
2094,
3619,
8663,
8873,
3995,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/server/portforward/httpstream.go | monitorStreamPair | func (h *httpStreamHandler) monitorStreamPair(p *httpStreamPair, timeout <-chan time.Time) {
select {
case <-timeout:
err := fmt.Errorf("(conn=%v, request=%s) timed out waiting for streams", h.conn, p.requestID)
utilruntime.HandleError(err)
p.printError(err.Error())
case <-p.complete:
klog.V(5).Infof("(conn=%v, request=%s) successfully received error and data streams", h.conn, p.requestID)
}
h.removeStreamPair(p.requestID)
} | go | func (h *httpStreamHandler) monitorStreamPair(p *httpStreamPair, timeout <-chan time.Time) {
select {
case <-timeout:
err := fmt.Errorf("(conn=%v, request=%s) timed out waiting for streams", h.conn, p.requestID)
utilruntime.HandleError(err)
p.printError(err.Error())
case <-p.complete:
klog.V(5).Infof("(conn=%v, request=%s) successfully received error and data streams", h.conn, p.requestID)
}
h.removeStreamPair(p.requestID)
} | [
"func",
"(",
"h",
"*",
"httpStreamHandler",
")",
"monitorStreamPair",
"(",
"p",
"*",
"httpStreamPair",
",",
"timeout",
"<-",
"chan",
"time",
".",
"Time",
")",
"{",
"select",
"{",
"case",
"<-",
"timeout",
":",
"err",
":=",
"fmt",
".",
"Errorf",
"(",
"\"... | // monitorStreamPair waits for the pair to receive both its error and data
// streams, or for the timeout to expire (whichever happens first), and then
// removes the pair. | [
"monitorStreamPair",
"waits",
"for",
"the",
"pair",
"to",
"receive",
"both",
"its",
"error",
"and",
"data",
"streams",
"or",
"for",
"the",
"timeout",
"to",
"expire",
"(",
"whichever",
"happens",
"first",
")",
"and",
"then",
"removes",
"the",
"pair",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/server/portforward/httpstream.go#L139-L149 | train | monitorStreamPair is a helper function to monitor a stream pair | [
30522,
4569,
2278,
1006,
1044,
1008,
16770,
25379,
11774,
3917,
1007,
15410,
25379,
4502,
4313,
1006,
1052,
1008,
16770,
25379,
4502,
4313,
1010,
2051,
5833,
1026,
1011,
9212,
2051,
1012,
2051,
1007,
1063,
7276,
1063,
2553,
1026,
1011,
2051... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/scaleio/sio_client.go | getGUID | func (c *sioClient) getGUID() (string, error) {
if c.sdcGUID == "" {
klog.V(4).Info(log("sdc guid label not set, falling back to using drv_cfg"))
cmd := c.getSdcCmd()
output, err := c.exec.Run(cmd, "--query_guid")
if err != nil {
klog.Error(log("drv_cfg --query_guid failed: %v", err))
return "", err
}
c.sdcGUID = strings.TrimSpace(string(output))
}
return c.sdcGUID, nil
} | go | func (c *sioClient) getGUID() (string, error) {
if c.sdcGUID == "" {
klog.V(4).Info(log("sdc guid label not set, falling back to using drv_cfg"))
cmd := c.getSdcCmd()
output, err := c.exec.Run(cmd, "--query_guid")
if err != nil {
klog.Error(log("drv_cfg --query_guid failed: %v", err))
return "", err
}
c.sdcGUID = strings.TrimSpace(string(output))
}
return c.sdcGUID, nil
} | [
"func",
"(",
"c",
"*",
"sioClient",
")",
"getGUID",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"c",
".",
"sdcGUID",
"==",
"\"",
"\"",
"{",
"klog",
".",
"V",
"(",
"4",
")",
".",
"Info",
"(",
"log",
"(",
"\"",
"\"",
")",
")",
"\n"... | // getGUID returns instance GUID, if not set using resource labels
// it attempts to fallback to using drv_cfg binary | [
"getGUID",
"returns",
"instance",
"GUID",
"if",
"not",
"set",
"using",
"resource",
"labels",
"it",
"attempts",
"to",
"fallback",
"to",
"using",
"drv_cfg",
"binary"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/scaleio/sio_client.go#L320-L332 | train | getGUID returns the GUID of the SDC | [
30522,
4569,
2278,
1006,
1039,
1008,
9033,
10085,
8751,
3372,
1007,
2131,
25698,
2094,
1006,
1007,
1006,
5164,
1010,
7561,
1007,
1063,
2065,
1039,
1012,
17371,
2278,
25698,
2094,
1027,
1027,
1000,
1000,
1063,
1047,
21197,
1012,
1058,
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 | cmd/kubeadm/app/apis/kubeadm/v1beta1/zz_generated.conversion.go | Convert_v1beta1_Discovery_To_kubeadm_Discovery | func Convert_v1beta1_Discovery_To_kubeadm_Discovery(in *Discovery, out *kubeadm.Discovery, s conversion.Scope) error {
return autoConvert_v1beta1_Discovery_To_kubeadm_Discovery(in, out, s)
} | go | func Convert_v1beta1_Discovery_To_kubeadm_Discovery(in *Discovery, out *kubeadm.Discovery, s conversion.Scope) error {
return autoConvert_v1beta1_Discovery_To_kubeadm_Discovery(in, out, s)
} | [
"func",
"Convert_v1beta1_Discovery_To_kubeadm_Discovery",
"(",
"in",
"*",
"Discovery",
",",
"out",
"*",
"kubeadm",
".",
"Discovery",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoConvert_v1beta1_Discovery_To_kubeadm_Discovery",
"(",
"in",
","... | // Convert_v1beta1_Discovery_To_kubeadm_Discovery is an autogenerated conversion function. | [
"Convert_v1beta1_Discovery_To_kubeadm_Discovery",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/apis/kubeadm/v1beta1/zz_generated.conversion.go#L528-L530 | train | Convert_v1beta1_Discovery_To_kubeadm_Discovery is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
1058,
2487,
20915,
27717,
1035,
5456,
1035,
2000,
1035,
13970,
4783,
4215,
2213,
1035,
5456,
1006,
1999,
1008,
5456,
1010,
2041,
1008,
13970,
4783,
4215,
2213,
1012,
5456,
1010,
1055,
7584,
1012,
9531,
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/kubectl/generate/versioned/service_basic.go | validate | func (s ServiceCommonGeneratorV1) validate() error {
if len(s.Name) == 0 {
return fmt.Errorf("name must be specified")
}
if len(s.Type) == 0 {
return fmt.Errorf("type must be specified")
}
if s.ClusterIP == v1.ClusterIPNone && s.Type != v1.ServiceTypeClusterIP {
return fmt.Errorf("ClusterIP=None can only be used with ClusterIP service type")
}
if s.ClusterIP != v1.ClusterIPNone && len(s.TCP) == 0 && s.Type != v1.ServiceTypeExternalName {
return fmt.Errorf("at least one tcp port specifier must be provided")
}
if s.Type == v1.ServiceTypeExternalName {
if errs := validation.IsDNS1123Subdomain(s.ExternalName); len(errs) != 0 {
return fmt.Errorf("invalid service external name %s", s.ExternalName)
}
}
return nil
} | go | func (s ServiceCommonGeneratorV1) validate() error {
if len(s.Name) == 0 {
return fmt.Errorf("name must be specified")
}
if len(s.Type) == 0 {
return fmt.Errorf("type must be specified")
}
if s.ClusterIP == v1.ClusterIPNone && s.Type != v1.ServiceTypeClusterIP {
return fmt.Errorf("ClusterIP=None can only be used with ClusterIP service type")
}
if s.ClusterIP != v1.ClusterIPNone && len(s.TCP) == 0 && s.Type != v1.ServiceTypeExternalName {
return fmt.Errorf("at least one tcp port specifier must be provided")
}
if s.Type == v1.ServiceTypeExternalName {
if errs := validation.IsDNS1123Subdomain(s.ExternalName); len(errs) != 0 {
return fmt.Errorf("invalid service external name %s", s.ExternalName)
}
}
return nil
} | [
"func",
"(",
"s",
"ServiceCommonGeneratorV1",
")",
"validate",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"s",
".",
"Name",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"s",
".",
"... | // validate validates required fields are set to support structured generation
// TODO(xiangpengzhao): validate ports are identity mapped for headless service when we enforce that in validation.validateServicePort. | [
"validate",
"validates",
"required",
"fields",
"are",
"set",
"to",
"support",
"structured",
"generation",
"TODO",
"(",
"xiangpengzhao",
")",
":",
"validate",
"ports",
"are",
"identity",
"mapped",
"for",
"headless",
"service",
"when",
"we",
"enforce",
"that",
"in... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubectl/generate/versioned/service_basic.go#L195-L214 | train | validate returns nil if the service is valid | [
30522,
4569,
2278,
1006,
1055,
2326,
9006,
8202,
6914,
6906,
4263,
2615,
2487,
1007,
9398,
3686,
1006,
1007,
7561,
1063,
2065,
18798,
1006,
1055,
1012,
2171,
1007,
1027,
1027,
1014,
1063,
2709,
4718,
2102,
1012,
7561,
2546,
1006,
1000,
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 | staging/src/k8s.io/cli-runtime/pkg/resource/builder.go | ReplaceAliases | func (b *Builder) ReplaceAliases(input string) string {
replaced := []string{}
for _, arg := range strings.Split(input, ",") {
if b.categoryExpanderFn == nil {
continue
}
categoryExpander, err := b.categoryExpanderFn()
if err != nil {
b.AddError(err)
continue
}
if resources, ok := categoryExpander.Expand(arg); ok {
asStrings := []string{}
for _, resource := range resources {
if len(resource.Group) == 0 {
asStrings = append(asStrings, resource.Resource)
continue
}
asStrings = append(asStrings, resource.Resource+"."+resource.Group)
}
arg = strings.Join(asStrings, ",")
}
replaced = append(replaced, arg)
}
return strings.Join(replaced, ",")
} | go | func (b *Builder) ReplaceAliases(input string) string {
replaced := []string{}
for _, arg := range strings.Split(input, ",") {
if b.categoryExpanderFn == nil {
continue
}
categoryExpander, err := b.categoryExpanderFn()
if err != nil {
b.AddError(err)
continue
}
if resources, ok := categoryExpander.Expand(arg); ok {
asStrings := []string{}
for _, resource := range resources {
if len(resource.Group) == 0 {
asStrings = append(asStrings, resource.Resource)
continue
}
asStrings = append(asStrings, resource.Resource+"."+resource.Group)
}
arg = strings.Join(asStrings, ",")
}
replaced = append(replaced, arg)
}
return strings.Join(replaced, ",")
} | [
"func",
"(",
"b",
"*",
"Builder",
")",
"ReplaceAliases",
"(",
"input",
"string",
")",
"string",
"{",
"replaced",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"arg",
":=",
"range",
"strings",
".",
"Split",
"(",
"input",
",",
"\"",
"\""... | // ReplaceAliases accepts an argument and tries to expand any existing
// aliases found in it | [
"ReplaceAliases",
"accepts",
"an",
"argument",
"and",
"tries",
"to",
"expand",
"any",
"existing",
"aliases",
"found",
"in",
"it"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/cli-runtime/pkg/resource/builder.go#L577-L603 | train | ReplaceAliases replaces aliases in a string | [
30522,
4569,
2278,
1006,
1038,
1008,
12508,
1007,
5672,
22786,
8583,
1006,
7953,
5164,
1007,
5164,
1063,
2999,
1024,
1027,
1031,
1033,
5164,
1063,
1065,
2005,
1035,
1010,
12098,
2290,
1024,
1027,
2846,
7817,
1012,
3975,
1006,
7953,
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/apimachinery/pkg/api/errors/errors.go | NewBadRequest | func NewBadRequest(reason string) *StatusError {
return &StatusError{metav1.Status{
Status: metav1.StatusFailure,
Code: http.StatusBadRequest,
Reason: metav1.StatusReasonBadRequest,
Message: reason,
}}
} | go | func NewBadRequest(reason string) *StatusError {
return &StatusError{metav1.Status{
Status: metav1.StatusFailure,
Code: http.StatusBadRequest,
Reason: metav1.StatusReasonBadRequest,
Message: reason,
}}
} | [
"func",
"NewBadRequest",
"(",
"reason",
"string",
")",
"*",
"StatusError",
"{",
"return",
"&",
"StatusError",
"{",
"metav1",
".",
"Status",
"{",
"Status",
":",
"metav1",
".",
"StatusFailure",
",",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Reason",
... | // NewBadRequest creates an error that indicates that the request is invalid and can not be processed. | [
"NewBadRequest",
"creates",
"an",
"error",
"that",
"indicates",
"that",
"the",
"request",
"is",
"invalid",
"and",
"can",
"not",
"be",
"processed",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/api/errors/errors.go#L248-L255 | train | NewBadRequest returns a new StatusError with the given reason. | [
30522,
4569,
2278,
2047,
9024,
2890,
15500,
1006,
3114,
5164,
1007,
1008,
3570,
2121,
29165,
1063,
2709,
1004,
3570,
2121,
29165,
1063,
18804,
2615,
2487,
1012,
3570,
1063,
3570,
1024,
18804,
2615,
2487,
1012,
3570,
7011,
4014,
5397,
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/controller/namespace/deletion/namespaced_resources_deleter.go | listCollection | func (d *namespacedResourcesDeleter) listCollection(gvr schema.GroupVersionResource, namespace string) (*unstructured.UnstructuredList, bool, error) {
klog.V(5).Infof("namespace controller - listCollection - namespace: %s, gvr: %v", namespace, gvr)
key := operationKey{operation: operationList, gvr: gvr}
if !d.opCache.isSupported(key) {
klog.V(5).Infof("namespace controller - listCollection ignored since not supported - namespace: %s, gvr: %v", namespace, gvr)
return nil, false, nil
}
unstructuredList, err := d.dynamicClient.Resource(gvr).Namespace(namespace).List(metav1.ListOptions{})
if err == nil {
return unstructuredList, true, nil
}
// this is strange, but we need to special case for both MethodNotSupported and NotFound errors
// TODO: https://github.com/kubernetes/kubernetes/issues/22413
// we have a resource returned in the discovery API that supports no top-level verbs:
// /apis/extensions/v1beta1/namespaces/default/replicationcontrollers
// when working with this resource type, we will get a literal not found error rather than expected method not supported
// remember next time that this resource does not support delete collection...
if errors.IsMethodNotSupported(err) || errors.IsNotFound(err) {
klog.V(5).Infof("namespace controller - listCollection not supported - namespace: %s, gvr: %v", namespace, gvr)
d.opCache.setNotSupported(key)
return nil, false, nil
}
return nil, true, err
} | go | func (d *namespacedResourcesDeleter) listCollection(gvr schema.GroupVersionResource, namespace string) (*unstructured.UnstructuredList, bool, error) {
klog.V(5).Infof("namespace controller - listCollection - namespace: %s, gvr: %v", namespace, gvr)
key := operationKey{operation: operationList, gvr: gvr}
if !d.opCache.isSupported(key) {
klog.V(5).Infof("namespace controller - listCollection ignored since not supported - namespace: %s, gvr: %v", namespace, gvr)
return nil, false, nil
}
unstructuredList, err := d.dynamicClient.Resource(gvr).Namespace(namespace).List(metav1.ListOptions{})
if err == nil {
return unstructuredList, true, nil
}
// this is strange, but we need to special case for both MethodNotSupported and NotFound errors
// TODO: https://github.com/kubernetes/kubernetes/issues/22413
// we have a resource returned in the discovery API that supports no top-level verbs:
// /apis/extensions/v1beta1/namespaces/default/replicationcontrollers
// when working with this resource type, we will get a literal not found error rather than expected method not supported
// remember next time that this resource does not support delete collection...
if errors.IsMethodNotSupported(err) || errors.IsNotFound(err) {
klog.V(5).Infof("namespace controller - listCollection not supported - namespace: %s, gvr: %v", namespace, gvr)
d.opCache.setNotSupported(key)
return nil, false, nil
}
return nil, true, err
} | [
"func",
"(",
"d",
"*",
"namespacedResourcesDeleter",
")",
"listCollection",
"(",
"gvr",
"schema",
".",
"GroupVersionResource",
",",
"namespace",
"string",
")",
"(",
"*",
"unstructured",
".",
"UnstructuredList",
",",
"bool",
",",
"error",
")",
"{",
"klog",
".",... | // listCollection will list the items in the specified namespace
// it returns the following:
// the list of items in the collection (if found)
// a boolean if the operation is supported
// an error if the operation is supported but could not be completed. | [
"listCollection",
"will",
"list",
"the",
"items",
"in",
"the",
"specified",
"namespace",
"it",
"returns",
"the",
"following",
":",
"the",
"list",
"of",
"items",
"in",
"the",
"collection",
"(",
"if",
"found",
")",
"a",
"boolean",
"if",
"the",
"operation",
"... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/namespace/deletion/namespaced_resources_deleter.go#L372-L399 | train | listCollection returns a list of resources in the given namespace. | [
30522,
4569,
2278,
1006,
1040,
1008,
3415,
15327,
16200,
6499,
3126,
9623,
9247,
15141,
1007,
2862,
26895,
18491,
1006,
1043,
19716,
8040,
28433,
1012,
2177,
27774,
6072,
8162,
3401,
1010,
3415,
15327,
5164,
1007,
1006,
1008,
4895,
3367,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/daemon/daemon_controller.go | addHistory | func (dsc *DaemonSetsController) addHistory(obj interface{}) {
history := obj.(*apps.ControllerRevision)
if history.DeletionTimestamp != nil {
// On a restart of the controller manager, it's possible for an object to
// show up in a state that is already pending deletion.
dsc.deleteHistory(history)
return
}
// If it has a ControllerRef, that's all that matters.
if controllerRef := metav1.GetControllerOf(history); controllerRef != nil {
ds := dsc.resolveControllerRef(history.Namespace, controllerRef)
if ds == nil {
return
}
klog.V(4).Infof("ControllerRevision %s added.", history.Name)
return
}
// Otherwise, it's an orphan. Get a list of all matching DaemonSets and sync
// them to see if anyone wants to adopt it.
daemonSets := dsc.getDaemonSetsForHistory(history)
if len(daemonSets) == 0 {
return
}
klog.V(4).Infof("Orphan ControllerRevision %s added.", history.Name)
for _, ds := range daemonSets {
dsc.enqueueDaemonSet(ds)
}
} | go | func (dsc *DaemonSetsController) addHistory(obj interface{}) {
history := obj.(*apps.ControllerRevision)
if history.DeletionTimestamp != nil {
// On a restart of the controller manager, it's possible for an object to
// show up in a state that is already pending deletion.
dsc.deleteHistory(history)
return
}
// If it has a ControllerRef, that's all that matters.
if controllerRef := metav1.GetControllerOf(history); controllerRef != nil {
ds := dsc.resolveControllerRef(history.Namespace, controllerRef)
if ds == nil {
return
}
klog.V(4).Infof("ControllerRevision %s added.", history.Name)
return
}
// Otherwise, it's an orphan. Get a list of all matching DaemonSets and sync
// them to see if anyone wants to adopt it.
daemonSets := dsc.getDaemonSetsForHistory(history)
if len(daemonSets) == 0 {
return
}
klog.V(4).Infof("Orphan ControllerRevision %s added.", history.Name)
for _, ds := range daemonSets {
dsc.enqueueDaemonSet(ds)
}
} | [
"func",
"(",
"dsc",
"*",
"DaemonSetsController",
")",
"addHistory",
"(",
"obj",
"interface",
"{",
"}",
")",
"{",
"history",
":=",
"obj",
".",
"(",
"*",
"apps",
".",
"ControllerRevision",
")",
"\n",
"if",
"history",
".",
"DeletionTimestamp",
"!=",
"nil",
... | // addHistory enqueues the DaemonSet that manages a ControllerRevision when the ControllerRevision is created
// or when the controller manager is restarted. | [
"addHistory",
"enqueues",
"the",
"DaemonSet",
"that",
"manages",
"a",
"ControllerRevision",
"when",
"the",
"ControllerRevision",
"is",
"created",
"or",
"when",
"the",
"controller",
"manager",
"is",
"restarted",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/daemon/daemon_controller.go#L372-L401 | train | addHistory adds a new object to the daemon sets controller. | [
30522,
4569,
2278,
1006,
16233,
2278,
1008,
12828,
13462,
9363,
3372,
26611,
1007,
5587,
24158,
7062,
1006,
27885,
3501,
8278,
1063,
1065,
1007,
1063,
2381,
1024,
1027,
27885,
3501,
1012,
1006,
1008,
18726,
1012,
11486,
2890,
17084,
1007,
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/apis/core/zz_generated.deepcopy.go | DeepCopyObject | func (in *LimitRange) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
} | go | func (in *LimitRange) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
} | [
"func",
"(",
"in",
"*",
"LimitRange",
")",
"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/pkg/apis/core/zz_generated.deepcopy.go#L1816-L1821 | train | DeepCopyObject is an autogenerated deepcopy function copying the receiver creating a new LimitRange. | [
30522,
4569,
2278,
1006,
1999,
1008,
5787,
24388,
2063,
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,
2140,
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/policy/v1beta1/zz_generated.conversion.go | Convert_v1beta1_PodDisruptionBudgetStatus_To_policy_PodDisruptionBudgetStatus | func Convert_v1beta1_PodDisruptionBudgetStatus_To_policy_PodDisruptionBudgetStatus(in *v1beta1.PodDisruptionBudgetStatus, out *policy.PodDisruptionBudgetStatus, s conversion.Scope) error {
return autoConvert_v1beta1_PodDisruptionBudgetStatus_To_policy_PodDisruptionBudgetStatus(in, out, s)
} | go | func Convert_v1beta1_PodDisruptionBudgetStatus_To_policy_PodDisruptionBudgetStatus(in *v1beta1.PodDisruptionBudgetStatus, out *policy.PodDisruptionBudgetStatus, s conversion.Scope) error {
return autoConvert_v1beta1_PodDisruptionBudgetStatus_To_policy_PodDisruptionBudgetStatus(in, out, s)
} | [
"func",
"Convert_v1beta1_PodDisruptionBudgetStatus_To_policy_PodDisruptionBudgetStatus",
"(",
"in",
"*",
"v1beta1",
".",
"PodDisruptionBudgetStatus",
",",
"out",
"*",
"policy",
".",
"PodDisruptionBudgetStatus",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"ret... | // Convert_v1beta1_PodDisruptionBudgetStatus_To_policy_PodDisruptionBudgetStatus is an autogenerated conversion function. | [
"Convert_v1beta1_PodDisruptionBudgetStatus_To_policy_PodDisruptionBudgetStatus",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/policy/v1beta1/zz_generated.conversion.go#L475-L477 | train | Convert_v1beta1_PodDisruptionBudgetStatus_To_policy_PodDisruptionBudgetStatus is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
1058,
2487,
20915,
27717,
1035,
17491,
10521,
21531,
3508,
8569,
28682,
29336,
2271,
1035,
2000,
1035,
3343,
1035,
17491,
10521,
21531,
3508,
8569,
28682,
29336,
2271,
1006,
1999,
1008,
1058,
2487,
20915,
27717... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/api/v1/zz_generated.deepcopy.go | DeepCopyInto | func (in *Cluster) DeepCopyInto(out *Cluster) {
*out = *in
if in.CertificateAuthorityData != nil {
in, out := &in.CertificateAuthorityData, &out.CertificateAuthorityData
*out = make([]byte, len(*in))
copy(*out, *in)
}
if in.Extensions != nil {
in, out := &in.Extensions, &out.Extensions
*out = make([]NamedExtension, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
} | go | func (in *Cluster) DeepCopyInto(out *Cluster) {
*out = *in
if in.CertificateAuthorityData != nil {
in, out := &in.CertificateAuthorityData, &out.CertificateAuthorityData
*out = make([]byte, len(*in))
copy(*out, *in)
}
if in.Extensions != nil {
in, out := &in.Extensions, &out.Extensions
*out = make([]NamedExtension, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
} | [
"func",
"(",
"in",
"*",
"Cluster",
")",
"DeepCopyInto",
"(",
"out",
"*",
"Cluster",
")",
"{",
"*",
"out",
"=",
"*",
"in",
"\n",
"if",
"in",
".",
"CertificateAuthorityData",
"!=",
"nil",
"{",
"in",
",",
"out",
":=",
"&",
"in",
".",
"CertificateAuthori... | // 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/client-go/tools/clientcmd/api/v1/zz_generated.deepcopy.go#L114-L129 | train | DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new Cluster. | [
30522,
4569,
2278,
1006,
1999,
1008,
9324,
1007,
2784,
3597,
7685,
18447,
2080,
1006,
2041,
1008,
9324,
1007,
1063,
1008,
2041,
1027,
1008,
1999,
2065,
1999,
1012,
8196,
4887,
27844,
3012,
2850,
2696,
999,
1027,
9152,
2140,
1063,
1999,
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/apiextensions-apiserver/examples/client-go/pkg/client/informers/externalversions/factory.go | NewFilteredSharedInformerFactory | func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory {
return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions))
} | go | func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory {
return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions))
} | [
"func",
"NewFilteredSharedInformerFactory",
"(",
"client",
"versioned",
".",
"Interface",
",",
"defaultResync",
"time",
".",
"Duration",
",",
"namespace",
"string",
",",
"tweakListOptions",
"internalinterfaces",
".",
"TweakListOptionsFunc",
")",
"SharedInformerFactory",
"... | // NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory.
// Listers obtained via this SharedInformerFactory will be subject to the same filters
// as specified here.
// Deprecated: Please use NewSharedInformerFactoryWithOptions instead | [
"NewFilteredSharedInformerFactory",
"constructs",
"a",
"new",
"instance",
"of",
"sharedInformerFactory",
".",
"Listers",
"obtained",
"via",
"this",
"SharedInformerFactory",
"will",
"be",
"subject",
"to",
"the",
"same",
"filters",
"as",
"specified",
"here",
".",
"Depre... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/informers/externalversions/factory.go#L87-L89 | train | NewFilteredSharedSharedInformerFactory constructs a new informer factory for ClusterID type. Always prefer using an informer factory to get a shared informer factory instead of getting an independent one. This reduces memory footprint and number of connections to the server. | [
30522,
4569,
2278,
2047,
8873,
21928,
2098,
7377,
5596,
2378,
14192,
2121,
21450,
1006,
7396,
2544,
2098,
1012,
8278,
1010,
12398,
6072,
6038,
2278,
2051,
1012,
9367,
1010,
3415,
15327,
5164,
1010,
1056,
8545,
4817,
9863,
7361,
9285,
4722,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/networking/validation/validation.go | ValidateNetworkPolicyUpdate | func ValidateNetworkPolicyUpdate(update, old *networking.NetworkPolicy) field.ErrorList {
allErrs := field.ErrorList{}
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&update.ObjectMeta, &old.ObjectMeta, field.NewPath("metadata"))...)
allErrs = append(allErrs, ValidateNetworkPolicySpec(&update.Spec, field.NewPath("spec"))...)
return allErrs
} | go | func ValidateNetworkPolicyUpdate(update, old *networking.NetworkPolicy) field.ErrorList {
allErrs := field.ErrorList{}
allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&update.ObjectMeta, &old.ObjectMeta, field.NewPath("metadata"))...)
allErrs = append(allErrs, ValidateNetworkPolicySpec(&update.Spec, field.NewPath("spec"))...)
return allErrs
} | [
"func",
"ValidateNetworkPolicyUpdate",
"(",
"update",
",",
"old",
"*",
"networking",
".",
"NetworkPolicy",
")",
"field",
".",
"ErrorList",
"{",
"allErrs",
":=",
"field",
".",
"ErrorList",
"{",
"}",
"\n",
"allErrs",
"=",
"append",
"(",
"allErrs",
",",
"apival... | // ValidateNetworkPolicyUpdate tests if an update to a NetworkPolicy is valid. | [
"ValidateNetworkPolicyUpdate",
"tests",
"if",
"an",
"update",
"to",
"a",
"NetworkPolicy",
"is",
"valid",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/networking/validation/validation.go#L143-L148 | train | ValidateNetworkPolicyUpdate tests that the update and old are valid. | [
30522,
4569,
2278,
9398,
3686,
7159,
6198,
18155,
2594,
10513,
17299,
3686,
1006,
10651,
1010,
2214,
1008,
14048,
1012,
2897,
18155,
2594,
2100,
1007,
2492,
1012,
7561,
9863,
1063,
2035,
2121,
2869,
1024,
1027,
2492,
1012,
7561,
9863,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/discovery/discovery_client.go | ServerResources | func ServerResources(d DiscoveryInterface) ([]*metav1.APIResourceList, error) {
_, rs, err := ServerGroupsAndResources(d)
return rs, err
} | go | func ServerResources(d DiscoveryInterface) ([]*metav1.APIResourceList, error) {
_, rs, err := ServerGroupsAndResources(d)
return rs, err
} | [
"func",
"ServerResources",
"(",
"d",
"DiscoveryInterface",
")",
"(",
"[",
"]",
"*",
"metav1",
".",
"APIResourceList",
",",
"error",
")",
"{",
"_",
",",
"rs",
",",
"err",
":=",
"ServerGroupsAndResources",
"(",
"d",
")",
"\n",
"return",
"rs",
",",
"err",
... | // ServerResources uses the provided discovery interface to look up supported resources for all groups and versions.
// Deprecated: use ServerGroupsAndResources instead. | [
"ServerResources",
"uses",
"the",
"provided",
"discovery",
"interface",
"to",
"look",
"up",
"supported",
"resources",
"for",
"all",
"groups",
"and",
"versions",
".",
"Deprecated",
":",
"use",
"ServerGroupsAndResources",
"instead",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/discovery/discovery_client.go#L249-L252 | train | ServerResources returns a list of all API resources in the discovery interface. | [
30522,
4569,
2278,
8241,
6072,
8162,
9623,
1006,
1040,
5456,
18447,
2121,
12172,
1007,
1006,
1031,
1033,
1008,
18804,
2615,
2487,
1012,
17928,
6072,
8162,
29109,
2923,
1010,
7561,
1007,
1063,
1035,
1010,
12667,
1010,
9413,
2099,
1024,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ipset/ipset.go | ListSets | func (runner *runner) ListSets() ([]string, error) {
out, err := runner.exec.Command(IPSetCmd, "list", "-n").CombinedOutput()
if err != nil {
return nil, fmt.Errorf("error listing all sets, error: %v", err)
}
return strings.Split(string(out), "\n"), nil
} | go | func (runner *runner) ListSets() ([]string, error) {
out, err := runner.exec.Command(IPSetCmd, "list", "-n").CombinedOutput()
if err != nil {
return nil, fmt.Errorf("error listing all sets, error: %v", err)
}
return strings.Split(string(out), "\n"), nil
} | [
"func",
"(",
"runner",
"*",
"runner",
")",
"ListSets",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"runner",
".",
"exec",
".",
"Command",
"(",
"IPSetCmd",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
".",
"Comb... | // ListSets list all set names from kernel | [
"ListSets",
"list",
"all",
"set",
"names",
"from",
"kernel"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/util/ipset/ipset.go#L371-L377 | train | ListSets returns a list of all sets | [
30522,
4569,
2278,
1006,
5479,
1008,
5479,
1007,
7201,
8454,
1006,
1007,
1006,
1031,
1033,
5164,
1010,
7561,
1007,
1063,
2041,
1010,
9413,
2099,
1024,
1027,
5479,
1012,
4654,
8586,
1012,
3094,
1006,
12997,
13462,
27487,
2094,
1010,
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/kubelet/dockershim/docker_container.go | CreateContainer | func (ds *dockerService) CreateContainer(_ context.Context, r *runtimeapi.CreateContainerRequest) (*runtimeapi.CreateContainerResponse, error) {
podSandboxID := r.PodSandboxId
config := r.GetConfig()
sandboxConfig := r.GetSandboxConfig()
if config == nil {
return nil, fmt.Errorf("container config is nil")
}
if sandboxConfig == nil {
return nil, fmt.Errorf("sandbox config is nil for container %q", config.Metadata.Name)
}
labels := makeLabels(config.GetLabels(), config.GetAnnotations())
// Apply a the container type label.
labels[containerTypeLabelKey] = containerTypeLabelContainer
// Write the container log path in the labels.
labels[containerLogPathLabelKey] = filepath.Join(sandboxConfig.LogDirectory, config.LogPath)
// Write the sandbox ID in the labels.
labels[sandboxIDLabelKey] = podSandboxID
apiVersion, err := ds.getDockerAPIVersion()
if err != nil {
return nil, fmt.Errorf("unable to get the docker API version: %v", err)
}
image := ""
if iSpec := config.GetImage(); iSpec != nil {
image = iSpec.Image
}
containerName := makeContainerName(sandboxConfig, config)
createConfig := dockertypes.ContainerCreateConfig{
Name: containerName,
Config: &dockercontainer.Config{
// TODO: set User.
Entrypoint: dockerstrslice.StrSlice(config.Command),
Cmd: dockerstrslice.StrSlice(config.Args),
Env: generateEnvList(config.GetEnvs()),
Image: image,
WorkingDir: config.WorkingDir,
Labels: labels,
// Interactive containers:
OpenStdin: config.Stdin,
StdinOnce: config.StdinOnce,
Tty: config.Tty,
// Disable Docker's health check until we officially support it
// (https://github.com/kubernetes/kubernetes/issues/25829).
Healthcheck: &dockercontainer.HealthConfig{
Test: []string{"NONE"},
},
},
HostConfig: &dockercontainer.HostConfig{
Binds: generateMountBindings(config.GetMounts()),
RestartPolicy: dockercontainer.RestartPolicy{
Name: "no",
},
},
}
hc := createConfig.HostConfig
err = ds.updateCreateConfig(&createConfig, config, sandboxConfig, podSandboxID, securityOptSeparator, apiVersion)
if err != nil {
return nil, fmt.Errorf("failed to update container create config: %v", err)
}
// Set devices for container.
devices := make([]dockercontainer.DeviceMapping, len(config.Devices))
for i, device := range config.Devices {
devices[i] = dockercontainer.DeviceMapping{
PathOnHost: device.HostPath,
PathInContainer: device.ContainerPath,
CgroupPermissions: device.Permissions,
}
}
hc.Resources.Devices = devices
securityOpts, err := ds.getSecurityOpts(config.GetLinux().GetSecurityContext().GetSeccompProfilePath(), securityOptSeparator)
if err != nil {
return nil, fmt.Errorf("failed to generate security options for container %q: %v", config.Metadata.Name, err)
}
hc.SecurityOpt = append(hc.SecurityOpt, securityOpts...)
cleanupInfo, err := ds.applyPlatformSpecificDockerConfig(r, &createConfig)
if err != nil {
return nil, err
}
createResp, createErr := ds.client.CreateContainer(createConfig)
if createErr != nil {
createResp, createErr = recoverFromCreationConflictIfNeeded(ds.client, createConfig, createErr)
}
if createResp != nil {
containerID := createResp.ID
if cleanupInfo != nil {
// we don't perform the clean up just yet at that could destroy information
// needed for the container to start (e.g. Windows credentials stored in
// registry keys); instead, we'll clean up after the container successfully
// starts or gets removed
ds.containerCleanupInfos[containerID] = cleanupInfo
}
return &runtimeapi.CreateContainerResponse{ContainerId: containerID}, nil
}
// the creation failed, let's clean up right away
ds.performPlatformSpecificContainerCleanupAndLogErrors(containerName, cleanupInfo)
return nil, createErr
} | go | func (ds *dockerService) CreateContainer(_ context.Context, r *runtimeapi.CreateContainerRequest) (*runtimeapi.CreateContainerResponse, error) {
podSandboxID := r.PodSandboxId
config := r.GetConfig()
sandboxConfig := r.GetSandboxConfig()
if config == nil {
return nil, fmt.Errorf("container config is nil")
}
if sandboxConfig == nil {
return nil, fmt.Errorf("sandbox config is nil for container %q", config.Metadata.Name)
}
labels := makeLabels(config.GetLabels(), config.GetAnnotations())
// Apply a the container type label.
labels[containerTypeLabelKey] = containerTypeLabelContainer
// Write the container log path in the labels.
labels[containerLogPathLabelKey] = filepath.Join(sandboxConfig.LogDirectory, config.LogPath)
// Write the sandbox ID in the labels.
labels[sandboxIDLabelKey] = podSandboxID
apiVersion, err := ds.getDockerAPIVersion()
if err != nil {
return nil, fmt.Errorf("unable to get the docker API version: %v", err)
}
image := ""
if iSpec := config.GetImage(); iSpec != nil {
image = iSpec.Image
}
containerName := makeContainerName(sandboxConfig, config)
createConfig := dockertypes.ContainerCreateConfig{
Name: containerName,
Config: &dockercontainer.Config{
// TODO: set User.
Entrypoint: dockerstrslice.StrSlice(config.Command),
Cmd: dockerstrslice.StrSlice(config.Args),
Env: generateEnvList(config.GetEnvs()),
Image: image,
WorkingDir: config.WorkingDir,
Labels: labels,
// Interactive containers:
OpenStdin: config.Stdin,
StdinOnce: config.StdinOnce,
Tty: config.Tty,
// Disable Docker's health check until we officially support it
// (https://github.com/kubernetes/kubernetes/issues/25829).
Healthcheck: &dockercontainer.HealthConfig{
Test: []string{"NONE"},
},
},
HostConfig: &dockercontainer.HostConfig{
Binds: generateMountBindings(config.GetMounts()),
RestartPolicy: dockercontainer.RestartPolicy{
Name: "no",
},
},
}
hc := createConfig.HostConfig
err = ds.updateCreateConfig(&createConfig, config, sandboxConfig, podSandboxID, securityOptSeparator, apiVersion)
if err != nil {
return nil, fmt.Errorf("failed to update container create config: %v", err)
}
// Set devices for container.
devices := make([]dockercontainer.DeviceMapping, len(config.Devices))
for i, device := range config.Devices {
devices[i] = dockercontainer.DeviceMapping{
PathOnHost: device.HostPath,
PathInContainer: device.ContainerPath,
CgroupPermissions: device.Permissions,
}
}
hc.Resources.Devices = devices
securityOpts, err := ds.getSecurityOpts(config.GetLinux().GetSecurityContext().GetSeccompProfilePath(), securityOptSeparator)
if err != nil {
return nil, fmt.Errorf("failed to generate security options for container %q: %v", config.Metadata.Name, err)
}
hc.SecurityOpt = append(hc.SecurityOpt, securityOpts...)
cleanupInfo, err := ds.applyPlatformSpecificDockerConfig(r, &createConfig)
if err != nil {
return nil, err
}
createResp, createErr := ds.client.CreateContainer(createConfig)
if createErr != nil {
createResp, createErr = recoverFromCreationConflictIfNeeded(ds.client, createConfig, createErr)
}
if createResp != nil {
containerID := createResp.ID
if cleanupInfo != nil {
// we don't perform the clean up just yet at that could destroy information
// needed for the container to start (e.g. Windows credentials stored in
// registry keys); instead, we'll clean up after the container successfully
// starts or gets removed
ds.containerCleanupInfos[containerID] = cleanupInfo
}
return &runtimeapi.CreateContainerResponse{ContainerId: containerID}, nil
}
// the creation failed, let's clean up right away
ds.performPlatformSpecificContainerCleanupAndLogErrors(containerName, cleanupInfo)
return nil, createErr
} | [
"func",
"(",
"ds",
"*",
"dockerService",
")",
"CreateContainer",
"(",
"_",
"context",
".",
"Context",
",",
"r",
"*",
"runtimeapi",
".",
"CreateContainerRequest",
")",
"(",
"*",
"runtimeapi",
".",
"CreateContainerResponse",
",",
"error",
")",
"{",
"podSandboxID... | // CreateContainer creates a new container in the given PodSandbox
// Docker cannot store the log to an arbitrary location (yet), so we create an
// symlink at LogPath, linking to the actual path of the log.
// TODO: check if the default values returned by the runtime API are ok. | [
"CreateContainer",
"creates",
"a",
"new",
"container",
"in",
"the",
"given",
"PodSandbox",
"Docker",
"cannot",
"store",
"the",
"log",
"to",
"an",
"arbitrary",
"location",
"(",
"yet",
")",
"so",
"we",
"create",
"an",
"symlink",
"at",
"LogPath",
"linking",
"to... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/dockershim/docker_container.go#L88-L196 | train | CreateContainer creates a container | [
30522,
4569,
2278,
1006,
16233,
1008,
8946,
2545,
2121,
7903,
2063,
1007,
3443,
8663,
18249,
2121,
1006,
1035,
6123,
1012,
6123,
1010,
1054,
1008,
2448,
7292,
9331,
2072,
1012,
3443,
8663,
18249,
28849,
15500,
1007,
1006,
1008,
2448,
7292,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/version.go | NewCmdVersion | func NewCmdVersion(out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Short: "Print the version of kubeadm",
Run: func(cmd *cobra.Command, args []string) {
err := RunVersion(out, cmd)
kubeadmutil.CheckErr(err)
},
}
cmd.Flags().StringP("output", "o", "", "Output format; available options are 'yaml', 'json' and 'short'")
return cmd
} | go | func NewCmdVersion(out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Short: "Print the version of kubeadm",
Run: func(cmd *cobra.Command, args []string) {
err := RunVersion(out, cmd)
kubeadmutil.CheckErr(err)
},
}
cmd.Flags().StringP("output", "o", "", "Output format; available options are 'yaml', 'json' and 'short'")
return cmd
} | [
"func",
"NewCmdVersion",
"(",
"out",
"io",
".",
"Writer",
")",
"*",
"cobra",
".",
"Command",
"{",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Run",
":",
"func",
"(",
"cmd",
"*",
"... | // NewCmdVersion provides the version information of kubeadm. | [
"NewCmdVersion",
"provides",
"the",
"version",
"information",
"of",
"kubeadm",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/cmd/version.go#L40-L51 | train | NewCmdVersion returns a new command that prints the version of kubeadm | [
30522,
4569,
2278,
2047,
27487,
2094,
27774,
1006,
2041,
22834,
1012,
3213,
1007,
1008,
16604,
1012,
3094,
1063,
4642,
2094,
1024,
1027,
1004,
16604,
1012,
3094,
1063,
2224,
1024,
1000,
2544,
1000,
1010,
2460,
1024,
1000,
6140,
1996,
2544,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/interface.go | memberOf | func memberOf(ip net.IP, family AddressFamily) bool {
if ip.To4() != nil {
return family == familyIPv4
} else {
return family == familyIPv6
}
} | go | func memberOf(ip net.IP, family AddressFamily) bool {
if ip.To4() != nil {
return family == familyIPv4
} else {
return family == familyIPv6
}
} | [
"func",
"memberOf",
"(",
"ip",
"net",
".",
"IP",
",",
"family",
"AddressFamily",
")",
"bool",
"{",
"if",
"ip",
".",
"To4",
"(",
")",
"!=",
"nil",
"{",
"return",
"family",
"==",
"familyIPv4",
"\n",
"}",
"else",
"{",
"return",
"family",
"==",
"familyIP... | // memberOF tells if the IP is of the desired family. Used for checking interface addresses. | [
"memberOF",
"tells",
"if",
"the",
"IP",
"is",
"of",
"the",
"desired",
"family",
".",
"Used",
"for",
"checking",
"interface",
"addresses",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/util/net/interface.go#L258-L264 | train | memberOf returns true if the given IP is a member of the given family. | [
30522,
4569,
2278,
2266,
11253,
1006,
12997,
5658,
1012,
12997,
1010,
2155,
4769,
7011,
4328,
2135,
1007,
22017,
2140,
1063,
2065,
12997,
1012,
2000,
2549,
1006,
1007,
999,
1027,
9152,
2140,
1063,
2709,
2155,
1027,
1027,
2155,
11514,
2615,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/internal/cache/debugger/comparer.go | CompareNodes | func (c *CacheComparer) CompareNodes(nodes []*v1.Node, nodeinfos map[string]*schedulernodeinfo.NodeInfo) (missed, redundant []string) {
actual := []string{}
for _, node := range nodes {
actual = append(actual, node.Name)
}
cached := []string{}
for nodeName := range nodeinfos {
cached = append(cached, nodeName)
}
return compareStrings(actual, cached)
} | go | func (c *CacheComparer) CompareNodes(nodes []*v1.Node, nodeinfos map[string]*schedulernodeinfo.NodeInfo) (missed, redundant []string) {
actual := []string{}
for _, node := range nodes {
actual = append(actual, node.Name)
}
cached := []string{}
for nodeName := range nodeinfos {
cached = append(cached, nodeName)
}
return compareStrings(actual, cached)
} | [
"func",
"(",
"c",
"*",
"CacheComparer",
")",
"CompareNodes",
"(",
"nodes",
"[",
"]",
"*",
"v1",
".",
"Node",
",",
"nodeinfos",
"map",
"[",
"string",
"]",
"*",
"schedulernodeinfo",
".",
"NodeInfo",
")",
"(",
"missed",
",",
"redundant",
"[",
"]",
"string... | // CompareNodes compares actual nodes with cached nodes. | [
"CompareNodes",
"compares",
"actual",
"nodes",
"with",
"cached",
"nodes",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/scheduler/internal/cache/debugger/comparer.go#L71-L83 | train | CompareNodes compares nodes with nodeinfos. | [
30522,
4569,
2278,
1006,
1039,
1008,
17053,
9006,
19362,
2121,
1007,
12826,
3630,
6155,
1006,
14164,
1031,
1033,
1008,
1058,
2487,
1012,
13045,
1010,
13045,
2378,
14876,
2015,
4949,
1031,
5164,
1033,
1008,
6134,
19139,
3207,
2378,
14876,
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/storage/v1alpha1/zz_generated.conversion.go | Convert_v1alpha1_VolumeAttachmentList_To_storage_VolumeAttachmentList | func Convert_v1alpha1_VolumeAttachmentList_To_storage_VolumeAttachmentList(in *v1alpha1.VolumeAttachmentList, out *storage.VolumeAttachmentList, s conversion.Scope) error {
return autoConvert_v1alpha1_VolumeAttachmentList_To_storage_VolumeAttachmentList(in, out, s)
} | go | func Convert_v1alpha1_VolumeAttachmentList_To_storage_VolumeAttachmentList(in *v1alpha1.VolumeAttachmentList, out *storage.VolumeAttachmentList, s conversion.Scope) error {
return autoConvert_v1alpha1_VolumeAttachmentList_To_storage_VolumeAttachmentList(in, out, s)
} | [
"func",
"Convert_v1alpha1_VolumeAttachmentList_To_storage_VolumeAttachmentList",
"(",
"in",
"*",
"v1alpha1",
".",
"VolumeAttachmentList",
",",
"out",
"*",
"storage",
".",
"VolumeAttachmentList",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoCon... | // Convert_v1alpha1_VolumeAttachmentList_To_storage_VolumeAttachmentList is an autogenerated conversion function. | [
"Convert_v1alpha1_VolumeAttachmentList_To_storage_VolumeAttachmentList",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/storage/v1alpha1/zz_generated.conversion.go#L141-L143 | train | Convert_v1alpha1_VolumeAttachmentList_To_storage_VolumeAttachmentList is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
1058,
2487,
2389,
21890,
2487,
1035,
3872,
19321,
6776,
3672,
9863,
1035,
2000,
1035,
5527,
1035,
3872,
19321,
6776,
3672,
9863,
1006,
1999,
1008,
1058,
2487,
2389,
21890,
2487,
1012,
3872,
19321,
6776,
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 | pkg/apis/core/v1/zz_generated.conversion.go | Convert_core_PortworxVolumeSource_To_v1_PortworxVolumeSource | func Convert_core_PortworxVolumeSource_To_v1_PortworxVolumeSource(in *core.PortworxVolumeSource, out *v1.PortworxVolumeSource, s conversion.Scope) error {
return autoConvert_core_PortworxVolumeSource_To_v1_PortworxVolumeSource(in, out, s)
} | go | func Convert_core_PortworxVolumeSource_To_v1_PortworxVolumeSource(in *core.PortworxVolumeSource, out *v1.PortworxVolumeSource, s conversion.Scope) error {
return autoConvert_core_PortworxVolumeSource_To_v1_PortworxVolumeSource(in, out, s)
} | [
"func",
"Convert_core_PortworxVolumeSource_To_v1_PortworxVolumeSource",
"(",
"in",
"*",
"core",
".",
"PortworxVolumeSource",
",",
"out",
"*",
"v1",
".",
"PortworxVolumeSource",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoConvert_core_Portworx... | // Convert_core_PortworxVolumeSource_To_v1_PortworxVolumeSource is an autogenerated conversion function. | [
"Convert_core_PortworxVolumeSource_To_v1_PortworxVolumeSource",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/v1/zz_generated.conversion.go#L5819-L5821 | train | Convert_core_PortworxVolumeSource_To_v1_PortworxVolumeSource is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
4563,
1035,
3417,
12155,
2099,
2595,
6767,
12942,
2229,
8162,
3401,
1035,
2000,
1035,
1058,
2487,
1035,
3417,
12155,
2099,
2595,
6767,
12942,
2229,
8162,
3401,
1006,
1999,
1008,
4563,
1012,
3417,
12155,
2099,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/cronjob/cronjob_controller.go | Run | func (jm *Controller) Run(stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
klog.Infof("Starting CronJob Manager")
// Check things every 10 second.
go wait.Until(jm.syncAll, 10*time.Second, stopCh)
<-stopCh
klog.Infof("Shutting down CronJob Manager")
} | go | func (jm *Controller) Run(stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
klog.Infof("Starting CronJob Manager")
// Check things every 10 second.
go wait.Until(jm.syncAll, 10*time.Second, stopCh)
<-stopCh
klog.Infof("Shutting down CronJob Manager")
} | [
"func",
"(",
"jm",
"*",
"Controller",
")",
"Run",
"(",
"stopCh",
"<-",
"chan",
"struct",
"{",
"}",
")",
"{",
"defer",
"utilruntime",
".",
"HandleCrash",
"(",
")",
"\n",
"klog",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"// Check things every 10 second.",... | // Run starts the main goroutine responsible for watching and syncing jobs. | [
"Run",
"starts",
"the",
"main",
"goroutine",
"responsible",
"for",
"watching",
"and",
"syncing",
"jobs",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/cronjob/cronjob_controller.go#L94-L101 | train | Run starts the CronJob Manager. | [
30522,
4569,
2278,
1006,
1046,
2213,
1008,
11486,
1007,
2448,
1006,
2644,
2818,
1026,
1011,
9212,
2358,
6820,
6593,
1063,
1065,
1007,
1063,
13366,
2121,
21183,
4014,
15532,
7292,
1012,
5047,
26775,
11823,
1006,
1007,
1047,
21197,
1012,
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 | staging/src/k8s.io/client-go/tools/cache/delta_fifo.go | ListKeys | func (f *DeltaFIFO) ListKeys() []string {
f.lock.RLock()
defer f.lock.RUnlock()
list := make([]string, 0, len(f.items))
for key := range f.items {
list = append(list, key)
}
return list
} | go | func (f *DeltaFIFO) ListKeys() []string {
f.lock.RLock()
defer f.lock.RUnlock()
list := make([]string, 0, len(f.items))
for key := range f.items {
list = append(list, key)
}
return list
} | [
"func",
"(",
"f",
"*",
"DeltaFIFO",
")",
"ListKeys",
"(",
")",
"[",
"]",
"string",
"{",
"f",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"f",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n",
"list",
":=",
"make",
"(",
"[",
"]",
"string",
... | // ListKeys returns a list of all the keys of the objects currently
// in the FIFO. | [
"ListKeys",
"returns",
"a",
"list",
"of",
"all",
"the",
"keys",
"of",
"the",
"objects",
"currently",
"in",
"the",
"FIFO",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/tools/cache/delta_fifo.go#L356-L364 | train | ListKeys returns a list of keys in the deltaFIFO | [
30522,
4569,
2278,
1006,
1042,
1008,
7160,
8873,
14876,
1007,
2862,
14839,
2015,
1006,
1007,
1031,
1033,
5164,
1063,
1042,
1012,
5843,
1012,
1054,
7878,
1006,
1007,
13366,
2121,
1042,
1012,
5843,
1012,
2448,
7878,
1006,
1007,
2862,
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 | pkg/kubelet/kubelet.go | deletePod | func (kl *Kubelet) deletePod(pod *v1.Pod) error {
if pod == nil {
return fmt.Errorf("deletePod does not allow nil pod")
}
if !kl.sourcesReady.AllReady() {
// If the sources aren't ready, skip deletion, as we may accidentally delete pods
// for sources that haven't reported yet.
return fmt.Errorf("skipping delete because sources aren't ready yet")
}
kl.podWorkers.ForgetWorker(pod.UID)
// Runtime cache may not have been updated to with the pod, but it's okay
// because the periodic cleanup routine will attempt to delete again later.
runningPods, err := kl.runtimeCache.GetPods()
if err != nil {
return fmt.Errorf("error listing containers: %v", err)
}
runningPod := kubecontainer.Pods(runningPods).FindPod("", pod.UID)
if runningPod.IsEmpty() {
return fmt.Errorf("pod not found")
}
podPair := kubecontainer.PodPair{APIPod: pod, RunningPod: &runningPod}
kl.podKillingCh <- &podPair
// TODO: delete the mirror pod here?
// We leave the volume/directory cleanup to the periodic cleanup routine.
return nil
} | go | func (kl *Kubelet) deletePod(pod *v1.Pod) error {
if pod == nil {
return fmt.Errorf("deletePod does not allow nil pod")
}
if !kl.sourcesReady.AllReady() {
// If the sources aren't ready, skip deletion, as we may accidentally delete pods
// for sources that haven't reported yet.
return fmt.Errorf("skipping delete because sources aren't ready yet")
}
kl.podWorkers.ForgetWorker(pod.UID)
// Runtime cache may not have been updated to with the pod, but it's okay
// because the periodic cleanup routine will attempt to delete again later.
runningPods, err := kl.runtimeCache.GetPods()
if err != nil {
return fmt.Errorf("error listing containers: %v", err)
}
runningPod := kubecontainer.Pods(runningPods).FindPod("", pod.UID)
if runningPod.IsEmpty() {
return fmt.Errorf("pod not found")
}
podPair := kubecontainer.PodPair{APIPod: pod, RunningPod: &runningPod}
kl.podKillingCh <- &podPair
// TODO: delete the mirror pod here?
// We leave the volume/directory cleanup to the periodic cleanup routine.
return nil
} | [
"func",
"(",
"kl",
"*",
"Kubelet",
")",
"deletePod",
"(",
"pod",
"*",
"v1",
".",
"Pod",
")",
"error",
"{",
"if",
"pod",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"!",
"kl",
".",
"sourcesReady... | // deletePod deletes the pod from the internal state of the kubelet by:
// 1. stopping the associated pod worker asynchronously
// 2. signaling to kill the pod by sending on the podKillingCh channel
//
// deletePod returns an error if not all sources are ready or the pod is not
// found in the runtime cache. | [
"deletePod",
"deletes",
"the",
"pod",
"from",
"the",
"internal",
"state",
"of",
"the",
"kubelet",
"by",
":",
"1",
".",
"stopping",
"the",
"associated",
"pod",
"worker",
"asynchronously",
"2",
".",
"signaling",
"to",
"kill",
"the",
"pod",
"by",
"sending",
"... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/kubelet.go#L1714-L1742 | train | deletePod deletes a pod from the kubelet. | [
30522,
4569,
2278,
1006,
1047,
2140,
1008,
13970,
8671,
3388,
1007,
3972,
12870,
27633,
1006,
17491,
1008,
1058,
2487,
1012,
17491,
1007,
7561,
1063,
2065,
17491,
1027,
1027,
9152,
2140,
1063,
2709,
4718,
2102,
1012,
7561,
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/apis/admissionregistration/zz_generated.deepcopy.go | DeepCopy | func (in *MutatingWebhookConfigurationList) DeepCopy() *MutatingWebhookConfigurationList {
if in == nil {
return nil
}
out := new(MutatingWebhookConfigurationList)
in.DeepCopyInto(out)
return out
} | go | func (in *MutatingWebhookConfigurationList) DeepCopy() *MutatingWebhookConfigurationList {
if in == nil {
return nil
}
out := new(MutatingWebhookConfigurationList)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"MutatingWebhookConfigurationList",
")",
"DeepCopy",
"(",
")",
"*",
"MutatingWebhookConfigurationList",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"MutatingWebhookConfigurationList",
")",... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MutatingWebhookConfigurationList. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"MutatingWebhookConfigurationList",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/admissionregistration/zz_generated.deepcopy.go#L77-L84 | train | DeepCopy is an autogenerated deepcopy function copying the receiver creating a new MutatingWebhookConfigurationList. | [
30522,
4569,
2278,
1006,
1999,
1008,
14163,
29336,
2075,
8545,
23706,
14659,
8663,
8873,
27390,
3370,
9863,
1007,
2784,
3597,
7685,
1006,
1007,
1008,
14163,
29336,
2075,
8545,
23706,
14659,
8663,
8873,
27390,
3370,
9863,
1063,
2065,
1999,
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/registry/rbac/validation/policy_comparator.go | ruleCovers | func ruleCovers(ownerRule, subRule rbacv1.PolicyRule) bool {
verbMatches := has(ownerRule.Verbs, rbacv1.VerbAll) || hasAll(ownerRule.Verbs, subRule.Verbs)
groupMatches := has(ownerRule.APIGroups, rbacv1.APIGroupAll) || hasAll(ownerRule.APIGroups, subRule.APIGroups)
resourceMatches := resourceCoversAll(ownerRule.Resources, subRule.Resources)
nonResourceURLMatches := nonResourceURLsCoversAll(ownerRule.NonResourceURLs, subRule.NonResourceURLs)
resourceNameMatches := false
if len(subRule.ResourceNames) == 0 {
resourceNameMatches = (len(ownerRule.ResourceNames) == 0)
} else {
resourceNameMatches = (len(ownerRule.ResourceNames) == 0) || hasAll(ownerRule.ResourceNames, subRule.ResourceNames)
}
return verbMatches && groupMatches && resourceMatches && resourceNameMatches && nonResourceURLMatches
} | go | func ruleCovers(ownerRule, subRule rbacv1.PolicyRule) bool {
verbMatches := has(ownerRule.Verbs, rbacv1.VerbAll) || hasAll(ownerRule.Verbs, subRule.Verbs)
groupMatches := has(ownerRule.APIGroups, rbacv1.APIGroupAll) || hasAll(ownerRule.APIGroups, subRule.APIGroups)
resourceMatches := resourceCoversAll(ownerRule.Resources, subRule.Resources)
nonResourceURLMatches := nonResourceURLsCoversAll(ownerRule.NonResourceURLs, subRule.NonResourceURLs)
resourceNameMatches := false
if len(subRule.ResourceNames) == 0 {
resourceNameMatches = (len(ownerRule.ResourceNames) == 0)
} else {
resourceNameMatches = (len(ownerRule.ResourceNames) == 0) || hasAll(ownerRule.ResourceNames, subRule.ResourceNames)
}
return verbMatches && groupMatches && resourceMatches && resourceNameMatches && nonResourceURLMatches
} | [
"func",
"ruleCovers",
"(",
"ownerRule",
",",
"subRule",
"rbacv1",
".",
"PolicyRule",
")",
"bool",
"{",
"verbMatches",
":=",
"has",
"(",
"ownerRule",
".",
"Verbs",
",",
"rbacv1",
".",
"VerbAll",
")",
"||",
"hasAll",
"(",
"ownerRule",
".",
"Verbs",
",",
"s... | // ruleCovers determines whether the ownerRule (which may have multiple verbs, resources, and resourceNames) covers
// the subrule (which may only contain at most one verb, resource, and resourceName) | [
"ruleCovers",
"determines",
"whether",
"the",
"ownerRule",
"(",
"which",
"may",
"have",
"multiple",
"verbs",
"resources",
"and",
"resourceNames",
")",
"covers",
"the",
"subrule",
"(",
"which",
"may",
"only",
"contain",
"at",
"most",
"one",
"verb",
"resource",
... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/registry/rbac/validation/policy_comparator.go#L158-L173 | train | ruleCovers returns true if the ownerRule contains the rule and the subRule contains the rule. | [
30522,
4569,
2278,
3627,
3597,
14028,
1006,
3954,
6820,
2571,
1010,
4942,
6820,
2571,
21144,
6305,
2615,
2487,
1012,
3343,
6820,
2571,
1007,
22017,
2140,
1063,
12034,
18900,
8376,
1024,
1027,
2038,
1006,
3954,
6820,
2571,
1012,
16025,
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/networking/validation/validation.go | ValidateIPBlock | func ValidateIPBlock(ipb *networking.IPBlock, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if len(ipb.CIDR) == 0 || ipb.CIDR == "" {
allErrs = append(allErrs, field.Required(fldPath.Child("cidr"), ""))
return allErrs
}
cidrIPNet, err := apivalidation.ValidateCIDR(ipb.CIDR)
if err != nil {
allErrs = append(allErrs, field.Invalid(fldPath.Child("cidr"), ipb.CIDR, "not a valid CIDR"))
return allErrs
}
exceptCIDR := ipb.Except
for i, exceptIP := range exceptCIDR {
exceptPath := fldPath.Child("except").Index(i)
exceptCIDR, err := apivalidation.ValidateCIDR(exceptIP)
if err != nil {
allErrs = append(allErrs, field.Invalid(exceptPath, exceptIP, "not a valid CIDR"))
return allErrs
}
if !cidrIPNet.Contains(exceptCIDR.IP) {
allErrs = append(allErrs, field.Invalid(exceptPath, exceptCIDR.IP, "not within CIDR range"))
}
}
return allErrs
} | go | func ValidateIPBlock(ipb *networking.IPBlock, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if len(ipb.CIDR) == 0 || ipb.CIDR == "" {
allErrs = append(allErrs, field.Required(fldPath.Child("cidr"), ""))
return allErrs
}
cidrIPNet, err := apivalidation.ValidateCIDR(ipb.CIDR)
if err != nil {
allErrs = append(allErrs, field.Invalid(fldPath.Child("cidr"), ipb.CIDR, "not a valid CIDR"))
return allErrs
}
exceptCIDR := ipb.Except
for i, exceptIP := range exceptCIDR {
exceptPath := fldPath.Child("except").Index(i)
exceptCIDR, err := apivalidation.ValidateCIDR(exceptIP)
if err != nil {
allErrs = append(allErrs, field.Invalid(exceptPath, exceptIP, "not a valid CIDR"))
return allErrs
}
if !cidrIPNet.Contains(exceptCIDR.IP) {
allErrs = append(allErrs, field.Invalid(exceptPath, exceptCIDR.IP, "not within CIDR range"))
}
}
return allErrs
} | [
"func",
"ValidateIPBlock",
"(",
"ipb",
"*",
"networking",
".",
"IPBlock",
",",
"fldPath",
"*",
"field",
".",
"Path",
")",
"field",
".",
"ErrorList",
"{",
"allErrs",
":=",
"field",
".",
"ErrorList",
"{",
"}",
"\n",
"if",
"len",
"(",
"ipb",
".",
"CIDR",
... | // ValidateIPBlock validates a cidr and the except fields of an IpBlock NetworkPolicyPeer | [
"ValidateIPBlock",
"validates",
"a",
"cidr",
"and",
"the",
"except",
"fields",
"of",
"an",
"IpBlock",
"NetworkPolicyPeer"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/networking/validation/validation.go#L151-L175 | train | ValidateIPBlock validates a networking. IPBlock | [
30522,
4569,
2278,
9398,
3686,
11514,
23467,
1006,
12997,
2497,
1008,
14048,
1012,
12997,
23467,
1010,
13109,
18927,
8988,
1008,
2492,
1012,
4130,
1007,
2492,
1012,
7561,
9863,
1063,
2035,
2121,
2869,
1024,
1027,
2492,
1012,
7561,
9863,
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/kubectl/cmd/wait/wait.go | IsDeleted | func IsDeleted(info *resource.Info, o *WaitOptions) (runtime.Object, bool, error) {
endTime := time.Now().Add(o.Timeout)
for {
if len(info.Name) == 0 {
return info.Object, false, fmt.Errorf("resource name must be provided")
}
nameSelector := fields.OneTermEqualSelector("metadata.name", info.Name).String()
// List with a name field selector to get the current resourceVersion to watch from (not the object's resourceVersion)
gottenObjList, err := o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).List(metav1.ListOptions{FieldSelector: nameSelector})
if apierrors.IsNotFound(err) {
return info.Object, true, nil
}
if err != nil {
// TODO this could do something slightly fancier if we wish
return info.Object, false, err
}
if len(gottenObjList.Items) != 1 {
return info.Object, true, nil
}
gottenObj := &gottenObjList.Items[0]
resourceLocation := ResourceLocation{
GroupResource: info.Mapping.Resource.GroupResource(),
Namespace: gottenObj.GetNamespace(),
Name: gottenObj.GetName(),
}
if uid, ok := o.UIDMap[resourceLocation]; ok {
if gottenObj.GetUID() != uid {
return gottenObj, true, nil
}
}
watchOptions := metav1.ListOptions{}
watchOptions.FieldSelector = nameSelector
watchOptions.ResourceVersion = gottenObjList.GetResourceVersion()
objWatch, err := o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).Watch(watchOptions)
if err != nil {
return gottenObj, false, err
}
timeout := endTime.Sub(time.Now())
errWaitTimeoutWithName := extendErrWaitTimeout(wait.ErrWaitTimeout, info)
if timeout < 0 {
// we're out of time
return gottenObj, false, errWaitTimeoutWithName
}
ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), o.Timeout)
watchEvent, err := watchtools.UntilWithoutRetry(ctx, objWatch, Wait{errOut: o.ErrOut}.IsDeleted)
cancel()
switch {
case err == nil:
return watchEvent.Object, true, nil
case err == watchtools.ErrWatchClosed:
continue
case err == wait.ErrWaitTimeout:
if watchEvent != nil {
return watchEvent.Object, false, errWaitTimeoutWithName
}
return gottenObj, false, errWaitTimeoutWithName
default:
return gottenObj, false, err
}
}
} | go | func IsDeleted(info *resource.Info, o *WaitOptions) (runtime.Object, bool, error) {
endTime := time.Now().Add(o.Timeout)
for {
if len(info.Name) == 0 {
return info.Object, false, fmt.Errorf("resource name must be provided")
}
nameSelector := fields.OneTermEqualSelector("metadata.name", info.Name).String()
// List with a name field selector to get the current resourceVersion to watch from (not the object's resourceVersion)
gottenObjList, err := o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).List(metav1.ListOptions{FieldSelector: nameSelector})
if apierrors.IsNotFound(err) {
return info.Object, true, nil
}
if err != nil {
// TODO this could do something slightly fancier if we wish
return info.Object, false, err
}
if len(gottenObjList.Items) != 1 {
return info.Object, true, nil
}
gottenObj := &gottenObjList.Items[0]
resourceLocation := ResourceLocation{
GroupResource: info.Mapping.Resource.GroupResource(),
Namespace: gottenObj.GetNamespace(),
Name: gottenObj.GetName(),
}
if uid, ok := o.UIDMap[resourceLocation]; ok {
if gottenObj.GetUID() != uid {
return gottenObj, true, nil
}
}
watchOptions := metav1.ListOptions{}
watchOptions.FieldSelector = nameSelector
watchOptions.ResourceVersion = gottenObjList.GetResourceVersion()
objWatch, err := o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).Watch(watchOptions)
if err != nil {
return gottenObj, false, err
}
timeout := endTime.Sub(time.Now())
errWaitTimeoutWithName := extendErrWaitTimeout(wait.ErrWaitTimeout, info)
if timeout < 0 {
// we're out of time
return gottenObj, false, errWaitTimeoutWithName
}
ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), o.Timeout)
watchEvent, err := watchtools.UntilWithoutRetry(ctx, objWatch, Wait{errOut: o.ErrOut}.IsDeleted)
cancel()
switch {
case err == nil:
return watchEvent.Object, true, nil
case err == watchtools.ErrWatchClosed:
continue
case err == wait.ErrWaitTimeout:
if watchEvent != nil {
return watchEvent.Object, false, errWaitTimeoutWithName
}
return gottenObj, false, errWaitTimeoutWithName
default:
return gottenObj, false, err
}
}
} | [
"func",
"IsDeleted",
"(",
"info",
"*",
"resource",
".",
"Info",
",",
"o",
"*",
"WaitOptions",
")",
"(",
"runtime",
".",
"Object",
",",
"bool",
",",
"error",
")",
"{",
"endTime",
":=",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"o",
".",
"Time... | // IsDeleted is a condition func for waiting for something to be deleted | [
"IsDeleted",
"is",
"a",
"condition",
"func",
"for",
"waiting",
"for",
"something",
"to",
"be",
"deleted"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubectl/cmd/wait/wait.go#L256-L321 | train | IsDeleted returns the object that was deleted. | [
30522,
4569,
2278,
2003,
9247,
12870,
2094,
1006,
18558,
1008,
7692,
1012,
18558,
1010,
1051,
1008,
3524,
7361,
9285,
1007,
1006,
2448,
7292,
1012,
4874,
1010,
22017,
2140,
1010,
7561,
1007,
1063,
2203,
7292,
1024,
1027,
2051,
1012,
2085,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/registry/certificates/certificates/strategy.go | PrepareForCreate | func (csrStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
csr := obj.(*certificates.CertificateSigningRequest)
// Clear any user-specified info
csr.Spec.Username = ""
csr.Spec.UID = ""
csr.Spec.Groups = nil
csr.Spec.Extra = nil
// Inject user.Info from request context
if user, ok := genericapirequest.UserFrom(ctx); ok {
csr.Spec.Username = user.GetName()
csr.Spec.UID = user.GetUID()
csr.Spec.Groups = user.GetGroups()
if extra := user.GetExtra(); len(extra) > 0 {
csr.Spec.Extra = map[string]certificates.ExtraValue{}
for k, v := range extra {
csr.Spec.Extra[k] = certificates.ExtraValue(v)
}
}
}
// Be explicit that users cannot create pre-approved certificate requests.
csr.Status = certificates.CertificateSigningRequestStatus{}
csr.Status.Conditions = []certificates.CertificateSigningRequestCondition{}
} | go | func (csrStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
csr := obj.(*certificates.CertificateSigningRequest)
// Clear any user-specified info
csr.Spec.Username = ""
csr.Spec.UID = ""
csr.Spec.Groups = nil
csr.Spec.Extra = nil
// Inject user.Info from request context
if user, ok := genericapirequest.UserFrom(ctx); ok {
csr.Spec.Username = user.GetName()
csr.Spec.UID = user.GetUID()
csr.Spec.Groups = user.GetGroups()
if extra := user.GetExtra(); len(extra) > 0 {
csr.Spec.Extra = map[string]certificates.ExtraValue{}
for k, v := range extra {
csr.Spec.Extra[k] = certificates.ExtraValue(v)
}
}
}
// Be explicit that users cannot create pre-approved certificate requests.
csr.Status = certificates.CertificateSigningRequestStatus{}
csr.Status.Conditions = []certificates.CertificateSigningRequestCondition{}
} | [
"func",
"(",
"csrStrategy",
")",
"PrepareForCreate",
"(",
"ctx",
"context",
".",
"Context",
",",
"obj",
"runtime",
".",
"Object",
")",
"{",
"csr",
":=",
"obj",
".",
"(",
"*",
"certificates",
".",
"CertificateSigningRequest",
")",
"\n\n",
"// Clear any user-spe... | // PrepareForCreate clears fields that are not allowed to be set by end users
// on creation. | [
"PrepareForCreate",
"clears",
"fields",
"that",
"are",
"not",
"allowed",
"to",
"be",
"set",
"by",
"end",
"users",
"on",
"creation",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/registry/certificates/certificates/strategy.go#L55-L79 | train | PrepareForCreate clears all fields that are not allowed to be set by end users on creation. | [
30522,
4569,
2278,
1006,
20116,
12096,
11657,
6292,
1007,
7374,
29278,
16748,
3686,
1006,
14931,
2595,
6123,
1012,
6123,
1010,
27885,
3501,
2448,
7292,
1012,
4874,
1007,
1063,
20116,
2099,
1024,
1027,
27885,
3501,
1012,
1006,
1008,
17987,
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/credentialprovider/gcp/metadata.go | Provide | func (g *containerRegistryProvider) Provide(image string) credentialprovider.DockerConfig {
cfg := credentialprovider.DockerConfig{}
tokenJsonBlob, err := credentialprovider.ReadUrl(metadataToken, g.Client, metadataHeader)
if err != nil {
klog.Errorf("while reading access token endpoint: %v", err)
return cfg
}
email, err := credentialprovider.ReadUrl(metadataEmail, g.Client, metadataHeader)
if err != nil {
klog.Errorf("while reading email endpoint: %v", err)
return cfg
}
var parsedBlob tokenBlob
if err := json.Unmarshal([]byte(tokenJsonBlob), &parsedBlob); err != nil {
klog.Errorf("while parsing json blob %s: %v", tokenJsonBlob, err)
return cfg
}
entry := credentialprovider.DockerConfigEntry{
Username: "_token",
Password: parsedBlob.AccessToken,
Email: string(email),
}
// Add our entry for each of the supported container registry URLs
for _, k := range containerRegistryUrls {
cfg[k] = entry
}
return cfg
} | go | func (g *containerRegistryProvider) Provide(image string) credentialprovider.DockerConfig {
cfg := credentialprovider.DockerConfig{}
tokenJsonBlob, err := credentialprovider.ReadUrl(metadataToken, g.Client, metadataHeader)
if err != nil {
klog.Errorf("while reading access token endpoint: %v", err)
return cfg
}
email, err := credentialprovider.ReadUrl(metadataEmail, g.Client, metadataHeader)
if err != nil {
klog.Errorf("while reading email endpoint: %v", err)
return cfg
}
var parsedBlob tokenBlob
if err := json.Unmarshal([]byte(tokenJsonBlob), &parsedBlob); err != nil {
klog.Errorf("while parsing json blob %s: %v", tokenJsonBlob, err)
return cfg
}
entry := credentialprovider.DockerConfigEntry{
Username: "_token",
Password: parsedBlob.AccessToken,
Email: string(email),
}
// Add our entry for each of the supported container registry URLs
for _, k := range containerRegistryUrls {
cfg[k] = entry
}
return cfg
} | [
"func",
"(",
"g",
"*",
"containerRegistryProvider",
")",
"Provide",
"(",
"image",
"string",
")",
"credentialprovider",
".",
"DockerConfig",
"{",
"cfg",
":=",
"credentialprovider",
".",
"DockerConfig",
"{",
"}",
"\n\n",
"tokenJsonBlob",
",",
"err",
":=",
"credent... | // Provide implements DockerConfigProvider | [
"Provide",
"implements",
"DockerConfigProvider"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/credentialprovider/gcp/metadata.go#L266-L298 | train | Provide returns a credentialprovider. DockerConfig for the given image | [
30522,
4569,
2278,
1006,
1043,
1008,
11661,
2890,
24063,
2854,
21572,
17258,
2121,
1007,
3073,
1006,
3746,
5164,
1007,
13675,
14728,
19909,
21572,
17258,
2121,
1012,
8946,
2121,
8663,
8873,
2290,
1063,
12935,
2290,
1024,
1027,
13675,
14728,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/api/v1/zz_generated.deepcopy.go | DeepCopyInto | func (in *PriorityArgument) DeepCopyInto(out *PriorityArgument) {
*out = *in
if in.ServiceAntiAffinity != nil {
in, out := &in.ServiceAntiAffinity, &out.ServiceAntiAffinity
*out = new(ServiceAntiAffinity)
**out = **in
}
if in.LabelPreference != nil {
in, out := &in.LabelPreference, &out.LabelPreference
*out = new(LabelPreference)
**out = **in
}
if in.RequestedToCapacityRatioArguments != nil {
in, out := &in.RequestedToCapacityRatioArguments, &out.RequestedToCapacityRatioArguments
*out = new(RequestedToCapacityRatioArguments)
(*in).DeepCopyInto(*out)
}
return
} | go | func (in *PriorityArgument) DeepCopyInto(out *PriorityArgument) {
*out = *in
if in.ServiceAntiAffinity != nil {
in, out := &in.ServiceAntiAffinity, &out.ServiceAntiAffinity
*out = new(ServiceAntiAffinity)
**out = **in
}
if in.LabelPreference != nil {
in, out := &in.LabelPreference, &out.LabelPreference
*out = new(LabelPreference)
**out = **in
}
if in.RequestedToCapacityRatioArguments != nil {
in, out := &in.RequestedToCapacityRatioArguments, &out.RequestedToCapacityRatioArguments
*out = new(RequestedToCapacityRatioArguments)
(*in).DeepCopyInto(*out)
}
return
} | [
"func",
"(",
"in",
"*",
"PriorityArgument",
")",
"DeepCopyInto",
"(",
"out",
"*",
"PriorityArgument",
")",
"{",
"*",
"out",
"=",
"*",
"in",
"\n",
"if",
"in",
".",
"ServiceAntiAffinity",
"!=",
"nil",
"{",
"in",
",",
"out",
":=",
"&",
"in",
".",
"Servi... | // 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/scheduler/api/v1/zz_generated.deepcopy.go#L519-L537 | train | DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new PriorityArgument. | [
30522,
4569,
2278,
1006,
1999,
1008,
9470,
2906,
22850,
4765,
1007,
2784,
3597,
7685,
18447,
2080,
1006,
2041,
1008,
9470,
2906,
22850,
4765,
1007,
1063,
1008,
2041,
1027,
1008,
1999,
2065,
1999,
1012,
2326,
4630,
2401,
15379,
3012,
999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/internal/cache/cache.go | finishBinding | func (cache *schedulerCache) finishBinding(pod *v1.Pod, now time.Time) error {
key, err := schedulernodeinfo.GetPodKey(pod)
if err != nil {
return err
}
cache.mu.RLock()
defer cache.mu.RUnlock()
klog.V(5).Infof("Finished binding for pod %v. Can be expired.", key)
currState, ok := cache.podStates[key]
if ok && cache.assumedPods[key] {
dl := now.Add(cache.ttl)
currState.bindingFinished = true
currState.deadline = &dl
}
return nil
} | go | func (cache *schedulerCache) finishBinding(pod *v1.Pod, now time.Time) error {
key, err := schedulernodeinfo.GetPodKey(pod)
if err != nil {
return err
}
cache.mu.RLock()
defer cache.mu.RUnlock()
klog.V(5).Infof("Finished binding for pod %v. Can be expired.", key)
currState, ok := cache.podStates[key]
if ok && cache.assumedPods[key] {
dl := now.Add(cache.ttl)
currState.bindingFinished = true
currState.deadline = &dl
}
return nil
} | [
"func",
"(",
"cache",
"*",
"schedulerCache",
")",
"finishBinding",
"(",
"pod",
"*",
"v1",
".",
"Pod",
",",
"now",
"time",
".",
"Time",
")",
"error",
"{",
"key",
",",
"err",
":=",
"schedulernodeinfo",
".",
"GetPodKey",
"(",
"pod",
")",
"\n",
"if",
"er... | // finishBinding exists to make tests determinitistic by injecting now as an argument | [
"finishBinding",
"exists",
"to",
"make",
"tests",
"determinitistic",
"by",
"injecting",
"now",
"as",
"an",
"argument"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/scheduler/internal/cache/cache.go#L300-L317 | train | finishBinding is called when a pod is finished binding. | [
30522,
4569,
2278,
1006,
17053,
1008,
6134,
18992,
5403,
1007,
3926,
8428,
4667,
1006,
17491,
1008,
1058,
2487,
1012,
17491,
1010,
2085,
2051,
1012,
2051,
1007,
7561,
1063,
3145,
1010,
9413,
2099,
1024,
1027,
6134,
19139,
3207,
2378,
14876,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/node.go | NewCmdUpgradeControlPlane | func NewCmdUpgradeControlPlane() *cobra.Command {
flags := &controlplaneUpgradeFlags{
kubeConfigPath: constants.GetKubeletKubeConfigPath(),
advertiseAddress: "",
etcdUpgrade: true,
renewCerts: true,
dryRun: false,
}
cmd := &cobra.Command{
Use: "experimental-control-plane",
Short: "Upgrade the control plane instance deployed on this node. IMPORTANT. This command should be executed after executing `kubeadm upgrade apply` on another control plane instance",
Long: upgradeNodeConfigLongDesc,
Example: upgradeNodeConfigExample,
Run: func(cmd *cobra.Command, args []string) {
if flags.nodeName == "" {
klog.V(1).Infoln("[upgrade] found NodeName empty; considered OS hostname as NodeName")
}
nodeName, err := node.GetHostname(flags.nodeName)
if err != nil {
kubeadmutil.CheckErr(err)
}
flags.nodeName = nodeName
if flags.advertiseAddress == "" {
ip, err := configutil.ChooseAPIServerBindAddress(nil)
if err != nil {
kubeadmutil.CheckErr(err)
return
}
flags.advertiseAddress = ip.String()
}
err = RunUpgradeControlPlane(flags)
kubeadmutil.CheckErr(err)
},
}
options.AddKubeConfigFlag(cmd.Flags(), &flags.kubeConfigPath)
cmd.Flags().BoolVar(&flags.dryRun, options.DryRun, flags.dryRun, "Do not change any state, just output the actions that would be performed.")
cmd.Flags().BoolVar(&flags.etcdUpgrade, "etcd-upgrade", flags.etcdUpgrade, "Perform the upgrade of etcd.")
cmd.Flags().BoolVar(&flags.renewCerts, "certificate-renewal", flags.renewCerts, "Perform the renewal of certificates used by component changed during upgrades.")
return cmd
} | go | func NewCmdUpgradeControlPlane() *cobra.Command {
flags := &controlplaneUpgradeFlags{
kubeConfigPath: constants.GetKubeletKubeConfigPath(),
advertiseAddress: "",
etcdUpgrade: true,
renewCerts: true,
dryRun: false,
}
cmd := &cobra.Command{
Use: "experimental-control-plane",
Short: "Upgrade the control plane instance deployed on this node. IMPORTANT. This command should be executed after executing `kubeadm upgrade apply` on another control plane instance",
Long: upgradeNodeConfigLongDesc,
Example: upgradeNodeConfigExample,
Run: func(cmd *cobra.Command, args []string) {
if flags.nodeName == "" {
klog.V(1).Infoln("[upgrade] found NodeName empty; considered OS hostname as NodeName")
}
nodeName, err := node.GetHostname(flags.nodeName)
if err != nil {
kubeadmutil.CheckErr(err)
}
flags.nodeName = nodeName
if flags.advertiseAddress == "" {
ip, err := configutil.ChooseAPIServerBindAddress(nil)
if err != nil {
kubeadmutil.CheckErr(err)
return
}
flags.advertiseAddress = ip.String()
}
err = RunUpgradeControlPlane(flags)
kubeadmutil.CheckErr(err)
},
}
options.AddKubeConfigFlag(cmd.Flags(), &flags.kubeConfigPath)
cmd.Flags().BoolVar(&flags.dryRun, options.DryRun, flags.dryRun, "Do not change any state, just output the actions that would be performed.")
cmd.Flags().BoolVar(&flags.etcdUpgrade, "etcd-upgrade", flags.etcdUpgrade, "Perform the upgrade of etcd.")
cmd.Flags().BoolVar(&flags.renewCerts, "certificate-renewal", flags.renewCerts, "Perform the renewal of certificates used by component changed during upgrades.")
return cmd
} | [
"func",
"NewCmdUpgradeControlPlane",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"flags",
":=",
"&",
"controlplaneUpgradeFlags",
"{",
"kubeConfigPath",
":",
"constants",
".",
"GetKubeletKubeConfigPath",
"(",
")",
",",
"advertiseAddress",
":",
"\"",
"\"",
",",
"... | // NewCmdUpgradeControlPlane returns the cobra.Command for upgrading the controlplane instance on this node | [
"NewCmdUpgradeControlPlane",
"returns",
"the",
"cobra",
".",
"Command",
"for",
"upgrading",
"the",
"controlplane",
"instance",
"on",
"this",
"node"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/cmd/upgrade/node.go#L112-L158 | train | NewCmdUpgradeControlPlane returns a command to upgrade a control plane instance. | [
30522,
4569,
2278,
2047,
27487,
8566,
26952,
13662,
8663,
13181,
14277,
20644,
1006,
1007,
1008,
16604,
1012,
3094,
1063,
9245,
1024,
1027,
1004,
2491,
11751,
6279,
24170,
10258,
26454,
1063,
13970,
4783,
8663,
8873,
21600,
8988,
1024,
5377,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 *ResourceQuotaSpec) DeepCopy() *ResourceQuotaSpec {
if in == nil {
return nil
}
out := new(ResourceQuotaSpec)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceQuotaSpec) DeepCopy() *ResourceQuotaSpec {
if in == nil {
return nil
}
out := new(ResourceQuotaSpec)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceQuotaSpec",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceQuotaSpec",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceQuotaSpec",
")",
"\n",
"in",
".",
"DeepCopyInto",
"... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceQuotaSpec. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceQuotaSpec",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/zz_generated.deepcopy.go#L4256-L4263 | train | DeepCopy is an autogenerated deepcopy function copying the receiver creating a new ResourceResourceQuotaSpec. | [
30522,
4569,
2278,
1006,
1999,
1008,
7692,
28940,
17287,
13102,
8586,
1007,
2784,
3597,
7685,
1006,
1007,
1008,
7692,
28940,
17287,
13102,
8586,
1063,
2065,
1999,
1027,
1027,
9152,
2140,
1063,
2709,
9152,
2140,
1065,
2041,
1024,
1027,
2047,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_loadbalancer_external.go | verifyUserRequestedIP | func verifyUserRequestedIP(s CloudAddressService, region, requestedIP, fwdRuleIP, lbRef string, desiredNetTier cloud.NetworkTier) (isUserOwnedIP bool, err error) {
if requestedIP == "" {
return false, nil
}
// If a specific IP address has been requested, we have to respect the
// user's request and use that IP. If the forwarding rule was already using
// a different IP, it will be harmlessly abandoned because it was only an
// ephemeral IP (or it was a different static IP owned by the user, in which
// case we shouldn't delete it anyway).
existingAddress, err := s.GetRegionAddressByIP(region, requestedIP)
if err != nil && !isNotFound(err) {
klog.Errorf("verifyUserRequestedIP: failed to check whether the requested IP %q for LB %s exists: %v", requestedIP, lbRef, err)
return false, err
}
if err == nil {
// The requested IP is a static IP, owned and managed by the user.
// Check if the network tier of the static IP matches the desired
// network tier.
netTierStr, err := s.getNetworkTierFromAddress(existingAddress.Name, region)
if err != nil {
return false, fmt.Errorf("failed to check the network tier of the IP %q: %v", requestedIP, err)
}
netTier := cloud.NetworkTierGCEValueToType(netTierStr)
if netTier != desiredNetTier {
klog.Errorf("verifyUserRequestedIP: requested static IP %q (name: %s) for LB %s has network tier %s, need %s.", requestedIP, existingAddress.Name, lbRef, netTier, desiredNetTier)
return false, fmt.Errorf("requrested IP %q belongs to the %s network tier; expected %s", requestedIP, netTier, desiredNetTier)
}
klog.V(4).Infof("verifyUserRequestedIP: the requested static IP %q (name: %s, tier: %s) for LB %s exists.", requestedIP, existingAddress.Name, netTier, lbRef)
return true, nil
}
if requestedIP == fwdRuleIP {
// The requested IP is not a static IP, but is currently assigned
// to this forwarding rule, so we can just use it.
klog.V(4).Infof("verifyUserRequestedIP: the requested IP %q is not static, but is currently in use by for LB %s", requestedIP, lbRef)
return false, nil
}
// The requested IP is not static and it is not assigned to the
// current forwarding rule. It might be attached to a different
// rule or it might not be part of this project at all. Either
// way, we can't use it.
klog.Errorf("verifyUserRequestedIP: requested IP %q for LB %s is neither static nor assigned to the LB", requestedIP, lbRef)
return false, fmt.Errorf("requested ip %q is neither static nor assigned to the LB", requestedIP)
} | go | func verifyUserRequestedIP(s CloudAddressService, region, requestedIP, fwdRuleIP, lbRef string, desiredNetTier cloud.NetworkTier) (isUserOwnedIP bool, err error) {
if requestedIP == "" {
return false, nil
}
// If a specific IP address has been requested, we have to respect the
// user's request and use that IP. If the forwarding rule was already using
// a different IP, it will be harmlessly abandoned because it was only an
// ephemeral IP (or it was a different static IP owned by the user, in which
// case we shouldn't delete it anyway).
existingAddress, err := s.GetRegionAddressByIP(region, requestedIP)
if err != nil && !isNotFound(err) {
klog.Errorf("verifyUserRequestedIP: failed to check whether the requested IP %q for LB %s exists: %v", requestedIP, lbRef, err)
return false, err
}
if err == nil {
// The requested IP is a static IP, owned and managed by the user.
// Check if the network tier of the static IP matches the desired
// network tier.
netTierStr, err := s.getNetworkTierFromAddress(existingAddress.Name, region)
if err != nil {
return false, fmt.Errorf("failed to check the network tier of the IP %q: %v", requestedIP, err)
}
netTier := cloud.NetworkTierGCEValueToType(netTierStr)
if netTier != desiredNetTier {
klog.Errorf("verifyUserRequestedIP: requested static IP %q (name: %s) for LB %s has network tier %s, need %s.", requestedIP, existingAddress.Name, lbRef, netTier, desiredNetTier)
return false, fmt.Errorf("requrested IP %q belongs to the %s network tier; expected %s", requestedIP, netTier, desiredNetTier)
}
klog.V(4).Infof("verifyUserRequestedIP: the requested static IP %q (name: %s, tier: %s) for LB %s exists.", requestedIP, existingAddress.Name, netTier, lbRef)
return true, nil
}
if requestedIP == fwdRuleIP {
// The requested IP is not a static IP, but is currently assigned
// to this forwarding rule, so we can just use it.
klog.V(4).Infof("verifyUserRequestedIP: the requested IP %q is not static, but is currently in use by for LB %s", requestedIP, lbRef)
return false, nil
}
// The requested IP is not static and it is not assigned to the
// current forwarding rule. It might be attached to a different
// rule or it might not be part of this project at all. Either
// way, we can't use it.
klog.Errorf("verifyUserRequestedIP: requested IP %q for LB %s is neither static nor assigned to the LB", requestedIP, lbRef)
return false, fmt.Errorf("requested ip %q is neither static nor assigned to the LB", requestedIP)
} | [
"func",
"verifyUserRequestedIP",
"(",
"s",
"CloudAddressService",
",",
"region",
",",
"requestedIP",
",",
"fwdRuleIP",
",",
"lbRef",
"string",
",",
"desiredNetTier",
"cloud",
".",
"NetworkTier",
")",
"(",
"isUserOwnedIP",
"bool",
",",
"err",
"error",
")",
"{",
... | // verifyUserRequestedIP checks the user-provided IP to see whether it meets
// all the expected attributes for the load balancer, and returns an error if
// the verification failed. It also returns a boolean to indicate whether the
// IP address is considered owned by the user (i.e., not managed by the
// controller. | [
"verifyUserRequestedIP",
"checks",
"the",
"user",
"-",
"provided",
"IP",
"to",
"see",
"whether",
"it",
"meets",
"all",
"the",
"expected",
"attributes",
"for",
"the",
"load",
"balancer",
"and",
"returns",
"an",
"error",
"if",
"the",
"verification",
"failed",
".... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/cloudprovider/providers/gce/gce_loadbalancer_external.go#L421-L464 | train | verifyUserRequestedIP checks whether the user requested a static IP address is owned by the user and the requested IP is a static IP. | [
30522,
4569,
2278,
20410,
20330,
2890,
15500,
2098,
11514,
1006,
1055,
6112,
4215,
16200,
4757,
8043,
7903,
2063,
1010,
2555,
1010,
7303,
11514,
1010,
1042,
21724,
6820,
23057,
2361,
1010,
6053,
2890,
2546,
5164,
1010,
9059,
15361,
3771,
61... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/proxy/transport.go | RoundTrip | func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
// Add reverse proxy headers.
forwardedURI := path.Join(t.PathPrepend, req.URL.Path)
if strings.HasSuffix(req.URL.Path, "/") {
forwardedURI = forwardedURI + "/"
}
req.Header.Set("X-Forwarded-Uri", forwardedURI)
if len(t.Host) > 0 {
req.Header.Set("X-Forwarded-Host", t.Host)
}
if len(t.Scheme) > 0 {
req.Header.Set("X-Forwarded-Proto", t.Scheme)
}
rt := t.RoundTripper
if rt == nil {
rt = http.DefaultTransport
}
resp, err := rt.RoundTrip(req)
if err != nil {
message := fmt.Sprintf("Error: '%s'\nTrying to reach: '%v'", err.Error(), req.URL.String())
resp = &http.Response{
StatusCode: http.StatusServiceUnavailable,
Body: ioutil.NopCloser(strings.NewReader(message)),
}
return resp, nil
}
if redirect := resp.Header.Get("Location"); redirect != "" {
resp.Header.Set("Location", t.rewriteURL(redirect, req.URL, req.Host))
return resp, nil
}
cType := resp.Header.Get("Content-Type")
cType = strings.TrimSpace(strings.SplitN(cType, ";", 2)[0])
if cType != "text/html" {
// Do nothing, simply pass through
return resp, nil
}
return t.rewriteResponse(req, resp)
} | go | func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
// Add reverse proxy headers.
forwardedURI := path.Join(t.PathPrepend, req.URL.Path)
if strings.HasSuffix(req.URL.Path, "/") {
forwardedURI = forwardedURI + "/"
}
req.Header.Set("X-Forwarded-Uri", forwardedURI)
if len(t.Host) > 0 {
req.Header.Set("X-Forwarded-Host", t.Host)
}
if len(t.Scheme) > 0 {
req.Header.Set("X-Forwarded-Proto", t.Scheme)
}
rt := t.RoundTripper
if rt == nil {
rt = http.DefaultTransport
}
resp, err := rt.RoundTrip(req)
if err != nil {
message := fmt.Sprintf("Error: '%s'\nTrying to reach: '%v'", err.Error(), req.URL.String())
resp = &http.Response{
StatusCode: http.StatusServiceUnavailable,
Body: ioutil.NopCloser(strings.NewReader(message)),
}
return resp, nil
}
if redirect := resp.Header.Get("Location"); redirect != "" {
resp.Header.Set("Location", t.rewriteURL(redirect, req.URL, req.Host))
return resp, nil
}
cType := resp.Header.Get("Content-Type")
cType = strings.TrimSpace(strings.SplitN(cType, ";", 2)[0])
if cType != "text/html" {
// Do nothing, simply pass through
return resp, nil
}
return t.rewriteResponse(req, resp)
} | [
"func",
"(",
"t",
"*",
"Transport",
")",
"RoundTrip",
"(",
"req",
"*",
"http",
".",
"Request",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"// Add reverse proxy headers.",
"forwardedURI",
":=",
"path",
".",
"Join",
"(",
"t",
".",
"P... | // RoundTrip implements the http.RoundTripper interface | [
"RoundTrip",
"implements",
"the",
"http",
".",
"RoundTripper",
"interface"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/util/proxy/transport.go#L82-L124 | train | RoundTrip is a wrapper around http. RoundTripper. RoundTrip | [
30522,
4569,
2278,
1006,
1056,
1008,
3665,
1007,
2461,
24901,
1006,
2128,
4160,
1008,
8299,
1012,
5227,
1007,
1006,
1008,
8299,
1012,
3433,
1010,
7561,
1007,
1063,
1013,
1013,
5587,
7901,
24540,
20346,
2015,
1012,
2830,
30524,
4130,
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/rbac/v1alpha1/zz_generated.conversion.go | RegisterConversions | func RegisterConversions(s *runtime.Scheme) error {
if err := s.AddGeneratedConversionFunc((*v1alpha1.AggregationRule)(nil), (*rbac.AggregationRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_AggregationRule_To_rbac_AggregationRule(a.(*v1alpha1.AggregationRule), b.(*rbac.AggregationRule), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.AggregationRule)(nil), (*v1alpha1.AggregationRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_AggregationRule_To_v1alpha1_AggregationRule(a.(*rbac.AggregationRule), b.(*v1alpha1.AggregationRule), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.ClusterRole)(nil), (*rbac.ClusterRole)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ClusterRole_To_rbac_ClusterRole(a.(*v1alpha1.ClusterRole), b.(*rbac.ClusterRole), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.ClusterRole)(nil), (*v1alpha1.ClusterRole)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_ClusterRole_To_v1alpha1_ClusterRole(a.(*rbac.ClusterRole), b.(*v1alpha1.ClusterRole), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.ClusterRoleBinding)(nil), (*rbac.ClusterRoleBinding)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ClusterRoleBinding_To_rbac_ClusterRoleBinding(a.(*v1alpha1.ClusterRoleBinding), b.(*rbac.ClusterRoleBinding), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.ClusterRoleBinding)(nil), (*v1alpha1.ClusterRoleBinding)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_ClusterRoleBinding_To_v1alpha1_ClusterRoleBinding(a.(*rbac.ClusterRoleBinding), b.(*v1alpha1.ClusterRoleBinding), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.ClusterRoleBindingList)(nil), (*rbac.ClusterRoleBindingList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ClusterRoleBindingList_To_rbac_ClusterRoleBindingList(a.(*v1alpha1.ClusterRoleBindingList), b.(*rbac.ClusterRoleBindingList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.ClusterRoleBindingList)(nil), (*v1alpha1.ClusterRoleBindingList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_ClusterRoleBindingList_To_v1alpha1_ClusterRoleBindingList(a.(*rbac.ClusterRoleBindingList), b.(*v1alpha1.ClusterRoleBindingList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.ClusterRoleList)(nil), (*rbac.ClusterRoleList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ClusterRoleList_To_rbac_ClusterRoleList(a.(*v1alpha1.ClusterRoleList), b.(*rbac.ClusterRoleList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.ClusterRoleList)(nil), (*v1alpha1.ClusterRoleList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_ClusterRoleList_To_v1alpha1_ClusterRoleList(a.(*rbac.ClusterRoleList), b.(*v1alpha1.ClusterRoleList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.PolicyRule)(nil), (*rbac.PolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_PolicyRule_To_rbac_PolicyRule(a.(*v1alpha1.PolicyRule), b.(*rbac.PolicyRule), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.PolicyRule)(nil), (*v1alpha1.PolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_PolicyRule_To_v1alpha1_PolicyRule(a.(*rbac.PolicyRule), b.(*v1alpha1.PolicyRule), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.Role)(nil), (*rbac.Role)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_Role_To_rbac_Role(a.(*v1alpha1.Role), b.(*rbac.Role), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.Role)(nil), (*v1alpha1.Role)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_Role_To_v1alpha1_Role(a.(*rbac.Role), b.(*v1alpha1.Role), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.RoleBinding)(nil), (*rbac.RoleBinding)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_RoleBinding_To_rbac_RoleBinding(a.(*v1alpha1.RoleBinding), b.(*rbac.RoleBinding), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.RoleBinding)(nil), (*v1alpha1.RoleBinding)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_RoleBinding_To_v1alpha1_RoleBinding(a.(*rbac.RoleBinding), b.(*v1alpha1.RoleBinding), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.RoleBindingList)(nil), (*rbac.RoleBindingList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_RoleBindingList_To_rbac_RoleBindingList(a.(*v1alpha1.RoleBindingList), b.(*rbac.RoleBindingList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.RoleBindingList)(nil), (*v1alpha1.RoleBindingList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_RoleBindingList_To_v1alpha1_RoleBindingList(a.(*rbac.RoleBindingList), b.(*v1alpha1.RoleBindingList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.RoleList)(nil), (*rbac.RoleList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_RoleList_To_rbac_RoleList(a.(*v1alpha1.RoleList), b.(*rbac.RoleList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.RoleList)(nil), (*v1alpha1.RoleList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_RoleList_To_v1alpha1_RoleList(a.(*rbac.RoleList), b.(*v1alpha1.RoleList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.RoleRef)(nil), (*rbac.RoleRef)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_RoleRef_To_rbac_RoleRef(a.(*v1alpha1.RoleRef), b.(*rbac.RoleRef), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.RoleRef)(nil), (*v1alpha1.RoleRef)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_RoleRef_To_v1alpha1_RoleRef(a.(*rbac.RoleRef), b.(*v1alpha1.RoleRef), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.Subject)(nil), (*rbac.Subject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_Subject_To_rbac_Subject(a.(*v1alpha1.Subject), b.(*rbac.Subject), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.Subject)(nil), (*v1alpha1.Subject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_Subject_To_v1alpha1_Subject(a.(*rbac.Subject), b.(*v1alpha1.Subject), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*rbac.Subject)(nil), (*v1alpha1.Subject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_Subject_To_v1alpha1_Subject(a.(*rbac.Subject), b.(*v1alpha1.Subject), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*v1alpha1.Subject)(nil), (*rbac.Subject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_Subject_To_rbac_Subject(a.(*v1alpha1.Subject), b.(*rbac.Subject), scope)
}); err != nil {
return err
}
return nil
} | go | func RegisterConversions(s *runtime.Scheme) error {
if err := s.AddGeneratedConversionFunc((*v1alpha1.AggregationRule)(nil), (*rbac.AggregationRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_AggregationRule_To_rbac_AggregationRule(a.(*v1alpha1.AggregationRule), b.(*rbac.AggregationRule), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.AggregationRule)(nil), (*v1alpha1.AggregationRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_AggregationRule_To_v1alpha1_AggregationRule(a.(*rbac.AggregationRule), b.(*v1alpha1.AggregationRule), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.ClusterRole)(nil), (*rbac.ClusterRole)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ClusterRole_To_rbac_ClusterRole(a.(*v1alpha1.ClusterRole), b.(*rbac.ClusterRole), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.ClusterRole)(nil), (*v1alpha1.ClusterRole)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_ClusterRole_To_v1alpha1_ClusterRole(a.(*rbac.ClusterRole), b.(*v1alpha1.ClusterRole), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.ClusterRoleBinding)(nil), (*rbac.ClusterRoleBinding)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ClusterRoleBinding_To_rbac_ClusterRoleBinding(a.(*v1alpha1.ClusterRoleBinding), b.(*rbac.ClusterRoleBinding), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.ClusterRoleBinding)(nil), (*v1alpha1.ClusterRoleBinding)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_ClusterRoleBinding_To_v1alpha1_ClusterRoleBinding(a.(*rbac.ClusterRoleBinding), b.(*v1alpha1.ClusterRoleBinding), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.ClusterRoleBindingList)(nil), (*rbac.ClusterRoleBindingList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ClusterRoleBindingList_To_rbac_ClusterRoleBindingList(a.(*v1alpha1.ClusterRoleBindingList), b.(*rbac.ClusterRoleBindingList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.ClusterRoleBindingList)(nil), (*v1alpha1.ClusterRoleBindingList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_ClusterRoleBindingList_To_v1alpha1_ClusterRoleBindingList(a.(*rbac.ClusterRoleBindingList), b.(*v1alpha1.ClusterRoleBindingList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.ClusterRoleList)(nil), (*rbac.ClusterRoleList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ClusterRoleList_To_rbac_ClusterRoleList(a.(*v1alpha1.ClusterRoleList), b.(*rbac.ClusterRoleList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.ClusterRoleList)(nil), (*v1alpha1.ClusterRoleList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_ClusterRoleList_To_v1alpha1_ClusterRoleList(a.(*rbac.ClusterRoleList), b.(*v1alpha1.ClusterRoleList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.PolicyRule)(nil), (*rbac.PolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_PolicyRule_To_rbac_PolicyRule(a.(*v1alpha1.PolicyRule), b.(*rbac.PolicyRule), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.PolicyRule)(nil), (*v1alpha1.PolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_PolicyRule_To_v1alpha1_PolicyRule(a.(*rbac.PolicyRule), b.(*v1alpha1.PolicyRule), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.Role)(nil), (*rbac.Role)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_Role_To_rbac_Role(a.(*v1alpha1.Role), b.(*rbac.Role), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.Role)(nil), (*v1alpha1.Role)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_Role_To_v1alpha1_Role(a.(*rbac.Role), b.(*v1alpha1.Role), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.RoleBinding)(nil), (*rbac.RoleBinding)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_RoleBinding_To_rbac_RoleBinding(a.(*v1alpha1.RoleBinding), b.(*rbac.RoleBinding), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.RoleBinding)(nil), (*v1alpha1.RoleBinding)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_RoleBinding_To_v1alpha1_RoleBinding(a.(*rbac.RoleBinding), b.(*v1alpha1.RoleBinding), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.RoleBindingList)(nil), (*rbac.RoleBindingList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_RoleBindingList_To_rbac_RoleBindingList(a.(*v1alpha1.RoleBindingList), b.(*rbac.RoleBindingList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.RoleBindingList)(nil), (*v1alpha1.RoleBindingList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_RoleBindingList_To_v1alpha1_RoleBindingList(a.(*rbac.RoleBindingList), b.(*v1alpha1.RoleBindingList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.RoleList)(nil), (*rbac.RoleList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_RoleList_To_rbac_RoleList(a.(*v1alpha1.RoleList), b.(*rbac.RoleList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.RoleList)(nil), (*v1alpha1.RoleList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_RoleList_To_v1alpha1_RoleList(a.(*rbac.RoleList), b.(*v1alpha1.RoleList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.RoleRef)(nil), (*rbac.RoleRef)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_RoleRef_To_rbac_RoleRef(a.(*v1alpha1.RoleRef), b.(*rbac.RoleRef), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.RoleRef)(nil), (*v1alpha1.RoleRef)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_RoleRef_To_v1alpha1_RoleRef(a.(*rbac.RoleRef), b.(*v1alpha1.RoleRef), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.Subject)(nil), (*rbac.Subject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_Subject_To_rbac_Subject(a.(*v1alpha1.Subject), b.(*rbac.Subject), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*rbac.Subject)(nil), (*v1alpha1.Subject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_Subject_To_v1alpha1_Subject(a.(*rbac.Subject), b.(*v1alpha1.Subject), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*rbac.Subject)(nil), (*v1alpha1.Subject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_rbac_Subject_To_v1alpha1_Subject(a.(*rbac.Subject), b.(*v1alpha1.Subject), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*v1alpha1.Subject)(nil), (*rbac.Subject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_Subject_To_rbac_Subject(a.(*v1alpha1.Subject), b.(*rbac.Subject), scope)
}); err != nil {
return err
}
return nil
} | [
"func",
"RegisterConversions",
"(",
"s",
"*",
"runtime",
".",
"Scheme",
")",
"error",
"{",
"if",
"err",
":=",
"s",
".",
"AddGeneratedConversionFunc",
"(",
"(",
"*",
"v1alpha1",
".",
"AggregationRule",
")",
"(",
"nil",
")",
",",
"(",
"*",
"rbac",
".",
"... | // 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/apis/rbac/v1alpha1/zz_generated.conversion.go#L39-L171 | 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 | plugin/pkg/admission/namespace/exists/admission.go | NewExists | func NewExists() *Exists {
return &Exists{
Handler: admission.NewHandler(admission.Create, admission.Update, admission.Delete),
}
} | go | func NewExists() *Exists {
return &Exists{
Handler: admission.NewHandler(admission.Create, admission.Update, admission.Delete),
}
} | [
"func",
"NewExists",
"(",
")",
"*",
"Exists",
"{",
"return",
"&",
"Exists",
"{",
"Handler",
":",
"admission",
".",
"NewHandler",
"(",
"admission",
".",
"Create",
",",
"admission",
".",
"Update",
",",
"admission",
".",
"Delete",
")",
",",
"}",
"\n",
"}"... | // NewExists creates a new namespace exists admission control handler | [
"NewExists",
"creates",
"a",
"new",
"namespace",
"exists",
"admission",
"control",
"handler"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/plugin/pkg/admission/namespace/exists/admission.go#L90-L94 | train | NewExists returns a new instance of the Exists admission plugin | [
30522,
4569,
2278,
2047,
10288,
5130,
1006,
1007,
1008,
6526,
1063,
2709,
1004,
6526,
1063,
28213,
1024,
9634,
1012,
2047,
11774,
3917,
1006,
9634,
1012,
3443,
1010,
9634,
1012,
10651,
1010,
9634,
1012,
3972,
12870,
1007,
1010,
1065,
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 | staging/src/k8s.io/apiserver/pkg/server/mux/pathrecorder.go | refreshMuxLocked | func (m *PathRecorderMux) refreshMuxLocked() {
newMux := &pathHandler{
muxName: m.name,
pathToHandler: map[string]http.Handler{},
prefixHandlers: []prefixHandler{},
notFoundHandler: http.NotFoundHandler(),
}
if m.notFoundHandler != nil {
newMux.notFoundHandler = m.notFoundHandler
}
for path, handler := range m.pathToHandler {
newMux.pathToHandler[path] = handler
}
keys := sets.StringKeySet(m.prefixToHandler).List()
sort.Sort(sort.Reverse(byPrefixPriority(keys)))
for _, prefix := range keys {
newMux.prefixHandlers = append(newMux.prefixHandlers, prefixHandler{
prefix: prefix,
handler: m.prefixToHandler[prefix],
})
}
m.mux.Store(newMux)
} | go | func (m *PathRecorderMux) refreshMuxLocked() {
newMux := &pathHandler{
muxName: m.name,
pathToHandler: map[string]http.Handler{},
prefixHandlers: []prefixHandler{},
notFoundHandler: http.NotFoundHandler(),
}
if m.notFoundHandler != nil {
newMux.notFoundHandler = m.notFoundHandler
}
for path, handler := range m.pathToHandler {
newMux.pathToHandler[path] = handler
}
keys := sets.StringKeySet(m.prefixToHandler).List()
sort.Sort(sort.Reverse(byPrefixPriority(keys)))
for _, prefix := range keys {
newMux.prefixHandlers = append(newMux.prefixHandlers, prefixHandler{
prefix: prefix,
handler: m.prefixToHandler[prefix],
})
}
m.mux.Store(newMux)
} | [
"func",
"(",
"m",
"*",
"PathRecorderMux",
")",
"refreshMuxLocked",
"(",
")",
"{",
"newMux",
":=",
"&",
"pathHandler",
"{",
"muxName",
":",
"m",
".",
"name",
",",
"pathToHandler",
":",
"map",
"[",
"string",
"]",
"http",
".",
"Handler",
"{",
"}",
",",
... | // refreshMuxLocked creates a new mux and must be called while locked. Otherwise the view of handlers may
// not be consistent | [
"refreshMuxLocked",
"creates",
"a",
"new",
"mux",
"and",
"must",
"be",
"called",
"while",
"locked",
".",
"Otherwise",
"the",
"view",
"of",
"handlers",
"may",
"not",
"be",
"consistent"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiserver/pkg/server/mux/pathrecorder.go#L114-L138 | train | refreshMuxLocked refreshes the mux. | [
30522,
4569,
2278,
1006,
1049,
1008,
4130,
2890,
27108,
4063,
12274,
2595,
1007,
25416,
21898,
12274,
2595,
7878,
2098,
1006,
1007,
1063,
2047,
12274,
2595,
1024,
1027,
1004,
4130,
11774,
3917,
1063,
14163,
2595,
18442,
1024,
1049,
1012,
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 | staging/src/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/lease.go | Create | func (c *leases) Create(lease *v1beta1.Lease) (result *v1beta1.Lease, err error) {
result = &v1beta1.Lease{}
err = c.client.Post().
Namespace(c.ns).
Resource("leases").
Body(lease).
Do().
Into(result)
return
} | go | func (c *leases) Create(lease *v1beta1.Lease) (result *v1beta1.Lease, err error) {
result = &v1beta1.Lease{}
err = c.client.Post().
Namespace(c.ns).
Resource("leases").
Body(lease).
Do().
Into(result)
return
} | [
"func",
"(",
"c",
"*",
"leases",
")",
"Create",
"(",
"lease",
"*",
"v1beta1",
".",
"Lease",
")",
"(",
"result",
"*",
"v1beta1",
".",
"Lease",
",",
"err",
"error",
")",
"{",
"result",
"=",
"&",
"v1beta1",
".",
"Lease",
"{",
"}",
"\n",
"err",
"=",
... | // Create takes the representation of a lease and creates it. Returns the server's representation of the lease, and an error, if there is any. | [
"Create",
"takes",
"the",
"representation",
"of",
"a",
"lease",
"and",
"creates",
"it",
".",
"Returns",
"the",
"server",
"s",
"representation",
"of",
"the",
"lease",
"and",
"an",
"error",
"if",
"there",
"is",
"any",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/lease.go#L111-L120 | train | Create creates a lease. | [
30522,
4569,
2278,
1006,
1039,
1008,
29597,
1007,
3443,
1006,
30524,
2487,
20915,
27717,
1012,
10084,
1010,
9413,
2099,
7561,
1007,
1063,
2765,
1027,
1004,
1058,
2487,
20915,
27717,
1012,
10084,
1063,
1065,
9413,
2099,
1027,
1039,
1012,
739... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/proxy/ipvs/netlink_linux.go | ListBindAddress | func (h *netlinkHandle) ListBindAddress(devName string) ([]string, error) {
dev, err := h.LinkByName(devName)
if err != nil {
return nil, fmt.Errorf("error get interface: %s, err: %v", devName, err)
}
addrs, err := h.AddrList(dev, 0)
if err != nil {
return nil, fmt.Errorf("error list bound address of interface: %s, err: %v", devName, err)
}
var ips []string
for _, addr := range addrs {
ips = append(ips, addr.IP.String())
}
return ips, nil
} | go | func (h *netlinkHandle) ListBindAddress(devName string) ([]string, error) {
dev, err := h.LinkByName(devName)
if err != nil {
return nil, fmt.Errorf("error get interface: %s, err: %v", devName, err)
}
addrs, err := h.AddrList(dev, 0)
if err != nil {
return nil, fmt.Errorf("error list bound address of interface: %s, err: %v", devName, err)
}
var ips []string
for _, addr := range addrs {
ips = append(ips, addr.IP.String())
}
return ips, nil
} | [
"func",
"(",
"h",
"*",
"netlinkHandle",
")",
"ListBindAddress",
"(",
"devName",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"dev",
",",
"err",
":=",
"h",
".",
"LinkByName",
"(",
"devName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{... | // ListBindAddress will list all IP addresses which are bound in a given interface | [
"ListBindAddress",
"will",
"list",
"all",
"IP",
"addresses",
"which",
"are",
"bound",
"in",
"a",
"given",
"interface"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/proxy/ipvs/netlink_linux.go#L110-L124 | train | ListBindAddress lists all the addresses bound to the given interface. | [
30522,
4569,
2278,
1006,
1044,
1008,
5658,
13767,
11774,
2571,
1007,
2862,
8428,
14697,
16200,
4757,
1006,
16475,
18442,
5164,
1007,
1006,
1031,
1033,
5164,
1010,
7561,
1007,
1063,
16475,
1010,
9413,
2099,
1024,
1027,
1044,
1012,
4957,
3762... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/util.go | GetClassForVolume | func GetClassForVolume(kubeClient clientset.Interface, pv *v1.PersistentVolume) (*storage.StorageClass, error) {
if kubeClient == nil {
return nil, fmt.Errorf("Cannot get kube client")
}
className := v1helper.GetPersistentVolumeClass(pv)
if className == "" {
return nil, fmt.Errorf("Volume has no storage class")
}
class, err := kubeClient.StorageV1().StorageClasses().Get(className, metav1.GetOptions{})
if err != nil {
return nil, err
}
return class, nil
} | go | func GetClassForVolume(kubeClient clientset.Interface, pv *v1.PersistentVolume) (*storage.StorageClass, error) {
if kubeClient == nil {
return nil, fmt.Errorf("Cannot get kube client")
}
className := v1helper.GetPersistentVolumeClass(pv)
if className == "" {
return nil, fmt.Errorf("Volume has no storage class")
}
class, err := kubeClient.StorageV1().StorageClasses().Get(className, metav1.GetOptions{})
if err != nil {
return nil, err
}
return class, nil
} | [
"func",
"GetClassForVolume",
"(",
"kubeClient",
"clientset",
".",
"Interface",
",",
"pv",
"*",
"v1",
".",
"PersistentVolume",
")",
"(",
"*",
"storage",
".",
"StorageClass",
",",
"error",
")",
"{",
"if",
"kubeClient",
"==",
"nil",
"{",
"return",
"nil",
",",... | // GetClassForVolume locates storage class by persistent volume | [
"GetClassForVolume",
"locates",
"storage",
"class",
"by",
"persistent",
"volume"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/util/util.go#L145-L159 | train | GetClassForVolume returns the storage class for a volume | [
30522,
4569,
2278,
2131,
26266,
29278,
6767,
12942,
2063,
1006,
13970,
4783,
20464,
11638,
7846,
3388,
1012,
8278,
1010,
26189,
1008,
1058,
2487,
1012,
14516,
6767,
12942,
2063,
1007,
1006,
1008,
5527,
1012,
5527,
26266,
1010,
7561,
1007,
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_AzureFilePersistentVolumeSource_To_v1_AzureFilePersistentVolumeSource | func Convert_core_AzureFilePersistentVolumeSource_To_v1_AzureFilePersistentVolumeSource(in *core.AzureFilePersistentVolumeSource, out *v1.AzureFilePersistentVolumeSource, s conversion.Scope) error {
return autoConvert_core_AzureFilePersistentVolumeSource_To_v1_AzureFilePersistentVolumeSource(in, out, s)
} | go | func Convert_core_AzureFilePersistentVolumeSource_To_v1_AzureFilePersistentVolumeSource(in *core.AzureFilePersistentVolumeSource, out *v1.AzureFilePersistentVolumeSource, s conversion.Scope) error {
return autoConvert_core_AzureFilePersistentVolumeSource_To_v1_AzureFilePersistentVolumeSource(in, out, s)
} | [
"func",
"Convert_core_AzureFilePersistentVolumeSource_To_v1_AzureFilePersistentVolumeSource",
"(",
"in",
"*",
"core",
".",
"AzureFilePersistentVolumeSource",
",",
"out",
"*",
"v1",
".",
"AzureFilePersistentVolumeSource",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"... | // Convert_core_AzureFilePersistentVolumeSource_To_v1_AzureFilePersistentVolumeSource is an autogenerated conversion function. | [
"Convert_core_AzureFilePersistentVolumeSource_To_v1_AzureFilePersistentVolumeSource",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/v1/zz_generated.conversion.go#L2250-L2252 | train | Convert_core_AzureFilePersistentVolumeSource_To_v1_AzureFilePersistentVolumeSource is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
4563,
1035,
24296,
8873,
2571,
7347,
27870,
3372,
6767,
12942,
2229,
8162,
3401,
1035,
2000,
1035,
1058,
30524,
2571,
7347,
27870,
3372,
6767,
12942,
2229,
8162,
3401,
1010,
2041,
1008,
1058,
2487,
1012,
2429... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | CreateCertAndKeyFilesWithCA | func CreateCertAndKeyFilesWithCA(certSpec *KubeadmCert, caCertSpec *KubeadmCert, cfg *kubeadmapi.InitConfiguration) error {
if certSpec.CAName != caCertSpec.Name {
return errors.Errorf("expected CAname for %s to be %q, but was %s", certSpec.Name, certSpec.CAName, caCertSpec.Name)
}
caCert, caKey, err := LoadCertificateAuthority(cfg.CertificatesDir, caCertSpec.BaseName)
if err != nil {
return errors.Wrapf(err, "couldn't load CA certificate %s", caCertSpec.Name)
}
return certSpec.CreateFromCA(cfg, caCert, caKey)
} | go | func CreateCertAndKeyFilesWithCA(certSpec *KubeadmCert, caCertSpec *KubeadmCert, cfg *kubeadmapi.InitConfiguration) error {
if certSpec.CAName != caCertSpec.Name {
return errors.Errorf("expected CAname for %s to be %q, but was %s", certSpec.Name, certSpec.CAName, caCertSpec.Name)
}
caCert, caKey, err := LoadCertificateAuthority(cfg.CertificatesDir, caCertSpec.BaseName)
if err != nil {
return errors.Wrapf(err, "couldn't load CA certificate %s", caCertSpec.Name)
}
return certSpec.CreateFromCA(cfg, caCert, caKey)
} | [
"func",
"CreateCertAndKeyFilesWithCA",
"(",
"certSpec",
"*",
"KubeadmCert",
",",
"caCertSpec",
"*",
"KubeadmCert",
",",
"cfg",
"*",
"kubeadmapi",
".",
"InitConfiguration",
")",
"error",
"{",
"if",
"certSpec",
".",
"CAName",
"!=",
"caCertSpec",
".",
"Name",
"{",
... | // CreateCertAndKeyFilesWithCA loads the given certificate authority from disk, then generates and writes out the given certificate and key.
// The certSpec and caCertSpec should both be one of the variables from this package. | [
"CreateCertAndKeyFilesWithCA",
"loads",
"the",
"given",
"certificate",
"authority",
"from",
"disk",
"then",
"generates",
"and",
"writes",
"out",
"the",
"given",
"certificate",
"and",
"key",
".",
"The",
"certSpec",
"and",
"caCertSpec",
"should",
"both",
"be",
"one"... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/phases/certs/certs.go#L145-L156 | train | CreateCertAndKeyFilesWithCA creates a certificate and key files from the given config | [
30522,
4569,
2278,
3443,
17119,
5794,
2094,
14839,
8873,
4244,
24415,
3540,
1006,
8292,
21217,
5051,
2278,
1008,
13970,
4783,
4215,
12458,
8743,
1010,
6187,
17119,
3215,
5051,
2278,
1008,
13970,
4783,
4215,
12458,
8743,
1010,
12935,
2290,
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/util/webhook/webhook.go | NewGenericWebhook | func NewGenericWebhook(scheme *runtime.Scheme, codecFactory serializer.CodecFactory, kubeConfigFile string, groupVersions []schema.GroupVersion, initialBackoff time.Duration) (*GenericWebhook, error) {
return newGenericWebhook(scheme, codecFactory, kubeConfigFile, groupVersions, initialBackoff, defaultRequestTimeout)
} | go | func NewGenericWebhook(scheme *runtime.Scheme, codecFactory serializer.CodecFactory, kubeConfigFile string, groupVersions []schema.GroupVersion, initialBackoff time.Duration) (*GenericWebhook, error) {
return newGenericWebhook(scheme, codecFactory, kubeConfigFile, groupVersions, initialBackoff, defaultRequestTimeout)
} | [
"func",
"NewGenericWebhook",
"(",
"scheme",
"*",
"runtime",
".",
"Scheme",
",",
"codecFactory",
"serializer",
".",
"CodecFactory",
",",
"kubeConfigFile",
"string",
",",
"groupVersions",
"[",
"]",
"schema",
".",
"GroupVersion",
",",
"initialBackoff",
"time",
".",
... | // NewGenericWebhook creates a new GenericWebhook from the provided kubeconfig file. | [
"NewGenericWebhook",
"creates",
"a",
"new",
"GenericWebhook",
"from",
"the",
"provided",
"kubeconfig",
"file",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiserver/pkg/util/webhook/webhook.go#L44-L46 | train | NewGenericWebhook creates a new GenericWebhook. | [
30522,
4569,
2278,
2047,
6914,
22420,
8545,
23706,
14659,
1006,
5679,
1008,
2448,
7292,
1012,
5679,
1010,
3642,
2278,
21450,
7642,
17629,
1012,
3642,
2278,
21450,
1010,
13970,
4783,
8663,
8873,
25708,
9463,
5164,
1010,
2177,
27774,
2015,
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/batch/v1beta1/zz_generated.conversion.go | Convert_batch_JobTemplate_To_v1beta1_JobTemplate | func Convert_batch_JobTemplate_To_v1beta1_JobTemplate(in *batch.JobTemplate, out *v1beta1.JobTemplate, s conversion.Scope) error {
return autoConvert_batch_JobTemplate_To_v1beta1_JobTemplate(in, out, s)
} | go | func Convert_batch_JobTemplate_To_v1beta1_JobTemplate(in *batch.JobTemplate, out *v1beta1.JobTemplate, s conversion.Scope) error {
return autoConvert_batch_JobTemplate_To_v1beta1_JobTemplate(in, out, s)
} | [
"func",
"Convert_batch_JobTemplate_To_v1beta1_JobTemplate",
"(",
"in",
"*",
"batch",
".",
"JobTemplate",
",",
"out",
"*",
"v1beta1",
".",
"JobTemplate",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoConvert_batch_JobTemplate_To_v1beta1_JobTempl... | // Convert_batch_JobTemplate_To_v1beta1_JobTemplate is an autogenerated conversion function. | [
"Convert_batch_JobTemplate_To_v1beta1_JobTemplate",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/batch/v1beta1/zz_generated.conversion.go#L260-L262 | train | Convert_batch_JobTemplate_To_v1beta1_JobTemplate is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
14108,
1035,
3105,
18532,
15725,
1035,
2000,
1035,
1058,
2487,
20915,
27717,
1035,
3105,
18532,
15725,
1006,
1999,
1008,
14108,
1012,
3105,
18532,
15725,
1010,
2041,
1008,
1058,
2487,
20915,
27717,
1012,
3105,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/strategicpatch/patch.go | mergeSliceWithoutSpecialElements | func mergeSliceWithoutSpecialElements(original, patch []interface{}, mergeKey string, schema LookupPatchMeta, mergeOptions MergeOptions) ([]interface{}, error) {
for _, v := range patch {
typedV := v.(map[string]interface{})
mergeValue, ok := typedV[mergeKey]
if !ok {
return nil, mergepatch.ErrNoMergeKey(typedV, mergeKey)
}
// If we find a value with this merge key value in original, merge the
// maps. Otherwise append onto original.
originalMap, originalKey, found, err := findMapInSliceBasedOnKeyValue(original, mergeKey, mergeValue)
if err != nil {
return nil, err
}
if found {
var mergedMaps interface{}
var err error
// Merge into original.
mergedMaps, err = mergeMap(originalMap, typedV, schema, mergeOptions)
if err != nil {
return nil, err
}
original[originalKey] = mergedMaps
} else {
original = append(original, v)
}
}
return original, nil
} | go | func mergeSliceWithoutSpecialElements(original, patch []interface{}, mergeKey string, schema LookupPatchMeta, mergeOptions MergeOptions) ([]interface{}, error) {
for _, v := range patch {
typedV := v.(map[string]interface{})
mergeValue, ok := typedV[mergeKey]
if !ok {
return nil, mergepatch.ErrNoMergeKey(typedV, mergeKey)
}
// If we find a value with this merge key value in original, merge the
// maps. Otherwise append onto original.
originalMap, originalKey, found, err := findMapInSliceBasedOnKeyValue(original, mergeKey, mergeValue)
if err != nil {
return nil, err
}
if found {
var mergedMaps interface{}
var err error
// Merge into original.
mergedMaps, err = mergeMap(originalMap, typedV, schema, mergeOptions)
if err != nil {
return nil, err
}
original[originalKey] = mergedMaps
} else {
original = append(original, v)
}
}
return original, nil
} | [
"func",
"mergeSliceWithoutSpecialElements",
"(",
"original",
",",
"patch",
"[",
"]",
"interface",
"{",
"}",
",",
"mergeKey",
"string",
",",
"schema",
"LookupPatchMeta",
",",
"mergeOptions",
"MergeOptions",
")",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"error... | // mergeSliceWithoutSpecialElements merges slices with non-special elements.
// original and patch must be slices of maps, they should be checked before calling this function. | [
"mergeSliceWithoutSpecialElements",
"merges",
"slices",
"with",
"non",
"-",
"special",
"elements",
".",
"original",
"and",
"patch",
"must",
"be",
"slices",
"of",
"maps",
"they",
"should",
"be",
"checked",
"before",
"calling",
"this",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go#L1523-L1553 | train | mergeSliceWithoutSpecialElements merges a slice of values from patch into original. | [
30522,
4569,
2278,
13590,
14540,
6610,
24415,
12166,
5051,
13247,
12260,
8163,
1006,
2434,
1010,
8983,
1031,
1033,
8278,
1063,
1065,
1010,
13590,
14839,
5164,
1010,
8040,
28433,
2298,
6279,
4502,
10649,
11368,
2050,
1010,
13590,
7361,
9285,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/eviction/helpers.go | parseGracePeriods | func parseGracePeriods(statements map[string]string) (map[evictionapi.Signal]time.Duration, error) {
if len(statements) == 0 {
return nil, nil
}
results := map[evictionapi.Signal]time.Duration{}
for signal, val := range statements {
signal := evictionapi.Signal(signal)
if !validSignal(signal) {
return nil, fmt.Errorf(unsupportedEvictionSignal, signal)
}
gracePeriod, err := time.ParseDuration(val)
if err != nil {
return nil, err
}
if gracePeriod < 0 {
return nil, fmt.Errorf("invalid eviction grace period specified: %v, must be a positive value", val)
}
results[signal] = gracePeriod
}
return results, nil
} | go | func parseGracePeriods(statements map[string]string) (map[evictionapi.Signal]time.Duration, error) {
if len(statements) == 0 {
return nil, nil
}
results := map[evictionapi.Signal]time.Duration{}
for signal, val := range statements {
signal := evictionapi.Signal(signal)
if !validSignal(signal) {
return nil, fmt.Errorf(unsupportedEvictionSignal, signal)
}
gracePeriod, err := time.ParseDuration(val)
if err != nil {
return nil, err
}
if gracePeriod < 0 {
return nil, fmt.Errorf("invalid eviction grace period specified: %v, must be a positive value", val)
}
results[signal] = gracePeriod
}
return results, nil
} | [
"func",
"parseGracePeriods",
"(",
"statements",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"map",
"[",
"evictionapi",
".",
"Signal",
"]",
"time",
".",
"Duration",
",",
"error",
")",
"{",
"if",
"len",
"(",
"statements",
")",
"==",
"0",
"{",
"return"... | // parseGracePeriods parses the grace period statements | [
"parseGracePeriods",
"parses",
"the",
"grace",
"period",
"statements"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/eviction/helpers.go#L236-L256 | train | parseGracePeriods parses the grace period of a signal and returns a map of signal to grace period. | [
30522,
4569,
2278,
11968,
3366,
17643,
3401,
4842,
3695,
5104,
1006,
8635,
4949,
1031,
5164,
1033,
5164,
1007,
1006,
4949,
1031,
23408,
28097,
9331,
2072,
1012,
4742,
1033,
2051,
1012,
9367,
1010,
7561,
1007,
1063,
2065,
18798,
1006,
8635,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/listers/certificates/v1beta1/certificatesigningrequest.go | Get | func (s *certificateSigningRequestLister) Get(name string) (*v1beta1.CertificateSigningRequest, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1beta1.Resource("certificatesigningrequest"), name)
}
return obj.(*v1beta1.CertificateSigningRequest), nil
} | go | func (s *certificateSigningRequestLister) Get(name string) (*v1beta1.CertificateSigningRequest, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1beta1.Resource("certificatesigningrequest"), name)
}
return obj.(*v1beta1.CertificateSigningRequest), nil
} | [
"func",
"(",
"s",
"*",
"certificateSigningRequestLister",
")",
"Get",
"(",
"name",
"string",
")",
"(",
"*",
"v1beta1",
".",
"CertificateSigningRequest",
",",
"error",
")",
"{",
"obj",
",",
"exists",
",",
"err",
":=",
"s",
".",
"indexer",
".",
"GetByKey",
... | // Get retrieves the CertificateSigningRequest from the index for a given name. | [
"Get",
"retrieves",
"the",
"CertificateSigningRequest",
"from",
"the",
"index",
"for",
"a",
"given",
"name",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/listers/certificates/v1beta1/certificatesigningrequest.go#L56-L65 | train | Get retrieves the CertificateSigningRequest from the index for a given name. | [
30522,
4569,
2278,
1006,
1055,
1008,
17987,
23773,
2075,
2890,
15500,
9863,
2121,
1007,
2131,
1006,
2171,
5164,
1007,
1006,
1008,
1058,
2487,
20915,
27717,
30524,
15500,
1010,
7561,
1007,
1063,
27885,
3501,
1010,
6526,
1010,
9413,
2099,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/csi/csi_util.go | saveVolumeData | func saveVolumeData(dir string, fileName string, data map[string]string) error {
dataFilePath := filepath.Join(dir, fileName)
klog.V(4).Info(log("saving volume data file [%s]", dataFilePath))
file, err := os.Create(dataFilePath)
if err != nil {
klog.Error(log("failed to save volume data file %s: %v", dataFilePath, err))
return err
}
defer file.Close()
if err := json.NewEncoder(file).Encode(data); err != nil {
klog.Error(log("failed to save volume data file %s: %v", dataFilePath, err))
return err
}
klog.V(4).Info(log("volume data file saved successfully [%s]", dataFilePath))
return nil
} | go | func saveVolumeData(dir string, fileName string, data map[string]string) error {
dataFilePath := filepath.Join(dir, fileName)
klog.V(4).Info(log("saving volume data file [%s]", dataFilePath))
file, err := os.Create(dataFilePath)
if err != nil {
klog.Error(log("failed to save volume data file %s: %v", dataFilePath, err))
return err
}
defer file.Close()
if err := json.NewEncoder(file).Encode(data); err != nil {
klog.Error(log("failed to save volume data file %s: %v", dataFilePath, err))
return err
}
klog.V(4).Info(log("volume data file saved successfully [%s]", dataFilePath))
return nil
} | [
"func",
"saveVolumeData",
"(",
"dir",
"string",
",",
"fileName",
"string",
",",
"data",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"dataFilePath",
":=",
"filepath",
".",
"Join",
"(",
"dir",
",",
"fileName",
")",
"\n",
"klog",
".",
"V",
"("... | // saveVolumeData persists parameter data as json file at the provided location | [
"saveVolumeData",
"persists",
"parameter",
"data",
"as",
"json",
"file",
"at",
"the",
"provided",
"location"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/csi/csi_util.go#L56-L71 | train | saveVolumeData saves volume data to disk | [
30522,
4569,
2278,
3828,
6767,
12942,
11960,
2696,
1006,
16101,
5164,
1010,
5371,
18442,
5164,
1010,
2951,
4949,
1031,
5164,
1033,
5164,
1007,
7561,
1063,
2951,
8873,
2571,
15069,
1024,
1027,
5371,
15069,
1012,
3693,
1006,
16101,
1010,
5371... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/diff/diff.go | limit | func limit(aObj, bObj interface{}, max int) (string, string) {
elidedPrefix := ""
elidedASuffix := ""
elidedBSuffix := ""
a, b := fmt.Sprintf("%#v", aObj), fmt.Sprintf("%#v", bObj)
if aObj != nil && bObj != nil {
if aType, bType := fmt.Sprintf("%T", aObj), fmt.Sprintf("%T", bObj); aType != bType {
a = fmt.Sprintf("%s (%s)", a, aType)
b = fmt.Sprintf("%s (%s)", b, bType)
}
}
for {
switch {
case len(a) > max && len(a) > 4 && len(b) > 4 && a[:4] == b[:4]:
// a is too long, b has data, and the first several characters are the same
elidedPrefix = "..."
a = a[2:]
b = b[2:]
case len(b) > max && len(b) > 4 && len(a) > 4 && a[:4] == b[:4]:
// b is too long, a has data, and the first several characters are the same
elidedPrefix = "..."
a = a[2:]
b = b[2:]
case len(a) > max:
a = a[:max]
elidedASuffix = "..."
case len(b) > max:
b = b[:max]
elidedBSuffix = "..."
default:
// both are short enough
return elidedPrefix + a + elidedASuffix, elidedPrefix + b + elidedBSuffix
}
}
} | go | func limit(aObj, bObj interface{}, max int) (string, string) {
elidedPrefix := ""
elidedASuffix := ""
elidedBSuffix := ""
a, b := fmt.Sprintf("%#v", aObj), fmt.Sprintf("%#v", bObj)
if aObj != nil && bObj != nil {
if aType, bType := fmt.Sprintf("%T", aObj), fmt.Sprintf("%T", bObj); aType != bType {
a = fmt.Sprintf("%s (%s)", a, aType)
b = fmt.Sprintf("%s (%s)", b, bType)
}
}
for {
switch {
case len(a) > max && len(a) > 4 && len(b) > 4 && a[:4] == b[:4]:
// a is too long, b has data, and the first several characters are the same
elidedPrefix = "..."
a = a[2:]
b = b[2:]
case len(b) > max && len(b) > 4 && len(a) > 4 && a[:4] == b[:4]:
// b is too long, a has data, and the first several characters are the same
elidedPrefix = "..."
a = a[2:]
b = b[2:]
case len(a) > max:
a = a[:max]
elidedASuffix = "..."
case len(b) > max:
b = b[:max]
elidedBSuffix = "..."
default:
// both are short enough
return elidedPrefix + a + elidedASuffix, elidedPrefix + b + elidedBSuffix
}
}
} | [
"func",
"limit",
"(",
"aObj",
",",
"bObj",
"interface",
"{",
"}",
",",
"max",
"int",
")",
"(",
"string",
",",
"string",
")",
"{",
"elidedPrefix",
":=",
"\"",
"\"",
"\n",
"elidedASuffix",
":=",
"\"",
"\"",
"\n",
"elidedBSuffix",
":=",
"\"",
"\"",
"\n"... | // limit:
// 1. stringifies aObj and bObj
// 2. elides identical prefixes if either is too long
// 3. elides remaining content from the end if either is too long | [
"limit",
":",
"1",
".",
"stringifies",
"aObj",
"and",
"bObj",
"2",
".",
"elides",
"identical",
"prefixes",
"if",
"either",
"is",
"too",
"long",
"3",
".",
"elides",
"remaining",
"content",
"from",
"the",
"end",
"if",
"either",
"is",
"too",
"long"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/util/diff/diff.go#L119-L159 | train | limit returns the longest string that a and b can be limited to the given number of characters. | [
30522,
4569,
2278,
5787,
1006,
20118,
2497,
3501,
1010,
3960,
3501,
8278,
1063,
1065,
1010,
4098,
20014,
1007,
1006,
5164,
1010,
5164,
1007,
1063,
12005,
5732,
28139,
8873,
2595,
1024,
1027,
1000,
1000,
12005,
5732,
3022,
16093,
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 | pkg/apis/apps/v1beta1/zz_generated.conversion.go | Convert_apps_RollbackConfig_To_v1beta1_RollbackConfig | func Convert_apps_RollbackConfig_To_v1beta1_RollbackConfig(in *apps.RollbackConfig, out *v1beta1.RollbackConfig, s conversion.Scope) error {
return autoConvert_apps_RollbackConfig_To_v1beta1_RollbackConfig(in, out, s)
} | go | func Convert_apps_RollbackConfig_To_v1beta1_RollbackConfig(in *apps.RollbackConfig, out *v1beta1.RollbackConfig, s conversion.Scope) error {
return autoConvert_apps_RollbackConfig_To_v1beta1_RollbackConfig(in, out, s)
} | [
"func",
"Convert_apps_RollbackConfig_To_v1beta1_RollbackConfig",
"(",
"in",
"*",
"apps",
".",
"RollbackConfig",
",",
"out",
"*",
"v1beta1",
".",
"RollbackConfig",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoConvert_apps_RollbackConfig_To_v1be... | // Convert_apps_RollbackConfig_To_v1beta1_RollbackConfig is an autogenerated conversion function. | [
"Convert_apps_RollbackConfig_To_v1beta1_RollbackConfig",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/apps/v1beta1/zz_generated.conversion.go#L635-L637 | train | Convert_apps_RollbackConfig_To_v1beta1_RollbackConfig is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
18726,
1035,
4897,
5963,
8663,
8873,
2290,
1035,
2000,
1035,
1058,
2487,
20915,
27717,
1035,
4897,
5963,
8663,
8873,
2290,
1006,
1999,
1008,
18726,
1012,
4897,
5963,
8663,
8873,
2290,
1010,
2041,
1008,
1058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/init.go | ManifestDir | func (d *initData) ManifestDir() string {
if d.dryRun {
return d.dryRunDir
}
return kubeadmconstants.GetStaticPodDirectory()
} | go | func (d *initData) ManifestDir() string {
if d.dryRun {
return d.dryRunDir
}
return kubeadmconstants.GetStaticPodDirectory()
} | [
"func",
"(",
"d",
"*",
"initData",
")",
"ManifestDir",
"(",
")",
"string",
"{",
"if",
"d",
".",
"dryRun",
"{",
"return",
"d",
".",
"dryRunDir",
"\n",
"}",
"\n",
"return",
"kubeadmconstants",
".",
"GetStaticPodDirectory",
"(",
")",
"\n",
"}"
] | // ManifestDir returns the path where manifest should be stored or the temporary folder path in case of DryRun. | [
"ManifestDir",
"returns",
"the",
"path",
"where",
"manifest",
"should",
"be",
"stored",
"or",
"the",
"temporary",
"folder",
"path",
"in",
"case",
"of",
"DryRun",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/cmd/init.go#L465-L470 | train | ManifestDir returns the directory where the manifest is stored. | [
30522,
4569,
2278,
1006,
1040,
1008,
1999,
4183,
2850,
2696,
1007,
19676,
4305,
2099,
1006,
1007,
5164,
1063,
2065,
1040,
1012,
4318,
15532,
1063,
2709,
1040,
1012,
4318,
15532,
4305,
2099,
1065,
2709,
13970,
4783,
4215,
12458,
5644,
5794,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.go | listSubnetworksOfNetwork | func listSubnetworksOfNetwork(svc *compute.Service, networkProjectID, networkID, region string) ([]*compute.Subnetwork, error) {
var subnets []*compute.Subnetwork
err := svc.Subnetworks.List(networkProjectID, region).Filter(fmt.Sprintf("network eq .*/%v$", networkID)).Pages(context.Background(), func(res *compute.SubnetworkList) error {
subnets = append(subnets, res.Items...)
return nil
})
return subnets, err
} | go | func listSubnetworksOfNetwork(svc *compute.Service, networkProjectID, networkID, region string) ([]*compute.Subnetwork, error) {
var subnets []*compute.Subnetwork
err := svc.Subnetworks.List(networkProjectID, region).Filter(fmt.Sprintf("network eq .*/%v$", networkID)).Pages(context.Background(), func(res *compute.SubnetworkList) error {
subnets = append(subnets, res.Items...)
return nil
})
return subnets, err
} | [
"func",
"listSubnetworksOfNetwork",
"(",
"svc",
"*",
"compute",
".",
"Service",
",",
"networkProjectID",
",",
"networkID",
",",
"region",
"string",
")",
"(",
"[",
"]",
"*",
"compute",
".",
"Subnetwork",
",",
"error",
")",
"{",
"var",
"subnets",
"[",
"]",
... | // listSubnetworksOfNetwork returns a list of subnetworks for a particular region of a network. | [
"listSubnetworksOfNetwork",
"returns",
"a",
"list",
"of",
"subnetworks",
"for",
"a",
"particular",
"region",
"of",
"a",
"network",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/cloudprovider/providers/gce/gce.go#L805-L812 | train | listSubnetworksOfNetwork returns a slice of all the subnets of the specified network. | [
30522,
4569,
2278,
7201,
12083,
7159,
9316,
11253,
7159,
6198,
1006,
17917,
2278,
1008,
24134,
1012,
2326,
1010,
2897,
21572,
20614,
3593,
1010,
2897,
3593,
1010,
2555,
5164,
1007,
1006,
1031,
1033,
1008,
24134,
1012,
4942,
7159,
6198,
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/controller/controller_ref_manager.go | ClaimReplicaSets | func (m *ReplicaSetControllerRefManager) ClaimReplicaSets(sets []*apps.ReplicaSet) ([]*apps.ReplicaSet, error) {
var claimed []*apps.ReplicaSet
var errlist []error
match := func(obj metav1.Object) bool {
return m.Selector.Matches(labels.Set(obj.GetLabels()))
}
adopt := func(obj metav1.Object) error {
return m.AdoptReplicaSet(obj.(*apps.ReplicaSet))
}
release := func(obj metav1.Object) error {
return m.ReleaseReplicaSet(obj.(*apps.ReplicaSet))
}
for _, rs := range sets {
ok, err := m.ClaimObject(rs, match, adopt, release)
if err != nil {
errlist = append(errlist, err)
continue
}
if ok {
claimed = append(claimed, rs)
}
}
return claimed, utilerrors.NewAggregate(errlist)
} | go | func (m *ReplicaSetControllerRefManager) ClaimReplicaSets(sets []*apps.ReplicaSet) ([]*apps.ReplicaSet, error) {
var claimed []*apps.ReplicaSet
var errlist []error
match := func(obj metav1.Object) bool {
return m.Selector.Matches(labels.Set(obj.GetLabels()))
}
adopt := func(obj metav1.Object) error {
return m.AdoptReplicaSet(obj.(*apps.ReplicaSet))
}
release := func(obj metav1.Object) error {
return m.ReleaseReplicaSet(obj.(*apps.ReplicaSet))
}
for _, rs := range sets {
ok, err := m.ClaimObject(rs, match, adopt, release)
if err != nil {
errlist = append(errlist, err)
continue
}
if ok {
claimed = append(claimed, rs)
}
}
return claimed, utilerrors.NewAggregate(errlist)
} | [
"func",
"(",
"m",
"*",
"ReplicaSetControllerRefManager",
")",
"ClaimReplicaSets",
"(",
"sets",
"[",
"]",
"*",
"apps",
".",
"ReplicaSet",
")",
"(",
"[",
"]",
"*",
"apps",
".",
"ReplicaSet",
",",
"error",
")",
"{",
"var",
"claimed",
"[",
"]",
"*",
"apps"... | // ClaimReplicaSets tries to take ownership of a list of ReplicaSets.
//
// It will reconcile the following:
// * Adopt orphans if the selector matches.
// * Release owned objects if the selector no longer matches.
//
// A non-nil error is returned if some form of reconciliation was attempted and
// failed. Usually, controllers should try again later in case reconciliation
// is still needed.
//
// If the error is nil, either the reconciliation succeeded, or no
// reconciliation was necessary. The list of ReplicaSets that you now own is
// returned. | [
"ClaimReplicaSets",
"tries",
"to",
"take",
"ownership",
"of",
"a",
"list",
"of",
"ReplicaSets",
".",
"It",
"will",
"reconcile",
"the",
"following",
":",
"*",
"Adopt",
"orphans",
"if",
"the",
"selector",
"matches",
".",
"*",
"Release",
"owned",
"objects",
"if... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/controller_ref_manager.go#L303-L328 | train | ClaimReplicaSets returns a slice of replica sets that are claimed. | [
30522,
4569,
2278,
1006,
1049,
1008,
15059,
13462,
8663,
13181,
10820,
2890,
16715,
5162,
4590,
1007,
4366,
2890,
24759,
5555,
13462,
2015,
1006,
4520,
1031,
1033,
1008,
18726,
1012,
15059,
13462,
1007,
1006,
1031,
1033,
1008,
18726,
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/apis/core/zz_generated.deepcopy.go | DeepCopy | func (in *AvoidPods) DeepCopy() *AvoidPods {
if in == nil {
return nil
}
out := new(AvoidPods)
in.DeepCopyInto(out)
return out
} | go | func (in *AvoidPods) DeepCopy() *AvoidPods {
if in == nil {
return nil
}
out := new(AvoidPods)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"AvoidPods",
")",
"DeepCopy",
"(",
")",
"*",
"AvoidPods",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"AvoidPods",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AvoidPods. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"AvoidPods",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/zz_generated.deepcopy.go#L106-L113 | train | DeepCopy is an autogenerated deepcopy function copying the receiver creating a new AvoidPods. | [
30522,
4569,
2278,
1006,
1999,
1008,
4468,
22925,
1007,
2784,
3597,
7685,
1006,
1007,
1008,
4468,
22925,
1063,
2065,
1999,
1027,
1027,
9152,
2140,
1063,
2709,
9152,
2140,
1065,
2041,
1024,
1027,
2047,
1006,
4468,
22925,
1007,
1999,
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/tools/clientcmd/api/v1/zz_generated.deepcopy.go | DeepCopy | func (in *AuthInfo) DeepCopy() *AuthInfo {
if in == nil {
return nil
}
out := new(AuthInfo)
in.DeepCopyInto(out)
return out
} | go | func (in *AuthInfo) DeepCopy() *AuthInfo {
if in == nil {
return nil
}
out := new(AuthInfo)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"AuthInfo",
")",
"DeepCopy",
"(",
")",
"*",
"AuthInfo",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"AuthInfo",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthInfo. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"AuthInfo",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.deepcopy.go#L81-L88 | train | DeepCopy is an autogenerated deepcopy function copying the receiver creating a new AuthInfo. | [
30522,
4569,
2278,
1006,
1999,
1008,
8740,
15222,
2078,
14876,
1007,
2784,
3597,
7685,
1006,
1007,
1008,
8740,
15222,
2078,
14876,
1063,
2065,
1999,
1027,
1027,
9152,
2140,
1063,
2709,
9152,
2140,
1065,
2041,
1024,
1027,
2047,
1006,
8740,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | Parse | func Parse(s string) (CPUSet, error) {
b := NewBuilder()
// Handle empty string.
if s == "" {
return b.Result(), nil
}
// Split CPU list string:
// "0-5,34,46-48 => ["0-5", "34", "46-48"]
ranges := strings.Split(s, ",")
for _, r := range ranges {
boundaries := strings.Split(r, "-")
if len(boundaries) == 1 {
// Handle ranges that consist of only one element like "34".
elem, err := strconv.Atoi(boundaries[0])
if err != nil {
return NewCPUSet(), err
}
b.Add(elem)
} else if len(boundaries) == 2 {
// Handle multi-element ranges like "0-5".
start, err := strconv.Atoi(boundaries[0])
if err != nil {
return NewCPUSet(), err
}
end, err := strconv.Atoi(boundaries[1])
if err != nil {
return NewCPUSet(), err
}
// Add all elements to the result.
// e.g. "0-5", "46-48" => [0, 1, 2, 3, 4, 5, 46, 47, 48].
for e := start; e <= end; e++ {
b.Add(e)
}
}
}
return b.Result(), nil
} | go | func Parse(s string) (CPUSet, error) {
b := NewBuilder()
// Handle empty string.
if s == "" {
return b.Result(), nil
}
// Split CPU list string:
// "0-5,34,46-48 => ["0-5", "34", "46-48"]
ranges := strings.Split(s, ",")
for _, r := range ranges {
boundaries := strings.Split(r, "-")
if len(boundaries) == 1 {
// Handle ranges that consist of only one element like "34".
elem, err := strconv.Atoi(boundaries[0])
if err != nil {
return NewCPUSet(), err
}
b.Add(elem)
} else if len(boundaries) == 2 {
// Handle multi-element ranges like "0-5".
start, err := strconv.Atoi(boundaries[0])
if err != nil {
return NewCPUSet(), err
}
end, err := strconv.Atoi(boundaries[1])
if err != nil {
return NewCPUSet(), err
}
// Add all elements to the result.
// e.g. "0-5", "46-48" => [0, 1, 2, 3, 4, 5, 46, 47, 48].
for e := start; e <= end; e++ {
b.Add(e)
}
}
}
return b.Result(), nil
} | [
"func",
"Parse",
"(",
"s",
"string",
")",
"(",
"CPUSet",
",",
"error",
")",
"{",
"b",
":=",
"NewBuilder",
"(",
")",
"\n\n",
"// Handle empty string.",
"if",
"s",
"==",
"\"",
"\"",
"{",
"return",
"b",
".",
"Result",
"(",
")",
",",
"nil",
"\n",
"}",
... | // Parse CPUSet constructs a new CPU set from a Linux CPU list formatted string.
//
// See: http://man7.org/linux/man-pages/man7/cpuset.7.html#FORMATS | [
"Parse",
"CPUSet",
"constructs",
"a",
"new",
"CPU",
"set",
"from",
"a",
"Linux",
"CPU",
"list",
"formatted",
"string",
".",
"See",
":",
"http",
":",
"//",
"man7",
".",
"org",
"/",
"linux",
"/",
"man",
"-",
"pages",
"/",
"man7",
"/",
"cpuset",
".",
... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/cm/cpuset/cpuset.go#L232-L271 | train | Parse parses a string into a CPUSet. | [
30522,
4569,
2278,
11968,
3366,
1006,
1055,
5164,
1007,
1006,
17368,
13462,
1010,
7561,
1007,
1063,
1038,
1024,
1027,
2047,
8569,
23891,
2099,
1006,
1007,
1013,
1013,
5047,
4064,
5164,
1012,
2065,
1055,
1027,
1027,
1000,
1000,
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 | pkg/kubelet/util/logreduction/logreduction.go | NewLogReduction | func NewLogReduction(identicalErrorDelay time.Duration) *LogReduction {
l := new(LogReduction)
l.lastError = make(map[string]string)
l.errorPrinted = make(map[string]time.Time)
l.identicalErrorDelay = identicalErrorDelay
return l
} | go | func NewLogReduction(identicalErrorDelay time.Duration) *LogReduction {
l := new(LogReduction)
l.lastError = make(map[string]string)
l.errorPrinted = make(map[string]time.Time)
l.identicalErrorDelay = identicalErrorDelay
return l
} | [
"func",
"NewLogReduction",
"(",
"identicalErrorDelay",
"time",
".",
"Duration",
")",
"*",
"LogReduction",
"{",
"l",
":=",
"new",
"(",
"LogReduction",
")",
"\n",
"l",
".",
"lastError",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"l",... | // NewLogReduction returns an initialized LogReduction | [
"NewLogReduction",
"returns",
"an",
"initialized",
"LogReduction"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/util/logreduction/logreduction.go#L38-L44 | train | NewLogReduction creates a new LogReduction object | [
30522,
4569,
2278,
2047,
21197,
5596,
14194,
3508,
1006,
7235,
2121,
29165,
9247,
4710,
2051,
1012,
9367,
1007,
1008,
8833,
5596,
14194,
3508,
1063,
1048,
1024,
1027,
2047,
1006,
8833,
5596,
14194,
3508,
1007,
1048,
1012,
2197,
2121,
29165,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/legacy-cloud-providers/azure/azure_standard.go | getPrimaryInterfaceWithVMSet | func (as *availabilitySet) getPrimaryInterfaceWithVMSet(nodeName, vmSetName string) (network.Interface, error) {
var machine compute.VirtualMachine
machine, err := as.GetVirtualMachineWithRetry(types.NodeName(nodeName))
if err != nil {
klog.V(2).Infof("GetPrimaryInterface(%s, %s) abort backoff", nodeName, vmSetName)
return network.Interface{}, err
}
primaryNicID, err := getPrimaryInterfaceID(machine)
if err != nil {
return network.Interface{}, err
}
nicName, err := getLastSegment(primaryNicID)
if err != nil {
return network.Interface{}, err
}
nodeResourceGroup, err := as.GetNodeResourceGroup(nodeName)
if err != nil {
return network.Interface{}, err
}
// Check availability set name. Note that vmSetName is empty string when getting
// the Node's IP address. While vmSetName is not empty, it should be checked with
// Node's real availability set name:
// - For basic SKU load balancer, errNotInVMSet should be returned if the node's
// availability set is mismatched with vmSetName.
// - For standard SKU load balancer, backend could belong to multiple VMAS, so we
// don't check vmSet for it.
if vmSetName != "" && !as.useStandardLoadBalancer() {
expectedAvailabilitySetName := as.getAvailabilitySetID(nodeResourceGroup, vmSetName)
if machine.AvailabilitySet == nil || !strings.EqualFold(*machine.AvailabilitySet.ID, expectedAvailabilitySetName) {
klog.V(3).Infof(
"GetPrimaryInterface: nic (%s) is not in the availabilitySet(%s)", nicName, vmSetName)
return network.Interface{}, errNotInVMSet
}
}
nicResourceGroup, err := extractResourceGroupByNicID(primaryNicID)
if err != nil {
return network.Interface{}, err
}
ctx, cancel := getContextWithCancel()
defer cancel()
nic, err := as.InterfacesClient.Get(ctx, nicResourceGroup, nicName, "")
if err != nil {
return network.Interface{}, err
}
return nic, nil
} | go | func (as *availabilitySet) getPrimaryInterfaceWithVMSet(nodeName, vmSetName string) (network.Interface, error) {
var machine compute.VirtualMachine
machine, err := as.GetVirtualMachineWithRetry(types.NodeName(nodeName))
if err != nil {
klog.V(2).Infof("GetPrimaryInterface(%s, %s) abort backoff", nodeName, vmSetName)
return network.Interface{}, err
}
primaryNicID, err := getPrimaryInterfaceID(machine)
if err != nil {
return network.Interface{}, err
}
nicName, err := getLastSegment(primaryNicID)
if err != nil {
return network.Interface{}, err
}
nodeResourceGroup, err := as.GetNodeResourceGroup(nodeName)
if err != nil {
return network.Interface{}, err
}
// Check availability set name. Note that vmSetName is empty string when getting
// the Node's IP address. While vmSetName is not empty, it should be checked with
// Node's real availability set name:
// - For basic SKU load balancer, errNotInVMSet should be returned if the node's
// availability set is mismatched with vmSetName.
// - For standard SKU load balancer, backend could belong to multiple VMAS, so we
// don't check vmSet for it.
if vmSetName != "" && !as.useStandardLoadBalancer() {
expectedAvailabilitySetName := as.getAvailabilitySetID(nodeResourceGroup, vmSetName)
if machine.AvailabilitySet == nil || !strings.EqualFold(*machine.AvailabilitySet.ID, expectedAvailabilitySetName) {
klog.V(3).Infof(
"GetPrimaryInterface: nic (%s) is not in the availabilitySet(%s)", nicName, vmSetName)
return network.Interface{}, errNotInVMSet
}
}
nicResourceGroup, err := extractResourceGroupByNicID(primaryNicID)
if err != nil {
return network.Interface{}, err
}
ctx, cancel := getContextWithCancel()
defer cancel()
nic, err := as.InterfacesClient.Get(ctx, nicResourceGroup, nicName, "")
if err != nil {
return network.Interface{}, err
}
return nic, nil
} | [
"func",
"(",
"as",
"*",
"availabilitySet",
")",
"getPrimaryInterfaceWithVMSet",
"(",
"nodeName",
",",
"vmSetName",
"string",
")",
"(",
"network",
".",
"Interface",
",",
"error",
")",
"{",
"var",
"machine",
"compute",
".",
"VirtualMachine",
"\n\n",
"machine",
"... | // getPrimaryInterfaceWithVMSet gets machine primary network interface by node name and vmSet. | [
"getPrimaryInterfaceWithVMSet",
"gets",
"machine",
"primary",
"network",
"interface",
"by",
"node",
"name",
"and",
"vmSet",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/legacy-cloud-providers/azure/azure_standard.go#L572-L623 | train | getPrimaryInterfaceWithVMSet returns the primary interface of the node with the given name and VM set. | [
30522,
4569,
2278,
1006,
2004,
1008,
11343,
13462,
1007,
2131,
18098,
9581,
2854,
18447,
2121,
12172,
24415,
2615,
5244,
3388,
1006,
13045,
18442,
1010,
1058,
5244,
3388,
18442,
5164,
1007,
1006,
2897,
1012,
8278,
1010,
7561,
1007,
1063,
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 | pkg/apis/core/zz_generated.deepcopy.go | DeepCopyInto | func (in *ServiceSpec) DeepCopyInto(out *ServiceSpec) {
*out = *in
if in.Ports != nil {
in, out := &in.Ports, &out.Ports
*out = make([]ServicePort, len(*in))
copy(*out, *in)
}
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.ExternalIPs != nil {
in, out := &in.ExternalIPs, &out.ExternalIPs
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.SessionAffinityConfig != nil {
in, out := &in.SessionAffinityConfig, &out.SessionAffinityConfig
*out = new(SessionAffinityConfig)
(*in).DeepCopyInto(*out)
}
if in.LoadBalancerSourceRanges != nil {
in, out := &in.LoadBalancerSourceRanges, &out.LoadBalancerSourceRanges
*out = make([]string, len(*in))
copy(*out, *in)
}
return
} | go | func (in *ServiceSpec) DeepCopyInto(out *ServiceSpec) {
*out = *in
if in.Ports != nil {
in, out := &in.Ports, &out.Ports
*out = make([]ServicePort, len(*in))
copy(*out, *in)
}
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.ExternalIPs != nil {
in, out := &in.ExternalIPs, &out.ExternalIPs
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.SessionAffinityConfig != nil {
in, out := &in.SessionAffinityConfig, &out.SessionAffinityConfig
*out = new(SessionAffinityConfig)
(*in).DeepCopyInto(*out)
}
if in.LoadBalancerSourceRanges != nil {
in, out := &in.LoadBalancerSourceRanges, &out.LoadBalancerSourceRanges
*out = make([]string, len(*in))
copy(*out, *in)
}
return
} | [
"func",
"(",
"in",
"*",
"ServiceSpec",
")",
"DeepCopyInto",
"(",
"out",
"*",
"ServiceSpec",
")",
"{",
"*",
"out",
"=",
"*",
"in",
"\n",
"if",
"in",
".",
"Ports",
"!=",
"nil",
"{",
"in",
",",
"out",
":=",
"&",
"in",
".",
"Ports",
",",
"&",
"out"... | // 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#L4909-L4939 | train | DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new ServiceSpec. | [
30522,
4569,
2278,
1006,
1999,
1008,
2578,
5051,
2278,
1007,
2784,
3597,
7685,
18447,
2080,
1006,
2041,
1008,
2578,
5051,
2278,
1007,
1063,
1008,
2041,
1027,
1008,
1999,
2065,
1999,
1012,
8831,
999,
1027,
9152,
2140,
1063,
1999,
1010,
204... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/zz_generated.deepcopy.go | DeepCopyInto | func (in *ComponentConfigs) DeepCopyInto(out *ComponentConfigs) {
*out = *in
if in.Kubelet != nil {
in, out := &in.Kubelet, &out.Kubelet
*out = new(config.KubeletConfiguration)
(*in).DeepCopyInto(*out)
}
if in.KubeProxy != nil {
in, out := &in.KubeProxy, &out.KubeProxy
*out = new(apisconfig.KubeProxyConfiguration)
(*in).DeepCopyInto(*out)
}
return
} | go | func (in *ComponentConfigs) DeepCopyInto(out *ComponentConfigs) {
*out = *in
if in.Kubelet != nil {
in, out := &in.Kubelet, &out.Kubelet
*out = new(config.KubeletConfiguration)
(*in).DeepCopyInto(*out)
}
if in.KubeProxy != nil {
in, out := &in.KubeProxy, &out.KubeProxy
*out = new(apisconfig.KubeProxyConfiguration)
(*in).DeepCopyInto(*out)
}
return
} | [
"func",
"(",
"in",
"*",
"ComponentConfigs",
")",
"DeepCopyInto",
"(",
"out",
"*",
"ComponentConfigs",
")",
"{",
"*",
"out",
"=",
"*",
"in",
"\n",
"if",
"in",
".",
"Kubelet",
"!=",
"nil",
"{",
"in",
",",
"out",
":=",
"&",
"in",
".",
"Kubelet",
",",
... | // 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/cmd/kubeadm/app/apis/kubeadm/zz_generated.deepcopy.go#L223-L236 | train | DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new ComponentConfigs. | [
30522,
4569,
2278,
1006,
1999,
1008,
6922,
8663,
8873,
5620,
1007,
2784,
3597,
7685,
18447,
2080,
1006,
2041,
1008,
6922,
8663,
8873,
5620,
1007,
1063,
1008,
2041,
1027,
1008,
1999,
2065,
1999,
1012,
13970,
8671,
3388,
999,
1027,
9152,
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/apis/storage/zz_generated.deepcopy.go | DeepCopyObject | func (in *CSIDriver) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
} | go | func (in *CSIDriver) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
} | [
"func",
"(",
"in",
"*",
"CSIDriver",
")",
"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/pkg/apis/storage/zz_generated.deepcopy.go#L48-L53 | train | DeepCopyObject is an autogenerated deepcopy function copying the receiver creating a new runtime. Object. | [
30522,
4569,
2278,
1006,
1999,
1008,
22174,
23663,
2099,
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,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/kubelet_network.go | GetPodDNS | func (kl *Kubelet) GetPodDNS(pod *v1.Pod) (*runtimeapi.DNSConfig, error) {
return kl.dnsConfigurer.GetPodDNS(pod)
} | go | func (kl *Kubelet) GetPodDNS(pod *v1.Pod) (*runtimeapi.DNSConfig, error) {
return kl.dnsConfigurer.GetPodDNS(pod)
} | [
"func",
"(",
"kl",
"*",
"Kubelet",
")",
"GetPodDNS",
"(",
"pod",
"*",
"v1",
".",
"Pod",
")",
"(",
"*",
"runtimeapi",
".",
"DNSConfig",
",",
"error",
")",
"{",
"return",
"kl",
".",
"dnsConfigurer",
".",
"GetPodDNS",
"(",
"pod",
")",
"\n",
"}"
] | // GetPodDNS returns DNS settings for the pod.
// This function is defined in kubecontainer.RuntimeHelper interface so we
// have to implement it. | [
"GetPodDNS",
"returns",
"DNS",
"settings",
"for",
"the",
"pod",
".",
"This",
"function",
"is",
"defined",
"in",
"kubecontainer",
".",
"RuntimeHelper",
"interface",
"so",
"we",
"have",
"to",
"implement",
"it",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/kubelet_network.go#L85-L87 | train | GetPodDNS returns the DNS config for the given pod. | [
30522,
4569,
2278,
1006,
1047,
2140,
1008,
13970,
8671,
3388,
1007,
2131,
27633,
2094,
3619,
1006,
17491,
1008,
1058,
2487,
1012,
17491,
1007,
1006,
1008,
2448,
7292,
9331,
2072,
1012,
1040,
3619,
8663,
8873,
2290,
1010,
7561,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | DeepCopyObject | func (in *ServiceAccountList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
} | go | func (in *ServiceAccountList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
} | [
"func",
"(",
"in",
"*",
"ServiceAccountList",
")",
"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/pkg/apis/core/zz_generated.deepcopy.go#L4810-L4815 | train | DeepCopyObject is an autogenerated deepcopy function copying the receiver creating a new ServiceAccountList. | [
30522,
4569,
2278,
1006,
1999,
1008,
2326,
6305,
3597,
16671,
9863,
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,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.