Documentation
¶
Index ¶
- func ClientForResource(pool dynamic.ClientPool, disco discovery.DiscoveryInterface, ...) (*dynamic.ResourceClient, error)
- func FlattenToV1(objs []runtime.Object) []*unstructured.Unstructured
- func FqName(o metav1.Object) string
- func GroupVersionKindFor(o runtime.Object) string
- func IsASCIIIdentifier(s string) bool
- 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 NormalizeURL(s string) (string, error)
- func PadRows(rows [][]string) (string, error)
- 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 SetMetaDataAnnotation(obj metav1.Object, key, value string)
- type AlphabeticalOrder
- type DependencyOrder
- type ImageName
- type InvalidTypeError
- type Registry
- type Resolver
- type ServerVersion
- type SwaggerSchema
- type TypeNotFoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientForResource ¶
func ClientForResource(pool dynamic.ClientPool, disco discovery.DiscoveryInterface, obj runtime.Object, defNs string) (*dynamic.ResourceClient, error)
ClientForResource returns the ResourceClient for a given object
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 GroupVersionKindFor ¶
GroupVersionKindFor returns a lowercased kind for an Kubernete's object
func IsASCIIIdentifier ¶
IsASCIIIdentifier takes a string and returns true if the string does not contain any special characters.
func NewAuthTransport ¶
func NewAuthTransport(inner http.RoundTripper) http.RoundTripper
NewAuthTransport returns a roundtripper that does bearer/etc authentication
func NewInvalidTypeError ¶
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 NormalizeURL ¶
NormalizeURL uses purell's "usually safe normalization" algorithm to normalize URLs. This includes removing dot segments, removing trailing slashes, removing unnecessary escapes, removing default ports, and setting the URL to lowercase.
func Read ¶
Read fetches and decodes K8s objects by path. TODO: Replace this with something supporting more sophisticated content negotiation.
func RegisterNativeFuncs ¶
RegisterNativeFuncs adds kubecfg's native jsonnet functions to provided VM
func ResourceNameFor ¶
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 SetMetaDataAnnotation ¶
SetMetaDataAnnotation sets an annotation value
Types ¶
type AlphabeticalOrder ¶
type AlphabeticalOrder []*unstructured.Unstructured
AlphabeticalOrder is a `sort.Interface` that sorts the objects by namespace/name/kind alphabetical order
func (AlphabeticalOrder) Len ¶
func (l AlphabeticalOrder) Len() int
func (AlphabeticalOrder) Less ¶
func (l AlphabeticalOrder) Less(i, j int) bool
func (AlphabeticalOrder) Swap ¶
func (l AlphabeticalOrder) Swap(i, j int)
type DependencyOrder ¶
type DependencyOrder []*unstructured.Unstructured
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 (DependencyOrder) Len ¶
func (l DependencyOrder) Len() int
func (DependencyOrder) Less ¶
func (l DependencyOrder) Less(i, j int) bool
func (DependencyOrder) Swap ¶
func (l DependencyOrder) Swap(i, j int)
type ImageName ¶
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 ¶
ParseImageName parses a docker image into an ImageName struct
func (ImageName) RegistryRepoName ¶
RegistryRepoName returns the "repository" as used in the registry URL
func (ImageName) RegistryURL ¶
RegistryURL returns the deduced base URL of the registry for this image
type InvalidTypeError ¶
type InvalidTypeError struct {
ExpectedKind reflect.Kind
ObservedKind reflect.Kind
FieldName string
}
InvalidTypeError is returned when an invalid type is encountered
func (*InvalidTypeError) Error ¶
func (i *InvalidTypeError) Error() string
type Registry ¶
Registry is a *crazy limited* Docker registry client.
func NewRegistryClient ¶
NewRegistryClient creates a new Registry client using the given http client and base URL.
type Resolver ¶
Resolver is able to resolve docker image names into more specific forms
func NewIdentityResolver ¶
func NewIdentityResolver() Resolver
NewIdentityResolver returns a resolver that does only trivial :latest canonicalisation
func NewRegistryResolver ¶
NewRegistryResolver returns a resolver that looks up a docker registry to resolve digests
type ServerVersion ¶
ServerVersion captures k8s major.minor version in a parsed form
func FetchVersion ¶
func FetchVersion(v discovery.ServerVersionInterface) (ret ServerVersion, err error)
FetchVersion fetches version information from discovery client, and parses
func ParseVersion ¶
func ParseVersion(v *version.Info) (ret ServerVersion, err error)
ParseVersion parses version.Info into a ServerVersion struct
func (ServerVersion) Compare ¶
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 ¶
func (v ServerVersion) String() string
type SwaggerSchema ¶
type SwaggerSchema struct {
// contains filtered or unexported fields
}
SwaggerSchema represents an OpenAPI/Swagger schema
func NewSwaggerSchemaFor ¶
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 ¶
func (s *SwaggerSchema) Validate(obj *unstructured.Unstructured) []error
Validate is the primary entrypoint into this class
func (*SwaggerSchema) ValidateObject ¶
func (s *SwaggerSchema) ValidateObject(obj interface{}, fieldName, typeName string) []error
ValidateObject validates a JSON object against the schema
type TypeNotFoundError ¶
type TypeNotFoundError string
TypeNotFoundError is returned when specified type can not found in schema
func (TypeNotFoundError) Error ¶
func (tnfe TypeNotFoundError) Error() string