Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ocp platform and networktype in scale index #427

Merged
merged 1 commit into from
May 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions snafu/scale_openshift_wrapper/trigger_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ def _run_scale(self):
logger.error(err)
exit(1)

clusterversion = dyn_client.resources.get(kind="ClusterVersion")
openshift_version = clusterversion.get().items[0].status.desired.version
network_type = dyn_client.resources.get(kind="Network", api_version="config.openshift.io/v1")
network_type = network_type.get().attributes.items[0].spec.networkType

worker_count = (
len(
nodes.get(
Expand Down Expand Up @@ -222,7 +227,7 @@ def _run_scale(self):
action = "scale_nochange"
if int(worker_count) == int(self.scale):
logger.info("Already at requested worker count")
return init_workers, worker_count, master_count, infra_count, workload_count, platform, action
return init_workers, worker_count, master_count, infra_count, workload_count, platform, action, openshift_version, network_type
elif int(worker_count) > int(self.scale):
action = "scale_down"
else:
Expand Down Expand Up @@ -312,7 +317,7 @@ def _run_scale(self):
master_count = len(nodes.get(label_selector="node-role.kubernetes.io/master").attributes.items) or 0
infra_count = len(nodes.get(label_selector="node-role.kubernetes.io/infra").attributes.items) or 0

return init_workers, worker_count, master_count, infra_count, workload_count, platform, action
return init_workers, worker_count, master_count, infra_count, workload_count, platform, action, openshift_version, network_type

def emit_actions(self):
logger.info(
Expand All @@ -329,6 +334,8 @@ def emit_actions(self):
workload_count,
platform,
action,
openshift_version,
network_type
) = self._run_scale()
end_time = time.time()
elaspsed_time = end_time - start_time
Expand All @@ -343,6 +350,8 @@ def emit_actions(self):
"action": action,
"total_count": worker_count + master_count + infra_count + workload_count,
"platform": platform,
"openshift_version": openshift_version,
"network_type": network_type
}
es_data = self._json_payload(data)
yield es_data, ""
Expand Down