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 ServerResourcesOpenAPISchema, 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 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)
- func SetMetaDataLabel(obj metav1.Object, key, value string)
- type AlphabeticalOrder
- type ImageName
- type OpenAPISchema
- type Resolver
- type ServerResourcesOpenAPISchema
- type ServerVersion
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 ServerResourcesOpenAPISchema, 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 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
func SetMetaDataLabel ¶ added in v0.9.0
SetMetaDataLabel 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 OpenAPISchema ¶ added in v0.9.0
type OpenAPISchema struct {
// contains filtered or unexported fields
}
OpenAPISchema represents an OpenAPI schema for a given GroupVersionKind.
func NewOpenAPISchemaFor ¶ added in v0.9.0
func NewOpenAPISchemaFor(delegate discovery.OpenAPISchemaInterface, gvk schema.GroupVersionKind) (*OpenAPISchema, error)
NewOpenAPISchemaFor returns the OpenAPISchema object ready to validate objects of given GroupVersion
func (*OpenAPISchema) Validate ¶ added in v0.9.0
func (s *OpenAPISchema) Validate(obj *unstructured.Unstructured) []error
Validate is the primary entrypoint into this class
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 ServerResourcesOpenAPISchema ¶ added in v0.9.0
type ServerResourcesOpenAPISchema interface { discovery.ServerResourcesInterface discovery.OpenAPISchemaInterface }
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 GetDefaultVersion ¶ added in v0.9.0
func GetDefaultVersion() ServerVersion
GetDefaultVersion returns a default server version. This value will be updated periodically to match a current/popular version corresponding to the age of this code Current default version: 1.8
func ParseVersion ¶ added in v0.4.0
func ParseVersion(v *version.Info) (ServerVersion, 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