Documentation ¶
Index ¶
- Variables
- func SortManifests(manifests []Manifest)
- type Manifest
- type OrderedClient
- func (k *OrderedClient) Apply(ctx context.Context, applyPaths []string, output bool, format string, ...) ([]byte, error)
- func (k *OrderedClient) Delete(ctx context.Context, ids []string) ([]byte, error)
- func (k *OrderedClient) Diff(ctx context.Context, configPaths []string, structured bool) ([]byte, error)
- type SimpleHeader
Constants ¶
This section is empty.
Variables ¶
var KindOrder []string = []string{
"Namespace",
"NetworkPolicy",
"ResourceQuota",
"LimitRange",
"PodSecurityPolicy",
"PodDisruptionBudget",
"Secret",
"ConfigMap",
"ConfigMapList",
"StorageClass",
"PersistentVolume",
"PersistentVolumeClaim",
"ServiceAccount",
"CustomResourceDefinition",
"ClusterRole",
"ClusterRoleList",
"ClusterRoleBinding",
"ClusterRoleBindingList",
"Role",
"RoleList",
"RoleBinding",
"RoleBindingList",
"Service",
"DaemonSet",
"Pod",
"ReplicationController",
"ReplicaSet",
"Deployment",
"HorizontalPodAutoscaler",
"StatefulSet",
"Job",
"CronJob",
"Ingress",
"APIService",
}
KindOrder specifies the order in which Kubernetes resource types should be applied. Adapted from the list in https://github.com/helm/helm/blob/master/pkg/releaseutil/kind_sorter.go.
var KindithoutMetadata []string = []string{
"ConfigMapList",
"RoleBindingList",
"RoleList",
}
KindithoutMetadata lists out Kubernetes manifest types that don't have metadata.
Functions ¶
func SortManifests ¶
func SortManifests(manifests []Manifest)
SortManifests sorts the provided manifest slice using the KindOrder above. Ties within the same type are broken by (namespace, name).
Types ¶
type Manifest ¶
type Manifest struct { Path string Head SimpleHeader Contents string Hash string ID string }
Manifest is a wrapper around a Kubernetes resource manifest on local disk.
func GetManifests ¶
GetManifests recursively parses all of the manifests in the argument path.
type OrderedClient ¶
type OrderedClient struct {
// contains filtered or unexported fields
}
OrderedClient is a kubectl-wrapped client that tries to be clever about the order in which resources are created or destroyed.
func NewOrderedClient ¶
func NewOrderedClient( kubeConfigPath string, keepConfigs bool, extraEnv []string, debug bool, serverSide bool, ) *OrderedClient
NewOrderedClient returns a new OrderedClient instance.
func (*OrderedClient) Apply ¶
func (k *OrderedClient) Apply( ctx context.Context, applyPaths []string, output bool, format string, dryRun bool, ) ([]byte, error)
Apply runs kubectl apply on the manifests in the argument path. The apply is done in the optimal order based on resource type.
type SimpleHeader ¶
type SimpleHeader struct { Version string `json:"apiVersion"` Kind string `json:"kind,omitempty"` Metadata *struct { Name string `json:"name"` Namespace string `json:"namespace"` Annotations map[string]string `json:"annotations"` } `json:"metadata,omitempty"` }
SimpleHeader is a simplified header used to getting basic metadata from Kubernetes YAML files. Adapted from same struct in Helm repo.