Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
okozachenko1203 committed Mar 14, 2024
1 parent 40fc3a5 commit d9305ba
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions magnum_cluster_api/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ def __init__(

def get_object(self) -> pykube.ConfigMap:
# NOTE(mnaser): We have to assert that the only CNIs we support are Calico and Cilium.
assert Counter(CONF.cluster_template.kubernetes_allowed_network_drivers) == Counter(["calico", "cilium"])
assert Counter(
CONF.cluster_template.kubernetes_allowed_network_drivers
) == Counter(["calico", "cilium"])

manifests_path = pkg_resources.resource_filename(
"magnum_cluster_api", "manifests"
Expand Down Expand Up @@ -2114,12 +2116,19 @@ def __init__(
@property
def labels(self) -> dict:
if self.cluster.cluster_template.network_driver == "calico":
cni = f"calico-{utils.get_cluster_label(self.cluster, "calico_tag", CALICO_TAG)}"
cni_version = utils.get_cluster_label(
self.cluster, "calico_tag", CALICO_TAG
)
labels = {
"cni": f"calico-{cni_version}",
}
if self.cluster.cluster_template.network_driver == "cilium":
cni = f"cilium-{utils.get_cluster_label(self.cluster, "cilium_tag", CILIUM_TAG)}"
labels = {
"cni": cni,
}
cni_version = utils.get_cluster_label(
self.cluster, "cilium_tag", CILIUM_TAG
)
labels = {
"cni": f"cilium-{cni_version}",
}

return {**super().labels, **labels}

Expand All @@ -2139,9 +2148,13 @@ def get_object(self) -> objects.Cluster:
default_volume_type = osc.cinder().volume_types.default()

if self.cluster.cluster_template.network_driver == "calico":
pod_cidr = utils.get_cluster_label(self.cluster, "calico_ipv4pool", "10.100.0.0/16")
pod_cidr = utils.get_cluster_label(
self.cluster, "calico_ipv4pool", "10.100.0.0/16"
)
if self.cluster.cluster_template.network_driver == "cilium":
pod_cidr = utils.get_cluster_label(self.cluster, "cilium_ipv4pool", "10.100.0.0/16")
pod_cidr = utils.get_cluster_label(
self.cluster, "cilium_ipv4pool", "10.100.0.0/16"
)

return objects.Cluster(
self.api,
Expand Down

0 comments on commit d9305ba

Please sign in to comment.