diff --git a/charms/worker/k8s/charmcraft.yaml b/charms/worker/k8s/charmcraft.yaml index b138925b..c5b3ceab 100644 --- a/charms/worker/k8s/charmcraft.yaml +++ b/charms/worker/k8s/charmcraft.yaml @@ -184,6 +184,11 @@ config: "Retain". If set to "Delete", the storage will be deleted when the PersistentVolumeClaim is deleted. If set to "Retain", the storage will be retained when the PersistentVolumeClaim is deleted. + gateway-enabled: + type: boolean + default: false + description: | + Enable/Disable the gateway feature on the cluster. actions: get-kubeconfig: diff --git a/charms/worker/k8s/src/charm.py b/charms/worker/k8s/src/charm.py index 162b2716..7794ac84 100755 --- a/charms/worker/k8s/src/charm.py +++ b/charms/worker/k8s/src/charm.py @@ -41,6 +41,7 @@ ControlPlaneNodeJoinConfig, CreateClusterRequest, DNSConfig, + GatewayConfig, InvalidResponseError, JoinClusterRequest, K8sdAPIManager, @@ -413,12 +414,17 @@ def _assemble_cluster_config(self) -> UserFacingClusterConfig: # https://github.com/canonical/k8s-operator/pull/169/files#r1847378214 ) + gateway = GatewayConfig( + enabled=self.config.get("gateway-enabled"), + ) + cloud_provider = None if self.xcp.has_xcp: cloud_provider = "external" return UserFacingClusterConfig( local_storage=local_storage, + gateway=gateway, annotations=self._get_valid_annotations(), cloud_provider=cloud_provider, )