Documentation ¶
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func ClientForResource(pool dynamic.ClientPool, disco discovery.DiscoveryInterface, ...) (dynamic.ResourceInterface, error)
- func DependencyOrder(disco ServerResourcesSwaggerSchema, list []*unstructured.Unstructured) (sort.Interface, error)
- func FlattenToV1(objs []runtime.Object) []*unstructured.Unstructured
- func FqName(o metav1.Object) string
- func MakeUniversalImporter(searchUrls []*url.URL) jsonnet.Importer
- func MustAsset(name string) []byte
- func NewAuthTransport(inner http.RoundTripper) http.RoundTripper
- func NewInvalidTypeError(expected reflect.Kind, observed reflect.Kind, fieldName string) error
- func NewMemcachedDiscoveryClient(cl discovery.DiscoveryInterface) discovery.CachedDiscoveryInterface
- func Read(vm *jsonnet.VM, path string) ([]runtime.Object, error)
- func RegisterNativeFuncs(vm *jsonnet.VM, resolver Resolver)
- func ResourceNameFor(disco discovery.ServerResourcesInterface, o runtime.Object) string
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func SetMetaDataAnnotation(obj metav1.Object, key, value string)
- type AlphabeticalOrder
- type ImageName
- type InvalidTypeError
- type Registry
- type Resolver
- type ServerResourcesSwaggerSchema
- type ServerVersion
- type SwaggerSchema
- type TypeNotFoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶ added in v0.8.0
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶ added in v0.8.0
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶ added in v0.8.0
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetNames ¶ added in v0.8.0
func AssetNames() []string
AssetNames returns the names of the assets.
func ClientForResource ¶ added in v0.5.0
func ClientForResource(pool dynamic.ClientPool, disco discovery.DiscoveryInterface, obj runtime.Object, defNs string) (dynamic.ResourceInterface, error)
ClientForResource returns the ResourceClient for a given object
func DependencyOrder ¶ added in v0.2.0
func DependencyOrder(disco ServerResourcesSwaggerSchema, list []*unstructured.Unstructured) (sort.Interface, error)
DependencyOrder is a `sort.Interface` that *best-effort* sorts the objects so that known dependencies appear earlier in the list. The idea is to prevent *some* of the "crash-restart" loops when creating inter-dependent resources.
func FlattenToV1 ¶
func FlattenToV1(objs []runtime.Object) []*unstructured.Unstructured
FlattenToV1 expands any List-type objects into their members, and cooerces everything to v1.Unstructured. Panics if coercion encounters an unexpected object type.
func MakeUniversalImporter ¶ added in v0.8.0
MakeUniversalImporter creates an importer that handles resolving imports from the filesystem and http/s.
In addition to the standard importer, supports:
- URLs in import statements
- URLs in library search paths
A real-world example:
- you have https://raw.githubusercontent.com/ksonnet/ksonnet-lib/master in your search URLs
- you evaluate a local file which calls `import "ksonnet.beta.2/k.libsonnet"`
- if the `ksonnet.beta.2/k.libsonnet“ is not located in the current workdir, an attempt will be made to follow the search path, i.e. to download https://raw.githubusercontent.com/ksonnet/ksonnet-lib/master/ksonnet.beta.2/k.libsonnet
- since the downloaded `k.libsonnet“ file turn in contains `import "k8s.libsonnet"`, the import will be resolved as https://raw.githubusercontent.com/ksonnet/ksonnet-lib/master/ksonnet.beta.2/k8s.libsonnet and downloaded from that location
func MustAsset ¶ added in v0.8.0
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func NewAuthTransport ¶ added in v0.3.0
func NewAuthTransport(inner http.RoundTripper) http.RoundTripper
NewAuthTransport returns a roundtripper that does bearer/etc authentication
func NewInvalidTypeError ¶ added in v0.5.0
NewInvalidTypeError creates an InvalidTypeError object
func NewMemcachedDiscoveryClient ¶
func NewMemcachedDiscoveryClient(cl discovery.DiscoveryInterface) discovery.CachedDiscoveryInterface
NewMemcachedDiscoveryClient creates a new DiscoveryClient that caches results in memory
func Read ¶
Read fetches and decodes K8s objects by path. TODO: Replace this with something supporting more sophisticated content negotiation.
func RegisterNativeFuncs ¶ added in v0.3.0
RegisterNativeFuncs adds kubecfg's native jsonnet functions to provided VM
func ResourceNameFor ¶ added in v0.5.0
func ResourceNameFor(disco discovery.ServerResourcesInterface, o runtime.Object) string
ResourceNameFor returns a lowercase plural form of a type, for human messages. Returns lowercased kind if discovery lookup fails.
func RestoreAsset ¶ added in v0.8.0
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶ added in v0.8.0
RestoreAssets restores an asset under the given directory recursively
func SetMetaDataAnnotation ¶ added in v0.5.0
SetMetaDataAnnotation sets an annotation value
Types ¶
type AlphabeticalOrder ¶ added in v0.2.0
type AlphabeticalOrder []*unstructured.Unstructured
AlphabeticalOrder is a `sort.Interface` that sorts the objects by namespace/name/kind alphabetical order
func (AlphabeticalOrder) Len ¶ added in v0.2.0
func (l AlphabeticalOrder) Len() int
func (AlphabeticalOrder) Less ¶ added in v0.2.0
func (l AlphabeticalOrder) Less(i, j int) bool
func (AlphabeticalOrder) Swap ¶ added in v0.2.0
func (l AlphabeticalOrder) Swap(i, j int)
type ImageName ¶ added in v0.3.0
type ImageName struct { // eg: "myregistryhost:5000/fedora/httpd:version1.0" Registry string // "myregistryhost:5000" Repository string // "fedora" Name string // "httpd" Tag string // "version1.0" Digest string }
ImageName represents the parts of a docker image name
func ParseImageName ¶ added in v0.3.0
ParseImageName parses a docker image into an ImageName struct
func (ImageName) RegistryRepoName ¶ added in v0.3.0
RegistryRepoName returns the "repository" as used in the registry URL
func (ImageName) RegistryURL ¶ added in v0.3.0
RegistryURL returns the deduced base URL of the registry for this image
type InvalidTypeError ¶ added in v0.5.0
type InvalidTypeError struct { ExpectedKind reflect.Kind ObservedKind reflect.Kind FieldName string }
InvalidTypeError is returned when an invalid type is encountered
func (*InvalidTypeError) Error ¶ added in v0.5.0
func (i *InvalidTypeError) Error() string
type Registry ¶ added in v0.3.0
Registry is a *crazy limited* Docker registry client.
func NewRegistryClient ¶ added in v0.3.0
NewRegistryClient creates a new Registry client using the given http client and base URL.
type Resolver ¶ added in v0.3.0
Resolver is able to resolve docker image names into more specific forms
func NewIdentityResolver ¶ added in v0.3.0
func NewIdentityResolver() Resolver
NewIdentityResolver returns a resolver that does only trivial :latest canonicalisation
func NewRegistryResolver ¶ added in v0.3.0
NewRegistryResolver returns a resolver that looks up a docker registry to resolve digests
type ServerResourcesSwaggerSchema ¶ added in v0.6.0
type ServerResourcesSwaggerSchema interface { discovery.ServerResourcesInterface discovery.SwaggerSchemaInterface }
A subset of discovery.DiscoveryInterface
type ServerVersion ¶ added in v0.4.0
ServerVersion captures k8s major.minor version in a parsed form
func FetchVersion ¶ added in v0.4.0
func FetchVersion(v discovery.ServerVersionInterface) (ret ServerVersion, err error)
FetchVersion fetches version information from discovery client, and parses
func ParseVersion ¶ added in v0.4.0
func ParseVersion(v *version.Info) (ret ServerVersion, err error)
ParseVersion parses version.Info into a ServerVersion struct
func (ServerVersion) Compare ¶ added in v0.4.0
func (v ServerVersion) Compare(major, minor int) int
Compare returns -1/0/+1 iff v is less than / equal / greater than major.minor
func (ServerVersion) String ¶ added in v0.4.0
func (v ServerVersion) String() string
type SwaggerSchema ¶ added in v0.5.0
type SwaggerSchema struct {
// contains filtered or unexported fields
}
SwaggerSchema represents an OpenAPI/Swagger schema
func NewSwaggerSchemaFor ¶ added in v0.5.0
func NewSwaggerSchemaFor(delegate discovery.SwaggerSchemaInterface, gv schema.GroupVersion) (*SwaggerSchema, error)
NewSwaggerSchemaFor returns the SwaggerSchema object ready to validate objects of given GroupVersion
func (*SwaggerSchema) Validate ¶ added in v0.5.0
func (s *SwaggerSchema) Validate(obj *unstructured.Unstructured) []error
Validate is the primary entrypoint into this class
func (*SwaggerSchema) ValidateObject ¶ added in v0.5.0
func (s *SwaggerSchema) ValidateObject(obj interface{}, fieldName, typeName string) []error
ValidateObject validates a JSON object against the schema
type TypeNotFoundError ¶ added in v0.5.0
type TypeNotFoundError string
TypeNotFoundError is returned when specified type can not found in schema
func (TypeNotFoundError) Error ¶ added in v0.5.0
func (tnfe TypeNotFoundError) Error() string