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/apiserver/plugin/pkg/audit/fake/fake.go | ProcessEvents | func (b *Backend) ProcessEvents(ev ...*auditinternal.Event) bool {
if b.OnRequest != nil {
b.OnRequest(ev)
}
return true
} | go | func (b *Backend) ProcessEvents(ev ...*auditinternal.Event) bool {
if b.OnRequest != nil {
b.OnRequest(ev)
}
return true
} | [
"func",
"(",
"b",
"*",
"Backend",
")",
"ProcessEvents",
"(",
"ev",
"...",
"*",
"auditinternal",
".",
"Event",
")",
"bool",
"{",
"if",
"b",
".",
"OnRequest",
"!=",
"nil",
"{",
"b",
".",
"OnRequest",
"(",
"ev",
")",
"\n",
"}",
"\n",
"return",
"true",... | // ProcessEvents calls a callback on a batch, if present. | [
"ProcessEvents",
"calls",
"a",
"callback",
"on",
"a",
"batch",
"if",
"present",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiserver/plugin/pkg/audit/fake/fake.go#L42-L47 | train | ProcessEvents is a helper function to process events | [
30522,
4569,
2278,
1006,
1038,
1008,
2067,
10497,
1007,
2832,
18697,
7666,
1006,
23408,
1012,
1012,
1012,
1008,
15727,
18447,
11795,
2389,
1012,
2724,
1007,
22017,
2140,
1063,
2065,
1038,
1012,
2006,
2890,
15500,
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/apis/apps/zz_generated.deepcopy.go | DeepCopyInto | func (in *DaemonSetList) DeepCopyInto(out *DaemonSetList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]DaemonSet, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
} | go | func (in *DaemonSetList) DeepCopyInto(out *DaemonSetList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]DaemonSet, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
} | [
"func",
"(",
"in",
"*",
"DaemonSetList",
")",
"DeepCopyInto",
"(",
"out",
"*",
"DaemonSetList",
")",
"{",
"*",
"out",
"=",
"*",
"in",
"\n",
"out",
".",
"TypeMeta",
"=",
"in",
".",
"TypeMeta",
"\n",
"out",
".",
"ListMeta",
"=",
"in",
".",
"ListMeta",
... | // 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/apps/zz_generated.deepcopy.go#L137-L149 | train | DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new DaemonSetList. | [
30522,
4569,
2278,
1006,
1999,
1008,
12828,
13462,
9863,
1007,
2784,
3597,
7685,
18447,
2080,
1006,
2041,
1008,
12828,
13462,
9863,
1007,
1063,
1008,
2041,
1027,
1008,
1999,
2041,
1012,
2828,
11368,
2050,
1027,
1999,
1012,
2828,
11368,
2050... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | createImageStateSummary | func (cache *schedulerCache) createImageStateSummary(state *imageState) *schedulernodeinfo.ImageStateSummary {
return &schedulernodeinfo.ImageStateSummary{
Size: state.size,
NumNodes: len(state.nodes),
}
} | go | func (cache *schedulerCache) createImageStateSummary(state *imageState) *schedulernodeinfo.ImageStateSummary {
return &schedulernodeinfo.ImageStateSummary{
Size: state.size,
NumNodes: len(state.nodes),
}
} | [
"func",
"(",
"cache",
"*",
"schedulerCache",
")",
"createImageStateSummary",
"(",
"state",
"*",
"imageState",
")",
"*",
"schedulernodeinfo",
".",
"ImageStateSummary",
"{",
"return",
"&",
"schedulernodeinfo",
".",
"ImageStateSummary",
"{",
"Size",
":",
"state",
"."... | // createImageStateSummary returns a summarizing snapshot of the given image's state. | [
"createImageStateSummary",
"returns",
"a",
"summarizing",
"snapshot",
"of",
"the",
"given",
"image",
"s",
"state",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/scheduler/internal/cache/cache.go#L96-L101 | train | createImageStateSummary returns a summary of the image state. | [
30522,
4569,
2278,
1006,
17053,
1008,
6134,
18992,
5403,
1007,
3443,
9581,
8449,
12259,
17421,
7849,
2100,
1006,
2110,
1008,
4871,
12259,
1007,
1008,
6134,
19139,
3207,
2378,
14876,
1012,
4871,
12259,
17421,
7849,
2100,
1063,
2709,
1004,
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 | pkg/apis/core/zz_generated.deepcopy.go | DeepCopyInto | func (in *NodeAffinity) DeepCopyInto(out *NodeAffinity) {
*out = *in
if in.RequiredDuringSchedulingIgnoredDuringExecution != nil {
in, out := &in.RequiredDuringSchedulingIgnoredDuringExecution, &out.RequiredDuringSchedulingIgnoredDuringExecution
*out = new(NodeSelector)
(*in).DeepCopyInto(*out)
}
if in.PreferredDuringSchedulingIgnoredDuringExecution != nil {
in, out := &in.PreferredDuringSchedulingIgnoredDuringExecution, &out.PreferredDuringSchedulingIgnoredDuringExecution
*out = make([]PreferredSchedulingTerm, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
} | go | func (in *NodeAffinity) DeepCopyInto(out *NodeAffinity) {
*out = *in
if in.RequiredDuringSchedulingIgnoredDuringExecution != nil {
in, out := &in.RequiredDuringSchedulingIgnoredDuringExecution, &out.RequiredDuringSchedulingIgnoredDuringExecution
*out = new(NodeSelector)
(*in).DeepCopyInto(*out)
}
if in.PreferredDuringSchedulingIgnoredDuringExecution != nil {
in, out := &in.PreferredDuringSchedulingIgnoredDuringExecution, &out.PreferredDuringSchedulingIgnoredDuringExecution
*out = make([]PreferredSchedulingTerm, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
} | [
"func",
"(",
"in",
"*",
"NodeAffinity",
")",
"DeepCopyInto",
"(",
"out",
"*",
"NodeAffinity",
")",
"{",
"*",
"out",
"=",
"*",
"in",
"\n",
"if",
"in",
".",
"RequiredDuringSchedulingIgnoredDuringExecution",
"!=",
"nil",
"{",
"in",
",",
"out",
":=",
"&",
"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/pkg/apis/core/zz_generated.deepcopy.go#L2198-L2213 | train | DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new NodeAffinity. | [
30522,
4569,
2278,
1006,
1999,
1008,
13045,
10354,
16294,
3012,
1007,
2784,
3597,
7685,
18447,
2080,
1006,
2041,
1008,
13045,
10354,
16294,
3012,
1007,
1063,
1008,
2041,
1027,
1008,
1999,
2065,
1999,
1012,
3223,
24979,
8613,
7690,
18639,
58... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/framer/framer.go | Read | func (r *jsonFrameReader) Read(data []byte) (int, error) {
// Return whatever remaining data exists from an in progress frame
if n := len(r.remaining); n > 0 {
if n <= len(data) {
data = append(data[0:0], r.remaining...)
r.remaining = nil
return n, nil
}
n = len(data)
data = append(data[0:0], r.remaining[:n]...)
r.remaining = r.remaining[n:]
return n, io.ErrShortBuffer
}
// RawMessage#Unmarshal appends to data - we reset the slice down to 0 and will either see
// data written to data, or be larger than data and a different array.
n := len(data)
m := json.RawMessage(data[:0])
if err := r.decoder.Decode(&m); err != nil {
return 0, err
}
// If capacity of data is less than length of the message, decoder will allocate a new slice
// and set m to it, which means we need to copy the partial result back into data and preserve
// the remaining result for subsequent reads.
if len(m) > n {
data = append(data[0:0], m[:n]...)
r.remaining = m[n:]
return n, io.ErrShortBuffer
}
return len(m), nil
} | go | func (r *jsonFrameReader) Read(data []byte) (int, error) {
// Return whatever remaining data exists from an in progress frame
if n := len(r.remaining); n > 0 {
if n <= len(data) {
data = append(data[0:0], r.remaining...)
r.remaining = nil
return n, nil
}
n = len(data)
data = append(data[0:0], r.remaining[:n]...)
r.remaining = r.remaining[n:]
return n, io.ErrShortBuffer
}
// RawMessage#Unmarshal appends to data - we reset the slice down to 0 and will either see
// data written to data, or be larger than data and a different array.
n := len(data)
m := json.RawMessage(data[:0])
if err := r.decoder.Decode(&m); err != nil {
return 0, err
}
// If capacity of data is less than length of the message, decoder will allocate a new slice
// and set m to it, which means we need to copy the partial result back into data and preserve
// the remaining result for subsequent reads.
if len(m) > n {
data = append(data[0:0], m[:n]...)
r.remaining = m[n:]
return n, io.ErrShortBuffer
}
return len(m), nil
} | [
"func",
"(",
"r",
"*",
"jsonFrameReader",
")",
"Read",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"// Return whatever remaining data exists from an in progress frame",
"if",
"n",
":=",
"len",
"(",
"r",
".",
"remaining",
")",
";",... | // ReadFrame decodes the next JSON object in the stream, or returns an error. The returned
// byte slice will be modified the next time ReadFrame is invoked and should not be altered. | [
"ReadFrame",
"decodes",
"the",
"next",
"JSON",
"object",
"in",
"the",
"stream",
"or",
"returns",
"an",
"error",
".",
"The",
"returned",
"byte",
"slice",
"will",
"be",
"modified",
"the",
"next",
"time",
"ReadFrame",
"is",
"invoked",
"and",
"should",
"not",
... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/util/framer/framer.go#L131-L163 | train | Read reads the next chunk of data from the frame. | [
30522,
4569,
2278,
1006,
1054,
1008,
1046,
3385,
15643,
16416,
4063,
1007,
3191,
1006,
2951,
1031,
1033,
24880,
1007,
1006,
20014,
1010,
7561,
1007,
1063,
1013,
1013,
2709,
3649,
3588,
2951,
6526,
2013,
2019,
1999,
5082,
4853,
2065,
1050,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | staging/src/k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/internal/managedfields.go | RemoveObjectManagedFields | func RemoveObjectManagedFields(obj runtime.Object) {
accessor, err := meta.Accessor(obj)
if err != nil {
panic(fmt.Sprintf("couldn't get accessor: %v", err))
}
accessor.SetManagedFields(nil)
} | go | func RemoveObjectManagedFields(obj runtime.Object) {
accessor, err := meta.Accessor(obj)
if err != nil {
panic(fmt.Sprintf("couldn't get accessor: %v", err))
}
accessor.SetManagedFields(nil)
} | [
"func",
"RemoveObjectManagedFields",
"(",
"obj",
"runtime",
".",
"Object",
")",
"{",
"accessor",
",",
"err",
":=",
"meta",
".",
"Accessor",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",... | // RemoveObjectManagedFields removes the ManagedFields from the object
// before we merge so that it doesn't appear in the ManagedFields
// recursively. | [
"RemoveObjectManagedFields",
"removes",
"the",
"ManagedFields",
"from",
"the",
"object",
"before",
"we",
"merge",
"so",
"that",
"it",
"doesn",
"t",
"appear",
"in",
"the",
"ManagedFields",
"recursively",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/internal/managedfields.go#L34-L40 | train | RemoveObjectManagedFields removes all managed fields from the object | [
30522,
4569,
2278,
6366,
16429,
20614,
24805,
5999,
15155,
1006,
27885,
3501,
2448,
7292,
1012,
4874,
1007,
1063,
3229,
2953,
1010,
9413,
2099,
1024,
1027,
18804,
1012,
3229,
2953,
1006,
27885,
3501,
1007,
2065,
9413,
2099,
999,
1027,
9152,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | cmd/kubeadm/app/phases/upgrade/compute.go | CanUpgradeEtcd | func (u *Upgrade) CanUpgradeEtcd() bool {
return u.Before.EtcdVersion != u.After.EtcdVersion
} | go | func (u *Upgrade) CanUpgradeEtcd() bool {
return u.Before.EtcdVersion != u.After.EtcdVersion
} | [
"func",
"(",
"u",
"*",
"Upgrade",
")",
"CanUpgradeEtcd",
"(",
")",
"bool",
"{",
"return",
"u",
".",
"Before",
".",
"EtcdVersion",
"!=",
"u",
".",
"After",
".",
"EtcdVersion",
"\n",
"}"
] | // CanUpgradeEtcd returns whether an upgrade of etcd is possible | [
"CanUpgradeEtcd",
"returns",
"whether",
"an",
"upgrade",
"of",
"etcd",
"is",
"possible"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/phases/upgrade/compute.go#L55-L57 | train | CanUpgradeEtcd returns true if the upgrade can be upgraded to etcd. | [
30522,
4569,
2278,
1006,
1057,
1008,
12200,
1007,
2064,
6279,
24170,
3388,
19797,
1006,
1007,
22017,
2140,
1063,
2709,
1057,
1012,
2077,
1012,
4385,
2094,
27774,
999,
1027,
1057,
1012,
2044,
1012,
4385,
2094,
27774,
1065,
102,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | cmd/kubeadm/app/apis/kubeadm/v1beta1/zz_generated.conversion.go | Convert_v1beta1_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions | func Convert_v1beta1_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(in *NodeRegistrationOptions, out *kubeadm.NodeRegistrationOptions, s conversion.Scope) error {
return autoConvert_v1beta1_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(in, out, s)
} | go | func Convert_v1beta1_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(in *NodeRegistrationOptions, out *kubeadm.NodeRegistrationOptions, s conversion.Scope) error {
return autoConvert_v1beta1_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(in, out, s)
} | [
"func",
"Convert_v1beta1_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions",
"(",
"in",
"*",
"NodeRegistrationOptions",
",",
"out",
"*",
"kubeadm",
".",
"NodeRegistrationOptions",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoConvert_v1bet... | // Convert_v1beta1_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions is an autogenerated conversion function. | [
"Convert_v1beta1_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/apis/kubeadm/v1beta1/zz_generated.conversion.go#L824-L826 | train | Convert_v1beta1_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
1058,
2487,
20915,
27717,
1035,
13045,
2890,
24063,
8156,
7361,
9285,
1035,
2000,
1035,
13970,
4783,
4215,
2213,
1035,
13045,
2890,
24063,
8156,
7361,
9285,
1006,
1999,
1008,
13045,
2890,
24063,
8156,
7361,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | pkg/volume/util/nsenter/nsenter_mount.go | MakeRShared | func (n *Mounter) MakeRShared(path string) error {
return mount.DoMakeRShared(path, hostProcMountinfoPath)
} | go | func (n *Mounter) MakeRShared(path string) error {
return mount.DoMakeRShared(path, hostProcMountinfoPath)
} | [
"func",
"(",
"n",
"*",
"Mounter",
")",
"MakeRShared",
"(",
"path",
"string",
")",
"error",
"{",
"return",
"mount",
".",
"DoMakeRShared",
"(",
"path",
",",
"hostProcMountinfoPath",
")",
"\n",
"}"
] | // MakeRShared checks if path is shared and bind-mounts it as rshared if needed. | [
"MakeRShared",
"checks",
"if",
"path",
"is",
"shared",
"and",
"bind",
"-",
"mounts",
"it",
"as",
"rshared",
"if",
"needed",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/util/nsenter/nsenter_mount.go#L236-L238 | train | MakeRShared is part of the mount. Mounter interface. | [
30522,
4569,
2278,
1006,
1050,
1008,
4057,
2121,
1007,
11153,
8167,
2098,
1006,
4130,
5164,
1007,
7561,
1063,
2709,
4057,
1012,
14383,
22626,
7377,
5596,
1006,
4130,
1010,
3677,
21572,
27487,
21723,
2378,
14876,
15069,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | pkg/volume/glusterfs/glusterfs_minmax.go | AllocateNext | func (a *MinMaxAllocator) AllocateNext() (int, bool, error) {
a.lock.Lock()
defer a.lock.Unlock()
// Fast check if we're out of items
if a.free <= 0 {
return 0, false, ErrRangeFull
}
// Scan from the minimum until we find a free item
for i := a.min; i <= a.max; i++ {
if !a.has(i) {
a.used[i] = true
a.free--
return i, true, nil
}
}
// no free item found, but a.free != 0
return 0, false, ErrInternal
} | go | func (a *MinMaxAllocator) AllocateNext() (int, bool, error) {
a.lock.Lock()
defer a.lock.Unlock()
// Fast check if we're out of items
if a.free <= 0 {
return 0, false, ErrRangeFull
}
// Scan from the minimum until we find a free item
for i := a.min; i <= a.max; i++ {
if !a.has(i) {
a.used[i] = true
a.free--
return i, true, nil
}
}
// no free item found, but a.free != 0
return 0, false, ErrInternal
} | [
"func",
"(",
"a",
"*",
"MinMaxAllocator",
")",
"AllocateNext",
"(",
")",
"(",
"int",
",",
"bool",
",",
"error",
")",
"{",
"a",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"a",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"// Fast check if w... | //AllocateNext allocates next value from the allocator. | [
"AllocateNext",
"allocates",
"next",
"value",
"from",
"the",
"allocator",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/glusterfs/glusterfs_minmax.go#L131-L151 | train | AllocateNext returns the next free item in the allocator. | [
30522,
4569,
2278,
1006,
1037,
1008,
8117,
17848,
8095,
24755,
4263,
1007,
2035,
24755,
6528,
10288,
2102,
1006,
1007,
1006,
20014,
1010,
22017,
2140,
1010,
7561,
1007,
1063,
1037,
1012,
5843,
1012,
5843,
1006,
1007,
13366,
2121,
1037,
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 *SecretReference) DeepCopy() *SecretReference {
if in == nil {
return nil
}
out := new(SecretReference)
in.DeepCopyInto(out)
return out
} | go | func (in *SecretReference) DeepCopy() *SecretReference {
if in == nil {
return nil
}
out := new(SecretReference)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"SecretReference",
")",
"DeepCopy",
"(",
")",
"*",
"SecretReference",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"SecretReference",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretReference. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"SecretReference",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/zz_generated.deepcopy.go#L4581-L4588 | train | DeepCopy is an autogenerated deepcopy function copying the receiver creating a new SecretReference. | [
30522,
4569,
2278,
1006,
1999,
1008,
3595,
2890,
25523,
1007,
2784,
3597,
7685,
1006,
1007,
1008,
3595,
2890,
25523,
1063,
2065,
1999,
1027,
1027,
9152,
2140,
1063,
2709,
9152,
2140,
1065,
2041,
1024,
1027,
2047,
1006,
3595,
2890,
25523,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | IsReady | func IsReady(dir string) bool {
readyFile := filepath.Join(dir, readyFileName)
s, err := os.Stat(readyFile)
if err != nil {
return false
}
if !s.Mode().IsRegular() {
klog.Errorf("ready-file is not a file: %s", readyFile)
return false
}
return true
} | go | func IsReady(dir string) bool {
readyFile := filepath.Join(dir, readyFileName)
s, err := os.Stat(readyFile)
if err != nil {
return false
}
if !s.Mode().IsRegular() {
klog.Errorf("ready-file is not a file: %s", readyFile)
return false
}
return true
} | [
"func",
"IsReady",
"(",
"dir",
"string",
")",
"bool",
"{",
"readyFile",
":=",
"filepath",
".",
"Join",
"(",
"dir",
",",
"readyFileName",
")",
"\n",
"s",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"readyFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{"... | // IsReady checks for the existence of a regular file
// called 'ready' in the given directory and returns
// true if that file exists. | [
"IsReady",
"checks",
"for",
"the",
"existence",
"of",
"a",
"regular",
"file",
"called",
"ready",
"in",
"the",
"given",
"directory",
"and",
"returns",
"true",
"if",
"that",
"file",
"exists",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/util/util.go#L76-L89 | train | IsReady returns true if the file exists and is a regular file | [
30522,
4569,
2278,
2003,
16416,
5149,
1006,
16101,
5164,
1007,
22017,
2140,
1063,
3201,
8873,
2571,
1024,
1027,
5371,
15069,
1012,
3693,
1006,
16101,
1010,
3201,
8873,
20844,
4168,
1007,
1055,
1010,
9413,
2099,
1024,
1027,
9808,
1012,
28093... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | pkg/controller/nodeipam/config/v1alpha1/conversion.go | Convert_config_NodeIPAMControllerConfiguration_To_v1alpha1_NodeIPAMControllerConfiguration | func Convert_config_NodeIPAMControllerConfiguration_To_v1alpha1_NodeIPAMControllerConfiguration(in *config.NodeIPAMControllerConfiguration, out *v1alpha1.NodeIPAMControllerConfiguration, s conversion.Scope) error {
return autoConvert_config_NodeIPAMControllerConfiguration_To_v1alpha1_NodeIPAMControllerConfiguration(in, out, s)
} | go | func Convert_config_NodeIPAMControllerConfiguration_To_v1alpha1_NodeIPAMControllerConfiguration(in *config.NodeIPAMControllerConfiguration, out *v1alpha1.NodeIPAMControllerConfiguration, s conversion.Scope) error {
return autoConvert_config_NodeIPAMControllerConfiguration_To_v1alpha1_NodeIPAMControllerConfiguration(in, out, s)
} | [
"func",
"Convert_config_NodeIPAMControllerConfiguration_To_v1alpha1_NodeIPAMControllerConfiguration",
"(",
"in",
"*",
"config",
".",
"NodeIPAMControllerConfiguration",
",",
"out",
"*",
"v1alpha1",
".",
"NodeIPAMControllerConfiguration",
",",
"s",
"conversion",
".",
"Scope",
")"... | // Convert_config_NodeIPAMControllerConfiguration_To_v1alpha1_NodeIPAMControllerConfiguration is an autogenerated conversion function. | [
"Convert_config_NodeIPAMControllerConfiguration_To_v1alpha1_NodeIPAMControllerConfiguration",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/nodeipam/config/v1alpha1/conversion.go#L38-L40 | train | Convert_config_NodeIPAMControllerConfiguration_To_v1alpha1_NodeIPAMControllerConfiguration is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
9530,
8873,
2290,
1035,
13045,
11514,
3286,
8663,
13181,
10820,
8663,
8873,
27390,
3370,
1035,
2000,
1035,
1058,
2487,
2389,
21890,
2487,
1035,
13045,
11514,
3286,
8663,
13181,
10820,
8663,
8873,
27390,
3370,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/job/job_controller.go | syncJob | func (jm *JobController) syncJob(key string) (bool, error) {
startTime := time.Now()
defer func() {
klog.V(4).Infof("Finished syncing job %q (%v)", key, time.Since(startTime))
}()
ns, name, err := cache.SplitMetaNamespaceKey(key)
if err != nil {
return false, err
}
if len(ns) == 0 || len(name) == 0 {
return false, fmt.Errorf("invalid job key %q: either namespace or name is missing", key)
}
sharedJob, err := jm.jobLister.Jobs(ns).Get(name)
if err != nil {
if errors.IsNotFound(err) {
klog.V(4).Infof("Job has been deleted: %v", key)
jm.expectations.DeleteExpectations(key)
return true, nil
}
return false, err
}
job := *sharedJob
// if job was finished previously, we don't want to redo the termination
if IsJobFinished(&job) {
return true, nil
}
// retrieve the previous number of retry
previousRetry := jm.queue.NumRequeues(key)
// Check the expectations of the job before counting active pods, otherwise a new pod can sneak in
// and update the expectations after we've retrieved active pods from the store. If a new pod enters
// the store after we've checked the expectation, the job sync is just deferred till the next relist.
jobNeedsSync := jm.expectations.SatisfiedExpectations(key)
pods, err := jm.getPodsForJob(&job)
if err != nil {
return false, err
}
activePods := controller.FilterActivePods(pods)
active := int32(len(activePods))
succeeded, failed := getStatus(pods)
conditions := len(job.Status.Conditions)
// job first start
if job.Status.StartTime == nil {
now := metav1.Now()
job.Status.StartTime = &now
// enqueue a sync to check if job past ActiveDeadlineSeconds
if job.Spec.ActiveDeadlineSeconds != nil {
klog.V(4).Infof("Job %s have ActiveDeadlineSeconds will sync after %d seconds",
key, *job.Spec.ActiveDeadlineSeconds)
jm.queue.AddAfter(key, time.Duration(*job.Spec.ActiveDeadlineSeconds)*time.Second)
}
}
var manageJobErr error
jobFailed := false
var failureReason string
var failureMessage string
jobHaveNewFailure := failed > job.Status.Failed
// new failures happen when status does not reflect the failures and active
// is different than parallelism, otherwise the previous controller loop
// failed updating status so even if we pick up failure it is not a new one
exceedsBackoffLimit := jobHaveNewFailure && (active != *job.Spec.Parallelism) &&
(int32(previousRetry)+1 > *job.Spec.BackoffLimit)
if exceedsBackoffLimit || pastBackoffLimitOnFailure(&job, pods) {
// check if the number of pod restart exceeds backoff (for restart OnFailure only)
// OR if the number of failed jobs increased since the last syncJob
jobFailed = true
failureReason = "BackoffLimitExceeded"
failureMessage = "Job has reached the specified backoff limit"
} else if pastActiveDeadline(&job) {
jobFailed = true
failureReason = "DeadlineExceeded"
failureMessage = "Job was active longer than specified deadline"
}
if jobFailed {
errCh := make(chan error, active)
jm.deleteJobPods(&job, activePods, errCh)
select {
case manageJobErr = <-errCh:
if manageJobErr != nil {
break
}
default:
}
// update status values accordingly
failed += active
active = 0
job.Status.Conditions = append(job.Status.Conditions, newCondition(batch.JobFailed, failureReason, failureMessage))
jm.recorder.Event(&job, v1.EventTypeWarning, failureReason, failureMessage)
} else {
if jobNeedsSync && job.DeletionTimestamp == nil {
active, manageJobErr = jm.manageJob(activePods, succeeded, &job)
}
completions := succeeded
complete := false
if job.Spec.Completions == nil {
// This type of job is complete when any pod exits with success.
// Each pod is capable of
// determining whether or not the entire Job is done. Subsequent pods are
// not expected to fail, but if they do, the failure is ignored. Once any
// pod succeeds, the controller waits for remaining pods to finish, and
// then the job is complete.
if succeeded > 0 && active == 0 {
complete = true
}
} else {
// Job specifies a number of completions. This type of job signals
// success by having that number of successes. Since we do not
// start more pods than there are remaining completions, there should
// not be any remaining active pods once this count is reached.
if completions >= *job.Spec.Completions {
complete = true
if active > 0 {
jm.recorder.Event(&job, v1.EventTypeWarning, "TooManyActivePods", "Too many active pods running after completion count reached")
}
if completions > *job.Spec.Completions {
jm.recorder.Event(&job, v1.EventTypeWarning, "TooManySucceededPods", "Too many succeeded pods running after completion count reached")
}
}
}
if complete {
job.Status.Conditions = append(job.Status.Conditions, newCondition(batch.JobComplete, "", ""))
now := metav1.Now()
job.Status.CompletionTime = &now
}
}
forget := false
// Check if the number of jobs succeeded increased since the last check. If yes "forget" should be true
// This logic is linked to the issue: https://github.com/kubernetes/kubernetes/issues/56853 that aims to
// improve the Job backoff policy when parallelism > 1 and few Jobs failed but others succeed.
// In this case, we should clear the backoff delay.
if job.Status.Succeeded < succeeded {
forget = true
}
// no need to update the job if the status hasn't changed since last time
if job.Status.Active != active || job.Status.Succeeded != succeeded || job.Status.Failed != failed || len(job.Status.Conditions) != conditions {
job.Status.Active = active
job.Status.Succeeded = succeeded
job.Status.Failed = failed
if err := jm.updateHandler(&job); err != nil {
return forget, err
}
if jobHaveNewFailure && !IsJobFinished(&job) {
// returning an error will re-enqueue Job after the backoff period
return forget, fmt.Errorf("failed pod(s) detected for job key %q", key)
}
forget = true
}
return forget, manageJobErr
} | go | func (jm *JobController) syncJob(key string) (bool, error) {
startTime := time.Now()
defer func() {
klog.V(4).Infof("Finished syncing job %q (%v)", key, time.Since(startTime))
}()
ns, name, err := cache.SplitMetaNamespaceKey(key)
if err != nil {
return false, err
}
if len(ns) == 0 || len(name) == 0 {
return false, fmt.Errorf("invalid job key %q: either namespace or name is missing", key)
}
sharedJob, err := jm.jobLister.Jobs(ns).Get(name)
if err != nil {
if errors.IsNotFound(err) {
klog.V(4).Infof("Job has been deleted: %v", key)
jm.expectations.DeleteExpectations(key)
return true, nil
}
return false, err
}
job := *sharedJob
// if job was finished previously, we don't want to redo the termination
if IsJobFinished(&job) {
return true, nil
}
// retrieve the previous number of retry
previousRetry := jm.queue.NumRequeues(key)
// Check the expectations of the job before counting active pods, otherwise a new pod can sneak in
// and update the expectations after we've retrieved active pods from the store. If a new pod enters
// the store after we've checked the expectation, the job sync is just deferred till the next relist.
jobNeedsSync := jm.expectations.SatisfiedExpectations(key)
pods, err := jm.getPodsForJob(&job)
if err != nil {
return false, err
}
activePods := controller.FilterActivePods(pods)
active := int32(len(activePods))
succeeded, failed := getStatus(pods)
conditions := len(job.Status.Conditions)
// job first start
if job.Status.StartTime == nil {
now := metav1.Now()
job.Status.StartTime = &now
// enqueue a sync to check if job past ActiveDeadlineSeconds
if job.Spec.ActiveDeadlineSeconds != nil {
klog.V(4).Infof("Job %s have ActiveDeadlineSeconds will sync after %d seconds",
key, *job.Spec.ActiveDeadlineSeconds)
jm.queue.AddAfter(key, time.Duration(*job.Spec.ActiveDeadlineSeconds)*time.Second)
}
}
var manageJobErr error
jobFailed := false
var failureReason string
var failureMessage string
jobHaveNewFailure := failed > job.Status.Failed
// new failures happen when status does not reflect the failures and active
// is different than parallelism, otherwise the previous controller loop
// failed updating status so even if we pick up failure it is not a new one
exceedsBackoffLimit := jobHaveNewFailure && (active != *job.Spec.Parallelism) &&
(int32(previousRetry)+1 > *job.Spec.BackoffLimit)
if exceedsBackoffLimit || pastBackoffLimitOnFailure(&job, pods) {
// check if the number of pod restart exceeds backoff (for restart OnFailure only)
// OR if the number of failed jobs increased since the last syncJob
jobFailed = true
failureReason = "BackoffLimitExceeded"
failureMessage = "Job has reached the specified backoff limit"
} else if pastActiveDeadline(&job) {
jobFailed = true
failureReason = "DeadlineExceeded"
failureMessage = "Job was active longer than specified deadline"
}
if jobFailed {
errCh := make(chan error, active)
jm.deleteJobPods(&job, activePods, errCh)
select {
case manageJobErr = <-errCh:
if manageJobErr != nil {
break
}
default:
}
// update status values accordingly
failed += active
active = 0
job.Status.Conditions = append(job.Status.Conditions, newCondition(batch.JobFailed, failureReason, failureMessage))
jm.recorder.Event(&job, v1.EventTypeWarning, failureReason, failureMessage)
} else {
if jobNeedsSync && job.DeletionTimestamp == nil {
active, manageJobErr = jm.manageJob(activePods, succeeded, &job)
}
completions := succeeded
complete := false
if job.Spec.Completions == nil {
// This type of job is complete when any pod exits with success.
// Each pod is capable of
// determining whether or not the entire Job is done. Subsequent pods are
// not expected to fail, but if they do, the failure is ignored. Once any
// pod succeeds, the controller waits for remaining pods to finish, and
// then the job is complete.
if succeeded > 0 && active == 0 {
complete = true
}
} else {
// Job specifies a number of completions. This type of job signals
// success by having that number of successes. Since we do not
// start more pods than there are remaining completions, there should
// not be any remaining active pods once this count is reached.
if completions >= *job.Spec.Completions {
complete = true
if active > 0 {
jm.recorder.Event(&job, v1.EventTypeWarning, "TooManyActivePods", "Too many active pods running after completion count reached")
}
if completions > *job.Spec.Completions {
jm.recorder.Event(&job, v1.EventTypeWarning, "TooManySucceededPods", "Too many succeeded pods running after completion count reached")
}
}
}
if complete {
job.Status.Conditions = append(job.Status.Conditions, newCondition(batch.JobComplete, "", ""))
now := metav1.Now()
job.Status.CompletionTime = &now
}
}
forget := false
// Check if the number of jobs succeeded increased since the last check. If yes "forget" should be true
// This logic is linked to the issue: https://github.com/kubernetes/kubernetes/issues/56853 that aims to
// improve the Job backoff policy when parallelism > 1 and few Jobs failed but others succeed.
// In this case, we should clear the backoff delay.
if job.Status.Succeeded < succeeded {
forget = true
}
// no need to update the job if the status hasn't changed since last time
if job.Status.Active != active || job.Status.Succeeded != succeeded || job.Status.Failed != failed || len(job.Status.Conditions) != conditions {
job.Status.Active = active
job.Status.Succeeded = succeeded
job.Status.Failed = failed
if err := jm.updateHandler(&job); err != nil {
return forget, err
}
if jobHaveNewFailure && !IsJobFinished(&job) {
// returning an error will re-enqueue Job after the backoff period
return forget, fmt.Errorf("failed pod(s) detected for job key %q", key)
}
forget = true
}
return forget, manageJobErr
} | [
"func",
"(",
"jm",
"*",
"JobController",
")",
"syncJob",
"(",
"key",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"startTime",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"defer",
"func",
"(",
")",
"{",
"klog",
".",
"V",
"(",
"4",
")",
"."... | // syncJob will sync the job with the given key if it has had its expectations fulfilled, meaning
// it did not expect to see any more of its pods created or deleted. This function is not meant to be invoked
// concurrently with the same key. | [
"syncJob",
"will",
"sync",
"the",
"job",
"with",
"the",
"given",
"key",
"if",
"it",
"has",
"had",
"its",
"expectations",
"fulfilled",
"meaning",
"it",
"did",
"not",
"expect",
"to",
"see",
"any",
"more",
"of",
"its",
"pods",
"created",
"or",
"deleted",
".... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/job/job_controller.go#L436-L600 | train | syncJob syncs a job with the store. | [
30522,
4569,
2278,
1006,
1046,
2213,
1008,
3105,
8663,
13181,
10820,
1007,
26351,
5558,
2497,
1006,
3145,
5164,
1007,
1006,
22017,
2140,
1010,
7561,
1007,
1063,
2707,
7292,
1024,
1027,
2051,
1012,
2085,
1006,
1007,
13366,
2121,
4569,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/wsstream/conn.go | Close | func (conn *Conn) Close() error {
<-conn.ready
for _, s := range conn.channels {
s.Close()
}
conn.ws.Close()
return nil
} | go | func (conn *Conn) Close() error {
<-conn.ready
for _, s := range conn.channels {
s.Close()
}
conn.ws.Close()
return nil
} | [
"func",
"(",
"conn",
"*",
"Conn",
")",
"Close",
"(",
")",
"error",
"{",
"<-",
"conn",
".",
"ready",
"\n",
"for",
"_",
",",
"s",
":=",
"range",
"conn",
".",
"channels",
"{",
"s",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"conn",
".",
"ws",
".",... | // Close is only valid after Open has been called | [
"Close",
"is",
"only",
"valid",
"after",
"Open",
"has",
"been",
"called"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiserver/pkg/util/wsstream/conn.go#L235-L242 | train | Close closes the connection. | [
30522,
4569,
2278,
1006,
9530,
2078,
1008,
9530,
2078,
1007,
2485,
1006,
1007,
7561,
1063,
1026,
1011,
9530,
2078,
1012,
3201,
2005,
1035,
1010,
1055,
1024,
1027,
2846,
9530,
2078,
1012,
6833,
1063,
1055,
1012,
2485,
1006,
1007,
1065,
305... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_Secret_To_v1_Secret | func Convert_core_Secret_To_v1_Secret(in *core.Secret, out *v1.Secret, s conversion.Scope) error {
return autoConvert_core_Secret_To_v1_Secret(in, out, s)
} | go | func Convert_core_Secret_To_v1_Secret(in *core.Secret, out *v1.Secret, s conversion.Scope) error {
return autoConvert_core_Secret_To_v1_Secret(in, out, s)
} | [
"func",
"Convert_core_Secret_To_v1_Secret",
"(",
"in",
"*",
"core",
".",
"Secret",
",",
"out",
"*",
"v1",
".",
"Secret",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoConvert_core_Secret_To_v1_Secret",
"(",
"in",
",",
"out",
",",
"s... | // Convert_core_Secret_To_v1_Secret is an autogenerated conversion function. | [
"Convert_core_Secret_To_v1_Secret",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/v1/zz_generated.conversion.go#L6573-L6575 | train | Convert_core_Secret_To_v1_Secret is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
4563,
1035,
3595,
1035,
2000,
1035,
1058,
2487,
1035,
3595,
1006,
1999,
1008,
4563,
1012,
3595,
1010,
2041,
1008,
1058,
2487,
1012,
3595,
1010,
1055,
7584,
1012,
9531,
1007,
7561,
1063,
2709,
8285,
8663,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | log | func log(msg string, parts ...interface{}) string {
return fmt.Sprintf(fmt.Sprintf("%s: %s", CSIPluginName, msg), parts...)
} | go | func log(msg string, parts ...interface{}) string {
return fmt.Sprintf(fmt.Sprintf("%s: %s", CSIPluginName, msg), parts...)
} | [
"func",
"log",
"(",
"msg",
"string",
",",
"parts",
"...",
"interface",
"{",
"}",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"CSIPluginName",
",",
"msg",
")",
",",
"parts",
"...",
")",
"\n"... | // log prepends log string with `kubernetes.io/csi` | [
"log",
"prepends",
"log",
"string",
"with",
"kubernetes",
".",
"io",
"/",
"csi"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/csi/csi_util.go#L108-L110 | train | log returns a string that can be used to log a message to CSIPluginName | [
30522,
4569,
2278,
8833,
1006,
5796,
2290,
5164,
1010,
3033,
1012,
1012,
1012,
8278,
1063,
1065,
1007,
5164,
1063,
2709,
4718,
2102,
1012,
9043,
2546,
1006,
4718,
2102,
1012,
9043,
2546,
1006,
1000,
1003,
1055,
1024,
1003,
1055,
1000,
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 | pkg/cloudprovider/providers/openstack/openstack_instances.go | Instances | func (os *OpenStack) Instances() (cloudprovider.Instances, bool) {
klog.V(4).Info("openstack.Instances() called")
compute, err := os.NewComputeV2()
if err != nil {
klog.Errorf("unable to access compute v2 API : %v", err)
return nil, false
}
klog.V(4).Info("Claiming to support Instances")
return &Instances{
compute: compute,
opts: os.metadataOpts,
}, true
} | go | func (os *OpenStack) Instances() (cloudprovider.Instances, bool) {
klog.V(4).Info("openstack.Instances() called")
compute, err := os.NewComputeV2()
if err != nil {
klog.Errorf("unable to access compute v2 API : %v", err)
return nil, false
}
klog.V(4).Info("Claiming to support Instances")
return &Instances{
compute: compute,
opts: os.metadataOpts,
}, true
} | [
"func",
"(",
"os",
"*",
"OpenStack",
")",
"Instances",
"(",
")",
"(",
"cloudprovider",
".",
"Instances",
",",
"bool",
")",
"{",
"klog",
".",
"V",
"(",
"4",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",
"compute",
",",
"err",
":=",
"os",
".",
... | // Instances returns an implementation of Instances for OpenStack. | [
"Instances",
"returns",
"an",
"implementation",
"of",
"Instances",
"for",
"OpenStack",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/cloudprovider/providers/openstack/openstack_instances.go#L46-L61 | train | Instances returns a cloudprovider. Instances object | [
30522,
4569,
2278,
1006,
9808,
1008,
7480,
2696,
3600,
1007,
12107,
1006,
1007,
1006,
6112,
21572,
17258,
2121,
1012,
12107,
1010,
22017,
2140,
1007,
1063,
1047,
21197,
1012,
1058,
1006,
1018,
1007,
1012,
18558,
1006,
1000,
7480,
2696,
3600... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/photon/photon.go | NodeAddressesByProviderID | func (pc *PCCloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error) {
return []v1.NodeAddress{}, cloudprovider.NotImplemented
} | go | func (pc *PCCloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error) {
return []v1.NodeAddress{}, cloudprovider.NotImplemented
} | [
"func",
"(",
"pc",
"*",
"PCCloud",
")",
"NodeAddressesByProviderID",
"(",
"ctx",
"context",
".",
"Context",
",",
"providerID",
"string",
")",
"(",
"[",
"]",
"v1",
".",
"NodeAddress",
",",
"error",
")",
"{",
"return",
"[",
"]",
"v1",
".",
"NodeAddress",
... | // NodeAddressesByProviderID returns the node addresses of an instances with the specified unique providerID
// This method will not be called from the node that is requesting this ID. i.e. metadata service
// and other local methods cannot be used here | [
"NodeAddressesByProviderID",
"returns",
"the",
"node",
"addresses",
"of",
"an",
"instances",
"with",
"the",
"specified",
"unique",
"providerID",
"This",
"method",
"will",
"not",
"be",
"called",
"from",
"the",
"node",
"that",
"is",
"requesting",
"this",
"ID",
"."... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/cloudprovider/providers/photon/photon.go#L428-L430 | train | NodeAddressesByProviderID returns a list of node addresses for the specified providerID. | [
30522,
4569,
2278,
1006,
7473,
1008,
7473,
20464,
19224,
1007,
13045,
4215,
16200,
11393,
14478,
21572,
17258,
11124,
2094,
1006,
14931,
2595,
6123,
1012,
6123,
1010,
10802,
3593,
5164,
1007,
1006,
1031,
1033,
1058,
2487,
1012,
13045,
4215,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | staging/src/k8s.io/client-go/util/workqueue/queue.go | Len | func (q *Type) Len() int {
q.cond.L.Lock()
defer q.cond.L.Unlock()
return len(q.queue)
} | go | func (q *Type) Len() int {
q.cond.L.Lock()
defer q.cond.L.Unlock()
return len(q.queue)
} | [
"func",
"(",
"q",
"*",
"Type",
")",
"Len",
"(",
")",
"int",
"{",
"q",
".",
"cond",
".",
"L",
".",
"Lock",
"(",
")",
"\n",
"defer",
"q",
".",
"cond",
".",
"L",
".",
"Unlock",
"(",
")",
"\n",
"return",
"len",
"(",
"q",
".",
"queue",
")",
"\... | // Len returns the current queue length, for informational purposes only. You
// shouldn't e.g. gate a call to Add() or Get() on Len() being a particular
// value, that can't be synchronized properly. | [
"Len",
"returns",
"the",
"current",
"queue",
"length",
"for",
"informational",
"purposes",
"only",
".",
"You",
"shouldn",
"t",
"e",
".",
"g",
".",
"gate",
"a",
"call",
"to",
"Add",
"()",
"or",
"Get",
"()",
"on",
"Len",
"()",
"being",
"a",
"particular",... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/util/workqueue/queue.go#L132-L136 | train | Len returns the number of items in the queue. | [
30522,
4569,
2278,
1006,
1053,
1008,
2828,
1007,
18798,
1006,
1007,
20014,
1063,
1053,
1012,
9530,
2094,
1012,
1048,
1012,
5843,
1006,
1007,
13366,
2121,
1053,
1012,
9530,
2094,
1012,
1048,
1012,
19829,
1006,
1007,
2709,
18798,
1006,
1053,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | Convert_v1alpha1_RoleList_To_rbac_RoleList | func Convert_v1alpha1_RoleList_To_rbac_RoleList(in *v1alpha1.RoleList, out *rbac.RoleList, s conversion.Scope) error {
return autoConvert_v1alpha1_RoleList_To_rbac_RoleList(in, out, s)
} | go | func Convert_v1alpha1_RoleList_To_rbac_RoleList(in *v1alpha1.RoleList, out *rbac.RoleList, s conversion.Scope) error {
return autoConvert_v1alpha1_RoleList_To_rbac_RoleList(in, out, s)
} | [
"func",
"Convert_v1alpha1_RoleList_To_rbac_RoleList",
"(",
"in",
"*",
"v1alpha1",
".",
"RoleList",
",",
"out",
"*",
"rbac",
".",
"RoleList",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoConvert_v1alpha1_RoleList_To_rbac_RoleList",
"(",
"in... | // Convert_v1alpha1_RoleList_To_rbac_RoleList is an autogenerated conversion function. | [
"Convert_v1alpha1_RoleList_To_rbac_RoleList",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/rbac/v1alpha1/zz_generated.conversion.go#L476-L478 | train | Convert_v1alpha1_RoleList_To_rbac_RoleList is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
1058,
2487,
2389,
21890,
2487,
1035,
2535,
9863,
1035,
2000,
1035,
21144,
6305,
1035,
2535,
9863,
1006,
1999,
1008,
1058,
2487,
2389,
21890,
2487,
1012,
2535,
9863,
1010,
2041,
1008,
21144,
6305,
1012,
2535,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/parser.go | rewriteOptionalMethods | func rewriteOptionalMethods(decl ast.Decl, isOptional OptionalFunc) {
switch t := decl.(type) {
case *ast.FuncDecl:
ident, ptr, ok := receiver(t)
if !ok {
return
}
// correct initialization of the form `m.Field = &OptionalType{}` to
// `m.Field = OptionalType{}`
if t.Name.Name == "Unmarshal" {
ast.Walk(optionalAssignmentVisitor{fn: isOptional}, t.Body)
}
if !isOptional(ident.Name) {
return
}
switch t.Name.Name {
case "Unmarshal":
ast.Walk(&optionalItemsVisitor{}, t.Body)
case "MarshalTo", "Size", "String":
ast.Walk(&optionalItemsVisitor{}, t.Body)
fallthrough
case "Marshal":
// if the method has a pointer receiver, set it back to a normal receiver
if ptr {
t.Recv.List[0].Type = ident
}
}
}
} | go | func rewriteOptionalMethods(decl ast.Decl, isOptional OptionalFunc) {
switch t := decl.(type) {
case *ast.FuncDecl:
ident, ptr, ok := receiver(t)
if !ok {
return
}
// correct initialization of the form `m.Field = &OptionalType{}` to
// `m.Field = OptionalType{}`
if t.Name.Name == "Unmarshal" {
ast.Walk(optionalAssignmentVisitor{fn: isOptional}, t.Body)
}
if !isOptional(ident.Name) {
return
}
switch t.Name.Name {
case "Unmarshal":
ast.Walk(&optionalItemsVisitor{}, t.Body)
case "MarshalTo", "Size", "String":
ast.Walk(&optionalItemsVisitor{}, t.Body)
fallthrough
case "Marshal":
// if the method has a pointer receiver, set it back to a normal receiver
if ptr {
t.Recv.List[0].Type = ident
}
}
}
} | [
"func",
"rewriteOptionalMethods",
"(",
"decl",
"ast",
".",
"Decl",
",",
"isOptional",
"OptionalFunc",
")",
"{",
"switch",
"t",
":=",
"decl",
".",
"(",
"type",
")",
"{",
"case",
"*",
"ast",
".",
"FuncDecl",
":",
"ident",
",",
"ptr",
",",
"ok",
":=",
"... | // rewriteOptionalMethods makes specific mutations to marshaller methods that belong to types identified
// as being "optional" (they may be nil on the wire). This allows protobuf to serialize a map or slice and
// properly discriminate between empty and nil (which is not possible in protobuf).
// TODO: move into upstream gogo-protobuf once https://github.com/gogo/protobuf/issues/181
// has agreement | [
"rewriteOptionalMethods",
"makes",
"specific",
"mutations",
"to",
"marshaller",
"methods",
"that",
"belong",
"to",
"types",
"identified",
"as",
"being",
"optional",
"(",
"they",
"may",
"be",
"nil",
"on",
"the",
"wire",
")",
".",
"This",
"allows",
"protobuf",
"... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/parser.go#L114-L145 | train | rewriteOptionalMethods rewrite the optional methods of a method. | [
30522,
4569,
2278,
2128,
26373,
7361,
3508,
2389,
11368,
6806,
5104,
1006,
11703,
2140,
2004,
2102,
1012,
11703,
2140,
1010,
11163,
16790,
2389,
11887,
11263,
12273,
1007,
1063,
30524,
1024,
1027,
8393,
1006,
1056,
1007,
2065,
999,
7929,
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/apimachinery/pkg/util/strategicpatch/patch.go | preprocessDeletionListForMerging | func preprocessDeletionListForMerging(key string, original map[string]interface{},
patchVal interface{}, mergeDeletionList bool) (bool, bool, string, error) {
// If found a parallel list for deletion and we are going to merge the list,
// overwrite the key to the original key and set flag isDeleteList
foundParallelListPrefix := strings.HasPrefix(key, deleteFromPrimitiveListDirectivePrefix)
if foundParallelListPrefix {
if !mergeDeletionList {
original[key] = patchVal
return true, false, "", nil
}
originalKey, err := extractKey(key, deleteFromPrimitiveListDirectivePrefix)
return false, true, originalKey, err
}
return false, false, "", nil
} | go | func preprocessDeletionListForMerging(key string, original map[string]interface{},
patchVal interface{}, mergeDeletionList bool) (bool, bool, string, error) {
// If found a parallel list for deletion and we are going to merge the list,
// overwrite the key to the original key and set flag isDeleteList
foundParallelListPrefix := strings.HasPrefix(key, deleteFromPrimitiveListDirectivePrefix)
if foundParallelListPrefix {
if !mergeDeletionList {
original[key] = patchVal
return true, false, "", nil
}
originalKey, err := extractKey(key, deleteFromPrimitiveListDirectivePrefix)
return false, true, originalKey, err
}
return false, false, "", nil
} | [
"func",
"preprocessDeletionListForMerging",
"(",
"key",
"string",
",",
"original",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"patchVal",
"interface",
"{",
"}",
",",
"mergeDeletionList",
"bool",
")",
"(",
"bool",
",",
"bool",
",",
"string",
",",
... | // preprocessDeletionListForMerging preprocesses the deletion list.
// it returns shouldContinue, isDeletionList, noPrefixKey | [
"preprocessDeletionListForMerging",
"preprocesses",
"the",
"deletion",
"list",
".",
"it",
"returns",
"shouldContinue",
"isDeletionList",
"noPrefixKey"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go#L1027-L1041 | train | preprocessDeletionListForMerging takes a key and a map of values to be merged into a single key. | [
30522,
4569,
2278,
17463,
3217,
9623,
16150,
12260,
3508,
9863,
14192,
2121,
4726,
1006,
3145,
5164,
1010,
2434,
4949,
1031,
5164,
1033,
8278,
1063,
1065,
1010,
8983,
30524,
7561,
1007,
1063,
1013,
1013,
2065,
2179,
1037,
5903,
2862,
2005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | pkg/volume/iscsi/iscsi_util.go | MakeGlobalVDPDName | func (util *ISCSIUtil) MakeGlobalVDPDName(iscsi iscsiDisk) string {
return makeVDPDNameInternal(iscsi.plugin.host, iscsi.Portals[0], iscsi.Iqn, iscsi.Lun, iscsi.Iface)
} | go | func (util *ISCSIUtil) MakeGlobalVDPDName(iscsi iscsiDisk) string {
return makeVDPDNameInternal(iscsi.plugin.host, iscsi.Portals[0], iscsi.Iqn, iscsi.Lun, iscsi.Iface)
} | [
"func",
"(",
"util",
"*",
"ISCSIUtil",
")",
"MakeGlobalVDPDName",
"(",
"iscsi",
"iscsiDisk",
")",
"string",
"{",
"return",
"makeVDPDNameInternal",
"(",
"iscsi",
".",
"plugin",
".",
"host",
",",
"iscsi",
".",
"Portals",
"[",
"0",
"]",
",",
"iscsi",
".",
"... | // MakeGlobalVDPDName returns path of global volume device plugin dir | [
"MakeGlobalVDPDName",
"returns",
"path",
"of",
"global",
"volume",
"device",
"plugin",
"dir"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/iscsi/iscsi_util.go#L204-L206 | train | MakeGlobalVDPDName returns the global virtual disk name for the given iscsiDisk. | [
30522,
4569,
2278,
1006,
21183,
4014,
1008,
2003,
6169,
17922,
3775,
2140,
1007,
2191,
23296,
16429,
2389,
16872,
17299,
18442,
1006,
2003,
6169,
2072,
2003,
6169,
28173,
6711,
1007,
5164,
1063,
2709,
2191,
16872,
17299,
18442,
18447,
11795,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/validation/validation.go | ValidateDaemonSet | func ValidateDaemonSet(ds *apps.DaemonSet) field.ErrorList {
allErrs := apivalidation.ValidateObjectMeta(&ds.ObjectMeta, true, ValidateDaemonSetName, field.NewPath("metadata"))
allErrs = append(allErrs, ValidateDaemonSetSpec(&ds.Spec, field.NewPath("spec"))...)
return allErrs
} | go | func ValidateDaemonSet(ds *apps.DaemonSet) field.ErrorList {
allErrs := apivalidation.ValidateObjectMeta(&ds.ObjectMeta, true, ValidateDaemonSetName, field.NewPath("metadata"))
allErrs = append(allErrs, ValidateDaemonSetSpec(&ds.Spec, field.NewPath("spec"))...)
return allErrs
} | [
"func",
"ValidateDaemonSet",
"(",
"ds",
"*",
"apps",
".",
"DaemonSet",
")",
"field",
".",
"ErrorList",
"{",
"allErrs",
":=",
"apivalidation",
".",
"ValidateObjectMeta",
"(",
"&",
"ds",
".",
"ObjectMeta",
",",
"true",
",",
"ValidateDaemonSetName",
",",
"field",... | // ValidateDaemonSet tests if required fields in the DaemonSet are set. | [
"ValidateDaemonSet",
"tests",
"if",
"required",
"fields",
"in",
"the",
"DaemonSet",
"are",
"set",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/apps/validation/validation.go#L244-L248 | train | ValidateDaemonSet tests that the fields in the daemon set are valid. | [
30522,
4569,
2278,
9398,
4383,
6679,
16563,
3388,
1006,
16233,
1008,
18726,
1012,
12828,
13462,
1007,
2492,
1012,
7561,
9863,
1063,
2035,
2121,
2869,
1024,
1027,
17928,
10175,
8524,
3508,
1012,
9398,
3686,
16429,
20614,
11368,
2050,
1006,
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_RBDPersistentVolumeSource_To_v1_RBDPersistentVolumeSource | func Convert_core_RBDPersistentVolumeSource_To_v1_RBDPersistentVolumeSource(in *core.RBDPersistentVolumeSource, out *v1.RBDPersistentVolumeSource, s conversion.Scope) error {
return autoConvert_core_RBDPersistentVolumeSource_To_v1_RBDPersistentVolumeSource(in, out, s)
} | go | func Convert_core_RBDPersistentVolumeSource_To_v1_RBDPersistentVolumeSource(in *core.RBDPersistentVolumeSource, out *v1.RBDPersistentVolumeSource, s conversion.Scope) error {
return autoConvert_core_RBDPersistentVolumeSource_To_v1_RBDPersistentVolumeSource(in, out, s)
} | [
"func",
"Convert_core_RBDPersistentVolumeSource_To_v1_RBDPersistentVolumeSource",
"(",
"in",
"*",
"core",
".",
"RBDPersistentVolumeSource",
",",
"out",
"*",
"v1",
".",
"RBDPersistentVolumeSource",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoC... | // Convert_core_RBDPersistentVolumeSource_To_v1_RBDPersistentVolumeSource is an autogenerated conversion function. | [
"Convert_core_RBDPersistentVolumeSource_To_v1_RBDPersistentVolumeSource",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/v1/zz_generated.conversion.go#L6035-L6037 | train | Convert_core_RBDPersistentVolumeSource_To_v1_RBDPersistentVolumeSource is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
4563,
1035,
21144,
18927,
2545,
27870,
3372,
6767,
12942,
2229,
8162,
3401,
1035,
2000,
1035,
1058,
2487,
1035,
21144,
18927,
2545,
27870,
3372,
6767,
12942,
2229,
8162,
3401,
1006,
1999,
1008,
4563,
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/code-generator/cmd/deepcopy-gen/args/args.go | NewDefaults | func NewDefaults() (*args.GeneratorArgs, *CustomArgs) {
genericArgs := args.Default().WithoutDefaultFlagParsing()
customArgs := &CustomArgs{}
genericArgs.CustomArgs = (*generators.CustomArgs)(customArgs) // convert to upstream type to make type-casts work there
genericArgs.OutputFileBaseName = "deepcopy_generated"
return genericArgs, customArgs
} | go | func NewDefaults() (*args.GeneratorArgs, *CustomArgs) {
genericArgs := args.Default().WithoutDefaultFlagParsing()
customArgs := &CustomArgs{}
genericArgs.CustomArgs = (*generators.CustomArgs)(customArgs) // convert to upstream type to make type-casts work there
genericArgs.OutputFileBaseName = "deepcopy_generated"
return genericArgs, customArgs
} | [
"func",
"NewDefaults",
"(",
")",
"(",
"*",
"args",
".",
"GeneratorArgs",
",",
"*",
"CustomArgs",
")",
"{",
"genericArgs",
":=",
"args",
".",
"Default",
"(",
")",
".",
"WithoutDefaultFlagParsing",
"(",
")",
"\n",
"customArgs",
":=",
"&",
"CustomArgs",
"{",
... | // NewDefaults returns default arguments for the generator. | [
"NewDefaults",
"returns",
"default",
"arguments",
"for",
"the",
"generator",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/code-generator/cmd/deepcopy-gen/args/args.go#L31-L37 | train | NewDefaults returns a new default args. GeneratorArgs and a custom args. CustomArgs. | [
30522,
4569,
2278,
2047,
3207,
7011,
11314,
2015,
1006,
1007,
1006,
1008,
12098,
5620,
1012,
13103,
2906,
5620,
1010,
1008,
7661,
2906,
5620,
1007,
1063,
12391,
2906,
5620,
1024,
1027,
12098,
5620,
1012,
12398,
1006,
1007,
1012,
2302,
3207,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 *Container) DeepCopyInto(out *Container) {
*out = *in
if in.Command != nil {
in, out := &in.Command, &out.Command
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Args != nil {
in, out := &in.Args, &out.Args
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Ports != nil {
in, out := &in.Ports, &out.Ports
*out = make([]ContainerPort, len(*in))
copy(*out, *in)
}
if in.EnvFrom != nil {
in, out := &in.EnvFrom, &out.EnvFrom
*out = make([]EnvFromSource, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Env != nil {
in, out := &in.Env, &out.Env
*out = make([]EnvVar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
in.Resources.DeepCopyInto(&out.Resources)
if in.VolumeMounts != nil {
in, out := &in.VolumeMounts, &out.VolumeMounts
*out = make([]VolumeMount, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.VolumeDevices != nil {
in, out := &in.VolumeDevices, &out.VolumeDevices
*out = make([]VolumeDevice, len(*in))
copy(*out, *in)
}
if in.LivenessProbe != nil {
in, out := &in.LivenessProbe, &out.LivenessProbe
*out = new(Probe)
(*in).DeepCopyInto(*out)
}
if in.ReadinessProbe != nil {
in, out := &in.ReadinessProbe, &out.ReadinessProbe
*out = new(Probe)
(*in).DeepCopyInto(*out)
}
if in.Lifecycle != nil {
in, out := &in.Lifecycle, &out.Lifecycle
*out = new(Lifecycle)
(*in).DeepCopyInto(*out)
}
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(SecurityContext)
(*in).DeepCopyInto(*out)
}
return
} | go | func (in *Container) DeepCopyInto(out *Container) {
*out = *in
if in.Command != nil {
in, out := &in.Command, &out.Command
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Args != nil {
in, out := &in.Args, &out.Args
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Ports != nil {
in, out := &in.Ports, &out.Ports
*out = make([]ContainerPort, len(*in))
copy(*out, *in)
}
if in.EnvFrom != nil {
in, out := &in.EnvFrom, &out.EnvFrom
*out = make([]EnvFromSource, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Env != nil {
in, out := &in.Env, &out.Env
*out = make([]EnvVar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
in.Resources.DeepCopyInto(&out.Resources)
if in.VolumeMounts != nil {
in, out := &in.VolumeMounts, &out.VolumeMounts
*out = make([]VolumeMount, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.VolumeDevices != nil {
in, out := &in.VolumeDevices, &out.VolumeDevices
*out = make([]VolumeDevice, len(*in))
copy(*out, *in)
}
if in.LivenessProbe != nil {
in, out := &in.LivenessProbe, &out.LivenessProbe
*out = new(Probe)
(*in).DeepCopyInto(*out)
}
if in.ReadinessProbe != nil {
in, out := &in.ReadinessProbe, &out.ReadinessProbe
*out = new(Probe)
(*in).DeepCopyInto(*out)
}
if in.Lifecycle != nil {
in, out := &in.Lifecycle, &out.Lifecycle
*out = new(Lifecycle)
(*in).DeepCopyInto(*out)
}
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(SecurityContext)
(*in).DeepCopyInto(*out)
}
return
} | [
"func",
"(",
"in",
"*",
"Container",
")",
"DeepCopyInto",
"(",
"out",
"*",
"Container",
")",
"{",
"*",
"out",
"=",
"*",
"in",
"\n",
"if",
"in",
".",
"Command",
"!=",
"nil",
"{",
"in",
",",
"out",
":=",
"&",
"in",
".",
"Command",
",",
"&",
"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#L717-L782 | train | DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new Container. | [
30522,
4569,
2278,
1006,
1999,
1008,
11661,
1007,
2784,
3597,
7685,
18447,
2080,
1006,
2041,
1008,
11661,
1007,
1063,
1008,
2041,
1027,
1008,
1999,
2065,
1999,
1012,
3094,
999,
1027,
9152,
2140,
1063,
1999,
1010,
2041,
1024,
1027,
1004,
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/server/mux/pathrecorder.go | Unregister | func (m *PathRecorderMux) Unregister(path string) {
m.lock.Lock()
defer m.lock.Unlock()
delete(m.pathToHandler, path)
delete(m.prefixToHandler, path)
delete(m.pathStacks, path)
for i := range m.exposedPaths {
if m.exposedPaths[i] == path {
m.exposedPaths = append(m.exposedPaths[:i], m.exposedPaths[i+1:]...)
break
}
}
m.refreshMuxLocked()
} | go | func (m *PathRecorderMux) Unregister(path string) {
m.lock.Lock()
defer m.lock.Unlock()
delete(m.pathToHandler, path)
delete(m.prefixToHandler, path)
delete(m.pathStacks, path)
for i := range m.exposedPaths {
if m.exposedPaths[i] == path {
m.exposedPaths = append(m.exposedPaths[:i], m.exposedPaths[i+1:]...)
break
}
}
m.refreshMuxLocked()
} | [
"func",
"(",
"m",
"*",
"PathRecorderMux",
")",
"Unregister",
"(",
"path",
"string",
")",
"{",
"m",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"delete",
"(",
"m",
".",
"pathToHandler",
",",
... | // Unregister removes a path from the mux. | [
"Unregister",
"removes",
"a",
"path",
"from",
"the",
"mux",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiserver/pkg/server/mux/pathrecorder.go#L151-L166 | train | Unregister removes a handler from the pathRecorderMux | [
30522,
4569,
2278,
1006,
1049,
1008,
4130,
2890,
27108,
4063,
12274,
2595,
1007,
4895,
2890,
24063,
2121,
1006,
4130,
5164,
1007,
1063,
1049,
1012,
5843,
1012,
5843,
1006,
1007,
13366,
2121,
1049,
1012,
5843,
1012,
19829,
1006,
1007,
3972,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | pkg/volume/cinder/cinder_block.go | GetGlobalMapPath | func (cd *cinderVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) {
pdName, _, _, err := getVolumeInfo(spec)
if err != nil {
return "", err
}
return filepath.Join(cd.plugin.host.GetVolumeDevicePluginDir(cinderVolumePluginName), pdName), nil
} | go | func (cd *cinderVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) {
pdName, _, _, err := getVolumeInfo(spec)
if err != nil {
return "", err
}
return filepath.Join(cd.plugin.host.GetVolumeDevicePluginDir(cinderVolumePluginName), pdName), nil
} | [
"func",
"(",
"cd",
"*",
"cinderVolume",
")",
"GetGlobalMapPath",
"(",
"spec",
"*",
"volume",
".",
"Spec",
")",
"(",
"string",
",",
"error",
")",
"{",
"pdName",
",",
"_",
",",
"_",
",",
"err",
":=",
"getVolumeInfo",
"(",
"spec",
")",
"\n",
"if",
"er... | // GetGlobalMapPath returns global map path and error
// path: plugins/kubernetes.io/{PluginName}/volumeDevices/volumeID
// plugins/kubernetes.io/cinder/volumeDevices/vol-XXXXXX | [
"GetGlobalMapPath",
"returns",
"global",
"map",
"path",
"and",
"error",
"path",
":",
"plugins",
"/",
"kubernetes",
".",
"io",
"/",
"{",
"PluginName",
"}",
"/",
"volumeDevices",
"/",
"volumeID",
"plugins",
"/",
"kubernetes",
".",
"io",
"/",
"cinder",
"/",
"... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/cinder/cinder_block.go#L154-L160 | train | GetGlobalMapPath returns the path to the global map file for the volume. | [
30522,
4569,
2278,
1006,
3729,
1008,
29399,
6767,
12942,
2063,
1007,
2131,
23296,
16429,
2389,
2863,
13944,
2705,
1006,
28699,
1008,
3872,
1012,
28699,
1007,
1006,
5164,
1010,
7561,
1007,
1063,
22851,
18442,
1010,
1035,
1010,
1035,
1010,
94... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | third_party/forked/gonum/graph/traverse/visit_depth_first.go | Walk | func (d *VisitingDepthFirst) Walk(g VisitableGraph, from graph.Node, until func(graph.Node) bool) graph.Node {
if d.visited == nil {
d.visited = &intsets.Sparse{}
}
d.stack.Push(from)
d.visited.Insert(from.ID())
if until != nil && until(from) {
return from
}
var found graph.Node
for d.stack.Len() > 0 {
t := d.stack.Pop()
g.VisitFrom(t, func(n graph.Node) (shouldContinue bool) {
if d.EdgeFilter != nil && !d.EdgeFilter(g.Edge(t, n)) {
return true
}
if d.visited.Has(n.ID()) {
return true
}
if d.Visit != nil {
d.Visit(t, n)
}
d.visited.Insert(n.ID())
d.stack.Push(n)
if until != nil && until(n) {
found = n
return false
}
return true
})
if found != nil {
return found
}
}
return nil
} | go | func (d *VisitingDepthFirst) Walk(g VisitableGraph, from graph.Node, until func(graph.Node) bool) graph.Node {
if d.visited == nil {
d.visited = &intsets.Sparse{}
}
d.stack.Push(from)
d.visited.Insert(from.ID())
if until != nil && until(from) {
return from
}
var found graph.Node
for d.stack.Len() > 0 {
t := d.stack.Pop()
g.VisitFrom(t, func(n graph.Node) (shouldContinue bool) {
if d.EdgeFilter != nil && !d.EdgeFilter(g.Edge(t, n)) {
return true
}
if d.visited.Has(n.ID()) {
return true
}
if d.Visit != nil {
d.Visit(t, n)
}
d.visited.Insert(n.ID())
d.stack.Push(n)
if until != nil && until(n) {
found = n
return false
}
return true
})
if found != nil {
return found
}
}
return nil
} | [
"func",
"(",
"d",
"*",
"VisitingDepthFirst",
")",
"Walk",
"(",
"g",
"VisitableGraph",
",",
"from",
"graph",
".",
"Node",
",",
"until",
"func",
"(",
"graph",
".",
"Node",
")",
"bool",
")",
"graph",
".",
"Node",
"{",
"if",
"d",
".",
"visited",
"==",
... | // Walk performs a depth-first traversal of the graph g starting from the given node,
// depending on the EdgeFilter field and the until parameter if they are non-nil. The
// traversal follows edges for which EdgeFilter(edge) is true and returns the first node
// for which until(node) is true. During the traversal, if the Visit field is non-nil, it
// is called with the nodes joined by each followed edge. | [
"Walk",
"performs",
"a",
"depth",
"-",
"first",
"traversal",
"of",
"the",
"graph",
"g",
"starting",
"from",
"the",
"given",
"node",
"depending",
"on",
"the",
"EdgeFilter",
"field",
"and",
"the",
"until",
"parameter",
"if",
"they",
"are",
"non",
"-",
"nil",... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/third_party/forked/gonum/graph/traverse/visit_depth_first.go#L37-L73 | train | Walk traverses the graph starting from and until returns the first node that should continue. | [
30522,
4569,
2278,
1006,
1040,
1008,
5873,
3207,
13876,
2232,
8873,
12096,
1007,
3328,
1006,
1043,
3942,
3085,
14413,
1010,
2013,
10629,
1012,
30524,
1012,
4716,
1027,
1004,
20014,
13462,
2015,
1012,
20288,
1063,
1065,
1065,
1040,
1012,
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 | staging/src/k8s.io/api/extensions/v1beta1/zz_generated.deepcopy.go | DeepCopyInto | func (in *IPBlock) DeepCopyInto(out *IPBlock) {
*out = *in
if in.Except != nil {
in, out := &in.Except, &out.Except
*out = make([]string, len(*in))
copy(*out, *in)
}
return
} | go | func (in *IPBlock) DeepCopyInto(out *IPBlock) {
*out = *in
if in.Except != nil {
in, out := &in.Except, &out.Except
*out = make([]string, len(*in))
copy(*out, *in)
}
return
} | [
"func",
"(",
"in",
"*",
"IPBlock",
")",
"DeepCopyInto",
"(",
"out",
"*",
"IPBlock",
")",
"{",
"*",
"out",
"=",
"*",
"in",
"\n",
"if",
"in",
".",
"Except",
"!=",
"nil",
"{",
"in",
",",
"out",
":=",
"&",
"in",
".",
"Except",
",",
"&",
"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/staging/src/k8s.io/api/extensions/v1beta1/zz_generated.deepcopy.go#L529-L537 | train | DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new IPBlock. | [
30522,
4569,
2278,
1006,
1999,
1008,
12997,
23467,
1007,
2784,
3597,
7685,
18447,
2080,
1006,
2041,
1008,
12997,
23467,
1007,
1063,
1008,
2041,
1027,
1008,
1999,
2065,
1999,
1012,
3272,
999,
1027,
9152,
2140,
1063,
1999,
1010,
2041,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go | MarshalJSON | func (q Quantity) MarshalJSON() ([]byte, error) {
if len(q.s) > 0 {
out := make([]byte, len(q.s)+2)
out[0], out[len(out)-1] = '"', '"'
copy(out[1:], q.s)
return out, nil
}
result := make([]byte, int64QuantityExpectedBytes, int64QuantityExpectedBytes)
result[0] = '"'
number, suffix := q.CanonicalizeBytes(result[1:1])
// if the same slice was returned to us that we passed in, avoid another allocation by copying number into
// the source slice and returning that
if len(number) > 0 && &number[0] == &result[1] && (len(number)+len(suffix)+2) <= int64QuantityExpectedBytes {
number = append(number, suffix...)
number = append(number, '"')
return result[:1+len(number)], nil
}
// if CanonicalizeBytes needed more space than our slice provided, we may need to allocate again so use
// append
result = result[:1]
result = append(result, number...)
result = append(result, suffix...)
result = append(result, '"')
return result, nil
} | go | func (q Quantity) MarshalJSON() ([]byte, error) {
if len(q.s) > 0 {
out := make([]byte, len(q.s)+2)
out[0], out[len(out)-1] = '"', '"'
copy(out[1:], q.s)
return out, nil
}
result := make([]byte, int64QuantityExpectedBytes, int64QuantityExpectedBytes)
result[0] = '"'
number, suffix := q.CanonicalizeBytes(result[1:1])
// if the same slice was returned to us that we passed in, avoid another allocation by copying number into
// the source slice and returning that
if len(number) > 0 && &number[0] == &result[1] && (len(number)+len(suffix)+2) <= int64QuantityExpectedBytes {
number = append(number, suffix...)
number = append(number, '"')
return result[:1+len(number)], nil
}
// if CanonicalizeBytes needed more space than our slice provided, we may need to allocate again so use
// append
result = result[:1]
result = append(result, number...)
result = append(result, suffix...)
result = append(result, '"')
return result, nil
} | [
"func",
"(",
"q",
"Quantity",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"len",
"(",
"q",
".",
"s",
")",
">",
"0",
"{",
"out",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"len",
"(",
"q",
".",
"s",
")... | // MarshalJSON implements the json.Marshaller interface. | [
"MarshalJSON",
"implements",
"the",
"json",
".",
"Marshaller",
"interface",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go#L605-L629 | train | MarshalJSON returns the JSON representation of the quantity. | [
30522,
4569,
2278,
1006,
1053,
11712,
1007,
8610,
22578,
2239,
1006,
1007,
1006,
1031,
1033,
24880,
1010,
7561,
1007,
1063,
2065,
18798,
1006,
1053,
1012,
1055,
1007,
1028,
1014,
1063,
2041,
1024,
1027,
2191,
1006,
1031,
1033,
24880,
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/apiserver/pkg/apis/example/zz_generated.deepcopy.go | DeepCopyInto | func (in *ReplicaSet) DeepCopyInto(out *ReplicaSet) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
out.Status = in.Status
return
} | go | func (in *ReplicaSet) DeepCopyInto(out *ReplicaSet) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
out.Status = in.Status
return
} | [
"func",
"(",
"in",
"*",
"ReplicaSet",
")",
"DeepCopyInto",
"(",
"out",
"*",
"ReplicaSet",
")",
"{",
"*",
"out",
"=",
"*",
"in",
"\n",
"out",
".",
"TypeMeta",
"=",
"in",
".",
"TypeMeta",
"\n",
"in",
".",
"ObjectMeta",
".",
"DeepCopyInto",
"(",
"&",
... | // 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/apiserver/pkg/apis/example/zz_generated.deepcopy.go#L167-L174 | train | DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new ReplicaSet. | [
30522,
4569,
2278,
1006,
1999,
1008,
15059,
13462,
1007,
2784,
3597,
7685,
18447,
2080,
1006,
2041,
1008,
15059,
13462,
1007,
1063,
1008,
2041,
1027,
1008,
1999,
2041,
1012,
2828,
11368,
2050,
1027,
1999,
1012,
2828,
11368,
2050,
1999,
3052... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | UsingExternalCA | func UsingExternalCA(cfg *kubeadmapi.ClusterConfiguration) (bool, error) {
if err := validateCACert(certKeyLocation{cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName, "", "CA"}); err != nil {
return false, err
}
caKeyPath := filepath.Join(cfg.CertificatesDir, kubeadmconstants.CAKeyName)
if _, err := os.Stat(caKeyPath); !os.IsNotExist(err) {
return false, nil
}
if err := validateSignedCert(certKeyLocation{cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName, kubeadmconstants.APIServerCertAndKeyBaseName, "API server"}); err != nil {
return true, err
}
if err := validateSignedCert(certKeyLocation{cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName, kubeadmconstants.APIServerKubeletClientCertAndKeyBaseName, "API server kubelet client"}); err != nil {
return true, err
}
return true, nil
} | go | func UsingExternalCA(cfg *kubeadmapi.ClusterConfiguration) (bool, error) {
if err := validateCACert(certKeyLocation{cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName, "", "CA"}); err != nil {
return false, err
}
caKeyPath := filepath.Join(cfg.CertificatesDir, kubeadmconstants.CAKeyName)
if _, err := os.Stat(caKeyPath); !os.IsNotExist(err) {
return false, nil
}
if err := validateSignedCert(certKeyLocation{cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName, kubeadmconstants.APIServerCertAndKeyBaseName, "API server"}); err != nil {
return true, err
}
if err := validateSignedCert(certKeyLocation{cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName, kubeadmconstants.APIServerKubeletClientCertAndKeyBaseName, "API server kubelet client"}); err != nil {
return true, err
}
return true, nil
} | [
"func",
"UsingExternalCA",
"(",
"cfg",
"*",
"kubeadmapi",
".",
"ClusterConfiguration",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"err",
":=",
"validateCACert",
"(",
"certKeyLocation",
"{",
"cfg",
".",
"CertificatesDir",
",",
"kubeadmconstants",
".",
"CAC... | // UsingExternalCA determines whether the user is relying on an external CA. We currently implicitly determine this is the case
// when the CA Cert is present but the CA Key is not.
// This allows us to, e.g., skip generating certs or not start the csr signing controller.
// In case we are using an external front-proxy CA, the function validates the certificates signed by front-proxy CA that should be provided by the user. | [
"UsingExternalCA",
"determines",
"whether",
"the",
"user",
"is",
"relying",
"on",
"an",
"external",
"CA",
".",
"We",
"currently",
"implicitly",
"determine",
"this",
"is",
"the",
"case",
"when",
"the",
"CA",
"Cert",
"is",
"present",
"but",
"the",
"CA",
"Key",... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/phases/certs/certs.go#L318-L338 | train | UsingExternalCA checks if the cluster configuration uses external CA | [
30522,
4569,
2278,
2478,
10288,
16451,
2389,
3540,
1006,
12935,
2290,
1008,
13970,
4783,
4215,
2863,
8197,
1012,
9324,
8663,
8873,
27390,
3370,
1007,
1006,
22017,
2140,
1010,
7561,
1007,
1063,
2065,
9413,
2099,
1024,
1027,
9398,
3686,
3540,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/fake/fake_client.go | GetPluginCapabilities | func (f *IdentityClient) GetPluginCapabilities(ctx context.Context, in *csipb.GetPluginCapabilitiesRequest, opts ...grpc.CallOption) (*csipb.GetPluginCapabilitiesResponse, error) {
return nil, nil
} | go | func (f *IdentityClient) GetPluginCapabilities(ctx context.Context, in *csipb.GetPluginCapabilitiesRequest, opts ...grpc.CallOption) (*csipb.GetPluginCapabilitiesResponse, error) {
return nil, nil
} | [
"func",
"(",
"f",
"*",
"IdentityClient",
")",
"GetPluginCapabilities",
"(",
"ctx",
"context",
".",
"Context",
",",
"in",
"*",
"csipb",
".",
"GetPluginCapabilitiesRequest",
",",
"opts",
"...",
"grpc",
".",
"CallOption",
")",
"(",
"*",
"csipb",
".",
"GetPlugin... | // GetPluginCapabilities implements csi method | [
"GetPluginCapabilities",
"implements",
"csi",
"method"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/csi/fake/fake_client.go#L50-L52 | train | GetPluginCapabilities is the default call option for this function. | [
30522,
4569,
2278,
1006,
1042,
1008,
4767,
20464,
11638,
1007,
2131,
24759,
15916,
2378,
17695,
28518,
15909,
3111,
1006,
14931,
2595,
6123,
1012,
6123,
1010,
1999,
1008,
22174,
2361,
2497,
1012,
2131,
24759,
15916,
2378,
17695,
28518,
15909,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/volumebinder/volume_binder.go | DeletePodBindings | func (b *VolumeBinder) DeletePodBindings(pod *v1.Pod) {
cache := b.Binder.GetBindingsCache()
if cache != nil && pod != nil {
cache.DeleteBindings(pod)
}
} | go | func (b *VolumeBinder) DeletePodBindings(pod *v1.Pod) {
cache := b.Binder.GetBindingsCache()
if cache != nil && pod != nil {
cache.DeleteBindings(pod)
}
} | [
"func",
"(",
"b",
"*",
"VolumeBinder",
")",
"DeletePodBindings",
"(",
"pod",
"*",
"v1",
".",
"Pod",
")",
"{",
"cache",
":=",
"b",
".",
"Binder",
".",
"GetBindingsCache",
"(",
")",
"\n",
"if",
"cache",
"!=",
"nil",
"&&",
"pod",
"!=",
"nil",
"{",
"ca... | // DeletePodBindings will delete the cached volume bindings for the given pod. | [
"DeletePodBindings",
"will",
"delete",
"the",
"cached",
"volume",
"bindings",
"for",
"the",
"given",
"pod",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/scheduler/volumebinder/volume_binder.go#L56-L61 | train | DeletePodBindings deletes the bindings for a pod | [
30522,
4569,
2278,
1006,
30524,
1063,
17053,
1024,
1027,
1038,
1012,
14187,
2121,
1012,
2131,
8428,
4667,
15782,
5403,
1006,
1007,
2065,
17053,
999,
1027,
9152,
2140,
1004,
1004,
17491,
999,
1027,
9152,
2140,
1063,
17053,
1012,
3972,
12870,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | pkg/kubelet/images/helpers.go | throttleImagePulling | func throttleImagePulling(imageService kubecontainer.ImageService, qps float32, burst int) kubecontainer.ImageService {
if qps == 0.0 {
return imageService
}
return &throttledImageService{
ImageService: imageService,
limiter: flowcontrol.NewTokenBucketRateLimiter(qps, burst),
}
} | go | func throttleImagePulling(imageService kubecontainer.ImageService, qps float32, burst int) kubecontainer.ImageService {
if qps == 0.0 {
return imageService
}
return &throttledImageService{
ImageService: imageService,
limiter: flowcontrol.NewTokenBucketRateLimiter(qps, burst),
}
} | [
"func",
"throttleImagePulling",
"(",
"imageService",
"kubecontainer",
".",
"ImageService",
",",
"qps",
"float32",
",",
"burst",
"int",
")",
"kubecontainer",
".",
"ImageService",
"{",
"if",
"qps",
"==",
"0.0",
"{",
"return",
"imageService",
"\n",
"}",
"\n",
"re... | // throttleImagePulling wraps kubecontainer.ImageService to throttle image
// pulling based on the given QPS and burst limits. If QPS is zero, defaults
// to no throttling. | [
"throttleImagePulling",
"wraps",
"kubecontainer",
".",
"ImageService",
"to",
"throttle",
"image",
"pulling",
"based",
"on",
"the",
"given",
"QPS",
"and",
"burst",
"limits",
".",
"If",
"QPS",
"is",
"zero",
"defaults",
"to",
"no",
"throttling",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/images/helpers.go#L31-L39 | train | throttleImagePulling returns a new image service that will throttle the pulling of images. | [
30522,
4569,
2278,
24420,
9581,
3351,
14289,
13112,
1006,
4871,
2121,
7903,
2063,
13970,
4783,
8663,
18249,
2121,
1012,
4871,
2121,
7903,
2063,
1010,
1053,
4523,
14257,
16703,
1010,
6532,
20014,
1007,
13970,
4783,
8663,
18249,
2121,
1012,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/get/get.go | watch | func (o *GetOptions) watch(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
r := f.NewBuilder().
Unstructured().
NamespaceParam(o.Namespace).DefaultNamespace().AllNamespaces(o.AllNamespaces).
FilenameParam(o.ExplicitNamespace, &o.FilenameOptions).
LabelSelectorParam(o.LabelSelector).
FieldSelectorParam(o.FieldSelector).
ExportParam(o.Export).
RequestChunksOf(o.ChunkSize).
ResourceTypeOrNameArgs(true, args...).
SingleResourceType().
Latest().
TransformRequests(o.transformRequests).
Do()
if err := r.Err(); err != nil {
return err
}
infos, err := r.Infos()
if err != nil {
return err
}
if multipleGVKsRequested(infos) {
return i18n.Errorf("watch is only supported on individual resources and resource collections - more than 1 resource was found")
}
info := infos[0]
mapping := info.ResourceMapping()
printer, err := o.ToPrinter(mapping, o.AllNamespaces, false)
if err != nil {
return err
}
obj, err := r.Object()
if err != nil {
return err
}
// watching from resourceVersion 0, starts the watch at ~now and
// will return an initial watch event. Starting form ~now, rather
// the rv of the object will insure that we start the watch from
// inside the watch window, which the rv of the object might not be.
rv := "0"
isList := meta.IsListType(obj)
if isList {
// the resourceVersion of list objects is ~now but won't return
// an initial watch event
rv, err = meta.NewAccessor().ResourceVersion(obj)
if err != nil {
return err
}
}
writer := utilprinters.GetNewTabWriter(o.Out)
tableGK := metainternal.SchemeGroupVersion.WithKind("Table").GroupKind()
// print the current object
if !o.WatchOnly {
var objsToPrint []runtime.Object
if isList {
objsToPrint, _ = meta.ExtractList(obj)
} else {
objsToPrint = append(objsToPrint, obj)
}
for _, objToPrint := range objsToPrint {
if o.IsHumanReadablePrinter && objToPrint.GetObjectKind().GroupVersionKind().GroupKind() != tableGK {
// printing anything other than tables always takes the internal version, but the watch event uses externals
internalGV := mapping.GroupVersionKind.GroupKind().WithVersion(runtime.APIVersionInternal).GroupVersion()
objToPrint = attemptToConvertToInternal(objToPrint, legacyscheme.Scheme, internalGV)
}
if err := printer.PrintObj(objToPrint, writer); err != nil {
return fmt.Errorf("unable to output the provided object: %v", err)
}
}
writer.Flush()
}
// print watched changes
w, err := r.Watch(rv)
if err != nil {
return err
}
first := true
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
intr := interrupt.New(nil, cancel)
intr.Run(func() error {
_, err := watchtools.UntilWithoutRetry(ctx, w, func(e watch.Event) (bool, error) {
if !isList && first {
// drop the initial watch event in the single resource case
first = false
return false, nil
}
// printing always takes the internal version, but the watch event uses externals
// TODO fix printing to use server-side or be version agnostic
objToPrint := e.Object
if o.IsHumanReadablePrinter && objToPrint.GetObjectKind().GroupVersionKind().GroupKind() != tableGK {
internalGV := mapping.GroupVersionKind.GroupKind().WithVersion(runtime.APIVersionInternal).GroupVersion()
objToPrint = attemptToConvertToInternal(e.Object, legacyscheme.Scheme, internalGV)
}
if err := printer.PrintObj(objToPrint, writer); err != nil {
return false, err
}
writer.Flush()
return false, nil
})
return err
})
return nil
} | go | func (o *GetOptions) watch(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
r := f.NewBuilder().
Unstructured().
NamespaceParam(o.Namespace).DefaultNamespace().AllNamespaces(o.AllNamespaces).
FilenameParam(o.ExplicitNamespace, &o.FilenameOptions).
LabelSelectorParam(o.LabelSelector).
FieldSelectorParam(o.FieldSelector).
ExportParam(o.Export).
RequestChunksOf(o.ChunkSize).
ResourceTypeOrNameArgs(true, args...).
SingleResourceType().
Latest().
TransformRequests(o.transformRequests).
Do()
if err := r.Err(); err != nil {
return err
}
infos, err := r.Infos()
if err != nil {
return err
}
if multipleGVKsRequested(infos) {
return i18n.Errorf("watch is only supported on individual resources and resource collections - more than 1 resource was found")
}
info := infos[0]
mapping := info.ResourceMapping()
printer, err := o.ToPrinter(mapping, o.AllNamespaces, false)
if err != nil {
return err
}
obj, err := r.Object()
if err != nil {
return err
}
// watching from resourceVersion 0, starts the watch at ~now and
// will return an initial watch event. Starting form ~now, rather
// the rv of the object will insure that we start the watch from
// inside the watch window, which the rv of the object might not be.
rv := "0"
isList := meta.IsListType(obj)
if isList {
// the resourceVersion of list objects is ~now but won't return
// an initial watch event
rv, err = meta.NewAccessor().ResourceVersion(obj)
if err != nil {
return err
}
}
writer := utilprinters.GetNewTabWriter(o.Out)
tableGK := metainternal.SchemeGroupVersion.WithKind("Table").GroupKind()
// print the current object
if !o.WatchOnly {
var objsToPrint []runtime.Object
if isList {
objsToPrint, _ = meta.ExtractList(obj)
} else {
objsToPrint = append(objsToPrint, obj)
}
for _, objToPrint := range objsToPrint {
if o.IsHumanReadablePrinter && objToPrint.GetObjectKind().GroupVersionKind().GroupKind() != tableGK {
// printing anything other than tables always takes the internal version, but the watch event uses externals
internalGV := mapping.GroupVersionKind.GroupKind().WithVersion(runtime.APIVersionInternal).GroupVersion()
objToPrint = attemptToConvertToInternal(objToPrint, legacyscheme.Scheme, internalGV)
}
if err := printer.PrintObj(objToPrint, writer); err != nil {
return fmt.Errorf("unable to output the provided object: %v", err)
}
}
writer.Flush()
}
// print watched changes
w, err := r.Watch(rv)
if err != nil {
return err
}
first := true
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
intr := interrupt.New(nil, cancel)
intr.Run(func() error {
_, err := watchtools.UntilWithoutRetry(ctx, w, func(e watch.Event) (bool, error) {
if !isList && first {
// drop the initial watch event in the single resource case
first = false
return false, nil
}
// printing always takes the internal version, but the watch event uses externals
// TODO fix printing to use server-side or be version agnostic
objToPrint := e.Object
if o.IsHumanReadablePrinter && objToPrint.GetObjectKind().GroupVersionKind().GroupKind() != tableGK {
internalGV := mapping.GroupVersionKind.GroupKind().WithVersion(runtime.APIVersionInternal).GroupVersion()
objToPrint = attemptToConvertToInternal(e.Object, legacyscheme.Scheme, internalGV)
}
if err := printer.PrintObj(objToPrint, writer); err != nil {
return false, err
}
writer.Flush()
return false, nil
})
return err
})
return nil
} | [
"func",
"(",
"o",
"*",
"GetOptions",
")",
"watch",
"(",
"f",
"cmdutil",
".",
"Factory",
",",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"r",
":=",
"f",
".",
"NewBuilder",
"(",
")",
".",
"Unstructured",
... | // watch starts a client-side watch of one or more resources.
// TODO: remove the need for arguments here. | [
"watch",
"starts",
"a",
"client",
"-",
"side",
"watch",
"of",
"one",
"or",
"more",
"resources",
".",
"TODO",
":",
"remove",
"the",
"need",
"for",
"arguments",
"here",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubectl/cmd/get/get.go#L611-L722 | train | watch starts a watch event for the given object. | [
30522,
4569,
2278,
1006,
1051,
1008,
2131,
7361,
9285,
1007,
3422,
1006,
1042,
4642,
8566,
3775,
2140,
1012,
4713,
1010,
4642,
2094,
1008,
16604,
1012,
3094,
1010,
12098,
5620,
1031,
1033,
5164,
1007,
7561,
1063,
1054,
1024,
1027,
1042,
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/certificates/certificates/storage/storage.go | NewREST | func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, *StatusREST, *ApprovalREST) {
store := &genericregistry.Store{
NewFunc: func() runtime.Object { return &certificates.CertificateSigningRequest{} },
NewListFunc: func() runtime.Object { return &certificates.CertificateSigningRequestList{} },
DefaultQualifiedResource: certificates.Resource("certificatesigningrequests"),
CreateStrategy: csrregistry.Strategy,
UpdateStrategy: csrregistry.Strategy,
DeleteStrategy: csrregistry.Strategy,
ExportStrategy: csrregistry.Strategy,
TableConvertor: printerstorage.TableConvertor{TableGenerator: printers.NewTableGenerator().With(printersinternal.AddHandlers)},
}
options := &generic.StoreOptions{RESTOptions: optsGetter}
if err := store.CompleteWithOptions(options); err != nil {
panic(err) // TODO: Propagate error up
}
// Subresources use the same store and creation strategy, which only
// allows empty subs. Updates to an existing subresource are handled by
// dedicated strategies.
statusStore := *store
statusStore.UpdateStrategy = csrregistry.StatusStrategy
approvalStore := *store
approvalStore.UpdateStrategy = csrregistry.ApprovalStrategy
return &REST{store}, &StatusREST{store: &statusStore}, &ApprovalREST{store: &approvalStore}
} | go | func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, *StatusREST, *ApprovalREST) {
store := &genericregistry.Store{
NewFunc: func() runtime.Object { return &certificates.CertificateSigningRequest{} },
NewListFunc: func() runtime.Object { return &certificates.CertificateSigningRequestList{} },
DefaultQualifiedResource: certificates.Resource("certificatesigningrequests"),
CreateStrategy: csrregistry.Strategy,
UpdateStrategy: csrregistry.Strategy,
DeleteStrategy: csrregistry.Strategy,
ExportStrategy: csrregistry.Strategy,
TableConvertor: printerstorage.TableConvertor{TableGenerator: printers.NewTableGenerator().With(printersinternal.AddHandlers)},
}
options := &generic.StoreOptions{RESTOptions: optsGetter}
if err := store.CompleteWithOptions(options); err != nil {
panic(err) // TODO: Propagate error up
}
// Subresources use the same store and creation strategy, which only
// allows empty subs. Updates to an existing subresource are handled by
// dedicated strategies.
statusStore := *store
statusStore.UpdateStrategy = csrregistry.StatusStrategy
approvalStore := *store
approvalStore.UpdateStrategy = csrregistry.ApprovalStrategy
return &REST{store}, &StatusREST{store: &statusStore}, &ApprovalREST{store: &approvalStore}
} | [
"func",
"NewREST",
"(",
"optsGetter",
"generic",
".",
"RESTOptionsGetter",
")",
"(",
"*",
"REST",
",",
"*",
"StatusREST",
",",
"*",
"ApprovalREST",
")",
"{",
"store",
":=",
"&",
"genericregistry",
".",
"Store",
"{",
"NewFunc",
":",
"func",
"(",
")",
"run... | // NewREST returns a registry which will store CertificateSigningRequest in the given helper | [
"NewREST",
"returns",
"a",
"registry",
"which",
"will",
"store",
"CertificateSigningRequest",
"in",
"the",
"given",
"helper"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/registry/certificates/certificates/storage/storage.go#L40-L68 | train | NewREST returns a RESTStorage object that will work against certificates signing requests. | [
30522,
4569,
2278,
2047,
28533,
1006,
23569,
28745,
7585,
2099,
12391,
1012,
2717,
7361,
9285,
18150,
3334,
1007,
1006,
1008,
2717,
1010,
1008,
3570,
28533,
1010,
1008,
6226,
28533,
1007,
1063,
3573,
1024,
1027,
1004,
12391,
2890,
24063,
28... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/autoscaling/horizontalpodautoscaler/strategy.go | ValidateUpdate | func (autoscalerStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
return validation.ValidateHorizontalPodAutoscalerUpdate(obj.(*autoscaling.HorizontalPodAutoscaler), old.(*autoscaling.HorizontalPodAutoscaler))
} | go | func (autoscalerStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
return validation.ValidateHorizontalPodAutoscalerUpdate(obj.(*autoscaling.HorizontalPodAutoscaler), old.(*autoscaling.HorizontalPodAutoscaler))
} | [
"func",
"(",
"autoscalerStrategy",
")",
"ValidateUpdate",
"(",
"ctx",
"context",
".",
"Context",
",",
"obj",
",",
"old",
"runtime",
".",
"Object",
")",
"field",
".",
"ErrorList",
"{",
"return",
"validation",
".",
"ValidateHorizontalPodAutoscalerUpdate",
"(",
"ob... | // ValidateUpdate is the default update validation for an end user. | [
"ValidateUpdate",
"is",
"the",
"default",
"update",
"validation",
"for",
"an",
"end",
"user",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/registry/autoscaling/horizontalpodautoscaler/strategy.go#L77-L79 | train | ValidateUpdate validates an update of an autoscaler. | [
30522,
4569,
2278,
1006,
8285,
15782,
12910,
6494,
2618,
6292,
1007,
9398,
3686,
6279,
13701,
1006,
14931,
2595,
6123,
1012,
6123,
1010,
27885,
3501,
1010,
2214,
2448,
7292,
1012,
4874,
1007,
2492,
1012,
7561,
9863,
1063,
2709,
27354,
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 | cmd/kubeadm/app/util/config/initconfiguration.go | LoadInitConfigurationFromFile | func LoadInitConfigurationFromFile(cfgPath string) (*kubeadmapi.InitConfiguration, error) {
klog.V(1).Infof("loading configuration from %q", cfgPath)
b, err := ioutil.ReadFile(cfgPath)
if err != nil {
return nil, errors.Wrapf(err, "unable to read config from %q ", cfgPath)
}
return BytesToInitConfiguration(b)
} | go | func LoadInitConfigurationFromFile(cfgPath string) (*kubeadmapi.InitConfiguration, error) {
klog.V(1).Infof("loading configuration from %q", cfgPath)
b, err := ioutil.ReadFile(cfgPath)
if err != nil {
return nil, errors.Wrapf(err, "unable to read config from %q ", cfgPath)
}
return BytesToInitConfiguration(b)
} | [
"func",
"LoadInitConfigurationFromFile",
"(",
"cfgPath",
"string",
")",
"(",
"*",
"kubeadmapi",
".",
"InitConfiguration",
",",
"error",
")",
"{",
"klog",
".",
"V",
"(",
"1",
")",
".",
"Infof",
"(",
"\"",
"\"",
",",
"cfgPath",
")",
"\n\n",
"b",
",",
"er... | // LoadInitConfigurationFromFile loads a supported versioned InitConfiguration from a file, converts it into internal config, defaults it and verifies it. | [
"LoadInitConfigurationFromFile",
"loads",
"a",
"supported",
"versioned",
"InitConfiguration",
"from",
"a",
"file",
"converts",
"it",
"into",
"internal",
"config",
"defaults",
"it",
"and",
"verifies",
"it",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/util/config/initconfiguration.go#L185-L194 | train | LoadInitConfigurationFromFile loads the init configuration from the given path. | [
30522,
4569,
2278,
7170,
5498,
13535,
2239,
8873,
27390,
3370,
19699,
5358,
8873,
2571,
1006,
12935,
21600,
8988,
5164,
1007,
1006,
1008,
13970,
4783,
4215,
2863,
8197,
1012,
1999,
4183,
8663,
8873,
27390,
3370,
1010,
7561,
1007,
1063,
1047... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 *EnvFromSource) DeepCopy() *EnvFromSource {
if in == nil {
return nil
}
out := new(EnvFromSource)
in.DeepCopyInto(out)
return out
} | go | func (in *EnvFromSource) DeepCopy() *EnvFromSource {
if in == nil {
return nil
}
out := new(EnvFromSource)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"EnvFromSource",
")",
"DeepCopy",
"(",
")",
"*",
"EnvFromSource",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"EnvFromSource",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvFromSource. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"EnvFromSource",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/zz_generated.deepcopy.go#L1210-L1217 | train | DeepCopy is an autogenerated deepcopy function copying the receiver creating a new EnvFromSource. | [
30522,
4569,
2278,
1006,
1999,
1008,
4372,
2615,
19699,
22225,
8162,
3401,
1007,
2784,
3597,
7685,
1006,
1007,
1008,
4372,
2615,
19699,
22225,
8162,
3401,
1063,
2065,
1999,
1027,
1027,
9152,
2140,
1063,
2709,
9152,
2140,
1065,
2041,
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/apis/apps/zz_generated.deepcopy.go | DeepCopy | func (in *ReplicaSetSpec) DeepCopy() *ReplicaSetSpec {
if in == nil {
return nil
}
out := new(ReplicaSetSpec)
in.DeepCopyInto(out)
return out
} | go | func (in *ReplicaSetSpec) DeepCopy() *ReplicaSetSpec {
if in == nil {
return nil
}
out := new(ReplicaSetSpec)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ReplicaSetSpec",
")",
"DeepCopy",
"(",
")",
"*",
"ReplicaSetSpec",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ReplicaSetSpec",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"ou... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplicaSetSpec. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ReplicaSetSpec",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/apps/zz_generated.deepcopy.go#L536-L543 | train | DeepCopy is an autogenerated deepcopy function copying the receiver creating a new ReplicaSetSpec. | [
30522,
4569,
2278,
1006,
1999,
1008,
15059,
13462,
13102,
8586,
1007,
2784,
3597,
7685,
1006,
1007,
1008,
15059,
13462,
13102,
8586,
1063,
2065,
1999,
1027,
1027,
9152,
2140,
1063,
2709,
9152,
2140,
1065,
2041,
1024,
1027,
2047,
1006,
15059... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/index.go | findByClaim | func (pvIndex *persistentVolumeOrderedIndex) findByClaim(claim *v1.PersistentVolumeClaim, delayBinding bool) (*v1.PersistentVolume, error) {
// PVs are indexed by their access modes to allow easier searching. Each
// index is the string representation of a set of access modes. There is a
// finite number of possible sets and PVs will only be indexed in one of
// them (whichever index matches the PV's modes).
//
// A request for resources will always specify its desired access modes.
// Any matching PV must have at least that number of access modes, but it
// can have more. For example, a user asks for ReadWriteOnce but a GCEPD
// is available, which is ReadWriteOnce+ReadOnlyMany.
//
// Searches are performed against a set of access modes, so we can attempt
// not only the exact matching modes but also potential matches (the GCEPD
// example above).
allPossibleModes := pvIndex.allPossibleMatchingAccessModes(claim.Spec.AccessModes)
for _, modes := range allPossibleModes {
volumes, err := pvIndex.listByAccessModes(modes)
if err != nil {
return nil, err
}
bestVol, err := findMatchingVolume(claim, volumes, nil /* node for topology binding*/, nil /* exclusion map */, delayBinding)
if err != nil {
return nil, err
}
if bestVol != nil {
return bestVol, nil
}
}
return nil, nil
} | go | func (pvIndex *persistentVolumeOrderedIndex) findByClaim(claim *v1.PersistentVolumeClaim, delayBinding bool) (*v1.PersistentVolume, error) {
// PVs are indexed by their access modes to allow easier searching. Each
// index is the string representation of a set of access modes. There is a
// finite number of possible sets and PVs will only be indexed in one of
// them (whichever index matches the PV's modes).
//
// A request for resources will always specify its desired access modes.
// Any matching PV must have at least that number of access modes, but it
// can have more. For example, a user asks for ReadWriteOnce but a GCEPD
// is available, which is ReadWriteOnce+ReadOnlyMany.
//
// Searches are performed against a set of access modes, so we can attempt
// not only the exact matching modes but also potential matches (the GCEPD
// example above).
allPossibleModes := pvIndex.allPossibleMatchingAccessModes(claim.Spec.AccessModes)
for _, modes := range allPossibleModes {
volumes, err := pvIndex.listByAccessModes(modes)
if err != nil {
return nil, err
}
bestVol, err := findMatchingVolume(claim, volumes, nil /* node for topology binding*/, nil /* exclusion map */, delayBinding)
if err != nil {
return nil, err
}
if bestVol != nil {
return bestVol, nil
}
}
return nil, nil
} | [
"func",
"(",
"pvIndex",
"*",
"persistentVolumeOrderedIndex",
")",
"findByClaim",
"(",
"claim",
"*",
"v1",
".",
"PersistentVolumeClaim",
",",
"delayBinding",
"bool",
")",
"(",
"*",
"v1",
".",
"PersistentVolume",
",",
"error",
")",
"{",
"// PVs are indexed by their ... | // find returns the nearest PV from the ordered list or nil if a match is not found | [
"find",
"returns",
"the",
"nearest",
"PV",
"from",
"the",
"ordered",
"list",
"or",
"nil",
"if",
"a",
"match",
"is",
"not",
"found"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/volume/persistentvolume/index.go#L77-L109 | train | findByClaim searches the index for a given claim and returns the best matching PV. | [
30522,
4569,
2278,
1006,
26189,
22254,
10288,
1008,
14516,
6767,
12942,
8780,
26764,
2098,
22254,
10288,
1007,
2424,
3762,
25154,
1006,
4366,
1008,
1058,
2487,
1012,
14516,
6767,
12942,
8586,
19771,
2213,
1010,
8536,
8428,
4667,
22017,
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 | staging/src/k8s.io/client-go/tools/cache/reflector.go | LastSyncResourceVersion | func (r *Reflector) LastSyncResourceVersion() string {
r.lastSyncResourceVersionMutex.RLock()
defer r.lastSyncResourceVersionMutex.RUnlock()
return r.lastSyncResourceVersion
} | go | func (r *Reflector) LastSyncResourceVersion() string {
r.lastSyncResourceVersionMutex.RLock()
defer r.lastSyncResourceVersionMutex.RUnlock()
return r.lastSyncResourceVersion
} | [
"func",
"(",
"r",
"*",
"Reflector",
")",
"LastSyncResourceVersion",
"(",
")",
"string",
"{",
"r",
".",
"lastSyncResourceVersionMutex",
".",
"RLock",
"(",
")",
"\n",
"defer",
"r",
".",
"lastSyncResourceVersionMutex",
".",
"RUnlock",
"(",
")",
"\n",
"return",
... | // LastSyncResourceVersion is the resource version observed when last sync with the underlying store
// The value returned is not synchronized with access to the underlying store and is not thread-safe | [
"LastSyncResourceVersion",
"is",
"the",
"resource",
"version",
"observed",
"when",
"last",
"sync",
"with",
"the",
"underlying",
"store",
"The",
"value",
"returned",
"is",
"not",
"synchronized",
"with",
"access",
"to",
"the",
"underlying",
"store",
"and",
"is",
"... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/tools/cache/reflector.go#L391-L395 | train | LastSyncResourceVersion returns the last sync resource version. | [
30522,
4569,
2278,
1006,
1054,
1008,
8339,
2953,
1007,
16180,
6038,
16748,
6499,
3126,
3401,
27774,
1006,
1007,
5164,
1063,
1054,
1012,
16180,
6038,
16748,
6499,
3126,
3401,
27774,
26746,
2595,
1012,
1054,
7878,
1006,
1007,
13366,
2121,
105... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/cloud-provider/plugins.go | GetCloudProvider | func GetCloudProvider(name string, config io.Reader) (Interface, error) {
providersMutex.Lock()
defer providersMutex.Unlock()
f, found := providers[name]
if !found {
return nil, nil
}
return f(config)
} | go | func GetCloudProvider(name string, config io.Reader) (Interface, error) {
providersMutex.Lock()
defer providersMutex.Unlock()
f, found := providers[name]
if !found {
return nil, nil
}
return f(config)
} | [
"func",
"GetCloudProvider",
"(",
"name",
"string",
",",
"config",
"io",
".",
"Reader",
")",
"(",
"Interface",
",",
"error",
")",
"{",
"providersMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"providersMutex",
".",
"Unlock",
"(",
")",
"\n",
"f",
",",
"fo... | // GetCloudProvider creates an instance of the named cloud provider, or nil if
// the name is unknown. The error return is only used if the named provider
// was known but failed to initialize. The config parameter specifies the
// io.Reader handler of the configuration file for the cloud provider, or nil
// for no configuration. | [
"GetCloudProvider",
"creates",
"an",
"instance",
"of",
"the",
"named",
"cloud",
"provider",
"or",
"nil",
"if",
"the",
"name",
"is",
"unknown",
".",
"The",
"error",
"return",
"is",
"only",
"used",
"if",
"the",
"named",
"provider",
"was",
"known",
"but",
"fa... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/cloud-provider/plugins.go#L82-L90 | train | GetCloudProvider returns a cloud provider by name. | [
30522,
4569,
2278,
2131,
20464,
19224,
21572,
17258,
2121,
1006,
2171,
5164,
1010,
9530,
8873,
2290,
22834,
1012,
8068,
1007,
1006,
8278,
1010,
7561,
30524,
2709,
9152,
2140,
1010,
9152,
2140,
1065,
2709,
1042,
1006,
9530,
8873,
2290,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | staging/src/k8s.io/apimachinery/pkg/runtime/codec.go | KindForGroupVersionKinds | func (internalGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersionKind) (schema.GroupVersionKind, bool) {
for _, kind := range kinds {
if kind.Version == APIVersionInternal {
return kind, true
}
}
for _, kind := range kinds {
return schema.GroupVersionKind{Group: kind.Group, Version: APIVersionInternal, Kind: kind.Kind}, true
}
return schema.GroupVersionKind{}, false
} | go | func (internalGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersionKind) (schema.GroupVersionKind, bool) {
for _, kind := range kinds {
if kind.Version == APIVersionInternal {
return kind, true
}
}
for _, kind := range kinds {
return schema.GroupVersionKind{Group: kind.Group, Version: APIVersionInternal, Kind: kind.Kind}, true
}
return schema.GroupVersionKind{}, false
} | [
"func",
"(",
"internalGroupVersioner",
")",
"KindForGroupVersionKinds",
"(",
"kinds",
"[",
"]",
"schema",
".",
"GroupVersionKind",
")",
"(",
"schema",
".",
"GroupVersionKind",
",",
"bool",
")",
"{",
"for",
"_",
",",
"kind",
":=",
"range",
"kinds",
"{",
"if",... | // KindForGroupVersionKinds returns an internal Kind if one is found, or converts the first provided kind to the internal version. | [
"KindForGroupVersionKinds",
"returns",
"an",
"internal",
"Kind",
"if",
"one",
"is",
"found",
"or",
"converts",
"the",
"first",
"provided",
"kind",
"to",
"the",
"internal",
"version",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/runtime/codec.go#L244-L254 | train | KindForGroupVersionKinds returns the kind of the given kinds. | [
30522,
4569,
2278,
1006,
4722,
17058,
27774,
2121,
1007,
2785,
29278,
17058,
27774,
18824,
2015,
1006,
7957,
1031,
1033,
8040,
28433,
1012,
2177,
27774,
18824,
1007,
1006,
8040,
28433,
1012,
2177,
27774,
18824,
1010,
22017,
2140,
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/proxy/apis/config/fuzzer/fuzzer.go | Funcs | func Funcs(codecs runtimeserializer.CodecFactory) []interface{} {
return []interface{}{
func(obj *kubeproxyconfig.KubeProxyConfiguration, c fuzz.Continue) {
c.FuzzNoCustom(obj)
obj.BindAddress = fmt.Sprintf("%d.%d.%d.%d", c.Intn(256), c.Intn(256), c.Intn(256), c.Intn(256))
obj.ClientConnection.ContentType = c.RandString()
obj.Conntrack.MaxPerCore = utilpointer.Int32Ptr(c.Int31())
obj.Conntrack.Min = utilpointer.Int32Ptr(c.Int31())
obj.Conntrack.TCPCloseWaitTimeout = &metav1.Duration{Duration: time.Duration(c.Int63()) * time.Hour}
obj.Conntrack.TCPEstablishedTimeout = &metav1.Duration{Duration: time.Duration(c.Int63()) * time.Hour}
obj.FeatureGates = map[string]bool{c.RandString(): true}
obj.HealthzBindAddress = fmt.Sprintf("%d.%d.%d.%d:%d", c.Intn(256), c.Intn(256), c.Intn(256), c.Intn(256), c.Intn(65536))
obj.IPTables.MasqueradeBit = utilpointer.Int32Ptr(c.Int31())
obj.MetricsBindAddress = fmt.Sprintf("%d.%d.%d.%d:%d", c.Intn(256), c.Intn(256), c.Intn(256), c.Intn(256), c.Intn(65536))
obj.OOMScoreAdj = utilpointer.Int32Ptr(c.Int31())
obj.ResourceContainer = "foo"
obj.ClientConnection.ContentType = "bar"
obj.NodePortAddresses = []string{"1.2.3.0/24"}
},
}
} | go | func Funcs(codecs runtimeserializer.CodecFactory) []interface{} {
return []interface{}{
func(obj *kubeproxyconfig.KubeProxyConfiguration, c fuzz.Continue) {
c.FuzzNoCustom(obj)
obj.BindAddress = fmt.Sprintf("%d.%d.%d.%d", c.Intn(256), c.Intn(256), c.Intn(256), c.Intn(256))
obj.ClientConnection.ContentType = c.RandString()
obj.Conntrack.MaxPerCore = utilpointer.Int32Ptr(c.Int31())
obj.Conntrack.Min = utilpointer.Int32Ptr(c.Int31())
obj.Conntrack.TCPCloseWaitTimeout = &metav1.Duration{Duration: time.Duration(c.Int63()) * time.Hour}
obj.Conntrack.TCPEstablishedTimeout = &metav1.Duration{Duration: time.Duration(c.Int63()) * time.Hour}
obj.FeatureGates = map[string]bool{c.RandString(): true}
obj.HealthzBindAddress = fmt.Sprintf("%d.%d.%d.%d:%d", c.Intn(256), c.Intn(256), c.Intn(256), c.Intn(256), c.Intn(65536))
obj.IPTables.MasqueradeBit = utilpointer.Int32Ptr(c.Int31())
obj.MetricsBindAddress = fmt.Sprintf("%d.%d.%d.%d:%d", c.Intn(256), c.Intn(256), c.Intn(256), c.Intn(256), c.Intn(65536))
obj.OOMScoreAdj = utilpointer.Int32Ptr(c.Int31())
obj.ResourceContainer = "foo"
obj.ClientConnection.ContentType = "bar"
obj.NodePortAddresses = []string{"1.2.3.0/24"}
},
}
} | [
"func",
"Funcs",
"(",
"codecs",
"runtimeserializer",
".",
"CodecFactory",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"return",
"[",
"]",
"interface",
"{",
"}",
"{",
"func",
"(",
"obj",
"*",
"kubeproxyconfig",
".",
"KubeProxyConfiguration",
",",
"c",
"fuzz"... | // Funcs returns the fuzzer functions for the kube-proxy apis. | [
"Funcs",
"returns",
"the",
"fuzzer",
"functions",
"for",
"the",
"kube",
"-",
"proxy",
"apis",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/proxy/apis/config/fuzzer/fuzzer.go#L32-L52 | train | Funcs returns a function that can be used to create a new cluster connection | [
30522,
4569,
2278,
4569,
6169,
1006,
3642,
6169,
2448,
7292,
8043,
4818,
17629,
1012,
3642,
2278,
21450,
1007,
1031,
1033,
8278,
1063,
1065,
1063,
2709,
1031,
1033,
8278,
1063,
1065,
1063,
4569,
2278,
1006,
27885,
3501,
1008,
13970,
4783,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | DeepCopy | func (in *PredicateArgument) DeepCopy() *PredicateArgument {
if in == nil {
return nil
}
out := new(PredicateArgument)
in.DeepCopyInto(out)
return out
} | go | func (in *PredicateArgument) DeepCopy() *PredicateArgument {
if in == nil {
return nil
}
out := new(PredicateArgument)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"PredicateArgument",
")",
"DeepCopy",
"(",
")",
"*",
"PredicateArgument",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"PredicateArgument",
")",
"\n",
"in",
".",
"DeepCopyInto",
"... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PredicateArgument. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"PredicateArgument",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/scheduler/api/v1/zz_generated.deepcopy.go#L488-L495 | train | DeepCopy is an autogenerated deepcopy function copying the receiver creating a new PredicateArgument. | [
30522,
4569,
2278,
1006,
1999,
1008,
3653,
16467,
2906,
22850,
4765,
1007,
2784,
3597,
7685,
1006,
1007,
1008,
3653,
16467,
2906,
22850,
4765,
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/apis/core/v1/zz_generated.conversion.go | Convert_v1_LoadBalancerStatus_To_core_LoadBalancerStatus | func Convert_v1_LoadBalancerStatus_To_core_LoadBalancerStatus(in *v1.LoadBalancerStatus, out *core.LoadBalancerStatus, s conversion.Scope) error {
return autoConvert_v1_LoadBalancerStatus_To_core_LoadBalancerStatus(in, out, s)
} | go | func Convert_v1_LoadBalancerStatus_To_core_LoadBalancerStatus(in *v1.LoadBalancerStatus, out *core.LoadBalancerStatus, s conversion.Scope) error {
return autoConvert_v1_LoadBalancerStatus_To_core_LoadBalancerStatus(in, out, s)
} | [
"func",
"Convert_v1_LoadBalancerStatus_To_core_LoadBalancerStatus",
"(",
"in",
"*",
"v1",
".",
"LoadBalancerStatus",
",",
"out",
"*",
"core",
".",
"LoadBalancerStatus",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoConvert_v1_LoadBalancerStatus... | // Convert_v1_LoadBalancerStatus_To_core_LoadBalancerStatus is an autogenerated conversion function. | [
"Convert_v1_LoadBalancerStatus_To_core_LoadBalancerStatus",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/v1/zz_generated.conversion.go#L4094-L4096 | train | Convert_v1_LoadBalancerStatus_To_core_LoadBalancerStatus is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
1058,
2487,
1035,
7170,
26657,
12096,
15590,
1035,
2000,
1035,
4563,
1035,
7170,
26657,
12096,
15590,
1006,
1999,
1008,
1058,
2487,
1012,
7170,
26657,
12096,
15590,
1010,
2041,
1008,
4563,
1012,
7170,
26657,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/apis/meta/v1/time.go | Unix | func Unix(sec int64, nsec int64) Time {
return Time{time.Unix(sec, nsec)}
} | go | func Unix(sec int64, nsec int64) Time {
return Time{time.Unix(sec, nsec)}
} | [
"func",
"Unix",
"(",
"sec",
"int64",
",",
"nsec",
"int64",
")",
"Time",
"{",
"return",
"Time",
"{",
"time",
".",
"Unix",
"(",
"sec",
",",
"nsec",
")",
"}",
"\n",
"}"
] | // Unix returns the local time corresponding to the given Unix time
// by wrapping time.Unix. | [
"Unix",
"returns",
"the",
"local",
"time",
"corresponding",
"to",
"the",
"given",
"Unix",
"time",
"by",
"wrapping",
"time",
".",
"Unix",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/time.go#L89-L91 | train | Unix returns a Time from a Unix time. | [
30522,
4569,
2278,
19998,
1006,
10819,
20014,
21084,
1010,
24978,
8586,
20014,
21084,
1007,
2051,
1063,
2709,
2051,
1063,
2051,
1012,
19998,
1006,
10819,
1010,
24978,
8586,
1007,
1065,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/selinux_util.go | modifySecurityOption | func modifySecurityOption(config []string, name, value string) []string {
if len(value) > 0 {
config = append(config, fmt.Sprintf("%s:%s", name, value))
}
return config
} | go | func modifySecurityOption(config []string, name, value string) []string {
if len(value) > 0 {
config = append(config, fmt.Sprintf("%s:%s", name, value))
}
return config
} | [
"func",
"modifySecurityOption",
"(",
"config",
"[",
"]",
"string",
",",
"name",
",",
"value",
"string",
")",
"[",
"]",
"string",
"{",
"if",
"len",
"(",
"value",
")",
">",
"0",
"{",
"config",
"=",
"append",
"(",
"config",
",",
"fmt",
".",
"Sprintf",
... | // modifySecurityOption adds the security option of name to the config array
// with value in the form of name:value. | [
"modifySecurityOption",
"adds",
"the",
"security",
"option",
"of",
"name",
"to",
"the",
"config",
"array",
"with",
"value",
"in",
"the",
"form",
"of",
"name",
":",
"value",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/dockershim/selinux_util.go#L80-L86 | train | modifySecurityOption adds a new security option to the config slice | [
30522,
4569,
2278,
19933,
3366,
10841,
15780,
7361,
3508,
1006,
9530,
8873,
2290,
1031,
1033,
5164,
1010,
2171,
1010,
3643,
5164,
1007,
1031,
1033,
5164,
1063,
2065,
18798,
1006,
3643,
1007,
1028,
1014,
1063,
9530,
8873,
2290,
1027,
10439,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/iptables/iptables.go | checkRuleUsingCheck | func (runner *runner) checkRuleUsingCheck(args []string) (bool, error) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
out, err := runner.runContext(ctx, opCheckRule, args)
if ctx.Err() == context.DeadlineExceeded {
return false, fmt.Errorf("timed out while checking rules")
}
if err == nil {
return true, nil
}
if ee, ok := err.(utilexec.ExitError); ok {
// iptables uses exit(1) to indicate a failure of the operation,
// as compared to a malformed commandline, for example.
if ee.Exited() && ee.ExitStatus() == 1 {
return false, nil
}
}
return false, fmt.Errorf("error checking rule: %v: %s", err, out)
} | go | func (runner *runner) checkRuleUsingCheck(args []string) (bool, error) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
out, err := runner.runContext(ctx, opCheckRule, args)
if ctx.Err() == context.DeadlineExceeded {
return false, fmt.Errorf("timed out while checking rules")
}
if err == nil {
return true, nil
}
if ee, ok := err.(utilexec.ExitError); ok {
// iptables uses exit(1) to indicate a failure of the operation,
// as compared to a malformed commandline, for example.
if ee.Exited() && ee.ExitStatus() == 1 {
return false, nil
}
}
return false, fmt.Errorf("error checking rule: %v: %s", err, out)
} | [
"func",
"(",
"runner",
"*",
"runner",
")",
"checkRuleUsingCheck",
"(",
"args",
"[",
"]",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
... | // Executes the rule check using the "-C" flag | [
"Executes",
"the",
"rule",
"check",
"using",
"the",
"-",
"C",
"flag"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/util/iptables/iptables.go#L505-L524 | train | checkRuleUsingCheck checks the rule using iptables | [
30522,
4569,
2278,
1006,
5479,
1008,
5479,
1007,
4638,
6820,
2571,
18161,
5403,
3600,
1006,
12098,
5620,
1031,
1033,
5164,
1007,
1006,
22017,
2140,
1010,
7561,
1007,
1063,
14931,
2595,
1010,
17542,
1024,
1027,
6123,
1012,
2007,
7292,
5833,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/taint/taint.go | validateFlags | func (o TaintOptions) validateFlags() error {
// Cannot have a non-empty selector and all flag set. They are mutually exclusive.
if o.all && o.selector != "" {
return fmt.Errorf("setting 'all' parameter with a non empty selector is prohibited.")
}
// If both selector and all are not set.
if !o.all && o.selector == "" {
if len(o.resources) < 2 {
return fmt.Errorf("at least one resource name must be specified since 'all' parameter is not set")
} else {
return nil
}
}
return nil
} | go | func (o TaintOptions) validateFlags() error {
// Cannot have a non-empty selector and all flag set. They are mutually exclusive.
if o.all && o.selector != "" {
return fmt.Errorf("setting 'all' parameter with a non empty selector is prohibited.")
}
// If both selector and all are not set.
if !o.all && o.selector == "" {
if len(o.resources) < 2 {
return fmt.Errorf("at least one resource name must be specified since 'all' parameter is not set")
} else {
return nil
}
}
return nil
} | [
"func",
"(",
"o",
"TaintOptions",
")",
"validateFlags",
"(",
")",
"error",
"{",
"// Cannot have a non-empty selector and all flag set. They are mutually exclusive.",
"if",
"o",
".",
"all",
"&&",
"o",
".",
"selector",
"!=",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"E... | // validateFlags checks for the validation of flags for kubectl taints. | [
"validateFlags",
"checks",
"for",
"the",
"validation",
"of",
"flags",
"for",
"kubectl",
"taints",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubectl/cmd/taint/taint.go#L183-L197 | train | validateFlags checks that all and all flags are set. | [
30522,
4569,
2278,
1006,
1051,
13843,
13663,
16790,
2015,
1007,
9398,
3686,
10258,
26454,
1006,
1007,
7561,
1063,
1013,
1013,
3685,
2031,
1037,
2512,
1011,
4064,
27000,
1998,
2035,
5210,
2275,
1012,
2027,
2024,
20271,
7262,
1012,
2065,
1051... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/util/utils.go | GetPodPriority | func GetPodPriority(pod *v1.Pod) int32 {
if pod.Spec.Priority != nil {
return *pod.Spec.Priority
}
// When priority of a running pod is nil, it means it was created at a time
// that there was no global default priority class and the priority class
// name of the pod was empty. So, we resolve to the static default priority.
return scheduling.DefaultPriorityWhenNoDefaultClassExists
} | go | func GetPodPriority(pod *v1.Pod) int32 {
if pod.Spec.Priority != nil {
return *pod.Spec.Priority
}
// When priority of a running pod is nil, it means it was created at a time
// that there was no global default priority class and the priority class
// name of the pod was empty. So, we resolve to the static default priority.
return scheduling.DefaultPriorityWhenNoDefaultClassExists
} | [
"func",
"GetPodPriority",
"(",
"pod",
"*",
"v1",
".",
"Pod",
")",
"int32",
"{",
"if",
"pod",
".",
"Spec",
".",
"Priority",
"!=",
"nil",
"{",
"return",
"*",
"pod",
".",
"Spec",
".",
"Priority",
"\n",
"}",
"\n",
"// When priority of a running pod is nil, it ... | // GetPodPriority returns priority of the given pod. | [
"GetPodPriority",
"returns",
"priority",
"of",
"the",
"given",
"pod",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/scheduler/util/utils.go#L60-L68 | train | GetPodPriority returns the priority of a running pod. | [
30522,
4569,
2278,
2131,
27633,
18098,
25346,
3012,
1006,
17491,
1008,
1058,
2487,
1012,
17491,
1007,
20014,
16703,
1063,
2065,
17491,
1012,
28699,
1012,
9470,
999,
1027,
9152,
2140,
1063,
2709,
1008,
17491,
1012,
28699,
1012,
9470,
1065,
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/apps/zz_generated.deepcopy.go | DeepCopyInto | func (in *DeploymentRollback) DeepCopyInto(out *DeploymentRollback) {
*out = *in
out.TypeMeta = in.TypeMeta
if in.UpdatedAnnotations != nil {
in, out := &in.UpdatedAnnotations, &out.UpdatedAnnotations
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
out.RollbackTo = in.RollbackTo
return
} | go | func (in *DeploymentRollback) DeepCopyInto(out *DeploymentRollback) {
*out = *in
out.TypeMeta = in.TypeMeta
if in.UpdatedAnnotations != nil {
in, out := &in.UpdatedAnnotations, &out.UpdatedAnnotations
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
out.RollbackTo = in.RollbackTo
return
} | [
"func",
"(",
"in",
"*",
"DeploymentRollback",
")",
"DeepCopyInto",
"(",
"out",
"*",
"DeploymentRollback",
")",
"{",
"*",
"out",
"=",
"*",
"in",
"\n",
"out",
".",
"TypeMeta",
"=",
"in",
".",
"TypeMeta",
"\n",
"if",
"in",
".",
"UpdatedAnnotations",
"!=",
... | // 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/apps/zz_generated.deepcopy.go#L326-L338 | train | DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new DeploymentRollback. | [
30522,
4569,
2278,
1006,
1999,
1008,
10813,
28402,
5963,
1007,
2784,
3597,
7685,
18447,
2080,
1006,
2041,
1008,
10813,
28402,
5963,
1007,
1063,
1008,
2041,
1027,
1008,
1999,
2041,
1012,
2828,
11368,
2050,
1027,
1999,
1012,
2828,
11368,
2050... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/apps/v1/fake/fake_daemonset.go | DeleteCollection | func (c *FakeDaemonSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(daemonsetsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &appsv1.DaemonSetList{})
return err
} | go | func (c *FakeDaemonSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(daemonsetsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &appsv1.DaemonSetList{})
return err
} | [
"func",
"(",
"c",
"*",
"FakeDaemonSets",
")",
"DeleteCollection",
"(",
"options",
"*",
"v1",
".",
"DeleteOptions",
",",
"listOptions",
"v1",
".",
"ListOptions",
")",
"error",
"{",
"action",
":=",
"testing",
".",
"NewDeleteCollectionAction",
"(",
"daemonsetsResou... | // DeleteCollection deletes a collection of objects. | [
"DeleteCollection",
"deletes",
"a",
"collection",
"of",
"objects",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/kubernetes/typed/apps/v1/fake/fake_daemonset.go#L124-L129 | train | DeleteCollection takes listOptions and deletes all DaemonSets in the system. Returns an error if one occurs. | [
30522,
4569,
2278,
1006,
1039,
1008,
8275,
6858,
16563,
8454,
1007,
3972,
12870,
26895,
18491,
1006,
7047,
1008,
1058,
2487,
1012,
3972,
12870,
7361,
9285,
1010,
2862,
7361,
9285,
1058,
2487,
1012,
2862,
7361,
9285,
1007,
7561,
1063,
2895,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/events/v1beta1/events_client.go | RESTClient | func (c *EventsV1beta1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
} | go | func (c *EventsV1beta1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
} | [
"func",
"(",
"c",
"*",
"EventsV1beta1Client",
")",
"RESTClient",
"(",
")",
"rest",
".",
"Interface",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"c",
".",
"restClient",
"\n",
"}"
] | // RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation. | [
"RESTClient",
"returns",
"a",
"RESTClient",
"that",
"is",
"used",
"to",
"communicate",
"with",
"API",
"server",
"by",
"this",
"client",
"implementation",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/kubernetes/typed/events/v1beta1/events_client.go#L84-L89 | train | RESTClient returns a RESTClient that is used to get the RESTClient function. | [
30522,
4569,
2278,
1006,
1039,
1008,
2824,
2615,
2487,
20915,
27717,
20464,
11638,
1007,
2717,
20464,
11638,
1006,
1007,
2717,
1012,
8278,
1063,
2065,
1039,
1027,
1027,
9152,
2140,
1063,
2709,
9152,
2140,
1065,
2709,
1039,
1012,
2717,
20464... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/helpers_unsupported.go | ResourceConfigForPod | func ResourceConfigForPod(pod *v1.Pod, enforceCPULimit bool, cpuPeriod uint64) *ResourceConfig {
return nil
} | go | func ResourceConfigForPod(pod *v1.Pod, enforceCPULimit bool, cpuPeriod uint64) *ResourceConfig {
return nil
} | [
"func",
"ResourceConfigForPod",
"(",
"pod",
"*",
"v1",
".",
"Pod",
",",
"enforceCPULimit",
"bool",
",",
"cpuPeriod",
"uint64",
")",
"*",
"ResourceConfig",
"{",
"return",
"nil",
"\n",
"}"
] | // ResourceConfigForPod takes the input pod and outputs the cgroup resource config. | [
"ResourceConfigForPod",
"takes",
"the",
"input",
"pod",
"and",
"outputs",
"the",
"cgroup",
"resource",
"config",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/cm/helpers_unsupported.go#L45-L47 | train | ResourceConfigForPod returns a ResourceConfig for a pod. | [
30522,
4569,
2278,
7692,
8663,
8873,
25708,
2953,
27633,
1006,
17491,
1008,
1058,
2487,
1012,
17491,
1010,
16306,
21906,
15859,
22930,
22017,
2140,
1010,
17368,
4842,
3695,
2094,
21318,
3372,
21084,
1007,
1008,
7692,
8663,
8873,
2290,
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/apimachinery/pkg/util/net/interface.go | parseIP | func parseIP(str string, family AddressFamily) (net.IP, error) {
if str == "" {
return nil, fmt.Errorf("input is nil")
}
bytes, err := hex.DecodeString(str)
if err != nil {
return nil, err
}
if family == familyIPv4 {
if len(bytes) != net.IPv4len {
return nil, fmt.Errorf("invalid IPv4 address in route")
}
return net.IP([]byte{bytes[3], bytes[2], bytes[1], bytes[0]}), nil
}
// Must be IPv6
if len(bytes) != net.IPv6len {
return nil, fmt.Errorf("invalid IPv6 address in route")
}
return net.IP(bytes), nil
} | go | func parseIP(str string, family AddressFamily) (net.IP, error) {
if str == "" {
return nil, fmt.Errorf("input is nil")
}
bytes, err := hex.DecodeString(str)
if err != nil {
return nil, err
}
if family == familyIPv4 {
if len(bytes) != net.IPv4len {
return nil, fmt.Errorf("invalid IPv4 address in route")
}
return net.IP([]byte{bytes[3], bytes[2], bytes[1], bytes[0]}), nil
}
// Must be IPv6
if len(bytes) != net.IPv6len {
return nil, fmt.Errorf("invalid IPv6 address in route")
}
return net.IP(bytes), nil
} | [
"func",
"parseIP",
"(",
"str",
"string",
",",
"family",
"AddressFamily",
")",
"(",
"net",
".",
"IP",
",",
"error",
")",
"{",
"if",
"str",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
... | // parseIP takes the hex IP address string from route file and converts it
// to a net.IP address. For IPv4, the value must be converted to big endian. | [
"parseIP",
"takes",
"the",
"hex",
"IP",
"address",
"string",
"from",
"route",
"file",
"and",
"converts",
"it",
"to",
"a",
"net",
".",
"IP",
"address",
".",
"For",
"IPv4",
"the",
"value",
"must",
"be",
"converted",
"to",
"big",
"endian",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/util/net/interface.go#L170-L189 | train | parseIP parses a string to an IP address. | [
30522,
4569,
2278,
11968,
20240,
2361,
1006,
2358,
2099,
5164,
1010,
2155,
4769,
7011,
4328,
2135,
1007,
1006,
5658,
1012,
12997,
1010,
7561,
1007,
1063,
2065,
2358,
2099,
1027,
1027,
1000,
1000,
1063,
2709,
9152,
2140,
1010,
4718,
2102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | pkg/scheduler/algorithm/priorities/taint_toleration.go | countIntolerableTaintsPreferNoSchedule | func countIntolerableTaintsPreferNoSchedule(taints []v1.Taint, tolerations []v1.Toleration) (intolerableTaints int) {
for _, taint := range taints {
// check only on taints that have effect PreferNoSchedule
if taint.Effect != v1.TaintEffectPreferNoSchedule {
continue
}
if !v1helper.TolerationsTolerateTaint(tolerations, &taint) {
intolerableTaints++
}
}
return
} | go | func countIntolerableTaintsPreferNoSchedule(taints []v1.Taint, tolerations []v1.Toleration) (intolerableTaints int) {
for _, taint := range taints {
// check only on taints that have effect PreferNoSchedule
if taint.Effect != v1.TaintEffectPreferNoSchedule {
continue
}
if !v1helper.TolerationsTolerateTaint(tolerations, &taint) {
intolerableTaints++
}
}
return
} | [
"func",
"countIntolerableTaintsPreferNoSchedule",
"(",
"taints",
"[",
"]",
"v1",
".",
"Taint",
",",
"tolerations",
"[",
"]",
"v1",
".",
"Toleration",
")",
"(",
"intolerableTaints",
"int",
")",
"{",
"for",
"_",
",",
"taint",
":=",
"range",
"taints",
"{",
"/... | // CountIntolerableTaintsPreferNoSchedule gives the count of intolerable taints of a pod with effect PreferNoSchedule | [
"CountIntolerableTaintsPreferNoSchedule",
"gives",
"the",
"count",
"of",
"intolerable",
"taints",
"of",
"a",
"pod",
"with",
"effect",
"PreferNoSchedule"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/scheduler/algorithm/priorities/taint_toleration.go#L29-L41 | train | countIntolerableTaintsPreferNoSchedule counts the number of intolerable taints that have a PreferNoScheduleTaint. | [
30522,
4569,
2278,
4175,
18447,
9890,
16670,
18249,
3215,
28139,
7512,
15460,
7690,
9307,
1006,
13843,
7666,
1031,
1033,
1058,
2487,
1012,
13843,
3372,
1010,
2000,
3917,
10708,
1031,
1033,
1058,
2487,
1012,
2000,
3917,
3370,
1007,
1006,
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 | staging/src/k8s.io/apimachinery/pkg/util/cache/lruexpirecache.go | Add | func (c *LRUExpireCache) Add(key interface{}, value interface{}, ttl time.Duration) {
c.lock.Lock()
defer c.lock.Unlock()
c.cache.Add(key, &cacheEntry{value, c.clock.Now().Add(ttl)})
} | go | func (c *LRUExpireCache) Add(key interface{}, value interface{}, ttl time.Duration) {
c.lock.Lock()
defer c.lock.Unlock()
c.cache.Add(key, &cacheEntry{value, c.clock.Now().Add(ttl)})
} | [
"func",
"(",
"c",
"*",
"LRUExpireCache",
")",
"Add",
"(",
"key",
"interface",
"{",
"}",
",",
"value",
"interface",
"{",
"}",
",",
"ttl",
"time",
".",
"Duration",
")",
"{",
"c",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
... | // Add adds the value to the cache at key with the specified maximum duration. | [
"Add",
"adds",
"the",
"value",
"to",
"the",
"cache",
"at",
"key",
"with",
"the",
"specified",
"maximum",
"duration",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apimachinery/pkg/util/cache/lruexpirecache.go#L67-L71 | train | Add adds a new entry to the cache. | [
30522,
4569,
2278,
1006,
1039,
1008,
1048,
6820,
10288,
20781,
3540,
5403,
1007,
5587,
1006,
3145,
8278,
1063,
1065,
1010,
3643,
8278,
1063,
1065,
1010,
23746,
2140,
2051,
1012,
9367,
1007,
1063,
1039,
1012,
5843,
1012,
5843,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | staging/src/k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1/zz_generated.conversion.go | Convert_v1alpha1_Response_To_clientauthentication_Response | func Convert_v1alpha1_Response_To_clientauthentication_Response(in *Response, out *clientauthentication.Response, s conversion.Scope) error {
return autoConvert_v1alpha1_Response_To_clientauthentication_Response(in, out, s)
} | go | func Convert_v1alpha1_Response_To_clientauthentication_Response(in *Response, out *clientauthentication.Response, s conversion.Scope) error {
return autoConvert_v1alpha1_Response_To_clientauthentication_Response(in, out, s)
} | [
"func",
"Convert_v1alpha1_Response_To_clientauthentication_Response",
"(",
"in",
"*",
"Response",
",",
"out",
"*",
"clientauthentication",
".",
"Response",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoConvert_v1alpha1_Response_To_clientauthenticat... | // Convert_v1alpha1_Response_To_clientauthentication_Response is an autogenerated conversion function. | [
"Convert_v1alpha1_Response_To_clientauthentication_Response",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1/zz_generated.conversion.go#L163-L165 | train | Convert_v1alpha1_Response_To_clientauthentication_Response is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
1058,
2487,
2389,
21890,
2487,
1035,
3433,
1035,
2000,
1035,
7396,
4887,
10760,
16778,
10719,
1035,
3433,
1006,
1999,
1008,
3433,
1010,
2041,
1008,
7396,
4887,
10760,
16778,
10719,
1012,
3433,
1010,
1055,
758... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 *List) DeepCopy() *List {
if in == nil {
return nil
}
out := new(List)
in.DeepCopyInto(out)
return out
} | go | func (in *List) DeepCopy() *List {
if in == nil {
return nil
}
out := new(List)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"List",
")",
"DeepCopy",
"(",
")",
"*",
"List",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"List",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new List. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"List",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/zz_generated.deepcopy.go#L1948-L1955 | train | DeepCopy is an autogenerated deepcopy function copying the receiver creating a new List. | [
30522,
4569,
2278,
1006,
1999,
1008,
2862,
1007,
2784,
3597,
7685,
1006,
1007,
1008,
2862,
1063,
2065,
1999,
1027,
1027,
9152,
2140,
1063,
2709,
9152,
2140,
1065,
2041,
1024,
1027,
2047,
1006,
2862,
1007,
1999,
1012,
2784,
3597,
7685,
184... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/autoscaling/v2beta1/fake/fake_horizontalpodautoscaler.go | Watch | func (c *FakeHorizontalPodAutoscalers) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(horizontalpodautoscalersResource, c.ns, opts))
} | go | func (c *FakeHorizontalPodAutoscalers) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(horizontalpodautoscalersResource, c.ns, opts))
} | [
"func",
"(",
"c",
"*",
"FakeHorizontalPodAutoscalers",
")",
"Watch",
"(",
"opts",
"v1",
".",
"ListOptions",
")",
"(",
"watch",
".",
"Interface",
",",
"error",
")",
"{",
"return",
"c",
".",
"Fake",
".",
"InvokesWatch",
"(",
"testing",
".",
"NewWatchAction",... | // Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers. | [
"Watch",
"returns",
"a",
"watch",
".",
"Interface",
"that",
"watches",
"the",
"requested",
"horizontalPodAutoscalers",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake/fake_horizontalpodautoscaler.go#L75-L79 | train | Watch returns a watch. Interface that watches the requested horizontalPodAutoscalers. | [
30522,
4569,
2278,
1006,
1039,
1008,
8275,
16368,
10993,
12162,
2389,
27633,
4887,
13122,
9289,
2545,
1007,
3422,
1006,
23569,
2015,
1058,
2487,
1012,
2862,
7361,
9285,
1007,
1006,
3422,
1012,
8278,
1010,
7561,
1007,
1063,
2709,
1039,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | staging/src/k8s.io/api/core/v1/zz_generated.deepcopy.go | DeepCopyInto | func (in *PodAffinityTerm) DeepCopyInto(out *PodAffinityTerm) {
*out = *in
if in.LabelSelector != nil {
in, out := &in.LabelSelector, &out.LabelSelector
*out = new(metav1.LabelSelector)
(*in).DeepCopyInto(*out)
}
if in.Namespaces != nil {
in, out := &in.Namespaces, &out.Namespaces
*out = make([]string, len(*in))
copy(*out, *in)
}
return
} | go | func (in *PodAffinityTerm) DeepCopyInto(out *PodAffinityTerm) {
*out = *in
if in.LabelSelector != nil {
in, out := &in.LabelSelector, &out.LabelSelector
*out = new(metav1.LabelSelector)
(*in).DeepCopyInto(*out)
}
if in.Namespaces != nil {
in, out := &in.Namespaces, &out.Namespaces
*out = make([]string, len(*in))
copy(*out, *in)
}
return
} | [
"func",
"(",
"in",
"*",
"PodAffinityTerm",
")",
"DeepCopyInto",
"(",
"out",
"*",
"PodAffinityTerm",
")",
"{",
"*",
"out",
"=",
"*",
"in",
"\n",
"if",
"in",
".",
"LabelSelector",
"!=",
"nil",
"{",
"in",
",",
"out",
":=",
"&",
"in",
".",
"LabelSelector... | // 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/api/core/v1/zz_generated.deepcopy.go#L3114-L3127 | train | DeepCopyInto is an autogenerated deepcopy function copying the receiver creating a new PodAffinityTerm. | [
30522,
4569,
2278,
1006,
1999,
1008,
17491,
10354,
16294,
3012,
3334,
2213,
1007,
2784,
3597,
7685,
18447,
2080,
1006,
2041,
1008,
17491,
10354,
16294,
3012,
3334,
2213,
1007,
1063,
1008,
2041,
1027,
1008,
1999,
2065,
1999,
1012,
10873,
122... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/statefulset/stateful_set_control.go | getStatefulSetRevisions | func (ssc *defaultStatefulSetControl) getStatefulSetRevisions(
set *apps.StatefulSet,
revisions []*apps.ControllerRevision) (*apps.ControllerRevision, *apps.ControllerRevision, int32, error) {
var currentRevision, updateRevision *apps.ControllerRevision
revisionCount := len(revisions)
history.SortControllerRevisions(revisions)
// Use a local copy of set.Status.CollisionCount to avoid modifying set.Status directly.
// This copy is returned so the value gets carried over to set.Status in updateStatefulSet.
var collisionCount int32
if set.Status.CollisionCount != nil {
collisionCount = *set.Status.CollisionCount
}
// create a new revision from the current set
updateRevision, err := newRevision(set, nextRevision(revisions), &collisionCount)
if err != nil {
return nil, nil, collisionCount, err
}
// find any equivalent revisions
equalRevisions := history.FindEqualRevisions(revisions, updateRevision)
equalCount := len(equalRevisions)
if equalCount > 0 && history.EqualRevision(revisions[revisionCount-1], equalRevisions[equalCount-1]) {
// if the equivalent revision is immediately prior the update revision has not changed
updateRevision = revisions[revisionCount-1]
} else if equalCount > 0 {
// if the equivalent revision is not immediately prior we will roll back by incrementing the
// Revision of the equivalent revision
updateRevision, err = ssc.controllerHistory.UpdateControllerRevision(
equalRevisions[equalCount-1],
updateRevision.Revision)
if err != nil {
return nil, nil, collisionCount, err
}
} else {
//if there is no equivalent revision we create a new one
updateRevision, err = ssc.controllerHistory.CreateControllerRevision(set, updateRevision, &collisionCount)
if err != nil {
return nil, nil, collisionCount, err
}
}
// attempt to find the revision that corresponds to the current revision
for i := range revisions {
if revisions[i].Name == set.Status.CurrentRevision {
currentRevision = revisions[i]
}
}
// if the current revision is nil we initialize the history by setting it to the update revision
if currentRevision == nil {
currentRevision = updateRevision
}
return currentRevision, updateRevision, collisionCount, nil
} | go | func (ssc *defaultStatefulSetControl) getStatefulSetRevisions(
set *apps.StatefulSet,
revisions []*apps.ControllerRevision) (*apps.ControllerRevision, *apps.ControllerRevision, int32, error) {
var currentRevision, updateRevision *apps.ControllerRevision
revisionCount := len(revisions)
history.SortControllerRevisions(revisions)
// Use a local copy of set.Status.CollisionCount to avoid modifying set.Status directly.
// This copy is returned so the value gets carried over to set.Status in updateStatefulSet.
var collisionCount int32
if set.Status.CollisionCount != nil {
collisionCount = *set.Status.CollisionCount
}
// create a new revision from the current set
updateRevision, err := newRevision(set, nextRevision(revisions), &collisionCount)
if err != nil {
return nil, nil, collisionCount, err
}
// find any equivalent revisions
equalRevisions := history.FindEqualRevisions(revisions, updateRevision)
equalCount := len(equalRevisions)
if equalCount > 0 && history.EqualRevision(revisions[revisionCount-1], equalRevisions[equalCount-1]) {
// if the equivalent revision is immediately prior the update revision has not changed
updateRevision = revisions[revisionCount-1]
} else if equalCount > 0 {
// if the equivalent revision is not immediately prior we will roll back by incrementing the
// Revision of the equivalent revision
updateRevision, err = ssc.controllerHistory.UpdateControllerRevision(
equalRevisions[equalCount-1],
updateRevision.Revision)
if err != nil {
return nil, nil, collisionCount, err
}
} else {
//if there is no equivalent revision we create a new one
updateRevision, err = ssc.controllerHistory.CreateControllerRevision(set, updateRevision, &collisionCount)
if err != nil {
return nil, nil, collisionCount, err
}
}
// attempt to find the revision that corresponds to the current revision
for i := range revisions {
if revisions[i].Name == set.Status.CurrentRevision {
currentRevision = revisions[i]
}
}
// if the current revision is nil we initialize the history by setting it to the update revision
if currentRevision == nil {
currentRevision = updateRevision
}
return currentRevision, updateRevision, collisionCount, nil
} | [
"func",
"(",
"ssc",
"*",
"defaultStatefulSetControl",
")",
"getStatefulSetRevisions",
"(",
"set",
"*",
"apps",
".",
"StatefulSet",
",",
"revisions",
"[",
"]",
"*",
"apps",
".",
"ControllerRevision",
")",
"(",
"*",
"apps",
".",
"ControllerRevision",
",",
"*",
... | // getStatefulSetRevisions returns the current and update ControllerRevisions for set. It also
// returns a collision count that records the number of name collisions set saw when creating
// new ControllerRevisions. This count is incremented on every name collision and is used in
// building the ControllerRevision names for name collision avoidance. This method may create
// a new revision, or modify the Revision of an existing revision if an update to set is detected.
// This method expects that revisions is sorted when supplied. | [
"getStatefulSetRevisions",
"returns",
"the",
"current",
"and",
"update",
"ControllerRevisions",
"for",
"set",
".",
"It",
"also",
"returns",
"a",
"collision",
"count",
"that",
"records",
"the",
"number",
"of",
"name",
"collisions",
"set",
"saw",
"when",
"creating",... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/statefulset/stateful_set_control.go#L185-L243 | train | getStatefulSetRevisions returns the set of revisions that are equal to the given set. | [
30522,
4569,
2278,
1006,
7020,
2278,
1008,
12398,
9153,
2618,
3993,
13462,
8663,
13181,
2140,
1007,
4152,
12259,
3993,
13462,
30524,
17084,
1010,
20014,
16703,
1010,
7561,
1007,
1063,
13075,
2783,
2890,
17084,
1010,
10651,
2890,
17084,
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/scheduler/algorithm/predicates/metadata.go | newTopologyPairsMaps | func newTopologyPairsMaps() *topologyPairsMaps {
return &topologyPairsMaps{topologyPairToPods: make(map[topologyPair]podSet),
podToTopologyPairs: make(map[string]topologyPairSet)}
} | go | func newTopologyPairsMaps() *topologyPairsMaps {
return &topologyPairsMaps{topologyPairToPods: make(map[topologyPair]podSet),
podToTopologyPairs: make(map[string]topologyPairSet)}
} | [
"func",
"newTopologyPairsMaps",
"(",
")",
"*",
"topologyPairsMaps",
"{",
"return",
"&",
"topologyPairsMaps",
"{",
"topologyPairToPods",
":",
"make",
"(",
"map",
"[",
"topologyPair",
"]",
"podSet",
")",
",",
"podToTopologyPairs",
":",
"make",
"(",
"map",
"[",
"... | // returns a pointer to a new topologyPairsMaps | [
"returns",
"a",
"pointer",
"to",
"a",
"new",
"topologyPairsMaps"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/scheduler/algorithm/predicates/metadata.go#L169-L172 | train | newTopologyPairsMaps returns a new instance of a topologyPairsMaps. | [
30522,
4569,
2278,
25597,
7361,
6779,
4502,
18894,
2863,
4523,
1006,
1007,
1008,
19587,
4502,
18894,
2863,
4523,
1063,
2709,
1004,
19587,
4502,
18894,
2863,
4523,
1063,
19587,
4502,
4313,
14399,
20620,
1024,
2191,
1006,
4949,
1031,
19587,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/upgrade/postupgrade.go | moveFiles | func moveFiles(files map[string]string) error {
filesToRecover := map[string]string{}
for from, to := range files {
if err := os.Rename(from, to); err != nil {
return rollbackFiles(filesToRecover, err)
}
filesToRecover[to] = from
}
return nil
} | go | func moveFiles(files map[string]string) error {
filesToRecover := map[string]string{}
for from, to := range files {
if err := os.Rename(from, to); err != nil {
return rollbackFiles(filesToRecover, err)
}
filesToRecover[to] = from
}
return nil
} | [
"func",
"moveFiles",
"(",
"files",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"filesToRecover",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"for",
"from",
",",
"to",
":=",
"range",
"files",
"{",
"if",
"err",
":=",
"os",
... | // moveFiles moves files from one directory to another. | [
"moveFiles",
"moves",
"files",
"from",
"one",
"directory",
"to",
"another",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/phases/upgrade/postupgrade.go#L189-L198 | train | moveFiles moves files from the given map to the new file | [
30522,
4569,
2278,
2693,
8873,
4244,
1006,
6764,
4949,
1031,
5164,
1033,
5164,
1007,
7561,
1063,
6764,
19277,
3597,
6299,
1024,
1027,
4949,
1031,
5164,
1033,
5164,
1063,
1065,
2005,
2013,
1010,
2000,
1024,
1027,
2846,
6764,
1063,
2065,
94... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/generated/listers/samplecontroller/v1alpha1/foo.go | Foos | func (s *fooLister) Foos(namespace string) FooNamespaceLister {
return fooNamespaceLister{indexer: s.indexer, namespace: namespace}
} | go | func (s *fooLister) Foos(namespace string) FooNamespaceLister {
return fooNamespaceLister{indexer: s.indexer, namespace: namespace}
} | [
"func",
"(",
"s",
"*",
"fooLister",
")",
"Foos",
"(",
"namespace",
"string",
")",
"FooNamespaceLister",
"{",
"return",
"fooNamespaceLister",
"{",
"indexer",
":",
"s",
".",
"indexer",
",",
"namespace",
":",
"namespace",
"}",
"\n",
"}"
] | // Foos returns an object that can list and get Foos. | [
"Foos",
"returns",
"an",
"object",
"that",
"can",
"list",
"and",
"get",
"Foos",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/sample-controller/pkg/generated/listers/samplecontroller/v1alpha1/foo.go#L56-L58 | train | Foos returns an object that can list and get Foos. | [
30522,
4569,
2278,
1006,
1055,
1008,
7966,
12911,
1007,
29379,
2015,
1006,
3415,
15327,
5164,
1007,
29379,
18442,
23058,
9863,
2121,
1063,
2709,
29379,
18442,
23058,
9863,
2121,
1063,
5950,
2121,
1024,
1055,
1012,
5950,
2121,
1010,
3415,
15... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/client/clientset_generated/clientset/typed/apiregistration/v1/apiregistration_client.go | RESTClient | func (c *ApiregistrationV1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
} | go | func (c *ApiregistrationV1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
} | [
"func",
"(",
"c",
"*",
"ApiregistrationV1Client",
")",
"RESTClient",
"(",
")",
"rest",
".",
"Interface",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"c",
".",
"restClient",
"\n",
"}"
] | // RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation. | [
"RESTClient",
"returns",
"a",
"RESTClient",
"that",
"is",
"used",
"to",
"communicate",
"with",
"API",
"server",
"by",
"this",
"client",
"implementation",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/typed/apiregistration/v1/apiregistration_client.go#L84-L89 | train | RESTClient returns a RESTClient that is used to get the RESTClient function | [
30522,
4569,
2278,
1006,
1039,
1008,
17928,
2890,
24063,
8156,
2615,
2487,
20464,
11638,
1007,
2717,
20464,
11638,
1006,
1007,
2717,
1012,
8278,
1063,
2065,
1039,
1027,
1027,
9152,
2140,
1063,
2709,
9152,
2140,
1065,
2709,
1039,
1012,
2717,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/apis/config/validation/validation.go | Validate | func Validate(config *kubeproxyconfig.KubeProxyConfiguration) field.ErrorList {
allErrs := field.ErrorList{}
newPath := field.NewPath("KubeProxyConfiguration")
allErrs = append(allErrs, validateKubeProxyIPTablesConfiguration(config.IPTables, newPath.Child("KubeProxyIPTablesConfiguration"))...)
if config.Mode == kubeproxyconfig.ProxyModeIPVS {
allErrs = append(allErrs, validateKubeProxyIPVSConfiguration(config.IPVS, newPath.Child("KubeProxyIPVSConfiguration"))...)
}
allErrs = append(allErrs, validateKubeProxyConntrackConfiguration(config.Conntrack, newPath.Child("KubeProxyConntrackConfiguration"))...)
allErrs = append(allErrs, validateProxyMode(config.Mode, newPath.Child("Mode"))...)
allErrs = append(allErrs, validateClientConnectionConfiguration(config.ClientConnection, newPath.Child("ClientConnection"))...)
if config.OOMScoreAdj != nil && (*config.OOMScoreAdj < -1000 || *config.OOMScoreAdj > 1000) {
allErrs = append(allErrs, field.Invalid(newPath.Child("OOMScoreAdj"), *config.OOMScoreAdj, "must be within the range [-1000, 1000]"))
}
if config.UDPIdleTimeout.Duration <= 0 {
allErrs = append(allErrs, field.Invalid(newPath.Child("UDPIdleTimeout"), config.UDPIdleTimeout, "must be greater than 0"))
}
if config.ConfigSyncPeriod.Duration <= 0 {
allErrs = append(allErrs, field.Invalid(newPath.Child("ConfigSyncPeriod"), config.ConfigSyncPeriod, "must be greater than 0"))
}
if net.ParseIP(config.BindAddress) == nil {
allErrs = append(allErrs, field.Invalid(newPath.Child("BindAddress"), config.BindAddress, "not a valid textual representation of an IP address"))
}
if config.HealthzBindAddress != "" {
allErrs = append(allErrs, validateHostPort(config.HealthzBindAddress, newPath.Child("HealthzBindAddress"))...)
}
allErrs = append(allErrs, validateHostPort(config.MetricsBindAddress, newPath.Child("MetricsBindAddress"))...)
if config.ClusterCIDR != "" {
if _, _, err := net.ParseCIDR(config.ClusterCIDR); err != nil {
allErrs = append(allErrs, field.Invalid(newPath.Child("ClusterCIDR"), config.ClusterCIDR, "must be a valid CIDR block (e.g. 10.100.0.0/16)"))
}
}
if _, err := utilnet.ParsePortRange(config.PortRange); err != nil {
allErrs = append(allErrs, field.Invalid(newPath.Child("PortRange"), config.PortRange, "must be a valid port range (e.g. 300-2000)"))
}
allErrs = append(allErrs, validateKubeProxyNodePortAddress(config.NodePortAddresses, newPath.Child("NodePortAddresses"))...)
return allErrs
} | go | func Validate(config *kubeproxyconfig.KubeProxyConfiguration) field.ErrorList {
allErrs := field.ErrorList{}
newPath := field.NewPath("KubeProxyConfiguration")
allErrs = append(allErrs, validateKubeProxyIPTablesConfiguration(config.IPTables, newPath.Child("KubeProxyIPTablesConfiguration"))...)
if config.Mode == kubeproxyconfig.ProxyModeIPVS {
allErrs = append(allErrs, validateKubeProxyIPVSConfiguration(config.IPVS, newPath.Child("KubeProxyIPVSConfiguration"))...)
}
allErrs = append(allErrs, validateKubeProxyConntrackConfiguration(config.Conntrack, newPath.Child("KubeProxyConntrackConfiguration"))...)
allErrs = append(allErrs, validateProxyMode(config.Mode, newPath.Child("Mode"))...)
allErrs = append(allErrs, validateClientConnectionConfiguration(config.ClientConnection, newPath.Child("ClientConnection"))...)
if config.OOMScoreAdj != nil && (*config.OOMScoreAdj < -1000 || *config.OOMScoreAdj > 1000) {
allErrs = append(allErrs, field.Invalid(newPath.Child("OOMScoreAdj"), *config.OOMScoreAdj, "must be within the range [-1000, 1000]"))
}
if config.UDPIdleTimeout.Duration <= 0 {
allErrs = append(allErrs, field.Invalid(newPath.Child("UDPIdleTimeout"), config.UDPIdleTimeout, "must be greater than 0"))
}
if config.ConfigSyncPeriod.Duration <= 0 {
allErrs = append(allErrs, field.Invalid(newPath.Child("ConfigSyncPeriod"), config.ConfigSyncPeriod, "must be greater than 0"))
}
if net.ParseIP(config.BindAddress) == nil {
allErrs = append(allErrs, field.Invalid(newPath.Child("BindAddress"), config.BindAddress, "not a valid textual representation of an IP address"))
}
if config.HealthzBindAddress != "" {
allErrs = append(allErrs, validateHostPort(config.HealthzBindAddress, newPath.Child("HealthzBindAddress"))...)
}
allErrs = append(allErrs, validateHostPort(config.MetricsBindAddress, newPath.Child("MetricsBindAddress"))...)
if config.ClusterCIDR != "" {
if _, _, err := net.ParseCIDR(config.ClusterCIDR); err != nil {
allErrs = append(allErrs, field.Invalid(newPath.Child("ClusterCIDR"), config.ClusterCIDR, "must be a valid CIDR block (e.g. 10.100.0.0/16)"))
}
}
if _, err := utilnet.ParsePortRange(config.PortRange); err != nil {
allErrs = append(allErrs, field.Invalid(newPath.Child("PortRange"), config.PortRange, "must be a valid port range (e.g. 300-2000)"))
}
allErrs = append(allErrs, validateKubeProxyNodePortAddress(config.NodePortAddresses, newPath.Child("NodePortAddresses"))...)
return allErrs
} | [
"func",
"Validate",
"(",
"config",
"*",
"kubeproxyconfig",
".",
"KubeProxyConfiguration",
")",
"field",
".",
"ErrorList",
"{",
"allErrs",
":=",
"field",
".",
"ErrorList",
"{",
"}",
"\n\n",
"newPath",
":=",
"field",
".",
"NewPath",
"(",
"\"",
"\"",
")",
"\n... | // Validate validates the configuration of kube-proxy | [
"Validate",
"validates",
"the",
"configuration",
"of",
"kube",
"-",
"proxy"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/proxy/apis/config/validation/validation.go#L35-L82 | train | Validate validates the given KubeProxyConfiguration | [
30522,
4569,
2278,
9398,
3686,
1006,
9530,
8873,
2290,
1008,
13970,
4783,
21572,
18037,
8663,
8873,
2290,
1012,
13970,
4783,
21572,
18037,
8663,
8873,
27390,
3370,
1007,
2492,
1012,
7561,
9863,
1063,
2035,
2121,
2869,
1024,
1027,
2492,
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/quota/v1/generic/evaluator.go | UsageStats | func (o *objectCountEvaluator) UsageStats(options quota.UsageStatsOptions) (quota.UsageStats, error) {
return CalculateUsageStats(options, o.listFuncByNamespace, MatchesNoScopeFunc, o.Usage)
} | go | func (o *objectCountEvaluator) UsageStats(options quota.UsageStatsOptions) (quota.UsageStats, error) {
return CalculateUsageStats(options, o.listFuncByNamespace, MatchesNoScopeFunc, o.Usage)
} | [
"func",
"(",
"o",
"*",
"objectCountEvaluator",
")",
"UsageStats",
"(",
"options",
"quota",
".",
"UsageStatsOptions",
")",
"(",
"quota",
".",
"UsageStats",
",",
"error",
")",
"{",
"return",
"CalculateUsageStats",
"(",
"options",
",",
"o",
".",
"listFuncByNamesp... | // UsageStats calculates aggregate usage for the object. | [
"UsageStats",
"calculates",
"aggregate",
"usage",
"for",
"the",
"object",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/quota/v1/generic/evaluator.go#L294-L296 | train | UsageStats returns the usage stats for the object count evaluator. | [
30522,
4569,
2278,
1006,
1051,
1008,
4874,
3597,
16671,
13331,
7630,
8844,
1007,
8192,
9153,
3215,
1006,
7047,
20563,
1012,
8192,
9153,
3215,
7361,
9285,
1007,
1006,
20563,
1012,
8192,
9153,
3215,
1010,
7561,
1007,
1063,
2709,
18422,
10383,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/core/pod/storage/eviction.go | GroupVersionKind | func (r *EvictionREST) GroupVersionKind(containingGV schema.GroupVersion) schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "policy", Version: "v1beta1", Kind: "Eviction"}
} | go | func (r *EvictionREST) GroupVersionKind(containingGV schema.GroupVersion) schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "policy", Version: "v1beta1", Kind: "Eviction"}
} | [
"func",
"(",
"r",
"*",
"EvictionREST",
")",
"GroupVersionKind",
"(",
"containingGV",
"schema",
".",
"GroupVersion",
")",
"schema",
".",
"GroupVersionKind",
"{",
"return",
"schema",
".",
"GroupVersionKind",
"{",
"Group",
":",
"\"",
"\"",
",",
"Version",
":",
... | // GroupVersionKind specifies a particular GroupVersionKind to discovery | [
"GroupVersionKind",
"specifies",
"a",
"particular",
"GroupVersionKind",
"to",
"discovery"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/registry/core/pod/storage/eviction.go#L74-L76 | train | GroupVersionKind returns the group version kind of the eviction policy. | [
30522,
4569,
2278,
1006,
1054,
1008,
23408,
28097,
28533,
1007,
2177,
27774,
18824,
1006,
4820,
2290,
2615,
8040,
28433,
1012,
2177,
27774,
1007,
8040,
28433,
1012,
2177,
27774,
18824,
1063,
2709,
8040,
28433,
1012,
2177,
27774,
18824,
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/code-generator/_examples/MixedCase/apis/example/v1/register.go | addKnownTypes | func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&TestType{},
&TestTypeList{},
)
scheme.AddKnownTypes(SchemeGroupVersion,
&metav1.Status{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
} | go | func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&TestType{},
&TestTypeList{},
)
scheme.AddKnownTypes(SchemeGroupVersion,
&metav1.Status{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
} | [
"func",
"addKnownTypes",
"(",
"scheme",
"*",
"runtime",
".",
"Scheme",
")",
"error",
"{",
"scheme",
".",
"AddKnownTypes",
"(",
"SchemeGroupVersion",
",",
"&",
"TestType",
"{",
"}",
",",
"&",
"TestTypeList",
"{",
"}",
",",
")",
"\n\n",
"scheme",
".",
"Add... | // Adds the list of known types to the given scheme. | [
"Adds",
"the",
"list",
"of",
"known",
"types",
"to",
"the",
"given",
"scheme",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/code-generator/_examples/MixedCase/apis/example/v1/register.go#L48-L59 | train | addKnownTypes adds the types of the specified scheme to the specified scheme. | [
30522,
4569,
2278,
5587,
2243,
19779,
29405,
10374,
1006,
5679,
1008,
2448,
7292,
1012,
5679,
1007,
7561,
1063,
5679,
1012,
5587,
2243,
19779,
29405,
10374,
1006,
5679,
17058,
27774,
1010,
1004,
3231,
13874,
1063,
1065,
1010,
1004,
3231,
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/kubectl/cmd/create/create.go | NameFromCommandArgs | func NameFromCommandArgs(cmd *cobra.Command, args []string) (string, error) {
argsLen := cmd.ArgsLenAtDash()
// ArgsLenAtDash returns -1 when -- was not specified
if argsLen == -1 {
argsLen = len(args)
}
if argsLen != 1 {
return "", cmdutil.UsageErrorf(cmd, "exactly one NAME is required, got %d", argsLen)
}
return args[0], nil
} | go | func NameFromCommandArgs(cmd *cobra.Command, args []string) (string, error) {
argsLen := cmd.ArgsLenAtDash()
// ArgsLenAtDash returns -1 when -- was not specified
if argsLen == -1 {
argsLen = len(args)
}
if argsLen != 1 {
return "", cmdutil.UsageErrorf(cmd, "exactly one NAME is required, got %d", argsLen)
}
return args[0], nil
} | [
"func",
"NameFromCommandArgs",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"argsLen",
":=",
"cmd",
".",
"ArgsLenAtDash",
"(",
")",
"\n",
"// ArgsLenAtDash returns -1 when -- was not spe... | // NameFromCommandArgs is a utility function for commands that assume the first argument is a resource name | [
"NameFromCommandArgs",
"is",
"a",
"utility",
"function",
"for",
"commands",
"that",
"assume",
"the",
"first",
"argument",
"is",
"a",
"resource",
"name"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubectl/cmd/create/create.go#L338-L348 | train | NameFromCommandArgs returns the name of the command given the command arguments. | [
30522,
4569,
2278,
2171,
19699,
5358,
9006,
2386,
7662,
5620,
1006,
4642,
2094,
1008,
16604,
1012,
3094,
1010,
12098,
5620,
1031,
1033,
5164,
1007,
1006,
5164,
1010,
7561,
1007,
1063,
12098,
5620,
7770,
1024,
1027,
4642,
2094,
1012,
12098,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | staging/src/k8s.io/client-go/util/cert/cert.go | NewSelfSignedCACert | func NewSelfSignedCACert(cfg Config, key crypto.Signer) (*x509.Certificate, error) {
now := time.Now()
tmpl := x509.Certificate{
SerialNumber: new(big.Int).SetInt64(0),
Subject: pkix.Name{
CommonName: cfg.CommonName,
Organization: cfg.Organization,
},
NotBefore: now.UTC(),
NotAfter: now.Add(duration365d * 10).UTC(),
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
BasicConstraintsValid: true,
IsCA: true,
}
certDERBytes, err := x509.CreateCertificate(cryptorand.Reader, &tmpl, &tmpl, key.Public(), key)
if err != nil {
return nil, err
}
return x509.ParseCertificate(certDERBytes)
} | go | func NewSelfSignedCACert(cfg Config, key crypto.Signer) (*x509.Certificate, error) {
now := time.Now()
tmpl := x509.Certificate{
SerialNumber: new(big.Int).SetInt64(0),
Subject: pkix.Name{
CommonName: cfg.CommonName,
Organization: cfg.Organization,
},
NotBefore: now.UTC(),
NotAfter: now.Add(duration365d * 10).UTC(),
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
BasicConstraintsValid: true,
IsCA: true,
}
certDERBytes, err := x509.CreateCertificate(cryptorand.Reader, &tmpl, &tmpl, key.Public(), key)
if err != nil {
return nil, err
}
return x509.ParseCertificate(certDERBytes)
} | [
"func",
"NewSelfSignedCACert",
"(",
"cfg",
"Config",
",",
"key",
"crypto",
".",
"Signer",
")",
"(",
"*",
"x509",
".",
"Certificate",
",",
"error",
")",
"{",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"tmpl",
":=",
"x509",
".",
"Certificate",
"{... | // NewSelfSignedCACert creates a CA certificate | [
"NewSelfSignedCACert",
"creates",
"a",
"CA",
"certificate"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/util/cert/cert.go#L57-L77 | train | NewSelfSignedCACert creates a new self - signed CA certificate | [
30522,
4569,
2278,
2739,
2884,
10343,
23773,
2098,
3540,
17119,
2102,
1006,
12935,
2290,
9530,
8873,
2290,
1010,
3145,
19888,
2080,
1012,
3696,
2121,
1007,
1006,
1008,
1060,
12376,
2683,
1012,
8196,
1010,
7561,
1007,
1063,
2085,
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/apis/core/zz_generated.deepcopy.go | DeepCopy | func (in *ReplicationControllerList) DeepCopy() *ReplicationControllerList {
if in == nil {
return nil
}
out := new(ReplicationControllerList)
in.DeepCopyInto(out)
return out
} | go | func (in *ReplicationControllerList) DeepCopy() *ReplicationControllerList {
if in == nil {
return nil
}
out := new(ReplicationControllerList)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ReplicationControllerList",
")",
"DeepCopy",
"(",
")",
"*",
"ReplicationControllerList",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ReplicationControllerList",
")",
"\n",
"in",
".... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplicationControllerList. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ReplicationControllerList",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/zz_generated.deepcopy.go#L4064-L4071 | train | DeepCopy is an autogenerated deepcopy function copying the receiver creating a new ReplicationControllerList. | [
30522,
4569,
2278,
1006,
1999,
1008,
21647,
8663,
13181,
10820,
9863,
1007,
2784,
3597,
7685,
1006,
1007,
1008,
21647,
8663,
13181,
10820,
9863,
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/apis/core/zz_generated.deepcopy.go | DeepCopy | func (in *PodStatusResult) DeepCopy() *PodStatusResult {
if in == nil {
return nil
}
out := new(PodStatusResult)
in.DeepCopyInto(out)
return out
} | go | func (in *PodStatusResult) DeepCopy() *PodStatusResult {
if in == nil {
return nil
}
out := new(PodStatusResult)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"PodStatusResult",
")",
"DeepCopy",
"(",
")",
"*",
"PodStatusResult",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"PodStatusResult",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodStatusResult. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"PodStatusResult",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/zz_generated.deepcopy.go#L3692-L3699 | train | DeepCopy is an autogenerated deepcopy function copying the receiver creating a new PodStatusResult. | [
30522,
4569,
2278,
1006,
1999,
1008,
26723,
29336,
2271,
6072,
11314,
1007,
2784,
3597,
7685,
1006,
1007,
1008,
26723,
29336,
2271,
6072,
11314,
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/registry/core/pod/strategy.go | CheckGracefulDelete | func (podStrategyWithoutGraceful) CheckGracefulDelete(ctx context.Context, obj runtime.Object, options *metav1.DeleteOptions) bool {
return false
} | go | func (podStrategyWithoutGraceful) CheckGracefulDelete(ctx context.Context, obj runtime.Object, options *metav1.DeleteOptions) bool {
return false
} | [
"func",
"(",
"podStrategyWithoutGraceful",
")",
"CheckGracefulDelete",
"(",
"ctx",
"context",
".",
"Context",
",",
"obj",
"runtime",
".",
"Object",
",",
"options",
"*",
"metav1",
".",
"DeleteOptions",
")",
"bool",
"{",
"return",
"false",
"\n",
"}"
] | // CheckGracefulDelete prohibits graceful deletion. | [
"CheckGracefulDelete",
"prohibits",
"graceful",
"deletion",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/registry/core/pod/strategy.go#L149-L151 | train | CheckGracefulDelete is not implemented for PodStrategyWithoutGraceful. | [
30522,
4569,
2278,
1006,
26723,
6494,
2618,
6292,
24415,
5833,
17643,
3401,
3993,
1007,
4638,
17643,
3401,
3993,
9247,
12870,
1006,
14931,
2595,
6123,
1012,
6123,
1010,
27885,
3501,
2448,
7292,
1012,
4874,
1010,
7047,
1008,
18804,
2615,
248... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | getPodsToSync | func (kl *Kubelet) getPodsToSync() []*v1.Pod {
allPods := kl.podManager.GetPods()
podUIDs := kl.workQueue.GetWork()
podUIDSet := sets.NewString()
for _, podUID := range podUIDs {
podUIDSet.Insert(string(podUID))
}
var podsToSync []*v1.Pod
for _, pod := range allPods {
if podUIDSet.Has(string(pod.UID)) {
// The work of the pod is ready
podsToSync = append(podsToSync, pod)
continue
}
for _, podSyncLoopHandler := range kl.PodSyncLoopHandlers {
if podSyncLoopHandler.ShouldSync(pod) {
podsToSync = append(podsToSync, pod)
break
}
}
}
return podsToSync
} | go | func (kl *Kubelet) getPodsToSync() []*v1.Pod {
allPods := kl.podManager.GetPods()
podUIDs := kl.workQueue.GetWork()
podUIDSet := sets.NewString()
for _, podUID := range podUIDs {
podUIDSet.Insert(string(podUID))
}
var podsToSync []*v1.Pod
for _, pod := range allPods {
if podUIDSet.Has(string(pod.UID)) {
// The work of the pod is ready
podsToSync = append(podsToSync, pod)
continue
}
for _, podSyncLoopHandler := range kl.PodSyncLoopHandlers {
if podSyncLoopHandler.ShouldSync(pod) {
podsToSync = append(podsToSync, pod)
break
}
}
}
return podsToSync
} | [
"func",
"(",
"kl",
"*",
"Kubelet",
")",
"getPodsToSync",
"(",
")",
"[",
"]",
"*",
"v1",
".",
"Pod",
"{",
"allPods",
":=",
"kl",
".",
"podManager",
".",
"GetPods",
"(",
")",
"\n",
"podUIDs",
":=",
"kl",
".",
"workQueue",
".",
"GetWork",
"(",
")",
... | // Get pods which should be resynchronized. Currently, the following pod should be resynchronized:
// * pod whose work is ready.
// * internal modules that request sync of a pod. | [
"Get",
"pods",
"which",
"should",
"be",
"resynchronized",
".",
"Currently",
"the",
"following",
"pod",
"should",
"be",
"resynchronized",
":",
"*",
"pod",
"whose",
"work",
"is",
"ready",
".",
"*",
"internal",
"modules",
"that",
"request",
"sync",
"of",
"a",
... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/kubelet.go#L1684-L1706 | train | getPodsToSync returns a list of pods to sync | [
30522,
4569,
2278,
1006,
1047,
2140,
1008,
13970,
8671,
3388,
1007,
2131,
22925,
13122,
6038,
2278,
1006,
1007,
1031,
1033,
1008,
1058,
2487,
1012,
17491,
1063,
2035,
22925,
1024,
1027,
1047,
2140,
1012,
17491,
24805,
4590,
1012,
2131,
2292... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/secret_for_docker_registry.go | handleDockerCfgJSONContent | func handleDockerCfgJSONContent(username, password, email, server string) ([]byte, error) {
dockercfgAuth := DockerConfigEntry{
Username: username,
Password: password,
Email: email,
Auth: encodeDockerConfigFieldAuth(username, password),
}
dockerCfgJSON := DockerConfigJSON{
Auths: map[string]DockerConfigEntry{server: dockercfgAuth},
}
return json.Marshal(dockerCfgJSON)
} | go | func handleDockerCfgJSONContent(username, password, email, server string) ([]byte, error) {
dockercfgAuth := DockerConfigEntry{
Username: username,
Password: password,
Email: email,
Auth: encodeDockerConfigFieldAuth(username, password),
}
dockerCfgJSON := DockerConfigJSON{
Auths: map[string]DockerConfigEntry{server: dockercfgAuth},
}
return json.Marshal(dockerCfgJSON)
} | [
"func",
"handleDockerCfgJSONContent",
"(",
"username",
",",
"password",
",",
"email",
",",
"server",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"dockercfgAuth",
":=",
"DockerConfigEntry",
"{",
"Username",
":",
"username",
",",
"Password",
... | // handleDockerCfgJSONContent serializes a ~/.docker/config.json file | [
"handleDockerCfgJSONContent",
"serializes",
"a",
"~",
"/",
".",
"docker",
"/",
"config",
".",
"json",
"file"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubectl/generate/versioned/secret_for_docker_registry.go#L151-L164 | train | handleDockerCfgJSONContent returns a JSON encoded DockerConfigJSON | [
30522,
4569,
2278,
8971,
7432,
2121,
2278,
2546,
2290,
22578,
2239,
8663,
6528,
2102,
1006,
5310,
18442,
30524,
1024,
1027,
8946,
2121,
8663,
8873,
11461,
2854,
1063,
5310,
18442,
1024,
5310,
18442,
1010,
20786,
1024,
20786,
1010,
10373,
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/client-go/listers/storage/v1beta1/csinode.go | List | func (s *cSINodeLister) List(selector labels.Selector) (ret []*v1beta1.CSINode, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.CSINode))
})
return ret, err
} | go | func (s *cSINodeLister) List(selector labels.Selector) (ret []*v1beta1.CSINode, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.CSINode))
})
return ret, err
} | [
"func",
"(",
"s",
"*",
"cSINodeLister",
")",
"List",
"(",
"selector",
"labels",
".",
"Selector",
")",
"(",
"ret",
"[",
"]",
"*",
"v1beta1",
".",
"CSINode",
",",
"err",
"error",
")",
"{",
"err",
"=",
"cache",
".",
"ListAll",
"(",
"s",
".",
"indexer"... | // List lists all CSINodes in the indexer. | [
"List",
"lists",
"all",
"CSINodes",
"in",
"the",
"indexer",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/listers/storage/v1beta1/csinode.go#L48-L53 | train | List lists all CSINodes in the indexer. | [
30522,
4569,
2278,
1006,
1055,
1008,
22174,
3630,
9247,
12911,
1007,
2862,
1006,
27000,
10873,
1012,
27000,
1007,
1006,
2128,
2102,
1031,
30524,
17053,
1012,
2862,
8095,
1006,
1055,
1012,
5950,
2121,
1010,
27000,
1010,
4569,
2278,
1006,
104... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | pkg/apis/apps/v1beta1/zz_generated.conversion.go | Convert_apps_ControllerRevision_To_v1beta1_ControllerRevision | func Convert_apps_ControllerRevision_To_v1beta1_ControllerRevision(in *apps.ControllerRevision, out *v1beta1.ControllerRevision, s conversion.Scope) error {
return autoConvert_apps_ControllerRevision_To_v1beta1_ControllerRevision(in, out, s)
} | go | func Convert_apps_ControllerRevision_To_v1beta1_ControllerRevision(in *apps.ControllerRevision, out *v1beta1.ControllerRevision, s conversion.Scope) error {
return autoConvert_apps_ControllerRevision_To_v1beta1_ControllerRevision(in, out, s)
} | [
"func",
"Convert_apps_ControllerRevision_To_v1beta1_ControllerRevision",
"(",
"in",
"*",
"apps",
".",
"ControllerRevision",
",",
"out",
"*",
"v1beta1",
".",
"ControllerRevision",
",",
"s",
"conversion",
".",
"Scope",
")",
"error",
"{",
"return",
"autoConvert_apps_Contro... | // Convert_apps_ControllerRevision_To_v1beta1_ControllerRevision is an autogenerated conversion function. | [
"Convert_apps_ControllerRevision_To_v1beta1_ControllerRevision",
"is",
"an",
"autogenerated",
"conversion",
"function",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/apps/v1beta1/zz_generated.conversion.go#L341-L343 | train | Convert_apps_ControllerRevision_To_v1beta1_ControllerRevision is an autogenerated conversion function. | [
30522,
4569,
2278,
10463,
1035,
18726,
1035,
11486,
2890,
17084,
1035,
2000,
1035,
1058,
2487,
20915,
27717,
1035,
11486,
2890,
17084,
1006,
1999,
1008,
18726,
1012,
11486,
2890,
17084,
1010,
2041,
1008,
1058,
2487,
20915,
27717,
1012,
11486,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | pkg/kubelet/kubeletconfig/configsync.go | syncConfigSource | func (cc *Controller) syncConfigSource(client clientset.Interface, eventClient v1core.EventsGetter, nodeName string) {
select {
case <-cc.pendingConfigSource:
default:
// no work to be done, return
return
}
// if the sync fails, we want to retry
var syncerr error
defer func() {
if syncerr != nil {
utillog.Errorf(syncerr.Error())
cc.pokeConfigSourceWorker()
}
}()
// get the latest Node.Spec.ConfigSource from the informer
source, err := latestNodeConfigSource(cc.nodeInformer.GetStore(), nodeName)
if err != nil {
cc.configStatus.SetErrorOverride(fmt.Sprintf(status.SyncErrorFmt, status.InternalError))
syncerr = fmt.Errorf("%s, error: %v", status.InternalError, err)
return
}
// a nil source simply means we reset to local defaults
if source == nil {
utillog.Infof("Node.Spec.ConfigSource is empty, will reset assigned and last-known-good to defaults")
if updated, reason, err := cc.resetConfig(); err != nil {
reason = fmt.Sprintf(status.SyncErrorFmt, reason)
cc.configStatus.SetErrorOverride(reason)
syncerr = fmt.Errorf("%s, error: %v", reason, err)
return
} else if updated {
restartForNewConfig(eventClient, nodeName, nil)
}
return
}
// a non-nil source means we should attempt to download the config, and checkpoint it if necessary
utillog.Infof("Node.Spec.ConfigSource is non-empty, will checkpoint source and update config if necessary")
// TODO(mtaufen): It would be nice if we could check the payload's metadata before (re)downloading the whole payload
// we at least try pulling the latest configmap out of the local informer store.
// construct the interface that can dynamically dispatch the correct Download, etc. methods for the given source type
remote, reason, err := checkpoint.NewRemoteConfigSource(source)
if err != nil {
reason = fmt.Sprintf(status.SyncErrorFmt, reason)
cc.configStatus.SetErrorOverride(reason)
syncerr = fmt.Errorf("%s, error: %v", reason, err)
return
}
// "download" source, either from informer's in-memory store or directly from the API server, if the informer doesn't have a copy
payload, reason, err := cc.downloadConfigPayload(client, remote)
if err != nil {
reason = fmt.Sprintf(status.SyncErrorFmt, reason)
cc.configStatus.SetErrorOverride(reason)
syncerr = fmt.Errorf("%s, error: %v", reason, err)
return
}
// save a checkpoint for the payload, if one does not already exist
if reason, err := cc.saveConfigCheckpoint(remote, payload); err != nil {
reason = fmt.Sprintf(status.SyncErrorFmt, reason)
cc.configStatus.SetErrorOverride(reason)
syncerr = fmt.Errorf("%s, error: %v", reason, err)
return
}
// update the local, persistent record of assigned config
if updated, reason, err := cc.setAssignedConfig(remote); err != nil {
reason = fmt.Sprintf(status.SyncErrorFmt, reason)
cc.configStatus.SetErrorOverride(reason)
syncerr = fmt.Errorf("%s, error: %v", reason, err)
return
} else if updated {
restartForNewConfig(eventClient, nodeName, remote)
}
// If we get here:
// - there is no need to restart to use new config
// - there was no error trying to sync configuration
// - if, previously, there was an error trying to sync configuration, we need to clear that error from the status
cc.configStatus.SetErrorOverride("")
} | go | func (cc *Controller) syncConfigSource(client clientset.Interface, eventClient v1core.EventsGetter, nodeName string) {
select {
case <-cc.pendingConfigSource:
default:
// no work to be done, return
return
}
// if the sync fails, we want to retry
var syncerr error
defer func() {
if syncerr != nil {
utillog.Errorf(syncerr.Error())
cc.pokeConfigSourceWorker()
}
}()
// get the latest Node.Spec.ConfigSource from the informer
source, err := latestNodeConfigSource(cc.nodeInformer.GetStore(), nodeName)
if err != nil {
cc.configStatus.SetErrorOverride(fmt.Sprintf(status.SyncErrorFmt, status.InternalError))
syncerr = fmt.Errorf("%s, error: %v", status.InternalError, err)
return
}
// a nil source simply means we reset to local defaults
if source == nil {
utillog.Infof("Node.Spec.ConfigSource is empty, will reset assigned and last-known-good to defaults")
if updated, reason, err := cc.resetConfig(); err != nil {
reason = fmt.Sprintf(status.SyncErrorFmt, reason)
cc.configStatus.SetErrorOverride(reason)
syncerr = fmt.Errorf("%s, error: %v", reason, err)
return
} else if updated {
restartForNewConfig(eventClient, nodeName, nil)
}
return
}
// a non-nil source means we should attempt to download the config, and checkpoint it if necessary
utillog.Infof("Node.Spec.ConfigSource is non-empty, will checkpoint source and update config if necessary")
// TODO(mtaufen): It would be nice if we could check the payload's metadata before (re)downloading the whole payload
// we at least try pulling the latest configmap out of the local informer store.
// construct the interface that can dynamically dispatch the correct Download, etc. methods for the given source type
remote, reason, err := checkpoint.NewRemoteConfigSource(source)
if err != nil {
reason = fmt.Sprintf(status.SyncErrorFmt, reason)
cc.configStatus.SetErrorOverride(reason)
syncerr = fmt.Errorf("%s, error: %v", reason, err)
return
}
// "download" source, either from informer's in-memory store or directly from the API server, if the informer doesn't have a copy
payload, reason, err := cc.downloadConfigPayload(client, remote)
if err != nil {
reason = fmt.Sprintf(status.SyncErrorFmt, reason)
cc.configStatus.SetErrorOverride(reason)
syncerr = fmt.Errorf("%s, error: %v", reason, err)
return
}
// save a checkpoint for the payload, if one does not already exist
if reason, err := cc.saveConfigCheckpoint(remote, payload); err != nil {
reason = fmt.Sprintf(status.SyncErrorFmt, reason)
cc.configStatus.SetErrorOverride(reason)
syncerr = fmt.Errorf("%s, error: %v", reason, err)
return
}
// update the local, persistent record of assigned config
if updated, reason, err := cc.setAssignedConfig(remote); err != nil {
reason = fmt.Sprintf(status.SyncErrorFmt, reason)
cc.configStatus.SetErrorOverride(reason)
syncerr = fmt.Errorf("%s, error: %v", reason, err)
return
} else if updated {
restartForNewConfig(eventClient, nodeName, remote)
}
// If we get here:
// - there is no need to restart to use new config
// - there was no error trying to sync configuration
// - if, previously, there was an error trying to sync configuration, we need to clear that error from the status
cc.configStatus.SetErrorOverride("")
} | [
"func",
"(",
"cc",
"*",
"Controller",
")",
"syncConfigSource",
"(",
"client",
"clientset",
".",
"Interface",
",",
"eventClient",
"v1core",
".",
"EventsGetter",
",",
"nodeName",
"string",
")",
"{",
"select",
"{",
"case",
"<-",
"cc",
".",
"pendingConfigSource",
... | // syncConfigSource checks if work needs to be done to use a new configuration, and does that work if necessary | [
"syncConfigSource",
"checks",
"if",
"work",
"needs",
"to",
"be",
"done",
"to",
"use",
"a",
"new",
"configuration",
"and",
"does",
"that",
"work",
"if",
"necessary"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/kubeletconfig/configsync.go#L55-L141 | train | syncConfigSource is used to sync the config source for the given node. | [
30522,
4569,
2278,
1006,
10507,
1008,
11486,
1007,
26351,
8663,
8873,
5620,
8162,
3401,
1006,
7396,
7846,
3388,
1012,
8278,
1010,
2724,
20464,
11638,
1058,
2487,
17345,
1012,
2824,
18150,
3334,
1010,
13045,
18442,
5164,
1007,
1063,
7276,
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 | cmd/kubeadm/app/util/apiclient/wait.go | WaitForAPI | func (w *KubeWaiter) WaitForAPI() error {
start := time.Now()
return wait.PollImmediate(constants.APICallRetryInterval, w.timeout, func() (bool, error) {
healthStatus := 0
w.client.Discovery().RESTClient().Get().AbsPath("/healthz").Do().StatusCode(&healthStatus)
if healthStatus != http.StatusOK {
return false, nil
}
fmt.Printf("[apiclient] All control plane components are healthy after %f seconds\n", time.Since(start).Seconds())
return true, nil
})
} | go | func (w *KubeWaiter) WaitForAPI() error {
start := time.Now()
return wait.PollImmediate(constants.APICallRetryInterval, w.timeout, func() (bool, error) {
healthStatus := 0
w.client.Discovery().RESTClient().Get().AbsPath("/healthz").Do().StatusCode(&healthStatus)
if healthStatus != http.StatusOK {
return false, nil
}
fmt.Printf("[apiclient] All control plane components are healthy after %f seconds\n", time.Since(start).Seconds())
return true, nil
})
} | [
"func",
"(",
"w",
"*",
"KubeWaiter",
")",
"WaitForAPI",
"(",
")",
"error",
"{",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"return",
"wait",
".",
"PollImmediate",
"(",
"constants",
".",
"APICallRetryInterval",
",",
"w",
".",
"timeout",
",",
"fu... | // WaitForAPI waits for the API Server's /healthz endpoint to report "ok" | [
"WaitForAPI",
"waits",
"for",
"the",
"API",
"Server",
"s",
"/",
"healthz",
"endpoint",
"to",
"report",
"ok"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/util/apiclient/wait.go#L78-L90 | train | WaitForAPI waits for the API to be healthy. | [
30522,
4569,
2278,
1006,
1059,
1008,
13970,
4783,
29601,
2099,
1007,
3524,
29278,
9331,
2072,
1006,
1007,
7561,
1063,
2707,
1024,
1027,
2051,
1012,
2085,
1006,
1007,
2709,
3524,
1012,
8554,
5714,
16969,
2618,
1006,
5377,
2015,
1012,
29197,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/awsebs/aws_util.go | CreateVolume | func (util *AWSDiskUtil) CreateVolume(c *awsElasticBlockStoreProvisioner, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm) (aws.KubernetesVolumeID, int, map[string]string, string, error) {
cloud, err := getCloudProvider(c.awsElasticBlockStore.plugin.host.GetCloudProvider())
if err != nil {
return "", 0, nil, "", err
}
// AWS volumes don't have Name field, store the name in Name tag
var tags map[string]string
if c.options.CloudTags == nil {
tags = make(map[string]string)
} else {
tags = *c.options.CloudTags
}
tags["Name"] = volumeutil.GenerateVolumeName(c.options.ClusterName, c.options.PVName, 255) // AWS tags can have 255 characters
capacity := c.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
zonesWithNodes, err := cloud.GetCandidateZonesForDynamicVolume()
if err != nil {
return "", 0, nil, "", fmt.Errorf("error querying for all zones: %v", err)
}
volumeOptions, err := populateVolumeOptions(c.plugin.GetPluginName(), c.options.PVC.Name, capacity, tags, c.options.Parameters, node, allowedTopologies, zonesWithNodes)
if err != nil {
klog.V(2).Infof("Error populating EBS options: %v", err)
return "", 0, nil, "", err
}
// TODO: implement PVC.Selector parsing
if c.options.PVC.Spec.Selector != nil {
return "", 0, nil, "", fmt.Errorf("claim.Spec.Selector is not supported for dynamic provisioning on AWS")
}
name, err := cloud.CreateDisk(volumeOptions)
if err != nil {
klog.V(2).Infof("Error creating EBS Disk volume: %v", err)
return "", 0, nil, "", err
}
klog.V(2).Infof("Successfully created EBS Disk volume %s", name)
labels, err := cloud.GetVolumeLabels(name)
if err != nil {
// We don't really want to leak the volume here...
klog.Errorf("error building labels for new EBS volume %q: %v", name, err)
}
fstype := ""
for k, v := range c.options.Parameters {
if strings.ToLower(k) == volume.VolumeParameterFSType {
fstype = v
}
}
return name, volumeOptions.CapacityGB, labels, fstype, nil
} | go | func (util *AWSDiskUtil) CreateVolume(c *awsElasticBlockStoreProvisioner, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm) (aws.KubernetesVolumeID, int, map[string]string, string, error) {
cloud, err := getCloudProvider(c.awsElasticBlockStore.plugin.host.GetCloudProvider())
if err != nil {
return "", 0, nil, "", err
}
// AWS volumes don't have Name field, store the name in Name tag
var tags map[string]string
if c.options.CloudTags == nil {
tags = make(map[string]string)
} else {
tags = *c.options.CloudTags
}
tags["Name"] = volumeutil.GenerateVolumeName(c.options.ClusterName, c.options.PVName, 255) // AWS tags can have 255 characters
capacity := c.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
zonesWithNodes, err := cloud.GetCandidateZonesForDynamicVolume()
if err != nil {
return "", 0, nil, "", fmt.Errorf("error querying for all zones: %v", err)
}
volumeOptions, err := populateVolumeOptions(c.plugin.GetPluginName(), c.options.PVC.Name, capacity, tags, c.options.Parameters, node, allowedTopologies, zonesWithNodes)
if err != nil {
klog.V(2).Infof("Error populating EBS options: %v", err)
return "", 0, nil, "", err
}
// TODO: implement PVC.Selector parsing
if c.options.PVC.Spec.Selector != nil {
return "", 0, nil, "", fmt.Errorf("claim.Spec.Selector is not supported for dynamic provisioning on AWS")
}
name, err := cloud.CreateDisk(volumeOptions)
if err != nil {
klog.V(2).Infof("Error creating EBS Disk volume: %v", err)
return "", 0, nil, "", err
}
klog.V(2).Infof("Successfully created EBS Disk volume %s", name)
labels, err := cloud.GetVolumeLabels(name)
if err != nil {
// We don't really want to leak the volume here...
klog.Errorf("error building labels for new EBS volume %q: %v", name, err)
}
fstype := ""
for k, v := range c.options.Parameters {
if strings.ToLower(k) == volume.VolumeParameterFSType {
fstype = v
}
}
return name, volumeOptions.CapacityGB, labels, fstype, nil
} | [
"func",
"(",
"util",
"*",
"AWSDiskUtil",
")",
"CreateVolume",
"(",
"c",
"*",
"awsElasticBlockStoreProvisioner",
",",
"node",
"*",
"v1",
".",
"Node",
",",
"allowedTopologies",
"[",
"]",
"v1",
".",
"TopologySelectorTerm",
")",
"(",
"aws",
".",
"KubernetesVolumeI... | // CreateVolume creates an AWS EBS volume.
// Returns: volumeID, volumeSizeGB, labels, error | [
"CreateVolume",
"creates",
"an",
"AWS",
"EBS",
"volume",
".",
"Returns",
":",
"volumeID",
"volumeSizeGB",
"labels",
"error"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/awsebs/aws_util.go#L72-L126 | train | CreateVolume creates a new volume | [
30522,
4569,
2278,
1006,
21183,
4014,
1008,
22091,
16150,
20573,
21823,
2140,
1007,
3443,
6767,
12942,
2063,
1006,
30524,
13970,
5677,
7159,
2229,
6767,
12942,
7416,
2094,
1010,
20014,
1010,
4949,
1031,
5164,
1033,
5164,
1010,
5164,
1010,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/watch/until.go | Until | func Until(ctx context.Context, initialResourceVersion string, watcherClient cache.Watcher, conditions ...ConditionFunc) (*watch.Event, error) {
w, err := NewRetryWatcher(initialResourceVersion, watcherClient)
if err != nil {
return nil, err
}
return UntilWithoutRetry(ctx, w, conditions...)
} | go | func Until(ctx context.Context, initialResourceVersion string, watcherClient cache.Watcher, conditions ...ConditionFunc) (*watch.Event, error) {
w, err := NewRetryWatcher(initialResourceVersion, watcherClient)
if err != nil {
return nil, err
}
return UntilWithoutRetry(ctx, w, conditions...)
} | [
"func",
"Until",
"(",
"ctx",
"context",
".",
"Context",
",",
"initialResourceVersion",
"string",
",",
"watcherClient",
"cache",
".",
"Watcher",
",",
"conditions",
"...",
"ConditionFunc",
")",
"(",
"*",
"watch",
".",
"Event",
",",
"error",
")",
"{",
"w",
",... | // Until wraps the watcherClient's watch function with RetryWatcher making sure that watcher gets restarted in case of errors.
// The initialResourceVersion will be given to watch method when first called. It shall not be "" or "0"
// given the underlying WATCH call issues (#74022). If you want the initial list ("", "0") done for you use ListWatchUntil instead.
// Remaining behaviour is identical to function UntilWithoutRetry. (See above.)
// Until can deal with API timeouts and lost connections.
// It guarantees you to see all events and in the order they happened.
// Due to this guarantee there is no way it can deal with 'Resource version too old error'. It will fail in this case.
// (See `UntilWithSync` if you'd prefer to recover from all the errors including RV too old by re-listing
// those items. In normal code you should care about being level driven so you'd not care about not seeing all the edges.)
// The most frequent usage for Until would be a test where you want to verify exact order of events ("edges"). | [
"Until",
"wraps",
"the",
"watcherClient",
"s",
"watch",
"function",
"with",
"RetryWatcher",
"making",
"sure",
"that",
"watcher",
"gets",
"restarted",
"in",
"case",
"of",
"errors",
".",
"The",
"initialResourceVersion",
"will",
"be",
"given",
"to",
"watch",
"metho... | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/tools/watch/until.go#L108-L115 | train | Until returns a watch. Event that will be sent to the watcherClient. | [
30522,
4569,
2278,
2127,
1006,
14931,
2595,
6123,
1012,
6123,
1010,
3988,
6072,
8162,
3401,
27774,
5164,
1010,
3422,
2121,
20464,
11638,
17053,
1012,
3422,
2121,
1010,
3785,
1012,
1012,
1012,
4650,
11263,
12273,
1007,
1006,
1008,
3422,
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/util/async/bounded_frequency_runner.go | construct | func construct(name string, fn func(), minInterval, maxInterval time.Duration, burstRuns int, timer timer) *BoundedFrequencyRunner {
if maxInterval < minInterval {
panic(fmt.Sprintf("%s: maxInterval (%v) must be >= minInterval (%v)", name, minInterval, maxInterval))
}
if timer == nil {
panic(fmt.Sprintf("%s: timer must be non-nil", name))
}
bfr := &BoundedFrequencyRunner{
name: name,
fn: fn,
minInterval: minInterval,
maxInterval: maxInterval,
run: make(chan struct{}, 1),
timer: timer,
}
if minInterval == 0 {
bfr.limiter = nullLimiter{}
} else {
// allow burst updates in short succession
qps := float32(time.Second) / float32(minInterval)
bfr.limiter = flowcontrol.NewTokenBucketRateLimiterWithClock(qps, burstRuns, timer)
}
return bfr
} | go | func construct(name string, fn func(), minInterval, maxInterval time.Duration, burstRuns int, timer timer) *BoundedFrequencyRunner {
if maxInterval < minInterval {
panic(fmt.Sprintf("%s: maxInterval (%v) must be >= minInterval (%v)", name, minInterval, maxInterval))
}
if timer == nil {
panic(fmt.Sprintf("%s: timer must be non-nil", name))
}
bfr := &BoundedFrequencyRunner{
name: name,
fn: fn,
minInterval: minInterval,
maxInterval: maxInterval,
run: make(chan struct{}, 1),
timer: timer,
}
if minInterval == 0 {
bfr.limiter = nullLimiter{}
} else {
// allow burst updates in short succession
qps := float32(time.Second) / float32(minInterval)
bfr.limiter = flowcontrol.NewTokenBucketRateLimiterWithClock(qps, burstRuns, timer)
}
return bfr
} | [
"func",
"construct",
"(",
"name",
"string",
",",
"fn",
"func",
"(",
")",
",",
"minInterval",
",",
"maxInterval",
"time",
".",
"Duration",
",",
"burstRuns",
"int",
",",
"timer",
"timer",
")",
"*",
"BoundedFrequencyRunner",
"{",
"if",
"maxInterval",
"<",
"mi... | // Make an instance with dependencies injected. | [
"Make",
"an",
"instance",
"with",
"dependencies",
"injected",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/util/async/bounded_frequency_runner.go#L141-L165 | train | construct creates a new BoundedFrequencyRunner. | [
30522,
4569,
2278,
9570,
1006,
2171,
5164,
1010,
1042,
2078,
4569,
2278,
1006,
1007,
1010,
7163,
10111,
26585,
1010,
30524,
1055,
1024,
21510,
10111,
26585,
1006,
1003,
1058,
1007,
2442,
2022,
1028,
1027,
7163,
10111,
26585,
1006,
1003,
105... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | pkg/controller/apis/config/v1alpha1/zz_generated.conversion.go | RegisterConversions | func RegisterConversions(s *runtime.Scheme) error {
if err := s.AddGeneratedConversionFunc((*v1alpha1.CloudProviderConfiguration)(nil), (*config.CloudProviderConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_CloudProviderConfiguration_To_config_CloudProviderConfiguration(a.(*v1alpha1.CloudProviderConfiguration), b.(*config.CloudProviderConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*config.CloudProviderConfiguration)(nil), (*v1alpha1.CloudProviderConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_CloudProviderConfiguration_To_v1alpha1_CloudProviderConfiguration(a.(*config.CloudProviderConfiguration), b.(*v1alpha1.CloudProviderConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.DeprecatedControllerConfiguration)(nil), (*config.DeprecatedControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_DeprecatedControllerConfiguration_To_config_DeprecatedControllerConfiguration(a.(*v1alpha1.DeprecatedControllerConfiguration), b.(*config.DeprecatedControllerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*config.DeprecatedControllerConfiguration)(nil), (*v1alpha1.DeprecatedControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_DeprecatedControllerConfiguration_To_v1alpha1_DeprecatedControllerConfiguration(a.(*config.DeprecatedControllerConfiguration), b.(*v1alpha1.DeprecatedControllerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.GenericControllerManagerConfiguration)(nil), (*config.GenericControllerManagerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_GenericControllerManagerConfiguration_To_config_GenericControllerManagerConfiguration(a.(*v1alpha1.GenericControllerManagerConfiguration), b.(*config.GenericControllerManagerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*config.GenericControllerManagerConfiguration)(nil), (*v1alpha1.GenericControllerManagerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_GenericControllerManagerConfiguration_To_v1alpha1_GenericControllerManagerConfiguration(a.(*config.GenericControllerManagerConfiguration), b.(*v1alpha1.GenericControllerManagerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.GroupResource)(nil), (*v1.GroupResource)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_GroupResource_To_v1_GroupResource(a.(*v1alpha1.GroupResource), b.(*v1.GroupResource), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1.GroupResource)(nil), (*v1alpha1.GroupResource)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_GroupResource_To_v1alpha1_GroupResource(a.(*v1.GroupResource), b.(*v1alpha1.GroupResource), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.KubeCloudSharedConfiguration)(nil), (*config.KubeCloudSharedConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_KubeCloudSharedConfiguration_To_config_KubeCloudSharedConfiguration(a.(*v1alpha1.KubeCloudSharedConfiguration), b.(*config.KubeCloudSharedConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*config.KubeCloudSharedConfiguration)(nil), (*v1alpha1.KubeCloudSharedConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_KubeCloudSharedConfiguration_To_v1alpha1_KubeCloudSharedConfiguration(a.(*config.KubeCloudSharedConfiguration), b.(*v1alpha1.KubeCloudSharedConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.KubeControllerManagerConfiguration)(nil), (*config.KubeControllerManagerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_KubeControllerManagerConfiguration_To_config_KubeControllerManagerConfiguration(a.(*v1alpha1.KubeControllerManagerConfiguration), b.(*config.KubeControllerManagerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*config.KubeControllerManagerConfiguration)(nil), (*v1alpha1.KubeControllerManagerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_KubeControllerManagerConfiguration_To_v1alpha1_KubeControllerManagerConfiguration(a.(*config.KubeControllerManagerConfiguration), b.(*v1alpha1.KubeControllerManagerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*config.GenericControllerManagerConfiguration)(nil), (*v1alpha1.GenericControllerManagerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_GenericControllerManagerConfiguration_To_v1alpha1_GenericControllerManagerConfiguration(a.(*config.GenericControllerManagerConfiguration), b.(*v1alpha1.GenericControllerManagerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*config.KubeCloudSharedConfiguration)(nil), (*v1alpha1.KubeCloudSharedConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_KubeCloudSharedConfiguration_To_v1alpha1_KubeCloudSharedConfiguration(a.(*config.KubeCloudSharedConfiguration), b.(*v1alpha1.KubeCloudSharedConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*v1alpha1.GenericControllerManagerConfiguration)(nil), (*config.GenericControllerManagerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_GenericControllerManagerConfiguration_To_config_GenericControllerManagerConfiguration(a.(*v1alpha1.GenericControllerManagerConfiguration), b.(*config.GenericControllerManagerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*v1alpha1.KubeCloudSharedConfiguration)(nil), (*config.KubeCloudSharedConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_KubeCloudSharedConfiguration_To_config_KubeCloudSharedConfiguration(a.(*v1alpha1.KubeCloudSharedConfiguration), b.(*config.KubeCloudSharedConfiguration), scope)
}); err != nil {
return err
}
return nil
} | go | func RegisterConversions(s *runtime.Scheme) error {
if err := s.AddGeneratedConversionFunc((*v1alpha1.CloudProviderConfiguration)(nil), (*config.CloudProviderConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_CloudProviderConfiguration_To_config_CloudProviderConfiguration(a.(*v1alpha1.CloudProviderConfiguration), b.(*config.CloudProviderConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*config.CloudProviderConfiguration)(nil), (*v1alpha1.CloudProviderConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_CloudProviderConfiguration_To_v1alpha1_CloudProviderConfiguration(a.(*config.CloudProviderConfiguration), b.(*v1alpha1.CloudProviderConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.DeprecatedControllerConfiguration)(nil), (*config.DeprecatedControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_DeprecatedControllerConfiguration_To_config_DeprecatedControllerConfiguration(a.(*v1alpha1.DeprecatedControllerConfiguration), b.(*config.DeprecatedControllerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*config.DeprecatedControllerConfiguration)(nil), (*v1alpha1.DeprecatedControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_DeprecatedControllerConfiguration_To_v1alpha1_DeprecatedControllerConfiguration(a.(*config.DeprecatedControllerConfiguration), b.(*v1alpha1.DeprecatedControllerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.GenericControllerManagerConfiguration)(nil), (*config.GenericControllerManagerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_GenericControllerManagerConfiguration_To_config_GenericControllerManagerConfiguration(a.(*v1alpha1.GenericControllerManagerConfiguration), b.(*config.GenericControllerManagerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*config.GenericControllerManagerConfiguration)(nil), (*v1alpha1.GenericControllerManagerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_GenericControllerManagerConfiguration_To_v1alpha1_GenericControllerManagerConfiguration(a.(*config.GenericControllerManagerConfiguration), b.(*v1alpha1.GenericControllerManagerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.GroupResource)(nil), (*v1.GroupResource)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_GroupResource_To_v1_GroupResource(a.(*v1alpha1.GroupResource), b.(*v1.GroupResource), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1.GroupResource)(nil), (*v1alpha1.GroupResource)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_GroupResource_To_v1alpha1_GroupResource(a.(*v1.GroupResource), b.(*v1alpha1.GroupResource), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.KubeCloudSharedConfiguration)(nil), (*config.KubeCloudSharedConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_KubeCloudSharedConfiguration_To_config_KubeCloudSharedConfiguration(a.(*v1alpha1.KubeCloudSharedConfiguration), b.(*config.KubeCloudSharedConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*config.KubeCloudSharedConfiguration)(nil), (*v1alpha1.KubeCloudSharedConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_KubeCloudSharedConfiguration_To_v1alpha1_KubeCloudSharedConfiguration(a.(*config.KubeCloudSharedConfiguration), b.(*v1alpha1.KubeCloudSharedConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.KubeControllerManagerConfiguration)(nil), (*config.KubeControllerManagerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_KubeControllerManagerConfiguration_To_config_KubeControllerManagerConfiguration(a.(*v1alpha1.KubeControllerManagerConfiguration), b.(*config.KubeControllerManagerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*config.KubeControllerManagerConfiguration)(nil), (*v1alpha1.KubeControllerManagerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_KubeControllerManagerConfiguration_To_v1alpha1_KubeControllerManagerConfiguration(a.(*config.KubeControllerManagerConfiguration), b.(*v1alpha1.KubeControllerManagerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*config.GenericControllerManagerConfiguration)(nil), (*v1alpha1.GenericControllerManagerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_GenericControllerManagerConfiguration_To_v1alpha1_GenericControllerManagerConfiguration(a.(*config.GenericControllerManagerConfiguration), b.(*v1alpha1.GenericControllerManagerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*config.KubeCloudSharedConfiguration)(nil), (*v1alpha1.KubeCloudSharedConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_KubeCloudSharedConfiguration_To_v1alpha1_KubeCloudSharedConfiguration(a.(*config.KubeCloudSharedConfiguration), b.(*v1alpha1.KubeCloudSharedConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*v1alpha1.GenericControllerManagerConfiguration)(nil), (*config.GenericControllerManagerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_GenericControllerManagerConfiguration_To_config_GenericControllerManagerConfiguration(a.(*v1alpha1.GenericControllerManagerConfiguration), b.(*config.GenericControllerManagerConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*v1alpha1.KubeCloudSharedConfiguration)(nil), (*config.KubeCloudSharedConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_KubeCloudSharedConfiguration_To_config_KubeCloudSharedConfiguration(a.(*v1alpha1.KubeCloudSharedConfiguration), b.(*config.KubeCloudSharedConfiguration), scope)
}); err != nil {
return err
}
return nil
} | [
"func",
"RegisterConversions",
"(",
"s",
"*",
"runtime",
".",
"Scheme",
")",
"error",
"{",
"if",
"err",
":=",
"s",
".",
"AddGeneratedConversionFunc",
"(",
"(",
"*",
"v1alpha1",
".",
"CloudProviderConfiguration",
")",
"(",
"nil",
")",
",",
"(",
"*",
"config... | // RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes. | [
"RegisterConversions",
"adds",
"conversion",
"functions",
"to",
"the",
"given",
"scheme",
".",
"Public",
"to",
"allow",
"building",
"arbitrary",
"schemes",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/apis/config/v1alpha1/zz_generated.conversion.go#L59-L141 | train | RegisterConversions registers conversion functions to the given scheme. | [
30522,
4569,
2278,
4236,
8663,
27774,
2015,
1006,
1055,
1008,
2448,
7292,
1012,
5679,
1007,
7561,
1063,
2065,
9413,
2099,
1024,
1027,
1055,
1012,
5587,
6914,
16848,
8663,
27774,
11263,
12273,
1006,
1006,
1008,
1058,
2487,
2389,
21890,
2487,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | pkg/apis/core/zz_generated.deepcopy.go | DeepCopy | func (in *ServiceAccount) DeepCopy() *ServiceAccount {
if in == nil {
return nil
}
out := new(ServiceAccount)
in.DeepCopyInto(out)
return out
} | go | func (in *ServiceAccount) DeepCopy() *ServiceAccount {
if in == nil {
return nil
}
out := new(ServiceAccount)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ServiceAccount",
")",
"DeepCopy",
"(",
")",
"*",
"ServiceAccount",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ServiceAccount",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"ou... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceAccount. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ServiceAccount",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/core/zz_generated.deepcopy.go#L4767-L4774 | train | DeepCopy is an autogenerated deepcopy function copying the receiver creating a new ServiceAccount. | [
30522,
4569,
2278,
1006,
1999,
1008,
2326,
6305,
3597,
16671,
1007,
2784,
3597,
7685,
1006,
1007,
1008,
2326,
6305,
3597,
16671,
1063,
2065,
1999,
1027,
1027,
9152,
2140,
1063,
2709,
9152,
2140,
1065,
2041,
1024,
1027,
2047,
1006,
2326,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | DeepCopy | func (in *CSINodeDriver) DeepCopy() *CSINodeDriver {
if in == nil {
return nil
}
out := new(CSINodeDriver)
in.DeepCopyInto(out)
return out
} | go | func (in *CSINodeDriver) DeepCopy() *CSINodeDriver {
if in == nil {
return nil
}
out := new(CSINodeDriver)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"CSINodeDriver",
")",
"DeepCopy",
"(",
")",
"*",
"CSINodeDriver",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"CSINodeDriver",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CSINodeDriver. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"CSINodeDriver",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/storage/zz_generated.deepcopy.go#L153-L160 | train | DeepCopy is an autogenerated deepcopy function copying the receiver creating a new CSINodeDriver. | [
30522,
4569,
2278,
1006,
1999,
1008,
22174,
3630,
5732,
24352,
1007,
2784,
3597,
7685,
1006,
1007,
1008,
22174,
3630,
5732,
24352,
1063,
2065,
1999,
1027,
1027,
9152,
2140,
1063,
2709,
9152,
2140,
1065,
2041,
1024,
1027,
2047,
1006,
22174,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/helpers.go | HasPerVersionSchema | func HasPerVersionSchema(versions []CustomResourceDefinitionVersion) bool {
for _, v := range versions {
if v.Schema != nil {
return true
}
}
return false
} | go | func HasPerVersionSchema(versions []CustomResourceDefinitionVersion) bool {
for _, v := range versions {
if v.Schema != nil {
return true
}
}
return false
} | [
"func",
"HasPerVersionSchema",
"(",
"versions",
"[",
"]",
"CustomResourceDefinitionVersion",
")",
"bool",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"versions",
"{",
"if",
"v",
".",
"Schema",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",... | // HasPerVersionSchema returns true if a CRD uses per-version schema. | [
"HasPerVersionSchema",
"returns",
"true",
"if",
"a",
"CRD",
"uses",
"per",
"-",
"version",
"schema",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/helpers.go#L205-L212 | train | HasPerVersionSchema returns true if the schema is set on all the versions. | [
30522,
4569,
2278,
2038,
4842,
27774,
22842,
2863,
1006,
4617,
1031,
1033,
7661,
6072,
8162,
22119,
16294,
22753,
27774,
1007,
22017,
2140,
1063,
2005,
1035,
1010,
1058,
1024,
1027,
2846,
4617,
1063,
2065,
1058,
1012,
8040,
28433,
999,
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/apis/core/zz_generated.deepcopy.go | DeepCopyInto | func (in ResourceList) DeepCopyInto(out *ResourceList) {
{
in := &in
*out = make(ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
return
}
} | go | func (in ResourceList) DeepCopyInto(out *ResourceList) {
{
in := &in
*out = make(ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
return
}
} | [
"func",
"(",
"in",
"ResourceList",
")",
"DeepCopyInto",
"(",
"out",
"*",
"ResourceList",
")",
"{",
"{",
"in",
":=",
"&",
"in",
"\n",
"*",
"out",
"=",
"make",
"(",
"ResourceList",
",",
"len",
"(",
"*",
"in",
")",
")",
"\n",
"for",
"key",
",",
"val... | // 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#L4150-L4159 | train | DeepCopyInto copies the receiver to the receiver. | [
30522,
4569,
2278,
1006,
1999,
7692,
9863,
1007,
2784,
3597,
7685,
18447,
2080,
1006,
2041,
1008,
7692,
9863,
1007,
1063,
1063,
1999,
1024,
1027,
1004,
1999,
1008,
2041,
1027,
2191,
1006,
7692,
9863,
1010,
18798,
1006,
1008,
1999,
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 | staging/src/k8s.io/client-go/kubernetes/typed/core/v1/persistentvolumeclaim.go | Create | func (c *persistentVolumeClaims) Create(persistentVolumeClaim *v1.PersistentVolumeClaim) (result *v1.PersistentVolumeClaim, err error) {
result = &v1.PersistentVolumeClaim{}
err = c.client.Post().
Namespace(c.ns).
Resource("persistentvolumeclaims").
Body(persistentVolumeClaim).
Do().
Into(result)
return
} | go | func (c *persistentVolumeClaims) Create(persistentVolumeClaim *v1.PersistentVolumeClaim) (result *v1.PersistentVolumeClaim, err error) {
result = &v1.PersistentVolumeClaim{}
err = c.client.Post().
Namespace(c.ns).
Resource("persistentvolumeclaims").
Body(persistentVolumeClaim).
Do().
Into(result)
return
} | [
"func",
"(",
"c",
"*",
"persistentVolumeClaims",
")",
"Create",
"(",
"persistentVolumeClaim",
"*",
"v1",
".",
"PersistentVolumeClaim",
")",
"(",
"result",
"*",
"v1",
".",
"PersistentVolumeClaim",
",",
"err",
"error",
")",
"{",
"result",
"=",
"&",
"v1",
".",
... | // Create takes the representation of a persistentVolumeClaim and creates it. Returns the server's representation of the persistentVolumeClaim, and an error, if there is any. | [
"Create",
"takes",
"the",
"representation",
"of",
"a",
"persistentVolumeClaim",
"and",
"creates",
"it",
".",
"Returns",
"the",
"server",
"s",
"representation",
"of",
"the",
"persistentVolumeClaim",
"and",
"an",
"error",
"if",
"there",
"is",
"any",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/persistentvolumeclaim.go#L112-L121 | train | Create a new persistent volume claim. | [
30522,
4569,
2278,
1006,
1039,
1008,
14516,
6767,
12942,
8586,
19771,
5244,
1007,
3443,
1006,
14516,
6767,
12942,
8586,
19771,
2213,
1008,
1058,
2487,
1012,
14516,
6767,
12942,
8586,
19771,
2213,
1007,
1006,
2765,
1008,
1058,
2487,
1012,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/iptables/iptables.go | Restore | func (runner *runner) Restore(table Table, data []byte, flush FlushFlag, counters RestoreCountersFlag) error {
// setup args
args := []string{"-T", string(table)}
return runner.restoreInternal(args, data, flush, counters)
} | go | func (runner *runner) Restore(table Table, data []byte, flush FlushFlag, counters RestoreCountersFlag) error {
// setup args
args := []string{"-T", string(table)}
return runner.restoreInternal(args, data, flush, counters)
} | [
"func",
"(",
"runner",
"*",
"runner",
")",
"Restore",
"(",
"table",
"Table",
",",
"data",
"[",
"]",
"byte",
",",
"flush",
"FlushFlag",
",",
"counters",
"RestoreCountersFlag",
")",
"error",
"{",
"// setup args",
"args",
":=",
"[",
"]",
"string",
"{",
"\""... | // Restore is part of Interface. | [
"Restore",
"is",
"part",
"of",
"Interface",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/util/iptables/iptables.go#L340-L344 | train | Restore restores a table to a new state. | [
30522,
4569,
2278,
1006,
5479,
1008,
5479,
1007,
9239,
1006,
2795,
2795,
1010,
2951,
1031,
1033,
24880,
1010,
13862,
13862,
10258,
8490,
1010,
24094,
9239,
3597,
16671,
2545,
10258,
8490,
1007,
7561,
1063,
1013,
1013,
16437,
12098,
5620,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/fc/fc_util.go | findDiskWWIDs | func findDiskWWIDs(wwid string, io ioHandler, deviceUtil volumeutil.DeviceUtil) (string, string) {
// Example wwid format:
// 3600508b400105e210000900000490000
// <VENDOR NAME> <IDENTIFIER NUMBER>
// Example of symlink under by-id:
// /dev/by-id/scsi-3600508b400105e210000900000490000
// /dev/by-id/scsi-<VENDOR NAME>_<IDENTIFIER NUMBER>
// The wwid could contain white space and it will be replaced
// underscore when wwid is exposed under /dev/by-id.
fcPath := "scsi-" + wwid
devID := byID
if dirs, err := io.ReadDir(devID); err == nil {
for _, f := range dirs {
name := f.Name()
if name == fcPath {
disk, err := io.EvalSymlinks(devID + name)
if err != nil {
klog.V(2).Infof("fc: failed to find a corresponding disk from symlink[%s], error %v", devID+name, err)
return "", ""
}
dm := deviceUtil.FindMultipathDeviceForDevice(disk)
klog.Infof("fc: find disk: %v, dm: %v", disk, dm)
return disk, dm
}
}
}
klog.V(2).Infof("fc: failed to find a disk [%s]", devID+fcPath)
return "", ""
} | go | func findDiskWWIDs(wwid string, io ioHandler, deviceUtil volumeutil.DeviceUtil) (string, string) {
// Example wwid format:
// 3600508b400105e210000900000490000
// <VENDOR NAME> <IDENTIFIER NUMBER>
// Example of symlink under by-id:
// /dev/by-id/scsi-3600508b400105e210000900000490000
// /dev/by-id/scsi-<VENDOR NAME>_<IDENTIFIER NUMBER>
// The wwid could contain white space and it will be replaced
// underscore when wwid is exposed under /dev/by-id.
fcPath := "scsi-" + wwid
devID := byID
if dirs, err := io.ReadDir(devID); err == nil {
for _, f := range dirs {
name := f.Name()
if name == fcPath {
disk, err := io.EvalSymlinks(devID + name)
if err != nil {
klog.V(2).Infof("fc: failed to find a corresponding disk from symlink[%s], error %v", devID+name, err)
return "", ""
}
dm := deviceUtil.FindMultipathDeviceForDevice(disk)
klog.Infof("fc: find disk: %v, dm: %v", disk, dm)
return disk, dm
}
}
}
klog.V(2).Infof("fc: failed to find a disk [%s]", devID+fcPath)
return "", ""
} | [
"func",
"findDiskWWIDs",
"(",
"wwid",
"string",
",",
"io",
"ioHandler",
",",
"deviceUtil",
"volumeutil",
".",
"DeviceUtil",
")",
"(",
"string",
",",
"string",
")",
"{",
"// Example wwid format:",
"// 3600508b400105e210000900000490000",
"// <VENDOR NAME> <IDENTIFIER NU... | // given a wwid, find the device and associated devicemapper parent | [
"given",
"a",
"wwid",
"find",
"the",
"device",
"and",
"associated",
"devicemapper",
"parent"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/fc/fc_util.go#L83-L112 | train | findDiskWWIDs returns the disk name and disk name for the given wwid. | [
30522,
4569,
2278,
2424,
10521,
2243,
2860,
9148,
5104,
1006,
1059,
9148,
2094,
5164,
1010,
22834,
22834,
11774,
3917,
1010,
5080,
21823,
2140,
3872,
21823,
2140,
1012,
5080,
21823,
2140,
1007,
1006,
5164,
1010,
5164,
1007,
1063,
1013,
1013... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | pkg/kubelet/cm/cpumanager/state/state.go | Clone | func (as ContainerCPUAssignments) Clone() ContainerCPUAssignments {
ret := make(ContainerCPUAssignments)
for key, val := range as {
ret[key] = val
}
return ret
} | go | func (as ContainerCPUAssignments) Clone() ContainerCPUAssignments {
ret := make(ContainerCPUAssignments)
for key, val := range as {
ret[key] = val
}
return ret
} | [
"func",
"(",
"as",
"ContainerCPUAssignments",
")",
"Clone",
"(",
")",
"ContainerCPUAssignments",
"{",
"ret",
":=",
"make",
"(",
"ContainerCPUAssignments",
")",
"\n",
"for",
"key",
",",
"val",
":=",
"range",
"as",
"{",
"ret",
"[",
"key",
"]",
"=",
"val",
... | // Clone returns a copy of ContainerCPUAssignments | [
"Clone",
"returns",
"a",
"copy",
"of",
"ContainerCPUAssignments"
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/cm/cpumanager/state/state.go#L27-L33 | train | Clone returns a copy of the containerCPUAssignments | [
30522,
4569,
2278,
1006,
2004,
11661,
21906,
6692,
18719,
16206,
8163,
1007,
17598,
1006,
1007,
11661,
21906,
6692,
18719,
16206,
8163,
1063,
2128,
2102,
1024,
1027,
2191,
1006,
11661,
21906,
6692,
18719,
16206,
8163,
1007,
2005,
3145,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kubernetes/kubernetes | staging/src/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_mutatingwebhookconfiguration.go | DeleteCollection | func (c *FakeMutatingWebhookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(mutatingwebhookconfigurationsResource, listOptions)
_, err := c.Fake.Invokes(action, &v1beta1.MutatingWebhookConfigurationList{})
return err
} | go | func (c *FakeMutatingWebhookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(mutatingwebhookconfigurationsResource, listOptions)
_, err := c.Fake.Invokes(action, &v1beta1.MutatingWebhookConfigurationList{})
return err
} | [
"func",
"(",
"c",
"*",
"FakeMutatingWebhookConfigurations",
")",
"DeleteCollection",
"(",
"options",
"*",
"v1",
".",
"DeleteOptions",
",",
"listOptions",
"v1",
".",
"ListOptions",
")",
"error",
"{",
"action",
":=",
"testing",
".",
"NewRootDeleteCollectionAction",
... | // DeleteCollection deletes a collection of objects. | [
"DeleteCollection",
"deletes",
"a",
"collection",
"of",
"objects",
"."
] | 6a8a3682919652ae668c389ed2f60efb770eed03 | https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/fake/fake_mutatingwebhookconfiguration.go#L105-L110 | train | DeleteCollection takes listOptions and deletes all MutatingWebhookConfigurations in the specified collection. Returns an error if one occurs. | [
30522,
4569,
2278,
1006,
1039,
1008,
8275,
28120,
5844,
8545,
23706,
14659,
8663,
8873,
27390,
10708,
1007,
3972,
12870,
26895,
18491,
1006,
7047,
1008,
1058,
2487,
1012,
3972,
12870,
7361,
9285,
1010,
2862,
7361,
9285,
1058,
2487,
1012,
28... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.