Documentation ¶
Index ¶
- Variables
- func CreateKubeconfigFromClusterData(clusterName string, serverURL string, caData string, region string, ...) error
- func CreateKubeconfigViaAPI(ctx context.Context, sess *session.Session, clusterName string, region string, ...) error
- func KubeconfigMatchesCluster(path string, clusterName string) bool
- func SortManifests(manifests []Manifest)
- type KubeconfigTemplateData
- type Manifest
- type OrderedClient
- func (k *OrderedClient) Apply(ctx context.Context, applyPaths []string, output bool, format string, ...) ([]byte, error)
- func (k *OrderedClient) Diff(ctx context.Context, configPaths []string, structured bool, diffCommand string, ...) ([]byte, error)
- func (k *OrderedClient) GetNamespaceUID(ctx context.Context, namespace string) (string, error)
- func (k *OrderedClient) Summary(ctx context.Context) (string, 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 CreateKubeconfigFromClusterData ¶
func CreateKubeconfigFromClusterData( clusterName string, serverURL string, caData string, region string, path string, ) error
CreateKubeconfigFromClusterData generates a kubeconfig from the raw components in KubeconfigTemplateData.
func CreateKubeconfigViaAPI ¶
func CreateKubeconfigViaAPI( ctx context.Context, sess *session.Session, clusterName string, region string, path string, ) error
CreateKubeconfigViaAPI generates a kubeconfig by hitting the EKS API.
func KubeconfigMatchesCluster ¶
KubeconfigMatchesCluster determines (roughly) whether a kubeconfig matches the provided cluster name. Currently, it just looks for the latter string in the config.
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 KubeconfigTemplateData ¶
KubeconfigTemplateData stores the data necessary to generate a kubeconfig.
type Manifest ¶
type Manifest struct { Path string Head SimpleHeader Contents 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.
func (*OrderedClient) Diff ¶
func (k *OrderedClient) Diff( ctx context.Context, configPaths []string, structured bool, diffCommand string, spinner *spinner.Spinner, ) ([]byte, error)
Diff runs kubectl diff for the configs at the argument path.
func (*OrderedClient) GetNamespaceUID ¶
GetNamespaceUID returns the kubernetes identifier for a given namespace in this cluster.
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.