Dataset Viewer
Auto-converted to Parquet Duplicate
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
sequencelengths
22
32.6k
docstring
stringlengths
13
1.73k
docstring_tokens
sequencelengths
1
316
sha
stringclasses
1 value
url
stringlengths
114
252
partition
stringclasses
1 value
summary
stringlengths
13
316
input_ids
sequencelengths
502
502
token_type_ids
sequencelengths
502
502
attention_mask
sequencelengths
502
502
labels
sequencelengths
502
502
kubernetes/kubernetes
pkg/controller/serviceaccount/tokens_controller.go
ensureReferencedToken
func (e *TokensController) ensureReferencedToken(serviceAccount *v1.ServiceAccount) ( /* retry */ bool, error) { if hasToken, err := e.hasReferencedToken(serviceAccount); err != nil { // Don't retry cache lookup errors return false, err } else if hasToken { // A service account token already exists, and is referenced, short-circuit return false, nil } // We don't want to update the cache's copy of the service account // so add the secret to a freshly retrieved copy of the service account serviceAccounts := e.client.CoreV1().ServiceAccounts(serviceAccount.Namespace) liveServiceAccount, err := serviceAccounts.Get(serviceAccount.Name, metav1.GetOptions{}) if err != nil { // Retry if we cannot fetch the live service account (for a NotFound error, either the live lookup or our cache are stale) return true, err } if liveServiceAccount.ResourceVersion != serviceAccount.ResourceVersion { // Retry if our liveServiceAccount doesn't match our cache's resourceVersion (either the live lookup or our cache are stale) klog.V(4).Infof("liveServiceAccount.ResourceVersion (%s) does not match cache (%s), retrying", liveServiceAccount.ResourceVersion, serviceAccount.ResourceVersion) return true, nil } // Build the secret secret := &v1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: secret.Strategy.GenerateName(fmt.Sprintf("%s-token-", serviceAccount.Name)), Namespace: serviceAccount.Namespace, Annotations: map[string]string{ v1.ServiceAccountNameKey: serviceAccount.Name, v1.ServiceAccountUIDKey: string(serviceAccount.UID), }, }, Type: v1.SecretTypeServiceAccountToken, Data: map[string][]byte{}, } // Generate the token token, err := e.token.GenerateToken(serviceaccount.LegacyClaims(*serviceAccount, *secret)) if err != nil { // retriable error return true, err } secret.Data[v1.ServiceAccountTokenKey] = []byte(token) secret.Data[v1.ServiceAccountNamespaceKey] = []byte(serviceAccount.Namespace) if e.rootCA != nil && len(e.rootCA) > 0 { secret.Data[v1.ServiceAccountRootCAKey] = e.rootCA } // Save the secret createdToken, err := e.client.CoreV1().Secrets(serviceAccount.Namespace).Create(secret) if err != nil { // retriable error return true, err } // Manually add the new token to the cache store. // This prevents the service account update (below) triggering another token creation, if the referenced token couldn't be found in the store e.updatedSecrets.Mutation(createdToken) // Try to add a reference to the newly created token to the service account addedReference := false err = clientretry.RetryOnConflict(clientretry.DefaultRetry, func() error { // refresh liveServiceAccount on every retry defer func() { liveServiceAccount = nil }() // fetch the live service account if needed, and verify the UID matches and that we still need a token if liveServiceAccount == nil { liveServiceAccount, err = serviceAccounts.Get(serviceAccount.Name, metav1.GetOptions{}) if err != nil { return err } if liveServiceAccount.UID != serviceAccount.UID { // If we don't have the same service account, stop trying to add a reference to the token made for the old service account. return nil } if hasToken, err := e.hasReferencedToken(liveServiceAccount); err != nil { // Don't retry cache lookup errors return nil } else if hasToken { // A service account token already exists, and is referenced, short-circuit return nil } } // Try to add a reference to the token liveServiceAccount.Secrets = append(liveServiceAccount.Secrets, v1.ObjectReference{Name: secret.Name}) if _, err := serviceAccounts.Update(liveServiceAccount); err != nil { return err } addedReference = true return nil }) if !addedReference { // we weren't able to use the token, try to clean it up. klog.V(2).Infof("deleting secret %s/%s because reference couldn't be added (%v)", secret.Namespace, secret.Name, err) deleteOpts := &metav1.DeleteOptions{Preconditions: &metav1.Preconditions{UID: &createdToken.UID}} if deleteErr := e.client.CoreV1().Secrets(createdToken.Namespace).Delete(createdToken.Name, deleteOpts); deleteErr != nil { klog.Error(deleteErr) // if we fail, just log it } } if err != nil { if apierrors.IsConflict(err) || apierrors.IsNotFound(err) { // if we got a Conflict error, the service account was updated by someone else, and we'll get an update notification later // if we got a NotFound error, the service account no longer exists, and we don't need to create a token for it return false, nil } // retry in all other cases return true, err } // success! return false, nil }
go
func (e *TokensController) ensureReferencedToken(serviceAccount *v1.ServiceAccount) ( /* retry */ bool, error) { if hasToken, err := e.hasReferencedToken(serviceAccount); err != nil { // Don't retry cache lookup errors return false, err } else if hasToken { // A service account token already exists, and is referenced, short-circuit return false, nil } // We don't want to update the cache's copy of the service account // so add the secret to a freshly retrieved copy of the service account serviceAccounts := e.client.CoreV1().ServiceAccounts(serviceAccount.Namespace) liveServiceAccount, err := serviceAccounts.Get(serviceAccount.Name, metav1.GetOptions{}) if err != nil { // Retry if we cannot fetch the live service account (for a NotFound error, either the live lookup or our cache are stale) return true, err } if liveServiceAccount.ResourceVersion != serviceAccount.ResourceVersion { // Retry if our liveServiceAccount doesn't match our cache's resourceVersion (either the live lookup or our cache are stale) klog.V(4).Infof("liveServiceAccount.ResourceVersion (%s) does not match cache (%s), retrying", liveServiceAccount.ResourceVersion, serviceAccount.ResourceVersion) return true, nil } // Build the secret secret := &v1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: secret.Strategy.GenerateName(fmt.Sprintf("%s-token-", serviceAccount.Name)), Namespace: serviceAccount.Namespace, Annotations: map[string]string{ v1.ServiceAccountNameKey: serviceAccount.Name, v1.ServiceAccountUIDKey: string(serviceAccount.UID), }, }, Type: v1.SecretTypeServiceAccountToken, Data: map[string][]byte{}, } // Generate the token token, err := e.token.GenerateToken(serviceaccount.LegacyClaims(*serviceAccount, *secret)) if err != nil { // retriable error return true, err } secret.Data[v1.ServiceAccountTokenKey] = []byte(token) secret.Data[v1.ServiceAccountNamespaceKey] = []byte(serviceAccount.Namespace) if e.rootCA != nil && len(e.rootCA) > 0 { secret.Data[v1.ServiceAccountRootCAKey] = e.rootCA } // Save the secret createdToken, err := e.client.CoreV1().Secrets(serviceAccount.Namespace).Create(secret) if err != nil { // retriable error return true, err } // Manually add the new token to the cache store. // This prevents the service account update (below) triggering another token creation, if the referenced token couldn't be found in the store e.updatedSecrets.Mutation(createdToken) // Try to add a reference to the newly created token to the service account addedReference := false err = clientretry.RetryOnConflict(clientretry.DefaultRetry, func() error { // refresh liveServiceAccount on every retry defer func() { liveServiceAccount = nil }() // fetch the live service account if needed, and verify the UID matches and that we still need a token if liveServiceAccount == nil { liveServiceAccount, err = serviceAccounts.Get(serviceAccount.Name, metav1.GetOptions{}) if err != nil { return err } if liveServiceAccount.UID != serviceAccount.UID { // If we don't have the same service account, stop trying to add a reference to the token made for the old service account. return nil } if hasToken, err := e.hasReferencedToken(liveServiceAccount); err != nil { // Don't retry cache lookup errors return nil } else if hasToken { // A service account token already exists, and is referenced, short-circuit return nil } } // Try to add a reference to the token liveServiceAccount.Secrets = append(liveServiceAccount.Secrets, v1.ObjectReference{Name: secret.Name}) if _, err := serviceAccounts.Update(liveServiceAccount); err != nil { return err } addedReference = true return nil }) if !addedReference { // we weren't able to use the token, try to clean it up. klog.V(2).Infof("deleting secret %s/%s because reference couldn't be added (%v)", secret.Namespace, secret.Name, err) deleteOpts := &metav1.DeleteOptions{Preconditions: &metav1.Preconditions{UID: &createdToken.UID}} if deleteErr := e.client.CoreV1().Secrets(createdToken.Namespace).Delete(createdToken.Name, deleteOpts); deleteErr != nil { klog.Error(deleteErr) // if we fail, just log it } } if err != nil { if apierrors.IsConflict(err) || apierrors.IsNotFound(err) { // if we got a Conflict error, the service account was updated by someone else, and we'll get an update notification later // if we got a NotFound error, the service account no longer exists, and we don't need to create a token for it return false, nil } // retry in all other cases return true, err } // success! return false, nil }
[ "func", "(", "e", "*", "TokensController", ")", "ensureReferencedToken", "(", "serviceAccount", "*", "v1", ".", "ServiceAccount", ")", "(", "/* retry */", "bool", ",", "error", ")", "{", "if", "hasToken", ",", "err", ":=", "e", ".", "hasReferencedToken", "("...
// ensureReferencedToken makes sure at least one ServiceAccountToken secret exists, and is included in the serviceAccount's Secrets list
[ "ensureReferencedToken", "makes", "sure", "at", "least", "one", "ServiceAccountToken", "secret", "exists", "and", "is", "included", "in", "the", "serviceAccount", "s", "Secrets", "list" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/serviceaccount/tokens_controller.go#L360-L477
train
ensureReferencedToken ensures that the service account token is referenced by the service account.
[ 30522, 4569, 2278, 1006, 1041, 1008, 19204, 9363, 3372, 26611, 1007, 5676, 2890, 25523, 11927, 11045, 2078, 1006, 2326, 6305, 3597, 16671, 1008, 1058, 2487, 1012, 2326, 6305, 3597, 16671, 1007, 1006, 1013, 1008, 2128, 11129, 1008, 1013, 220...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/zz_generated.deepcopy.go
DeepCopy
func (in *CustomResourceSubresources) DeepCopy() *CustomResourceSubresources { if in == nil { return nil } out := new(CustomResourceSubresources) in.DeepCopyInto(out) return out }
go
func (in *CustomResourceSubresources) DeepCopy() *CustomResourceSubresources { if in == nil { return nil } out := new(CustomResourceSubresources) in.DeepCopyInto(out) return out }
[ "func", "(", "in", "*", "CustomResourceSubresources", ")", "DeepCopy", "(", ")", "*", "CustomResourceSubresources", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "CustomResourceSubresources", ")", "\n", "in", ...
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomResourceSubresources.
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "CustomResourceSubresources", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/zz_generated.deepcopy.go#L331-L338
train
DeepCopy is an autogenerated deepcopy function copying the receiver creating a new CustomResourceSubresources.
[ 30522, 4569, 2278, 1006, 1999, 1008, 7661, 6072, 8162, 9623, 12083, 6072, 8162, 9623, 1007, 2784, 3597, 7685, 1006, 1007, 1008, 7661, 6072, 8162, 9623, 12083, 6072, 8162, 9623, 1063, 2065, 1999, 1027, 1027, 9152, 2140, 1063, 2709, 9152, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
cmd/kubeadm/app/cmd/reset.go
resetConfigDir
func resetConfigDir(configPathDir, pkiPathDir string) { dirsToClean := []string{ filepath.Join(configPathDir, kubeadmconstants.ManifestsSubDirName), pkiPathDir, } fmt.Printf("[reset] Deleting contents of config directories: %v\n", dirsToClean) for _, dir := range dirsToClean { if err := cleanDir(dir); err != nil { klog.Errorf("[reset] Failed to remove directory: %q [%v]\n", dir, err) } } filesToClean := []string{ filepath.Join(configPathDir, kubeadmconstants.AdminKubeConfigFileName), filepath.Join(configPathDir, kubeadmconstants.KubeletKubeConfigFileName), filepath.Join(configPathDir, kubeadmconstants.KubeletBootstrapKubeConfigFileName), filepath.Join(configPathDir, kubeadmconstants.ControllerManagerKubeConfigFileName), filepath.Join(configPathDir, kubeadmconstants.SchedulerKubeConfigFileName), } fmt.Printf("[reset] Deleting files: %v\n", filesToClean) for _, path := range filesToClean { if err := os.RemoveAll(path); err != nil { klog.Errorf("[reset] Failed to remove file: %q [%v]\n", path, err) } } }
go
func resetConfigDir(configPathDir, pkiPathDir string) { dirsToClean := []string{ filepath.Join(configPathDir, kubeadmconstants.ManifestsSubDirName), pkiPathDir, } fmt.Printf("[reset] Deleting contents of config directories: %v\n", dirsToClean) for _, dir := range dirsToClean { if err := cleanDir(dir); err != nil { klog.Errorf("[reset] Failed to remove directory: %q [%v]\n", dir, err) } } filesToClean := []string{ filepath.Join(configPathDir, kubeadmconstants.AdminKubeConfigFileName), filepath.Join(configPathDir, kubeadmconstants.KubeletKubeConfigFileName), filepath.Join(configPathDir, kubeadmconstants.KubeletBootstrapKubeConfigFileName), filepath.Join(configPathDir, kubeadmconstants.ControllerManagerKubeConfigFileName), filepath.Join(configPathDir, kubeadmconstants.SchedulerKubeConfigFileName), } fmt.Printf("[reset] Deleting files: %v\n", filesToClean) for _, path := range filesToClean { if err := os.RemoveAll(path); err != nil { klog.Errorf("[reset] Failed to remove file: %q [%v]\n", path, err) } } }
[ "func", "resetConfigDir", "(", "configPathDir", ",", "pkiPathDir", "string", ")", "{", "dirsToClean", ":=", "[", "]", "string", "{", "filepath", ".", "Join", "(", "configPathDir", ",", "kubeadmconstants", ".", "ManifestsSubDirName", ")", ",", "pkiPathDir", ",", ...
// resetConfigDir is used to cleanup the files kubeadm writes in /etc/kubernetes/.
[ "resetConfigDir", "is", "used", "to", "cleanup", "the", "files", "kubeadm", "writes", "in", "/", "etc", "/", "kubernetes", "/", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/cmd/reset.go#L293-L318
train
resetConfigDir removes all the contents of the config directory
[ 30522, 4569, 2278, 25141, 8663, 8873, 2290, 4305, 2099, 1006, 9530, 8873, 21600, 8988, 4305, 2099, 1010, 1052, 3211, 15069, 4305, 2099, 5164, 1007, 1063, 16101, 16033, 14321, 2319, 1024, 1027, 1031, 1033, 5164, 1063, 5371, 15069, 1012, 3693...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/rest/request.go
request
func (r *Request) request(fn func(*http.Request, *http.Response)) error { //Metrics for total request latency start := time.Now() defer func() { metrics.RequestLatency.Observe(r.verb, r.finalURLTemplate(), time.Since(start)) }() if r.err != nil { klog.V(4).Infof("Error in request: %v", r.err) return r.err } // TODO: added to catch programmer errors (invoking operations with an object with an empty namespace) if (r.verb == "GET" || r.verb == "PUT" || r.verb == "DELETE") && r.namespaceSet && len(r.resourceName) > 0 && len(r.namespace) == 0 { return fmt.Errorf("an empty namespace may not be set when a resource name is provided") } if (r.verb == "POST") && r.namespaceSet && len(r.namespace) == 0 { return fmt.Errorf("an empty namespace may not be set during creation") } client := r.client if client == nil { client = http.DefaultClient } // Right now we make about ten retry attempts if we get a Retry-After response. maxRetries := 10 retries := 0 for { url := r.URL().String() req, err := http.NewRequest(r.verb, url, r.body) if err != nil { return err } if r.timeout > 0 { if r.ctx == nil { r.ctx = context.Background() } var cancelFn context.CancelFunc r.ctx, cancelFn = context.WithTimeout(r.ctx, r.timeout) defer cancelFn() } if r.ctx != nil { req = req.WithContext(r.ctx) } req.Header = r.headers r.backoffMgr.Sleep(r.backoffMgr.CalculateBackoff(r.URL())) if retries > 0 { // We are retrying the request that we already send to apiserver // at least once before. // This request should also be throttled with the client-internal throttler. r.tryThrottle() } resp, err := client.Do(req) updateURLMetrics(r, resp, err) if err != nil { r.backoffMgr.UpdateBackoff(r.URL(), err, 0) } else { r.backoffMgr.UpdateBackoff(r.URL(), err, resp.StatusCode) } if err != nil { // "Connection reset by peer" is usually a transient error. // Thus in case of "GET" operations, we simply retry it. // We are not automatically retrying "write" operations, as // they are not idempotent. if !net.IsConnectionReset(err) || r.verb != "GET" { return err } // For the purpose of retry, we set the artificial "retry-after" response. // TODO: Should we clean the original response if it exists? resp = &http.Response{ StatusCode: http.StatusInternalServerError, Header: http.Header{"Retry-After": []string{"1"}}, Body: ioutil.NopCloser(bytes.NewReader([]byte{})), } } done := func() bool { // Ensure the response body is fully read and closed // before we reconnect, so that we reuse the same TCP // connection. defer func() { const maxBodySlurpSize = 2 << 10 if resp.ContentLength <= maxBodySlurpSize { io.Copy(ioutil.Discard, &io.LimitedReader{R: resp.Body, N: maxBodySlurpSize}) } resp.Body.Close() }() retries++ if seconds, wait := checkWait(resp); wait && retries < maxRetries { if seeker, ok := r.body.(io.Seeker); ok && r.body != nil { _, err := seeker.Seek(0, 0) if err != nil { klog.V(4).Infof("Could not retry request, can't Seek() back to beginning of body for %T", r.body) fn(req, resp) return true } } klog.V(4).Infof("Got a Retry-After %ds response for attempt %d to %v", seconds, retries, url) r.backoffMgr.Sleep(time.Duration(seconds) * time.Second) return false } fn(req, resp) return true }() if done { return nil } } }
go
func (r *Request) request(fn func(*http.Request, *http.Response)) error { //Metrics for total request latency start := time.Now() defer func() { metrics.RequestLatency.Observe(r.verb, r.finalURLTemplate(), time.Since(start)) }() if r.err != nil { klog.V(4).Infof("Error in request: %v", r.err) return r.err } // TODO: added to catch programmer errors (invoking operations with an object with an empty namespace) if (r.verb == "GET" || r.verb == "PUT" || r.verb == "DELETE") && r.namespaceSet && len(r.resourceName) > 0 && len(r.namespace) == 0 { return fmt.Errorf("an empty namespace may not be set when a resource name is provided") } if (r.verb == "POST") && r.namespaceSet && len(r.namespace) == 0 { return fmt.Errorf("an empty namespace may not be set during creation") } client := r.client if client == nil { client = http.DefaultClient } // Right now we make about ten retry attempts if we get a Retry-After response. maxRetries := 10 retries := 0 for { url := r.URL().String() req, err := http.NewRequest(r.verb, url, r.body) if err != nil { return err } if r.timeout > 0 { if r.ctx == nil { r.ctx = context.Background() } var cancelFn context.CancelFunc r.ctx, cancelFn = context.WithTimeout(r.ctx, r.timeout) defer cancelFn() } if r.ctx != nil { req = req.WithContext(r.ctx) } req.Header = r.headers r.backoffMgr.Sleep(r.backoffMgr.CalculateBackoff(r.URL())) if retries > 0 { // We are retrying the request that we already send to apiserver // at least once before. // This request should also be throttled with the client-internal throttler. r.tryThrottle() } resp, err := client.Do(req) updateURLMetrics(r, resp, err) if err != nil { r.backoffMgr.UpdateBackoff(r.URL(), err, 0) } else { r.backoffMgr.UpdateBackoff(r.URL(), err, resp.StatusCode) } if err != nil { // "Connection reset by peer" is usually a transient error. // Thus in case of "GET" operations, we simply retry it. // We are not automatically retrying "write" operations, as // they are not idempotent. if !net.IsConnectionReset(err) || r.verb != "GET" { return err } // For the purpose of retry, we set the artificial "retry-after" response. // TODO: Should we clean the original response if it exists? resp = &http.Response{ StatusCode: http.StatusInternalServerError, Header: http.Header{"Retry-After": []string{"1"}}, Body: ioutil.NopCloser(bytes.NewReader([]byte{})), } } done := func() bool { // Ensure the response body is fully read and closed // before we reconnect, so that we reuse the same TCP // connection. defer func() { const maxBodySlurpSize = 2 << 10 if resp.ContentLength <= maxBodySlurpSize { io.Copy(ioutil.Discard, &io.LimitedReader{R: resp.Body, N: maxBodySlurpSize}) } resp.Body.Close() }() retries++ if seconds, wait := checkWait(resp); wait && retries < maxRetries { if seeker, ok := r.body.(io.Seeker); ok && r.body != nil { _, err := seeker.Seek(0, 0) if err != nil { klog.V(4).Infof("Could not retry request, can't Seek() back to beginning of body for %T", r.body) fn(req, resp) return true } } klog.V(4).Infof("Got a Retry-After %ds response for attempt %d to %v", seconds, retries, url) r.backoffMgr.Sleep(time.Duration(seconds) * time.Second) return false } fn(req, resp) return true }() if done { return nil } } }
[ "func", "(", "r", "*", "Request", ")", "request", "(", "fn", "func", "(", "*", "http", ".", "Request", ",", "*", "http", ".", "Response", ")", ")", "error", "{", "//Metrics for total request latency", "start", ":=", "time", ".", "Now", "(", ")", "\n", ...
// request connects to the server and invokes the provided function when a server response is // received. It handles retry behavior and up front validation of requests. It will invoke // fn at most once. It will return an error if a problem occurred prior to connecting to the // server - the provided function is responsible for handling server errors.
[ "request", "connects", "to", "the", "server", "and", "invokes", "the", "provided", "function", "when", "a", "server", "response", "is", "received", ".", "It", "handles", "retry", "behavior", "and", "up", "front", "validation", "of", "requests", ".", "It", "w...
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/rest/request.go#L683-L795
train
request is a helper function to make a request to the server.
[ 30522, 4569, 2278, 1006, 1054, 1008, 5227, 1007, 5227, 1006, 1042, 2078, 4569, 2278, 1006, 1008, 8299, 1012, 5227, 1010, 1008, 8299, 1012, 3433, 1007, 30524, 6633, 15725, 1006, 1007, 1010, 2051, 1012, 2144, 1006, 2707, 1007, 1007, 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/controller/volume/persistentvolume/config/v1alpha1/zz_generated.conversion.go
RegisterConversions
func RegisterConversions(s *runtime.Scheme) error { 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.PersistentVolumeBinderControllerConfiguration)(nil), (*config.PersistentVolumeBinderControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_PersistentVolumeBinderControllerConfiguration_To_config_PersistentVolumeBinderControllerConfiguration(a.(*v1alpha1.PersistentVolumeBinderControllerConfiguration), b.(*config.PersistentVolumeBinderControllerConfiguration), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*config.PersistentVolumeBinderControllerConfiguration)(nil), (*v1alpha1.PersistentVolumeBinderControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_config_PersistentVolumeBinderControllerConfiguration_To_v1alpha1_PersistentVolumeBinderControllerConfiguration(a.(*config.PersistentVolumeBinderControllerConfiguration), b.(*v1alpha1.PersistentVolumeBinderControllerConfiguration), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*v1alpha1.PersistentVolumeRecyclerConfiguration)(nil), (*config.PersistentVolumeRecyclerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_PersistentVolumeRecyclerConfiguration_To_config_PersistentVolumeRecyclerConfiguration(a.(*v1alpha1.PersistentVolumeRecyclerConfiguration), b.(*config.PersistentVolumeRecyclerConfiguration), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*config.PersistentVolumeRecyclerConfiguration)(nil), (*v1alpha1.PersistentVolumeRecyclerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_config_PersistentVolumeRecyclerConfiguration_To_v1alpha1_PersistentVolumeRecyclerConfiguration(a.(*config.PersistentVolumeRecyclerConfiguration), b.(*v1alpha1.PersistentVolumeRecyclerConfiguration), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*v1alpha1.VolumeConfiguration)(nil), (*config.VolumeConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_VolumeConfiguration_To_config_VolumeConfiguration(a.(*v1alpha1.VolumeConfiguration), b.(*config.VolumeConfiguration), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*config.VolumeConfiguration)(nil), (*v1alpha1.VolumeConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_config_VolumeConfiguration_To_v1alpha1_VolumeConfiguration(a.(*config.VolumeConfiguration), b.(*v1alpha1.VolumeConfiguration), scope) }); err != nil { return err } if err := s.AddConversionFunc((*config.PersistentVolumeBinderControllerConfiguration)(nil), (*v1alpha1.PersistentVolumeBinderControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_config_PersistentVolumeBinderControllerConfiguration_To_v1alpha1_PersistentVolumeBinderControllerConfiguration(a.(*config.PersistentVolumeBinderControllerConfiguration), b.(*v1alpha1.PersistentVolumeBinderControllerConfiguration), scope) }); err != nil { return err } if err := s.AddConversionFunc((*v1alpha1.PersistentVolumeBinderControllerConfiguration)(nil), (*config.PersistentVolumeBinderControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_PersistentVolumeBinderControllerConfiguration_To_config_PersistentVolumeBinderControllerConfiguration(a.(*v1alpha1.PersistentVolumeBinderControllerConfiguration), b.(*config.PersistentVolumeBinderControllerConfiguration), scope) }); err != nil { return err } return nil }
go
func RegisterConversions(s *runtime.Scheme) error { 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.PersistentVolumeBinderControllerConfiguration)(nil), (*config.PersistentVolumeBinderControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_PersistentVolumeBinderControllerConfiguration_To_config_PersistentVolumeBinderControllerConfiguration(a.(*v1alpha1.PersistentVolumeBinderControllerConfiguration), b.(*config.PersistentVolumeBinderControllerConfiguration), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*config.PersistentVolumeBinderControllerConfiguration)(nil), (*v1alpha1.PersistentVolumeBinderControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_config_PersistentVolumeBinderControllerConfiguration_To_v1alpha1_PersistentVolumeBinderControllerConfiguration(a.(*config.PersistentVolumeBinderControllerConfiguration), b.(*v1alpha1.PersistentVolumeBinderControllerConfiguration), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*v1alpha1.PersistentVolumeRecyclerConfiguration)(nil), (*config.PersistentVolumeRecyclerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_PersistentVolumeRecyclerConfiguration_To_config_PersistentVolumeRecyclerConfiguration(a.(*v1alpha1.PersistentVolumeRecyclerConfiguration), b.(*config.PersistentVolumeRecyclerConfiguration), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*config.PersistentVolumeRecyclerConfiguration)(nil), (*v1alpha1.PersistentVolumeRecyclerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_config_PersistentVolumeRecyclerConfiguration_To_v1alpha1_PersistentVolumeRecyclerConfiguration(a.(*config.PersistentVolumeRecyclerConfiguration), b.(*v1alpha1.PersistentVolumeRecyclerConfiguration), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*v1alpha1.VolumeConfiguration)(nil), (*config.VolumeConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_VolumeConfiguration_To_config_VolumeConfiguration(a.(*v1alpha1.VolumeConfiguration), b.(*config.VolumeConfiguration), scope) }); err != nil { return err } if err := s.AddGeneratedConversionFunc((*config.VolumeConfiguration)(nil), (*v1alpha1.VolumeConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_config_VolumeConfiguration_To_v1alpha1_VolumeConfiguration(a.(*config.VolumeConfiguration), b.(*v1alpha1.VolumeConfiguration), scope) }); err != nil { return err } if err := s.AddConversionFunc((*config.PersistentVolumeBinderControllerConfiguration)(nil), (*v1alpha1.PersistentVolumeBinderControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_config_PersistentVolumeBinderControllerConfiguration_To_v1alpha1_PersistentVolumeBinderControllerConfiguration(a.(*config.PersistentVolumeBinderControllerConfiguration), b.(*v1alpha1.PersistentVolumeBinderControllerConfiguration), scope) }); err != nil { return err } if err := s.AddConversionFunc((*v1alpha1.PersistentVolumeBinderControllerConfiguration)(nil), (*config.PersistentVolumeBinderControllerConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_PersistentVolumeBinderControllerConfiguration_To_config_PersistentVolumeBinderControllerConfiguration(a.(*v1alpha1.PersistentVolumeBinderControllerConfiguration), b.(*config.PersistentVolumeBinderControllerConfiguration), scope) }); err != nil { return err } return nil }
[ "func", "RegisterConversions", "(", "s", "*", "runtime", ".", "Scheme", ")", "error", "{", "if", "err", ":=", "s", ".", "AddGeneratedConversionFunc", "(", "(", "*", "v1alpha1", ".", "GroupResource", ")", "(", "nil", ")", ",", "(", "*", "v1", ".", "Grou...
// 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/volume/persistentvolume/config/v1alpha1/zz_generated.conversion.go#L37-L89
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/volume/util/util.go
GetUniquePodName
func GetUniquePodName(pod *v1.Pod) types.UniquePodName { return types.UniquePodName(pod.UID) }
go
func GetUniquePodName(pod *v1.Pod) types.UniquePodName { return types.UniquePodName(pod.UID) }
[ "func", "GetUniquePodName", "(", "pod", "*", "v1", ".", "Pod", ")", "types", ".", "UniquePodName", "{", "return", "types", ".", "UniquePodName", "(", "pod", ".", "UID", ")", "\n", "}" ]
// GetUniquePodName returns a unique identifier to reference a pod by
[ "GetUniquePodName", "returns", "a", "unique", "identifier", "to", "reference", "a", "pod", "by" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/util/util.go#L323-L325
train
GetUniquePodName returns the unique pod name for a pod.
[ 30522, 4569, 2278, 2131, 19496, 4226, 27633, 18442, 1006, 17491, 1008, 1058, 2487, 1012, 17491, 1007, 4127, 1012, 4310, 27633, 18442, 1063, 2709, 4127, 1012, 4310, 27633, 18442, 1006, 17491, 1012, 21318, 2094, 1007, 1065, 102, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/api/extensions/v1beta1/zz_generated.deepcopy.go
DeepCopyObject
func (in *IngressList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil }
go
func (in *IngressList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil }
[ "func", "(", "in", "*", "IngressList", ")", "DeepCopyObject", "(", ")", "runtime", ".", "Object", "{", "if", "c", ":=", "in", ".", "DeepCopy", "(", ")", ";", "c", "!=", "nil", "{", "return", "c", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
[ "DeepCopyObject", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "runtime", ".", "Object", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/api/extensions/v1beta1/zz_generated.deepcopy.go#L620-L625
train
DeepCopyObject is an autogenerated deepcopy function copying the receiver creating a new runtime. Object.
[ 30522, 4569, 2278, 1006, 1999, 1008, 13749, 8303, 9863, 1007, 2784, 3597, 7685, 16429, 20614, 1006, 1007, 2448, 7292, 1012, 4874, 1063, 2065, 1039, 1024, 1027, 1999, 1012, 2784, 3597, 7685, 1006, 1007, 1025, 1039, 999, 1027, 9152, 2140, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
cmd/kubeadm/app/preflight/checks_unix.go
Check
func (ipuc IsPrivilegedUserCheck) Check() (warnings, errorList []error) { errorList = []error{} if os.Getuid() != 0 { errorList = append(errorList, errors.New("user is not running as root")) } return nil, errorList }
go
func (ipuc IsPrivilegedUserCheck) Check() (warnings, errorList []error) { errorList = []error{} if os.Getuid() != 0 { errorList = append(errorList, errors.New("user is not running as root")) } return nil, errorList }
[ "func", "(", "ipuc", "IsPrivilegedUserCheck", ")", "Check", "(", ")", "(", "warnings", ",", "errorList", "[", "]", "error", ")", "{", "errorList", "=", "[", "]", "error", "{", "}", "\n", "if", "os", ".", "Getuid", "(", ")", "!=", "0", "{", "errorLi...
// Check validates if an user has elevated (root) privileges.
[ "Check", "validates", "if", "an", "user", "has", "elevated", "(", "root", ")", "privileges", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/cmd/kubeadm/app/preflight/checks_unix.go#L28-L35
train
Check is a wrapper for IsPrivilegedUserCheck.
[ 30522, 4569, 2278, 1006, 12997, 14194, 2003, 18098, 12848, 9463, 5999, 20330, 5403, 3600, 1007, 4638, 1006, 1007, 1006, 16234, 1010, 7561, 9863, 1031, 1033, 7561, 1007, 1063, 7561, 9863, 1027, 1031, 1033, 7561, 1063, 1065, 2065, 9808, 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
hack/make-rules/helpers/go2make/pkgwalk.go
findPackage
func findPackage(pkgName string) (*build.Package, error) { debug("find", pkgName) pkg, err := build.Import(pkgName, getwd(), build.FindOnly) if err != nil { return nil, err } return pkg, nil }
go
func findPackage(pkgName string) (*build.Package, error) { debug("find", pkgName) pkg, err := build.Import(pkgName, getwd(), build.FindOnly) if err != nil { return nil, err } return pkg, nil }
[ "func", "findPackage", "(", "pkgName", "string", ")", "(", "*", "build", ".", "Package", ",", "error", ")", "{", "debug", "(", "\"", "\"", ",", "pkgName", ")", "\n", "pkg", ",", "err", ":=", "build", ".", "Import", "(", "pkgName", ",", "getwd", "("...
// findPackage finds a Go package.
[ "findPackage", "finds", "a", "Go", "package", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/hack/make-rules/helpers/go2make/pkgwalk.go#L73-L80
train
findPackage returns a package with the given name.
[ 30522, 4569, 2278, 2424, 23947, 4270, 1006, 1052, 2243, 16989, 4168, 5164, 1007, 1006, 1008, 3857, 1012, 7427, 1010, 7561, 1007, 1063, 2139, 8569, 2290, 1006, 1000, 2424, 1000, 1010, 1052, 2243, 16989, 4168, 1007, 1052, 2243, 2290, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/controller/garbagecollector/garbagecollector.go
printDiff
func printDiff(oldResources, newResources map[schema.GroupVersionResource]struct{}) string { removed := sets.NewString() for oldResource := range oldResources { if _, ok := newResources[oldResource]; !ok { removed.Insert(fmt.Sprintf("%+v", oldResource)) } } added := sets.NewString() for newResource := range newResources { if _, ok := oldResources[newResource]; !ok { added.Insert(fmt.Sprintf("%+v", newResource)) } } return fmt.Sprintf("added: %v, removed: %v", added.List(), removed.List()) }
go
func printDiff(oldResources, newResources map[schema.GroupVersionResource]struct{}) string { removed := sets.NewString() for oldResource := range oldResources { if _, ok := newResources[oldResource]; !ok { removed.Insert(fmt.Sprintf("%+v", oldResource)) } } added := sets.NewString() for newResource := range newResources { if _, ok := oldResources[newResource]; !ok { added.Insert(fmt.Sprintf("%+v", newResource)) } } return fmt.Sprintf("added: %v, removed: %v", added.List(), removed.List()) }
[ "func", "printDiff", "(", "oldResources", ",", "newResources", "map", "[", "schema", ".", "GroupVersionResource", "]", "struct", "{", "}", ")", "string", "{", "removed", ":=", "sets", ".", "NewString", "(", ")", "\n", "for", "oldResource", ":=", "range", "...
// printDiff returns a human-readable summary of what resources were added and removed
[ "printDiff", "returns", "a", "human", "-", "readable", "summary", "of", "what", "resources", "were", "added", "and", "removed" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/controller/garbagecollector/garbagecollector.go#L247-L261
train
printDiff returns a string containing the diff between two resources.
[ 30522, 4569, 2278, 6140, 4305, 4246, 1006, 2214, 6072, 8162, 9623, 1010, 2047, 6072, 8162, 9623, 4949, 1031, 8040, 28433, 1012, 2177, 27774, 6072, 8162, 3401, 1033, 2358, 6820, 6593, 1063, 1065, 1007, 5164, 1063, 3718, 1024, 1027, 4520, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/volume/storageos/storageos.go
parseAPIConfig
func parseAPIConfig(params map[string]string) (*storageosAPIConfig, error) { if len(params) == 0 { return nil, fmt.Errorf("empty API config") } c := &storageosAPIConfig{} for name, data := range params { switch strings.ToLower(name) { case "apiaddress": c.apiAddr = string(data) case "apiusername": c.apiUser = string(data) case "apipassword": c.apiPass = string(data) case "apiversion": c.apiVersion = string(data) } } return c, nil }
go
func parseAPIConfig(params map[string]string) (*storageosAPIConfig, error) { if len(params) == 0 { return nil, fmt.Errorf("empty API config") } c := &storageosAPIConfig{} for name, data := range params { switch strings.ToLower(name) { case "apiaddress": c.apiAddr = string(data) case "apiusername": c.apiUser = string(data) case "apipassword": c.apiPass = string(data) case "apiversion": c.apiVersion = string(data) } } return c, nil }
[ "func", "parseAPIConfig", "(", "params", "map", "[", "string", "]", "string", ")", "(", "*", "storageosAPIConfig", ",", "error", ")", "{", "if", "len", "(", "params", ")", "==", "0", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ...
// Parse API configuration from parameters or secret
[ "Parse", "API", "configuration", "from", "parameters", "or", "secret" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/volume/storageos/storageos.go#L750-L772
train
parseAPIConfig parses the API config from a map
[ 30522, 4569, 2278, 11968, 17310, 24330, 2239, 8873, 2290, 1006, 11498, 5244, 4949, 1031, 5164, 1033, 5164, 1007, 1006, 1008, 5527, 8820, 24330, 2239, 8873, 2290, 1010, 7561, 1007, 1063, 2065, 18798, 1006, 11498, 5244, 1007, 1027, 1027, 1014...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubelet/images/image_gc_manager.go
freeSpace
func (im *realImageGCManager) freeSpace(bytesToFree int64, freeTime time.Time) (int64, error) { imagesInUse, err := im.detectImages(freeTime) if err != nil { return 0, err } im.imageRecordsLock.Lock() defer im.imageRecordsLock.Unlock() // Get all images in eviction order. images := make([]evictionInfo, 0, len(im.imageRecords)) for image, record := range im.imageRecords { if isImageUsed(image, imagesInUse) { klog.V(5).Infof("Image ID %s is being used", image) continue } images = append(images, evictionInfo{ id: image, imageRecord: *record, }) } sort.Sort(byLastUsedAndDetected(images)) // Delete unused images until we've freed up enough space. var deletionErrors []error spaceFreed := int64(0) for _, image := range images { klog.V(5).Infof("Evaluating image ID %s for possible garbage collection", image.id) // Images that are currently in used were given a newer lastUsed. if image.lastUsed.Equal(freeTime) || image.lastUsed.After(freeTime) { klog.V(5).Infof("Image ID %s has lastUsed=%v which is >= freeTime=%v, not eligible for garbage collection", image.id, image.lastUsed, freeTime) continue } // Avoid garbage collect the image if the image is not old enough. // In such a case, the image may have just been pulled down, and will be used by a container right away. if freeTime.Sub(image.firstDetected) < im.policy.MinAge { klog.V(5).Infof("Image ID %s has age %v which is less than the policy's minAge of %v, not eligible for garbage collection", image.id, freeTime.Sub(image.firstDetected), im.policy.MinAge) continue } // Remove image. Continue despite errors. klog.Infof("[imageGCManager]: Removing image %q to free %d bytes", image.id, image.size) err := im.runtime.RemoveImage(container.ImageSpec{Image: image.id}) if err != nil { deletionErrors = append(deletionErrors, err) continue } delete(im.imageRecords, image.id) spaceFreed += image.size if spaceFreed >= bytesToFree { break } } if len(deletionErrors) > 0 { return spaceFreed, fmt.Errorf("wanted to free %d bytes, but freed %d bytes space with errors in image deletion: %v", bytesToFree, spaceFreed, errors.NewAggregate(deletionErrors)) } return spaceFreed, nil }
go
func (im *realImageGCManager) freeSpace(bytesToFree int64, freeTime time.Time) (int64, error) { imagesInUse, err := im.detectImages(freeTime) if err != nil { return 0, err } im.imageRecordsLock.Lock() defer im.imageRecordsLock.Unlock() // Get all images in eviction order. images := make([]evictionInfo, 0, len(im.imageRecords)) for image, record := range im.imageRecords { if isImageUsed(image, imagesInUse) { klog.V(5).Infof("Image ID %s is being used", image) continue } images = append(images, evictionInfo{ id: image, imageRecord: *record, }) } sort.Sort(byLastUsedAndDetected(images)) // Delete unused images until we've freed up enough space. var deletionErrors []error spaceFreed := int64(0) for _, image := range images { klog.V(5).Infof("Evaluating image ID %s for possible garbage collection", image.id) // Images that are currently in used were given a newer lastUsed. if image.lastUsed.Equal(freeTime) || image.lastUsed.After(freeTime) { klog.V(5).Infof("Image ID %s has lastUsed=%v which is >= freeTime=%v, not eligible for garbage collection", image.id, image.lastUsed, freeTime) continue } // Avoid garbage collect the image if the image is not old enough. // In such a case, the image may have just been pulled down, and will be used by a container right away. if freeTime.Sub(image.firstDetected) < im.policy.MinAge { klog.V(5).Infof("Image ID %s has age %v which is less than the policy's minAge of %v, not eligible for garbage collection", image.id, freeTime.Sub(image.firstDetected), im.policy.MinAge) continue } // Remove image. Continue despite errors. klog.Infof("[imageGCManager]: Removing image %q to free %d bytes", image.id, image.size) err := im.runtime.RemoveImage(container.ImageSpec{Image: image.id}) if err != nil { deletionErrors = append(deletionErrors, err) continue } delete(im.imageRecords, image.id) spaceFreed += image.size if spaceFreed >= bytesToFree { break } } if len(deletionErrors) > 0 { return spaceFreed, fmt.Errorf("wanted to free %d bytes, but freed %d bytes space with errors in image deletion: %v", bytesToFree, spaceFreed, errors.NewAggregate(deletionErrors)) } return spaceFreed, nil }
[ "func", "(", "im", "*", "realImageGCManager", ")", "freeSpace", "(", "bytesToFree", "int64", ",", "freeTime", "time", ".", "Time", ")", "(", "int64", ",", "error", ")", "{", "imagesInUse", ",", "err", ":=", "im", ".", "detectImages", "(", "freeTime", ")"...
// Tries to free bytesToFree worth of images on the disk. // // Returns the number of bytes free and an error if any occurred. The number of // bytes freed is always returned. // Note that error may be nil and the number of bytes free may be less // than bytesToFree.
[ "Tries", "to", "free", "bytesToFree", "worth", "of", "images", "on", "the", "disk", ".", "Returns", "the", "number", "of", "bytes", "free", "and", "an", "error", "if", "any", "occurred", ".", "The", "number", "of", "bytes", "freed", "is", "always", "retu...
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/images/image_gc_manager.go#L328-L389
train
freeSpace is used to free up enough space.
[ 30522, 4569, 2278, 1006, 10047, 1008, 2613, 9581, 3351, 18195, 24805, 4590, 1007, 2489, 23058, 1006, 27507, 3406, 23301, 20014, 21084, 1010, 2489, 7292, 2051, 1012, 2051, 1007, 1006, 20014, 21084, 1010, 7561, 1007, 1063, 4871, 13429, 2063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
staging/src/k8s.io/client-go/tools/clientcmd/client_config.go
RESTConfigFromKubeConfig
func RESTConfigFromKubeConfig(configBytes []byte) (*restclient.Config, error) { clientConfig, err := NewClientConfigFromBytes(configBytes) if err != nil { return nil, err } return clientConfig.ClientConfig() }
go
func RESTConfigFromKubeConfig(configBytes []byte) (*restclient.Config, error) { clientConfig, err := NewClientConfigFromBytes(configBytes) if err != nil { return nil, err } return clientConfig.ClientConfig() }
[ "func", "RESTConfigFromKubeConfig", "(", "configBytes", "[", "]", "byte", ")", "(", "*", "restclient", ".", "Config", ",", "error", ")", "{", "clientConfig", ",", "err", ":=", "NewClientConfigFromBytes", "(", "configBytes", ")", "\n", "if", "err", "!=", "nil...
// RESTConfigFromKubeConfig is a convenience method to give back a restconfig from your kubeconfig bytes. // For programmatic access, this is what you want 80% of the time
[ "RESTConfigFromKubeConfig", "is", "a", "convenience", "method", "to", "give", "back", "a", "restconfig", "from", "your", "kubeconfig", "bytes", ".", "For", "programmatic", "access", "this", "is", "what", "you", "want", "80%", "of", "the", "time" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/tools/clientcmd/client_config.go#L114-L120
train
RESTConfigFromKubeConfig returns a REST client config from a byte slice
[ 30522, 4569, 2278, 2717, 8663, 8873, 25708, 21716, 5283, 4783, 8663, 8873, 2290, 1006, 9530, 8873, 18259, 17250, 2015, 1031, 1033, 24880, 1007, 1006, 1008, 2717, 20464, 11638, 1012, 9530, 8873, 2290, 1010, 7561, 1007, 1063, 7396, 8663, 8873...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/kubelet/eviction/helpers.go
thresholdsMet
func thresholdsMet(thresholds []evictionapi.Threshold, observations signalObservations, enforceMinReclaim bool) []evictionapi.Threshold { results := []evictionapi.Threshold{} for i := range thresholds { threshold := thresholds[i] observed, found := observations[threshold.Signal] if !found { klog.Warningf("eviction manager: no observation found for eviction signal %v", threshold.Signal) continue } // determine if we have met the specified threshold thresholdMet := false quantity := evictionapi.GetThresholdQuantity(threshold.Value, observed.capacity) // if enforceMinReclaim is specified, we compare relative to value - minreclaim if enforceMinReclaim && threshold.MinReclaim != nil { quantity.Add(*evictionapi.GetThresholdQuantity(*threshold.MinReclaim, observed.capacity)) } thresholdResult := quantity.Cmp(*observed.available) switch threshold.Operator { case evictionapi.OpLessThan: thresholdMet = thresholdResult > 0 } if thresholdMet { results = append(results, threshold) } } return results }
go
func thresholdsMet(thresholds []evictionapi.Threshold, observations signalObservations, enforceMinReclaim bool) []evictionapi.Threshold { results := []evictionapi.Threshold{} for i := range thresholds { threshold := thresholds[i] observed, found := observations[threshold.Signal] if !found { klog.Warningf("eviction manager: no observation found for eviction signal %v", threshold.Signal) continue } // determine if we have met the specified threshold thresholdMet := false quantity := evictionapi.GetThresholdQuantity(threshold.Value, observed.capacity) // if enforceMinReclaim is specified, we compare relative to value - minreclaim if enforceMinReclaim && threshold.MinReclaim != nil { quantity.Add(*evictionapi.GetThresholdQuantity(*threshold.MinReclaim, observed.capacity)) } thresholdResult := quantity.Cmp(*observed.available) switch threshold.Operator { case evictionapi.OpLessThan: thresholdMet = thresholdResult > 0 } if thresholdMet { results = append(results, threshold) } } return results }
[ "func", "thresholdsMet", "(", "thresholds", "[", "]", "evictionapi", ".", "Threshold", ",", "observations", "signalObservations", ",", "enforceMinReclaim", "bool", ")", "[", "]", "evictionapi", ".", "Threshold", "{", "results", ":=", "[", "]", "evictionapi", "."...
// thresholdsMet returns the set of thresholds that were met independent of grace period
[ "thresholdsMet", "returns", "the", "set", "of", "thresholds", "that", "were", "met", "independent", "of", "grace", "period" ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/kubelet/eviction/helpers.go#L780-L806
train
thresholdsMet returns a list of thresholds that are met by the specified signal.
[ 30522, 4569, 2278, 11207, 6491, 3388, 1006, 11207, 2015, 1031, 1033, 23408, 28097, 9331, 2072, 1012, 11207, 1010, 9420, 4742, 16429, 8043, 21596, 2015, 1010, 16306, 10020, 2890, 25154, 22017, 2140, 1007, 1031, 1033, 23408, 28097, 9331, 2072, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/node-api/pkg/client/listers/node/v1alpha1/runtimeclass.go
Get
func (s *runtimeClassLister) Get(name string) (*v1alpha1.RuntimeClass, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { return nil, errors.NewNotFound(v1alpha1.Resource("runtimeclass"), name) } return obj.(*v1alpha1.RuntimeClass), nil }
go
func (s *runtimeClassLister) Get(name string) (*v1alpha1.RuntimeClass, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { return nil, errors.NewNotFound(v1alpha1.Resource("runtimeclass"), name) } return obj.(*v1alpha1.RuntimeClass), nil }
[ "func", "(", "s", "*", "runtimeClassLister", ")", "Get", "(", "name", "string", ")", "(", "*", "v1alpha1", ".", "RuntimeClass", ",", "error", ")", "{", "obj", ",", "exists", ",", "err", ":=", "s", ".", "indexer", ".", "GetByKey", "(", "name", ")", ...
// Get retrieves the RuntimeClass from the index for a given name.
[ "Get", "retrieves", "the", "RuntimeClass", "from", "the", "index", "for", "a", "given", "name", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/node-api/pkg/client/listers/node/v1alpha1/runtimeclass.go#L56-L65
train
Get retrieves the RuntimeClass from the index for a given name.
[ 30522, 4569, 2278, 1006, 1055, 1008, 2448, 7292, 26266, 9863, 2121, 1007, 2131, 1006, 2171, 5164, 1007, 1006, 1008, 1058, 2487, 2389, 21890, 2487, 1012, 2448, 7292, 26266, 1010, 7561, 1007, 1063, 27885, 3501, 1010, 6526, 1010, 9413, 2099, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
kubernetes/kubernetes
pkg/apis/rbac/v1beta1/zz_generated.conversion.go
Convert_v1beta1_ClusterRole_To_rbac_ClusterRole
func Convert_v1beta1_ClusterRole_To_rbac_ClusterRole(in *v1beta1.ClusterRole, out *rbac.ClusterRole, s conversion.Scope) error { return autoConvert_v1beta1_ClusterRole_To_rbac_ClusterRole(in, out, s) }
go
func Convert_v1beta1_ClusterRole_To_rbac_ClusterRole(in *v1beta1.ClusterRole, out *rbac.ClusterRole, s conversion.Scope) error { return autoConvert_v1beta1_ClusterRole_To_rbac_ClusterRole(in, out, s) }
[ "func", "Convert_v1beta1_ClusterRole_To_rbac_ClusterRole", "(", "in", "*", "v1beta1", ".", "ClusterRole", ",", "out", "*", "rbac", ".", "ClusterRole", ",", "s", "conversion", ".", "Scope", ")", "error", "{", "return", "autoConvert_v1beta1_ClusterRole_To_rbac_ClusterRole...
// Convert_v1beta1_ClusterRole_To_rbac_ClusterRole is an autogenerated conversion function.
[ "Convert_v1beta1_ClusterRole_To_rbac_ClusterRole", "is", "an", "autogenerated", "conversion", "function", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/pkg/apis/rbac/v1beta1/zz_generated.conversion.go#L191-L193
train
Convert_v1beta1_ClusterRole_To_rbac_ClusterRole is an autogenerated conversion function.
[ 30522, 4569, 2278, 10463, 1035, 1058, 2487, 20915, 27717, 1035, 9324, 13153, 2063, 1035, 2000, 1035, 21144, 6305, 1035, 9324, 13153, 2063, 1006, 1999, 1008, 1058, 2487, 20915, 27717, 1012, 9324, 13153, 2063, 1010, 2041, 1008, 21144, 6305, 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/storage/v1beta1/fake/fake_csidriver.go
Get
func (c *FakeCSIDrivers) Get(name string, options v1.GetOptions) (result *v1beta1.CSIDriver, err error) { obj, err := c.Fake. Invokes(testing.NewRootGetAction(csidriversResource, name), &v1beta1.CSIDriver{}) if obj == nil { return nil, err } return obj.(*v1beta1.CSIDriver), err }
go
func (c *FakeCSIDrivers) Get(name string, options v1.GetOptions) (result *v1beta1.CSIDriver, err error) { obj, err := c.Fake. Invokes(testing.NewRootGetAction(csidriversResource, name), &v1beta1.CSIDriver{}) if obj == nil { return nil, err } return obj.(*v1beta1.CSIDriver), err }
[ "func", "(", "c", "*", "FakeCSIDrivers", ")", "Get", "(", "name", "string", ",", "options", "v1", ".", "GetOptions", ")", "(", "result", "*", "v1beta1", ".", "CSIDriver", ",", "err", "error", ")", "{", "obj", ",", "err", ":=", "c", ".", "Fake", "."...
// Get takes name of the cSIDriver, and returns the corresponding cSIDriver object, and an error if there is any.
[ "Get", "takes", "name", "of", "the", "cSIDriver", "and", "returns", "the", "corresponding", "cSIDriver", "object", "and", "an", "error", "if", "there", "is", "any", "." ]
6a8a3682919652ae668c389ed2f60efb770eed03
https://github.com/kubernetes/kubernetes/blob/6a8a3682919652ae668c389ed2f60efb770eed03/staging/src/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/fake_csidriver.go#L41-L48
train
Get takes name of the cSIDriver and returns the corresponding cSIDriver object and an error if there is any.
[ 30522, 4569, 2278, 1006, 1039, 1008, 8275, 6169, 3593, 24352, 2015, 1007, 2131, 1006, 2171, 5164, 1010, 7047, 1058, 2487, 1012, 2131, 7361, 9285, 1007, 1006, 2765, 1008, 1058, 2487, 20915, 27717, 1012, 22174, 23663, 2099, 1010, 9413, 2099, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
6