// Context is a tuple of references to a cluster (how do I communicate with a kubernetes cluster), a user (how do I identify myself), and a namespace (what subset of resources do I want to work with)
// Context is a tuple of references to a cluster (how do I communicate with a kubernetes cluster), a user (how do I identify myself), and a namespace (what subset of resources do I want to work with)
...
@@ -101,36 +101,36 @@ type Context struct {
...
@@ -101,36 +101,36 @@ type Context struct {
// Namespace is the default namespace to use on unspecified requests
// Namespace is the default namespace to use on unspecified requests
Namespacestring`json:"namespace,omitempty"`
Namespacestring`json:"namespace,omitempty"`
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
// Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields
// ResolvePaths updates the given refs to be absolute paths, relative to the given base directory
funcResolvePaths(refs[]*string,basestring)error{
for_,ref:=rangerefs{
// Don't resolve empty paths
iflen(*ref)>0{
// Don't resolve absolute paths
if!filepath.IsAbs(*ref){
*ref=filepath.Join(base,*ref)
}
}
}
returnnil
}
// RelativizePathWithNoBacksteps updates the given refs to be relative paths, relative to the given base directory as long as they do not require backsteps.
// Any path requiring a backstep is left as-is as long it is absolute. Any non-absolute path that can't be relativized produces an error
expectedErrorSubstring:[]string{"user \"missing\" was not found for context \"anything\"","cluster \"missing\" was not found for context \"anything\""},
expectedErrorSubstring:[]string{"user \"missing\" was not found for context \"anything\"","cluster \"missing\" was not found for context \"anything\""},