Skip to content

Commit 62459f3

Browse files
committed
fix: linters
Signed-off-by: Tadas Sutkaitis <[email protected]>
1 parent 700a1a3 commit 62459f3

File tree

3 files changed

+44
-30
lines changed

3 files changed

+44
-30
lines changed

magnum_cluster_api/helm.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ def __call__(self):
112112
class TemplateReleaseCommand(ReleaseCommand):
113113
COMMAND = ["template"]
114114

115-
def __init__(self, namespace, release_name, chart_ref, values={}, include_crds=True):
115+
def __init__(
116+
self, namespace, release_name, chart_ref, values={}, include_crds=True
117+
):
116118
super().__init__(namespace, release_name)
117119
self.chart_ref = chart_ref
118120
self.values = values
@@ -140,10 +142,11 @@ def __call__(self, *helm_args, repository=None, replacements=[]):
140142
# until https://github.com/helm/helm/issues/10737 is fixed.
141143
for doc in yaml.safe_load_all(data):
142144
# NOTE(fitbeard): Skip empty documents that can occur with YAML separators:
143-
# helm template test . --include-crds --set controller.volumeSnapshotClasses[0].name=test \
145+
# helm template test . --include-crds \
146+
# --set controller.volumeSnapshotClasses[0].name=test \
144147
# --set controller.volumeSnapshotClasses[0].driver=test.driver | head -20
145148
# ---
146-
# # Source: snapshot-controller-csi/crds/groupsnapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml
149+
# # Source: snapshot-controller-csi/crds/xxx.storage.k8s.io_xxxsnapshotclasses.yaml
147150
# ---
148151
# apiVersion: apiextensions.k8s.io/v1
149152
if doc is None:
@@ -161,7 +164,11 @@ def __call__(self, *helm_args, repository=None, replacements=[]):
161164
container["image"], repository
162165
)
163166

164-
if doc["kind"] not in ("ClusterRole", "ClusterRoleBinding", "CustomResourceDefinition"):
167+
if doc["kind"] not in (
168+
"ClusterRole",
169+
"ClusterRoleBinding",
170+
"CustomResourceDefinition",
171+
):
165172
doc["metadata"]["namespace"] = self.namespace
166173
docs.append(doc)
167174
return yaml.safe_dump_all(docs, default_flow_style=False)

magnum_cluster_api/resources.py

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -365,41 +365,45 @@ def get_object(self) -> dict:
365365
}
366366

367367
# Add snapshot controller CSI chart if either Cinder CSI or Manila CSI is enabled
368-
if (cinder.is_enabled(self.cluster) or manila.is_enabled(self.cluster)):
369-
368+
if cinder.is_enabled(self.cluster) or manila.is_enabled(self.cluster):
369+
370370
# Build volume snapshot classes based on enabled CSI drivers
371371
volume_snapshot_classes = []
372-
372+
373373
# Add Cinder CSI volume snapshot class if enabled
374374
if cinder.is_enabled(self.cluster):
375-
volume_snapshot_classes.append({
376-
"name": "block-snapshot",
377-
"annotations": {
378-
"snapshot.storage.kubernetes.io/is-default-class": "true"
379-
},
380-
"driver": "cinder.csi.openstack.org",
381-
"deletionPolicy": "Delete"
382-
})
383-
375+
volume_snapshot_classes.append(
376+
{
377+
"name": "block-snapshot",
378+
"annotations": {
379+
"snapshot.storage.kubernetes.io/is-default-class": "true"
380+
},
381+
"driver": "cinder.csi.openstack.org",
382+
"deletionPolicy": "Delete",
383+
}
384+
)
385+
384386
# Add Manila CSI volume snapshot class if enabled
385387
if manila.is_enabled(self.cluster):
386-
volume_snapshot_classes.append({
387-
"name": "share-snapshot",
388-
"annotations": {
389-
"snapshot.storage.kubernetes.io/is-default-class": "true"
390-
},
391-
"driver": "manila.csi.openstack.org",
392-
"deletionPolicy": "Delete"
393-
})
388+
volume_snapshot_classes.append(
389+
{
390+
"name": "share-snapshot",
391+
"annotations": {
392+
"snapshot.storage.kubernetes.io/is-default-class": "true"
393+
},
394+
"driver": "manila.csi.openstack.org",
395+
"deletionPolicy": "Delete",
396+
}
397+
)
394398

395399
controller_values = {
396400
"fullnameOverride": "snapshot-controller",
397-
"volumeSnapshotClasses": volume_snapshot_classes
401+
"volumeSnapshotClasses": volume_snapshot_classes,
398402
}
399403

400404
# Override image repository if custom registry is configured
401405
if repository: # repository is the container_infra_prefix
402-
repository_clean = repository.rstrip('/')
406+
repository_clean = repository.rstrip("/")
403407
# When using a custom registry, the image is named 'csi-snapshot-controller'
404408
controller_values["image"] = {
405409
"repository": f"{repository_clean}/csi-snapshot-controller"
@@ -418,9 +422,7 @@ def get_object(self) -> dict:
418422
),
419423
"snapshot-controller-csi/",
420424
),
421-
values={
422-
"controller": controller_values
423-
},
425+
values={"controller": controller_values},
424426
)(repository=repository)
425427
},
426428
}

tools/sync-snapshot-controller-csi-crds

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ def main():
3636
# Set target directory relative to script location
3737
script_dir = os.path.dirname(os.path.realpath(__file__))
3838
base_dir = os.path.join(
39-
script_dir, "..", "magnum_cluster_api", "charts", "snapshot-controller-csi", "crds"
39+
script_dir,
40+
"..",
41+
"magnum_cluster_api",
42+
"charts",
43+
"snapshot-controller-csi",
44+
"crds",
4045
)
4146

4247
tag = SNAPSHOT_CONTROLLER_CSI_TAG

0 commit comments

Comments
 (0)