Represent volumeClaimTemplates of StatefulSet resources as diagram nodes
@@ -254,7 +254,10 @@ class EdgesContext(list):
|
||||
if volumeClaimTemplates is None:
|
||||
return
|
||||
for volumeClaimTemplate in volumeClaimTemplates:
|
||||
self.add_storage_class("spec.storageClassName", volumeClaimTemplate)
|
||||
self.append([
|
||||
f"{volumeClaimTemplate['metadata']['name']}/{self.namespace}/PersistentVolumeClaim/v1",
|
||||
"REFERENCE"
|
||||
])
|
||||
|
||||
def add_storage_class(self, path, data=None):
|
||||
if data is None:
|
||||
@@ -547,6 +550,20 @@ for filename in args.filename:
|
||||
copy.deepcopy(config.get("clusters", []))
|
||||
)
|
||||
cluster.resources[rid] = resource
|
||||
code_to_exec = get_node_config(resource).get("nodes")
|
||||
if code_to_exec != None:
|
||||
nodes = []
|
||||
try:
|
||||
exec(code_to_exec)
|
||||
except Exception as exc:
|
||||
print("Error:", type(exc), ":", exc.args)
|
||||
traceback.print_exception(exc)
|
||||
print("Edges script:\n", code_to_exec)
|
||||
print("Resource:")
|
||||
pprint(resource)
|
||||
raise
|
||||
for node in nodes:
|
||||
process_resource(node)
|
||||
|
||||
data = yaml.safe_load_all(f) # load YAML file
|
||||
for resource in data:
|
||||
|
||||
@@ -340,6 +340,13 @@ nodes:
|
||||
StatefulSet/apps/v1:
|
||||
scoped: Namespaced
|
||||
diagram_node_classname: diagrams.k8s.compute.STS
|
||||
nodes: |
|
||||
for vct in query_path(resource, "spec.volumeClaimTemplates", []):
|
||||
nodes.append( {
|
||||
"kind": "PersistentVolumeClaim",
|
||||
"apiVersion": "v1",
|
||||
**vct
|
||||
} )
|
||||
edges: |
|
||||
edges.add_all_resources_matching_labels("Pod", "spec.selector.matchLabels")
|
||||
edges.add_service_account("spec.template.spec")
|
||||
|
||||
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 179 KiB |
|
Before Width: | Height: | Size: 300 KiB After Width: | Height: | Size: 308 KiB |
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.2 MiB |
|
Before Width: | Height: | Size: 322 KiB After Width: | Height: | Size: 290 KiB |
|
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 161 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 60 KiB |