kubernetes
This module has been generated via dagger init and serves as a reference tobasic module structure as you get started with Dagger.
Two functions have been pre-created. You can modify, delete, or add to them,
as needed. They demonstrate usage of arguments and return types using simple
echo and grep commands. The functions can be called from the dagger CLI or
from one of the SDKs.
The first line in this comment block is a short description line and the
rest is a long description with more detail on the module's purpose or usage,
if appropriate. All modules should have a short description.
Installation
dagger install github.com/stuttgart-things/dagger/kubernetes@v0.68.0Entrypoint
Return Type
Kubernetes Example
dagger -m github.com/stuttgart-things/dagger/kubernetes@4b7a9104a164f0bdbbfaae328ca067d98f70662c call \
func (m *MyModule) Example() *dagger.Kubernetes {
return dag.
Kubernetes()
}@function
def example() -> dagger.Kubernetes:
return (
dag.kubernetes()
)@func()
example(): Kubernetes {
return dag
.kubernetes()
}Types
Kubernetes 🔗
baseImage() 🔗
Return Type
String ! Example
dagger -m github.com/stuttgart-things/dagger/kubernetes@4b7a9104a164f0bdbbfaae328ca067d98f70662c call \
base-imagefunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Kubernetes().
BaseImage(ctx)
}@function
async def example() -> str:
return await (
dag.kubernetes()
.base_image()
)@func()
async example(): Promise<string> {
return dag
.kubernetes()
.baseImage()
}checkResourceStatus() 🔗
Return Type
Boolean !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| kind | String ! | - | e.g., "secret", "pod" |
| name | String ! | - | resource name |
| namespace | String ! | - | optional namespace |
| kubeConfig | Secret ! | - | No description provided |
Example
dagger -m github.com/stuttgart-things/dagger/kubernetes@4b7a9104a164f0bdbbfaae328ca067d98f70662c call \
check-resource-status --kind string --name string --namespace string --kube-config env:MYSECRETfunc (m *MyModule) Example(ctx context.Context, kind string, name string, namespace string, kubeConfig *dagger.Secret) bool {
return dag.
Kubernetes().
CheckResourceStatus(ctx, kind, name, namespace, kubeConfig)
}@function
async def example(kind: str, name: str, namespace: str, kube_config: dagger.Secret) -> bool:
return await (
dag.kubernetes()
.check_resource_status(kind, name, namespace, kube_config)
)@func()
async example(kind: string, name: string, namespace: string, kubeConfig: Secret): Promise<boolean> {
return dag
.kubernetes()
.checkResourceStatus(kind, name, namespace, kubeConfig)
}command() 🔗
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| operation | String | "get" | src *dagger.Directory, |
| resourceKind | String | "pods" | No description provided |
| namespace | String | - | No description provided |
| kubeConfig | Secret | - | No description provided |
| additionalCommand | String | - | No description provided |
Example
dagger -m github.com/stuttgart-things/dagger/kubernetes@4b7a9104a164f0bdbbfaae328ca067d98f70662c call \
commandfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Kubernetes().
Command(ctx)
}@function
async def example() -> str:
return await (
dag.kubernetes()
.command()
)@func()
async example(): Promise<string> {
return dag
.kubernetes()
.command()
}kubectl() 🔗
Kubectl applies or manages Kubernetes manifests from files or URLs
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| operation | String | "apply" | Kubectl operation (apply, delete, create, etc.) |
| sourceFile | File | - | Source file (local file from Dagger) |
| urlSource | String | - | URL source (e.g., https://raw.githubusercontent.com/org/repo/main/manifest.yaml) |
| kustomizeSource | String | - | Kustomize directory URL (e.g., https://github.com/org/repo/path/to/kustomize) |
| namespace | String | - | Namespace for the operation |
| kubeConfig | Secret | - | Kubeconfig secret for authentication |
| serverSide | Boolean | false | Use server-side apply (only valid with apply operation) |
| additionalFlags | String | - | Additional kubectl flags (e.g., "--dry-run=client -o yaml") |
Example
dagger -m github.com/stuttgart-things/dagger/kubernetes@4b7a9104a164f0bdbbfaae328ca067d98f70662c call \
kubectlfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Kubernetes().
Kubectl(ctx)
}@function
async def example() -> str:
return await (
dag.kubernetes()
.kubectl()
)@func()
async example(): Promise<string> {
return dag
.kubernetes()
.kubectl()
}createKubeconfigSecret() 🔗
CreateKubeconfigSecret creates or updates a Kubernetes secret from a kubeconfig file This is an idempotent operation using kubectl apply
Example usage:
dagger call -m kcl create-kubeconfig-secret \
--namespace crossplane-system \
--secret-name dev \
--kubeconfig-file ./kubeconfig.yaml \
--kube-config file:///home/user/.kube/config
Parameters: - namespace: Kubernetes namespace where the secret will be created - secretName: Name of the secret to create - kubeconfigFile: kubeconfig file to use as secret data - kubeConfig: kubeconfig for authentication (file:// or contents)
Returns the secret creation status
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| namespace | String | "crossplane-system" | Kubernetes namespace where secret will be created |
| secretName | String | "kubeconfig" | Name of the secret to create |
| toBeCreatedKubeconfigSecret | Secret ! | - | Kubeconfig secret to create secret from |
| kubeConfigCluster | Secret | - | Kubeconfig secret for kubectl authentication |
Example
dagger -m github.com/stuttgart-things/dagger/kubernetes@4b7a9104a164f0bdbbfaae328ca067d98f70662c call \
create-kubeconfig-secret --to-be-created-kubeconfig-secret env:MYSECRETfunc (m *MyModule) Example(ctx context.Context, toBeCreatedKubeconfigSecret *dagger.Secret) string {
return dag.
Kubernetes().
CreateKubeconfigSecret(ctxtoBeCreatedKubeconfigSecret)
}@function
async def example(to_be_created_kubeconfig_secret: dagger.Secret) -> str:
return await (
dag.kubernetes()
.create_kubeconfig_secret(to_be_created_kubeconfig_secret)
)@func()
async example(toBeCreatedKubeconfigSecret: Secret): Promise<string> {
return dag
.kubernetes()
.createKubeconfigSecret(toBeCreatedKubeconfigSecret)
}