diff --git a/functions/compose-aks-cluster/function/fn.py b/functions/compose-aks-cluster/function/fn.py index 77988a927..007a92a69 100644 --- a/functions/compose-aks-cluster/function/fn.py +++ b/functions/compose-aks-cluster/function/fn.py @@ -155,6 +155,10 @@ _NETWORK_OPERATOR_CHART_REPO = "https://helm.ngc.nvidia.com/nvidia" _NETWORK_OPERATOR_CHART_NAME = "network-operator" _NETWORK_OPERATOR_CHART_VERSION = "26.4.0" +# provider-helm installs a Release under its external name, which otherwise +# defaults to the Release's generated name: a long XR name pushes that past +# Helm's 53-character limit. +_NETWORK_OPERATOR_RELEASE_NAME = "mp-network-operator" _NETWORK_OPERATOR_NAMESPACE = "network-operator" # Name of the RWX StorageClass Modelplane composes for ModelCache. @@ -477,7 +481,10 @@ def compose_network_operator(self) -> None: resource.update( self.rsp.desired.resources["release-network-operator"], helmv1beta1.Release( - metadata=metav1.ObjectMeta(namespace=_namespace(self.xr.metadata)), + metadata=metav1.ObjectMeta( + namespace=_namespace(self.xr.metadata), + annotations={_ANNOTATION_EXTERNAL_NAME: _NETWORK_OPERATOR_RELEASE_NAME}, + ), spec=helmv1beta1.Spec( managementPolicies=_ORPHAN_MANAGEMENT, providerConfigRef=helmv1beta1.ProviderConfigRef( diff --git a/functions/compose-aks-cluster/tests/test_fn.py b/functions/compose-aks-cluster/tests/test_fn.py index 94e42184f..180bd9980 100644 --- a/functions/compose-aks-cluster/tests/test_fn.py +++ b/functions/compose-aks-cluster/tests/test_fn.py @@ -574,7 +574,10 @@ def _to_dict(msg: message.Message) -> dict: { "apiVersion": "helm.m.crossplane.io/v1beta1", "kind": "Release", - "metadata": {"namespace": "modelplane-system"}, + "metadata": { + "namespace": "modelplane-system", + "annotations": {"crossplane.io/external-name": "mp-network-operator"}, + }, "spec": { "managementPolicies": ["Observe", "Create", "Update"], "providerConfigRef": { diff --git a/functions/compose-civo-cluster/function/fn.py b/functions/compose-civo-cluster/function/fn.py index 5416d682d..e14eb2839 100644 --- a/functions/compose-civo-cluster/function/fn.py +++ b/functions/compose-civo-cluster/function/fn.py @@ -122,6 +122,10 @@ _AUTOSCALER_CHART_REPO = "https://kubernetes.github.io/autoscaler" _AUTOSCALER_CHART_NAME = "cluster-autoscaler" _AUTOSCALER_CHART_VERSION = "9.57.0" +# provider-helm installs a Release under its external name, which otherwise +# defaults to the Release's generated name: a long XR name pushes that past +# Helm's 53-character limit. +_AUTOSCALER_RELEASE_NAME = "mp-cluster-autoscaler" # Secret the autoscaler's Civo cloud provider reads its API access from: # civo-api-access in kube-system with api-key, api-url, cluster-id, and @@ -395,7 +399,10 @@ def compose_cluster_autoscaler(self) -> None: resource.update( self.rsp.desired.resources["release-cluster-autoscaler"], helmv1beta1.Release( - metadata=metav1.ObjectMeta(namespace=_namespace(self.xr.metadata)), + metadata=metav1.ObjectMeta( + namespace=_namespace(self.xr.metadata), + annotations={_ANNOTATION_EXTERNAL_NAME: _AUTOSCALER_RELEASE_NAME}, + ), spec=helmv1beta1.Spec( managementPolicies=_ORPHAN_MANAGEMENT, providerConfigRef=helmv1beta1.ProviderConfigRef( diff --git a/functions/compose-civo-cluster/tests/test_fn.py b/functions/compose-civo-cluster/tests/test_fn.py index 92edc33a0..f580c995b 100644 --- a/functions/compose-civo-cluster/tests/test_fn.py +++ b/functions/compose-civo-cluster/tests/test_fn.py @@ -313,7 +313,10 @@ def _autoscaler_release(*, autoscaling_groups: list[dict]) -> fnv1.Resource: { "apiVersion": "helm.m.crossplane.io/v1beta1", "kind": "Release", - "metadata": {"namespace": "modelplane-system"}, + "metadata": { + "namespace": "modelplane-system", + "annotations": {"crossplane.io/external-name": "mp-cluster-autoscaler"}, + }, "spec": { "managementPolicies": ["Observe", "Create", "Update"], "providerConfigRef": { diff --git a/functions/compose-eks-cluster/function/fn.py b/functions/compose-eks-cluster/function/fn.py index cce585b31..062fd1509 100644 --- a/functions/compose-eks-cluster/function/fn.py +++ b/functions/compose-eks-cluster/function/fn.py @@ -220,6 +220,10 @@ def _namespace(meta: metav1.ObjectMeta | None) -> str: _EFA_DRA_DRIVER_CHART_REPO = "https://aws.github.io/eks-charts" _EFA_DRA_DRIVER_CHART_NAME = "aws-dranet" _EFA_DRA_DRIVER_CHART_VERSION = "1.0.0" +# provider-helm installs a Release under its external name, which otherwise +# defaults to the Release's generated name: a long XR name pushes that past +# Helm's 53-character limit. +_EFA_DRA_DRIVER_RELEASE_NAME = "mp-aws-dranet" # GPU taint applied to GPU node groups so non-GPU pods don't land on # expensive GPU nodes. @@ -288,6 +292,7 @@ def _namespace(meta: metav1.ObjectMeta | None) -> str: _AUTOSCALER_CHART_REPO = "https://kubernetes.github.io/autoscaler" _AUTOSCALER_CHART_NAME = "cluster-autoscaler" _AUTOSCALER_CHART_VERSION = "9.57.0" +_AUTOSCALER_RELEASE_NAME = "mp-cluster-autoscaler" # IAM permissions the autoscaler needs to discover node groups and adjust their # ASGs' desired capacity. The Full Cluster Autoscaler Features policy from @@ -1575,7 +1580,10 @@ def compose_cluster_autoscaler(self) -> None: resource.update( self.rsp.desired.resources["release-cluster-autoscaler"], helmv1beta1.Release( - metadata=metav1.ObjectMeta(namespace=_namespace(self.xr.metadata)), + metadata=metav1.ObjectMeta( + namespace=_namespace(self.xr.metadata), + annotations={_ANNOTATION_EXTERNAL_NAME: _AUTOSCALER_RELEASE_NAME}, + ), spec=helmv1beta1.Spec( managementPolicies=_ORPHAN_MANAGEMENT, providerConfigRef=helmv1beta1.ProviderConfigRef( @@ -1621,7 +1629,10 @@ def compose_efa_dra_driver(self) -> None: resource.update( self.rsp.desired.resources["release-efa-dra-driver"], helmv1beta1.Release( - metadata=metav1.ObjectMeta(namespace=_namespace(self.xr.metadata)), + metadata=metav1.ObjectMeta( + namespace=_namespace(self.xr.metadata), + annotations={_ANNOTATION_EXTERNAL_NAME: _EFA_DRA_DRIVER_RELEASE_NAME}, + ), spec=helmv1beta1.Spec( managementPolicies=_ORPHAN_MANAGEMENT, providerConfigRef=helmv1beta1.ProviderConfigRef( diff --git a/functions/compose-eks-cluster/tests/test_fn.py b/functions/compose-eks-cluster/tests/test_fn.py index 83a6d50ec..7587f6f34 100644 --- a/functions/compose-eks-cluster/tests/test_fn.py +++ b/functions/compose-eks-cluster/tests/test_fn.py @@ -1070,7 +1070,10 @@ def _autoscaler_release() -> fnv1.Resource: { "apiVersion": "helm.m.crossplane.io/v1beta1", "kind": "Release", - "metadata": {"namespace": "modelplane-system"}, + "metadata": { + "namespace": "modelplane-system", + "annotations": {"crossplane.io/external-name": "mp-cluster-autoscaler"}, + }, "spec": { "managementPolicies": ["Observe", "Create", "Update"], "providerConfigRef": {"kind": "ProviderConfig", "name": "test-cluster-kubeconfig-55b57"}, @@ -2769,7 +2772,10 @@ def _to_dict(msg: message.Message) -> dict: { "apiVersion": "helm.m.crossplane.io/v1beta1", "kind": "Release", - "metadata": {"namespace": "modelplane-system"}, + "metadata": { + "namespace": "modelplane-system", + "annotations": {"crossplane.io/external-name": "mp-aws-dranet"}, + }, "spec": { "managementPolicies": ["Observe", "Create", "Update"], "providerConfigRef": { @@ -3005,7 +3011,10 @@ def _to_dict(msg: message.Message) -> dict: { "apiVersion": "helm.m.crossplane.io/v1beta1", "kind": "Release", - "metadata": {"namespace": "modelplane-system"}, + "metadata": { + "namespace": "modelplane-system", + "annotations": {"crossplane.io/external-name": "mp-aws-dranet"}, + }, "spec": { "managementPolicies": ["Observe", "Create", "Update"], "providerConfigRef": { diff --git a/functions/compose-nebius-cluster/function/fn.py b/functions/compose-nebius-cluster/function/fn.py index 9dfa7db89..254d76c49 100644 --- a/functions/compose-nebius-cluster/function/fn.py +++ b/functions/compose-nebius-cluster/function/fn.py @@ -111,6 +111,9 @@ _CPU_TAINT_VALUE = "true" _CPU_TAINT_EFFECT = "NO_SCHEDULE" +# Annotation the provider sets on a managed resource with its external name. +_ANNOTATION_EXTERNAL_NAME = "crossplane.io/external-name" + # Management policies that exclude Delete, used for resources installed on the # workload cluster (the RWX StorageClass Object and the CSI driver Helm # Release). These exist only to configure the cluster and are only ever @@ -154,6 +157,10 @@ _CSI_CHART_REPO = "oci://cr.eu-north1.nebius.cloud/mk8s/helm" _CSI_CHART_NAME = "csi-mounted-fs-path" _CSI_CHART_VERSION = "0.1.6" +# provider-helm installs a Release under its external name, which otherwise +# defaults to the Release's generated name: a long XR name pushes that past +# Helm's 53-character limit. +_CSI_RELEASE_NAME = "mp-csi-mounted-fs-path" _CSI_NAMESPACE = "kube-system" # The driver name the chart registers (its values.yaml driverName default). @@ -462,7 +469,10 @@ def compose_csi_driver(self) -> None: resource.update( self.rsp.desired.resources["release-csi-mounted-fs-path"], helmv1beta1.Release( - metadata=metav1.ObjectMeta(namespace=_namespace(self.xr.metadata)), + metadata=metav1.ObjectMeta( + namespace=_namespace(self.xr.metadata), + annotations={_ANNOTATION_EXTERNAL_NAME: _CSI_RELEASE_NAME}, + ), spec=helmv1beta1.Spec( managementPolicies=_ORPHAN_MANAGEMENT, providerConfigRef=helmv1beta1.ProviderConfigRef( diff --git a/functions/compose-nebius-cluster/tests/test_fn.py b/functions/compose-nebius-cluster/tests/test_fn.py index 419bc18e8..543b9529f 100644 --- a/functions/compose-nebius-cluster/tests/test_fn.py +++ b/functions/compose-nebius-cluster/tests/test_fn.py @@ -1194,7 +1194,10 @@ def _to_dict(msg: message.Message) -> dict: { "apiVersion": "helm.m.crossplane.io/v1beta1", "kind": "Release", - "metadata": {"namespace": "modelplane-system"}, + "metadata": { + "namespace": "modelplane-system", + "annotations": {"crossplane.io/external-name": "mp-csi-mounted-fs-path"}, + }, "spec": { "managementPolicies": ["Observe", "Create", "Update"], "providerConfigRef": {