Documentation ¶
Overview ¶
+groupName=gravitational.io
Index ¶
- Constants
- func Encode(objects []runtime.Object, encoding encoding, w io.Writer) error
- func ForEachObject(reader io.Reader, fn ResourceFunc) error
- func ForEachObjectInFile(path string, fn ResourceFunc) error
- func UpdateSecurityContext(pod *v1.PodSpec, serviceUser systeminfo.User) (updated bool)
- func UpdateSecurityContextInDir(dir string, serviceUser systeminfo.User) error
- type DecodeOption
- type ExtractedImages
- type ManifestRewriteFunc
- type Resource
- type ResourceFile
- type ResourceFiles
- type ResourceFunc
- type Resources
- type Unknown
Constants ¶
const ( // KindResourceFile represents a generic Kubernetes resource spec file. KindResourceFile = "Resource file" // KindManifestFile represents a cluster/app image manifest file. KindManifestFile = "Manifest file" // KindHelmTemplate represents a Helm template file. KindHelmTemplate = "Helm template" )
Variables ¶
This section is empty.
Functions ¶
func ForEachObject ¶
func ForEachObject(reader io.Reader, fn ResourceFunc) error
ForEachObject decodes Kubernetes objects from the provided reader and calls the provided function for each of them
func ForEachObjectInFile ¶
func ForEachObjectInFile(path string, fn ResourceFunc) error
ForEachObjectInFile decodes the file at specified path as Kubernetes spec and calls the provided function for each of the decoded objects
func UpdateSecurityContext ¶
func UpdateSecurityContext(pod *v1.PodSpec, serviceUser systeminfo.User) (updated bool)
UpdateSecurityContext updates the security context for the given Pod (including security contexts of all containers) using the specified service user. Only the security contexts using a special defaults.PlaceholderServiceUserID are updated.
func UpdateSecurityContextInDir ¶
func UpdateSecurityContextInDir(dir string, serviceUser systeminfo.User) error
UpdateSecurityContextInDir updates all application resources in the specified directory with securityContext using the given service user
Types ¶
type DecodeOption ¶
type DecodeOption func(*universalDecoder)
DecodeOption is a functional argument for decoding
type ExtractedImages ¶
type ExtractedImages struct { // Images contains extracted image names Images []string // UnrecognizedObjects contains objects which could not be recognized UnrecognizedObjects []runtime.Object }
ExtractedImages is the results of image extraction from a list of objects
type ManifestRewriteFunc ¶
ManifestRewriteFunc defines an interface for functions that can update parts of an application manifest
type Resource ¶
Resource combines a set of kubernetes resources and a means to serialize them in the original format (JSON or YAML)
func Decode ¶
func Decode(r io.Reader, options ...DecodeOption) (resource *Resource, err error)
Decode decodes kubernetes resources from the specified io.Reader
func NewResource ¶
NewResource creates a new resource object that can encode objects it was initialized with in YAML format
func (*Resource) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Resource.
func (*Resource) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourceFile ¶
type ResourceFile struct { Resource // contains filtered or unexported fields }
ResourceFile represents a file with resources to process
func NewResourceFile ¶
func NewResourceFile(path string) (*ResourceFile, error)
NewResourceFile parses the file at path and returns all kubernetes objects as a single ResourceFile instance. The object can then serialize itself to the original location.
func NewResourceFileObject ¶
func NewResourceFileObject(path, kind string, resource Resource) ResourceFile
NewResourceFileObject returns new resource file created from resource
func (*ResourceFile) DeepCopy ¶
func (in *ResourceFile) DeepCopy() *ResourceFile
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceFile.
func (*ResourceFile) DeepCopyInto ¶
func (in *ResourceFile) DeepCopyInto(out *ResourceFile)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (ResourceFile) Images ¶
func (r ResourceFile) Images() (*ExtractedImages, error)
Images returns a list of Docker images in this resource file
func (ResourceFile) Kind ¶
func (r ResourceFile) Kind() string
Kind returns the kind of the resource this file represents.
func (ResourceFile) String ¶
func (r ResourceFile) String() string
String implements fmt.Stringer for this resource file
type ResourceFiles ¶
type ResourceFiles []ResourceFile
ResourceFiles is a collection of resource files
func (ResourceFiles) Images ¶
func (r ResourceFiles) Images() ([]string, error)
Images accumulates container image references over the specified range of resource files and returns them as a flat list w/o duplicates.
func (*ResourceFiles) RewriteImages ¶
func (r *ResourceFiles) RewriteImages(rewriteFunc func(string) string) error
RewriteImages rewrites container image references in all resource files part of this collection using the specified imageService.
func (*ResourceFiles) RewriteManifest ¶
func (r *ResourceFiles) RewriteManifest(ctx context.Context, rewrites ...ManifestRewriteFunc) error
RewriteManifest rewrites parts of the application manifest resources by application of the specified set of rewrite functions
func (ResourceFiles) Write ¶
func (r ResourceFiles) Write() (err error)
Write serializes the resource files to disk back to the locations they were read from.
type ResourceFunc ¶
ResourceFunc is the function that operates on an arbitrary Kubernetes object
type Unknown ¶
type Unknown struct { Raw json.RawMessage `json:",inline"` // contains filtered or unexported fields }
Unknown represents an unparsed Kubernetes resource with an interpreted TypeMeta and ObjectMeta fields which are used for type recognition. +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
func (*Unknown) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Unknown.
func (*Unknown) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Unknown) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*Unknown) GetObjectKind ¶
func (r *Unknown) GetObjectKind() schema.ObjectKind
GetObjectKind returns the ObjectKind for this Unknown. Implements runtime.Object
func (*Unknown) MarshalJSON ¶
MarshalJSON returns the raw message
func (*Unknown) UnmarshalJSON ¶
UnmarshalJSON consumes the specified data as a binary blob w/o interpreting it