Documentation
¶
Index ¶
- func StreamLogs(ctx context.Context, client *Client, appName, namespace string, ...) (io.ReadCloser, error)
- func WaitForRollout(ctx context.Context, client *Client, name, namespace string, ...) error
- type Client
- type ClientConfig
- type ContainerStatus
- type Deployer
- func (d *Deployer) Apply(ctx context.Context, artifacts *deploy.DeployArtifacts, opts deploy.ApplyOpts) (*deploy.DeployResult, error)
- func (d *Deployer) Delete(ctx context.Context, appName, namespace string) error
- func (d *Deployer) Diff(ctx context.Context, artifacts *deploy.DeployArtifacts) (string, error)
- type K8sDeployTarget
- func (t *K8sDeployTarget) Apply(ctx context.Context, artifacts *deploy.DeployArtifacts, opts deploy.ApplyOpts) (*deploy.DeployResult, error)
- func (t *K8sDeployTarget) Destroy(ctx context.Context, appName, namespace string) error
- func (t *K8sDeployTarget) Diff(ctx context.Context, artifacts *deploy.DeployArtifacts) (string, error)
- func (t *K8sDeployTarget) Generate(ctx context.Context, req *deploy.DeployRequest) (*deploy.DeployArtifacts, error)
- func (t *K8sDeployTarget) Logs(ctx context.Context, appName, namespace string, opts deploy.LogOpts) (io.ReadCloser, error)
- func (t *K8sDeployTarget) Name() string
- func (t *K8sDeployTarget) Status(ctx context.Context, appName, namespace string) (*deploy.DeployStatus, error)
- type ManifestSet
- type PodStatus
- type RuntimeInfo
- type StatusResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
Typed kubernetes.Interface
Dynamic dynamic.Interface
Config *rest.Config
Namespace string
}
Client wraps Kubernetes clientsets for typed and dynamic operations.
func NewClient ¶
func NewClient(cfg ClientConfig) (*Client, error)
NewClient creates a Kubernetes client using the following resolution order: 1. Explicit kubeconfig path 2. KUBECONFIG environment variable 3. ~/.kube/config 4. In-cluster config
type ClientConfig ¶
ClientConfig holds options for creating a Kubernetes client.
type ContainerStatus ¶
type ContainerStatus struct {
Name string `json:"name"`
Ready bool `json:"ready"`
RestartCount int32 `json:"restartCount"`
State string `json:"state"`
Reason string `json:"reason,omitempty"`
Message string `json:"message,omitempty"`
}
ContainerStatus describes the status of a container within a pod.
type Deployer ¶
type Deployer struct {
// contains filtered or unexported fields
}
Deployer handles applying and deleting Kubernetes resources.
func (*Deployer) Apply ¶
func (d *Deployer) Apply(ctx context.Context, artifacts *deploy.DeployArtifacts, opts deploy.ApplyOpts) (*deploy.DeployResult, error)
Apply performs server-side apply for all objects in the artifacts.
type K8sDeployTarget ¶
type K8sDeployTarget struct {
// contains filtered or unexported fields
}
K8sDeployTarget implements deploy.DeployTarget for Kubernetes.
func NewDeployTarget ¶
func NewDeployTarget() *K8sDeployTarget
NewDeployTarget creates a K8sDeployTarget. If client is nil, one will be created lazily from default kubeconfig on first operation.
func NewDeployTargetWithClient ¶
func NewDeployTargetWithClient(client *Client) *K8sDeployTarget
NewDeployTargetWithClient creates a K8sDeployTarget with a pre-configured client.
func (*K8sDeployTarget) Apply ¶
func (t *K8sDeployTarget) Apply(ctx context.Context, artifacts *deploy.DeployArtifacts, opts deploy.ApplyOpts) (*deploy.DeployResult, error)
func (*K8sDeployTarget) Destroy ¶
func (t *K8sDeployTarget) Destroy(ctx context.Context, appName, namespace string) error
func (*K8sDeployTarget) Diff ¶
func (t *K8sDeployTarget) Diff(ctx context.Context, artifacts *deploy.DeployArtifacts) (string, error)
func (*K8sDeployTarget) Generate ¶
func (t *K8sDeployTarget) Generate(ctx context.Context, req *deploy.DeployRequest) (*deploy.DeployArtifacts, error)
func (*K8sDeployTarget) Logs ¶
func (t *K8sDeployTarget) Logs(ctx context.Context, appName, namespace string, opts deploy.LogOpts) (io.ReadCloser, error)
func (*K8sDeployTarget) Name ¶
func (t *K8sDeployTarget) Name() string
func (*K8sDeployTarget) Status ¶
func (t *K8sDeployTarget) Status(ctx context.Context, appName, namespace string) (*deploy.DeployStatus, error)
type ManifestSet ¶
type ManifestSet struct {
Objects []*unstructured.Unstructured
}
ManifestSet is an ordered collection of Kubernetes objects.
func Build ¶
func Build(req *deploy.DeployRequest) (*ManifestSet, error)
Build produces a ManifestSet from a DeployRequest.
func (*ManifestSet) Add ¶
func (m *ManifestSet) Add(obj *unstructured.Unstructured)
Add appends an object to the manifest set.
func (*ManifestSet) AddRuntime ¶
func (m *ManifestSet) AddRuntime(obj runtime.Object) error
AddRuntime converts a typed k8s object to unstructured and adds it.
func (*ManifestSet) Sort ¶
func (m *ManifestSet) Sort()
Sort orders objects by the canonical resource ordering.
func (*ManifestSet) WriteJSON ¶
func (m *ManifestSet) WriteJSON(path string) error
WriteJSON writes all objects as a JSON array to the given path.
func (*ManifestSet) WriteYAML ¶
func (m *ManifestSet) WriteYAML(dir string, singleFile bool) error
WriteYAML 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.
type PodStatus ¶
type PodStatus struct {
Name string `json:"name"`
Phase string `json:"phase"`
Ready bool `json:"ready"`
Restarts int32 `json:"restarts"`
Age time.Duration `json:"age"`
Containers []ContainerStatus `json:"containers,omitempty"`
}
PodStatus describes the status of a single pod.
type RuntimeInfo ¶
type RuntimeInfo struct {
Runtime imageloader.Runtime
ContextName string
ClusterName string // extracted from context (e.g. "mycluster" from "kind-mycluster")
}
RuntimeInfo holds detected cluster runtime information.
func DetectRuntime ¶
func DetectRuntime(kubeconfigPath, contextOverride string) (*RuntimeInfo, error)
DetectRuntime determines the cluster runtime from the kubeconfig context name.
type StatusResult ¶
type StatusResult struct {
AppName string `json:"appName"`
Namespace string `json:"namespace"`
Phase string `json:"phase"`
Ready int `json:"ready"`
Desired int `json:"desired"`
Pods []PodStatus `json:"pods,omitempty"`
Message string `json:"message,omitempty"`
UpdatedAt time.Time `json:"updatedAt"`
}
StatusResult describes the overall status of a deployed application.