runway.module.k8s module¶
K8s (kustomize) module.
- class runway.module.k8s.K8s[source]¶
Bases:
RunwayModule
[K8sOptions
]Kubectl Runway Module.
- __init__(context: RunwayContext, *, explicitly_enabled: bool | None = False, logger: RunwayLogger = <RunwayLogger runway.module.k8s (WARNING)>, module_root: Path, name: str | None = None, options: dict[str, Any] | ModuleOptions | None = None, parameters: dict[str, Any] | None = None, **_: Any) None [source]¶
Instantiate class.
- Parameters:
context – Runway context object for the current session.
explicitly_enabled – Whether or not the module is explicitly enabled. This is can be set in the event that the current environment being deployed to matches the defined environments of the module/deployment.
logger – Used to write logs.
module_root – Root path of the module.
name – Name of the module.
options – Options passed to the module class from the config as
options
ormodule_options
if coming from the deployment level.parameters – Values to pass to the underlying infrastructure as code tool that will alter the resulting infrastructure being deployed. Used to templatize IaC.
- gen_cmd(command: Literal['annotation', 'apply', 'auth', 'autoscale', 'cp', 'create', 'delete', 'describe', 'diff', 'edit', 'exec', 'expose', 'get', 'kustomize', 'label', 'logs', 'patch', 'port-forward', 'proxy'], args_list: list[str] | None = None) list[str] [source]¶
Generate and log a kubectl command.
This does not execute the command, only prepares it for use.
- Parameters:
command – The CDK command to be executed.
args_list – Additional arguments to include in the generated command.
- Returns:
The full command to be passed into a subprocess.
- property kbenv: KBEnvManager¶
Kubectl environment manager.
- kubectl_apply() None [source]¶
Execute
kubectl apply
command.https://kubectl.docs.kubernetes.io/references/kubectl/apply/
- kubectl_delete() None [source]¶
Execute
kubectl delete
command.https://kubectl.docs.kubernetes.io/references/kubectl/delete/
- kubectl_kustomize() str [source]¶
Execute
kubectl kustomize
command.https://kubectl.docs.kubernetes.io/references/kubectl/kustomize/
- class runway.module.k8s.K8sOptions[source]¶
Bases:
ModuleOptions
Module options for Kubernetes.
- data¶
Options parsed into a data model.
- deploy_environment¶
Runway deploy environment object.
- Type:
- path¶
Module path.
- Type:
Path
- __init__(data: RunwayK8sModuleOptionsDataModel, deploy_environment: DeployEnvironment, path: Path) None [source]¶
Instantiate class.
- Parameters:
data – Options parsed into a data model.
deploy_environment – Current deploy environment.
path – Module path.
- static gen_overlay_dirs(environment: str, region: str) list[str] [source]¶
Generate possible overlay directories.
Prefers more explicit directory name but falls back to environment name only.
- Parameters:
environment – Current deploy environment.
region – Current AWS region.
- classmethod get_overlay_dir(path: Path, environment: str, region: str) Path [source]¶
Determine the overlay directory to use.
- classmethod parse_obj(deploy_environment: DeployEnvironment, obj: object, path: Path | None = None) K8sOptions [source]¶
Parse options definition and return an options object.
- Parameters:
deploy_environment – Current deploy environment.
obj – Object to parse.
path – Module path.