Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dfaast
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Santhosh Kumar
dfaast
Commits
4664a56d
Commit
4664a56d
authored
May 04, 2024
by
Santhosh Kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup code
parent
50e05a1a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
4 deletions
+42
-4
report/.graph_service.py.swp
report/.graph_service.py.swp
+0
-0
src/.faas.py.swp
src/.faas.py.swp
+0
-0
src/faas.py
src/faas.py
+42
-4
No files found.
report/.graph_service.py.swp
deleted
100644 → 0
View file @
50e05a1a
File deleted
src/.faas.py.swp
deleted
100644 → 0
View file @
50e05a1a
File deleted
src/faas.py
View file @
4664a56d
...
...
@@ -502,20 +502,55 @@ def describe_pods_events(deployment_name, namespace="default"):
except
Exception
as
e
:
print
(
"Error describing pods and events:"
,
e
)
def
get_hpa1
():
deployment_name
=
input
(
"Enter the deployment name to delete: "
)
namespace
=
"default"
try
:
# Get HPA
hpa
=
scale_api
.
read_namespaced_horizontal_pod_autoscaler
(
name
=
deployment_name
+
"-hpa"
,
namespace
=
namespace
)
print
(
"Name:
%
s, Min replicas:
%
d, Max replicas:
%
d"
%
(
hpa
.
metadata
.
name
,
hpa
.
spec
.
min_replicas
,
hpa
.
spec
.
max_replicas
))
for
metric
in
hpa
.
spec
.
metrics
:
if
metric
.
type
==
"Resource"
:
print
(
"Resource metric:
%
s, Target average utilization:
%
d
%%
"
%
(
metric
.
resource
.
name
,
metric
.
resource
.
target
.
average_utilization
))
# Add handling for other metric types if needed
except
Exception
as
e
:
print
(
"Exception when describing HPA:
%
s"
%
str
(
e
))
def
get_hpa
():
deployment_name
=
input
(
"Enter the deployment name to delete: "
)
namespace
=
"default"
label_selector
=
f
"involvedObject.name={deployment_name}-hpa"
try
:
# Get events related to the HPA
events
=
core_api
.
list_namespaced_event
(
namespace
=
namespace
,
label_selector
=
label_selector
)
# Print events
for
event
in
events
.
items
:
print
(
f
"Name: {event.metadata.name}"
)
print
(
f
"Message: {event.message}"
)
print
(
f
"Reason: {event.reason}"
)
print
(
f
"Last Timestamp: {event.last_timestamp}"
)
print
(
"----"
)
except
Exception
as
e
:
print
(
"Exception when listing events:
%
s"
%
str
(
e
))
def
select_misc_operation
():
print
(
"Select the miscellaneous operation:"
)
print
(
"1. Get Cluster IP"
)
print
(
"2. Show Additional Pods Information"
)
print
(
"3. Exit"
)
print
(
"3. Show HPA info "
)
print
(
"4. Exit"
)
while
True
:
try
:
choice
=
int
(
input
(
"Enter your choice (1-
3
): "
))
if
1
<=
choice
<=
3
:
choice
=
int
(
input
(
"Enter your choice (1-
4
): "
))
if
1
<=
choice
<=
4
:
return
choice
else
:
print
(
choice
)
print
(
"Invalid choice. Please enter a number between 1 and
3
."
)
print
(
"Invalid choice. Please enter a number between 1 and
4
."
)
except
ValueError
:
print
(
"Invalid input. Please enter a number."
)
...
...
@@ -536,6 +571,9 @@ def misc_info():
# Call function to deploy function
describe_pods_events
(
function_name
,
namespace
)
elif
choice
==
3
:
print
(
"HPA informatio..."
)
get_hpa
()
elif
choice
==
4
:
print
(
"Exiting..."
)
break
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment