{"modulePath":"github.com/GoCodeAlone/workflow","version":"v0.87.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package k8s\n\n## Functions\n\n```go\nfunc StreamLogs(ctx context.Context, client *Client, appName, namespace string, opts deploy.LogOpts) (io.ReadCloser, error)\n```\nStreamLogs returns a ReadCloser streaming logs from the app's pods.\n\n```go\nfunc WaitForRollout(ctx context.Context, client *Client, name, namespace string, timeout time.Duration) error\n```\nWaitForRollout polls a Deployment until all replicas are ready or the context is cancelled.\n\n## Types\n\n```go\ntype Client struct {\n\tTyped     kubernetes.Interface\n\tDynamic   dynamic.Interface\n\tConfig    *rest.Config\n\tNamespace string\n}\n```\nClient wraps Kubernetes clientsets for typed and dynamic operations.\n\n```go\nfunc NewClient(cfg ClientConfig) (*Client, error)\n```\nNewClient creates a Kubernetes client using the following resolution order: 1. Explicit kubeconfig path 2. KUBECONFIG environment variable 3. ~/.kube/config 4. In-cluster config\n\n```go\ntype ClientConfig struct {\n\tKubeconfig string\n\tContext    string\n\tNamespace  string\n}\n```\nClientConfig holds options for creating a Kubernetes client.\n\n```go\ntype ContainerStatus struct {\n\tName         string `json:\"name\"`\n\tReady        bool   `json:\"ready\"`\n\tRestartCount int32  `json:\"restartCount\"`\n\tState        string `json:\"state\"`\n\tReason       string `json:\"reason,omitempty\"`\n\tMessage      string `json:\"message,omitempty\"`\n}\n```\nContainerStatus describes the status of a container within a pod.\n\n```go\ntype Deployer struct {\n\t// contains filtered or unexported fields\n}\n```\nDeployer handles applying and deleting Kubernetes resources.\n\n```go\nfunc NewDeployer(client *Client) *Deployer\n```\nNewDeployer creates a new Deployer.\n\n```go\nfunc (d *Deployer) Apply(ctx context.Context, artifacts *deploy.DeployArtifacts, opts deploy.ApplyOpts) (*deploy.DeployResult, error)\n```\nApply performs server-side apply for all objects in the artifacts.\n\n```go\nfunc (d *Deployer) Delete(ctx context.Context, appName, namespace string) error\n```\nDelete removes all resources matching the app label.\n\n```go\nfunc (d *Deployer) Diff(ctx context.Context, artifacts *deploy.DeployArtifacts) (string, error)\n```\nDiff compares artifacts against live state and returns a human-readable diff.\n\n```go\ntype K8sDeployTarget struct {\n\t// contains filtered or unexported fields\n}\n```\nK8sDeployTarget implements deploy.DeployTarget for Kubernetes.\n\n```go\nfunc NewDeployTarget() *K8sDeployTarget\n```\nNewDeployTarget creates a K8sDeployTarget. If client is nil, one will be created lazily from default kubeconfig on first operation.\n\n```go\nfunc NewDeployTargetWithClient(client *Client) *K8sDeployTarget\n```\nNewDeployTargetWithClient creates a K8sDeployTarget with a pre-configured client.\n\n```go\nfunc (t *K8sDeployTarget) Apply(ctx context.Context, artifacts *deploy.DeployArtifacts, opts deploy.ApplyOpts) (*deploy.DeployResult, error)\n```\n\n```go\nfunc (t *K8sDeployTarget) Destroy(ctx context.Context, appName, namespace string) error\n```\n\n```go\nfunc (t *K8sDeployTarget) Diff(ctx context.Context, artifacts *deploy.DeployArtifacts) (string, error)\n```\n\n```go\nfunc (t *K8sDeployTarget) Generate(ctx context.Context, req *deploy.DeployRequest) (*deploy.DeployArtifacts, error)\n```\n\n```go\nfunc (t *K8sDeployTarget) Logs(ctx context.Context, appName, namespace string, opts deploy.LogOpts) (io.ReadCloser, error)\n```\n\n```go\nfunc (t *K8sDeployTarget) Name() string\n```\n\n```go\nfunc (t *K8sDeployTarget) Status(ctx context.Context, appName, namespace string) (*deploy.DeployStatus, error)\n```\n\n```go\ntype ManifestSet struct {\n\tObjects []*unstructured.Unstructured\n}\n```\nManifestSet is an ordered collection of Kubernetes objects.\n\n```go\nfunc Build(req *deploy.DeployRequest) (*ManifestSet, error)\n```\nBuild produces a ManifestSet from a DeployRequest.\n\n```go\nfunc (m *ManifestSet) Add(obj *unstructured.Unstructured)\n```\nAdd appends an object to the manifest set.\n\n```go\nfunc (m *ManifestSet) AddRuntime(obj runtime.Object) error\n```\nAddRuntime converts a typed k8s object to unstructured and adds it.\n\n```go\nfunc (m *ManifestSet) Sort()\n```\nSort orders objects by the canonical resource ordering.\n\n```go\nfunc (m *ManifestSet) WriteJSON(path string) error\n```\nWriteJSON writes all objects as a JSON array to the given path.\n\n```go\nfunc (m *ManifestSet) WriteYAML(dir string, singleFile bool) error\n```\nWriteYAML writes all objects as YAML to the given directory. If singleFile is true, writes a multi-document YAML to manifests.yaml. Otherwise writes each object to a separate file named by kind-name.yaml.\n\n```go\ntype PodStatus struct {\n\tName       string            `json:\"name\"`\n\tPhase      string            `json:\"phase\"`\n\tReady      bool              `json:\"ready\"`\n\tRestarts   int32             `json:\"restarts\"`\n\tAge        time.Duration     `json:\"age\"`\n\tContainers []ContainerStatus `json:\"containers,omitempty\"`\n}\n```\nPodStatus describes the status of a single pod.\n\n```go\ntype RuntimeInfo struct {\n\tRuntime     imageloader.Runtime\n\tContextName string\n\tClusterName string // extracted from context (e.g. \"mycluster\" from \"kind-mycluster\")\n}\n```\nRuntimeInfo holds detected cluster runtime information.\n\n```go\nfunc DetectRuntime(kubeconfigPath, contextOverride string) (*RuntimeInfo, error)\n```\nDetectRuntime determines the cluster runtime from the kubeconfig context name.\n\n```go\ntype StatusResult struct {\n\tAppName   string      `json:\"appName\"`\n\tNamespace string      `json:\"namespace\"`\n\tPhase     string      `json:\"phase\"`\n\tReady     int         `json:\"ready\"`\n\tDesired   int         `json:\"desired\"`\n\tPods      []PodStatus `json:\"pods,omitempty\"`\n\tMessage   string      `json:\"message,omitempty\"`\n\tUpdatedAt time.Time   `json:\"updatedAt\"`\n}\n```\nStatusResult describes the overall status of a deployed application.\n\n```go\nfunc GetStatus(ctx context.Context, client *Client, appName, namespace string) (*StatusResult, error)\n```\nGetStatus returns the current deployment status for an app.\n\n","path":"github.com/GoCodeAlone/workflow/pkg/k8s","name":"k8s","synopsis":"","isRedistributable":true}
