Skip to content

Commit

Permalink
fix old controller tests
Browse files Browse the repository at this point in the history
  • Loading branch information
randytqwjp committed Dec 4, 2024
1 parent 7d07efd commit 12c7b05
Show file tree
Hide file tree
Showing 11 changed files with 532 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
metadata:
name: mercari-app
namespace: default
spec:
selector:
matchLabels:
app: mercari
strategy: {}
template:
metadata:
annotations:
kubectl.kubernetes.io/restartedAt: "2023-01-01T00:00:00Z"
creationTimestamp: null
labels:
app: mercari
spec:
containers:
- image: awesome-mercari-app-image
name: app
resources:
requests:
cpu: "10"
memory: 10Gi
- image: awesome-istio-proxy-image
name: istio-proxy
resources:
requests:
cpu: "4"
memory: 4Gi
status: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
metadata:
annotations:
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
name: tortoise-hpa-mercari
namespace: default
spec:
behavior:
scaleDown:
policies:
- periodSeconds: 90
type: Percent
value: 2
selectPolicy: Max
scaleUp:
policies:
- periodSeconds: 60
type: Percent
value: 100
selectPolicy: Max
stabilizationWindowSeconds: 0
maxReplicas: 15
metrics:
- containerResource:
container: app
name: cpu
target:
averageUtilization: 30
type: Utilization
type: ContainerResource
- containerResource:
container: istio-proxy
name: cpu
target:
averageUtilization: 30
type: Utilization
type: ContainerResource
minReplicas: 15
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: mercari-app
status:
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "False"
type: ScalingActive
message: "the HPA was unable to compute the replica count: failed to get cpu utilization"
currentMetrics: null
desiredReplicas: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
metadata:
finalizers:
- tortoise.autoscaling.mercari.com/finalizer
name: mercari
namespace: default
spec:
targetRefs:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: mercari-app
updateMode: Emergency
status:
autoscalingPolicy:
- containerName: app
policy:
cpu: Horizontal
memory: Vertical
- containerName: istio-proxy
policy:
cpu: Horizontal
memory: Vertical
conditions:
containerRecommendationFromVPA:
- containerName: app
maxRecommendation:
cpu:
quantity: "3"
updatedAt: "2023-01-01T00:00:00Z"
memory:
quantity: 3Gi
updatedAt: "2023-01-01T00:00:00Z"
recommendation:
cpu:
quantity: "3"
updatedAt: "2023-01-01T00:00:00Z"
memory:
quantity: 3Gi
updatedAt: "2023-01-01T00:00:00Z"
- containerName: istio-proxy
maxRecommendation:
cpu:
quantity: "3"
updatedAt: "2023-01-01T00:00:00Z"
memory:
quantity: 3Gi
updatedAt: "2023-01-01T00:00:00Z"
recommendation:
cpu:
quantity: "3"
updatedAt: "2023-01-01T00:00:00Z"
memory:
quantity: 3Gi
updatedAt: "2023-01-01T00:00:00Z"
containerResourceRequests:
- containerName: app
resource:
cpu: "6"
memory: 3Gi
- containerName: istio-proxy
resource:
cpu: "4"
memory: 3Gi
tortoiseConditions:
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: The recommendation is provided
status: "True"
type: VerticalRecommendationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
type: FailedToReconcile
containerResourcePhases:
- containerName: app
resourcePhases:
cpu:
lastTransitionTime: null
phase: Working
memory:
lastTransitionTime: "2023-01-01T00:00:00Z"
phase: Working
- containerName: istio-proxy
resourcePhases:
cpu:
lastTransitionTime: null
phase: Working
memory:
lastTransitionTime: "2023-01-01T00:00:00Z"
phase: Working
recommendations:
horizontal:
maxReplicas:
- from: 0
timezone: Local
to: 24
updatedAt: "2023-10-06T01:15:47Z"
value: 15
minReplicas:
- from: 0
timezone: Local
to: 24
updatedAt: "2023-10-06T01:15:47Z"
value: 3
targetUtilizations:
- containerName: app
targetUtilization:
cpu: 30
- containerName: istio-proxy
targetUtilization:
cpu: 30
vertical:
containerResourceRecommendation:
- RecommendedResource:
cpu: "6"
memory: 3Gi
containerName: app
- RecommendedResource:
cpu: "4"
memory: 3Gi
containerName: istio-proxy
targets:
horizontalPodAutoscaler: tortoise-hpa-mercari
scaleTargetRef:
kind: ""
name: ""
verticalPodAutoscalers:
- name: tortoise-monitor-mercari
role: Monitor
tortoisePhase: Emergency
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
metadata:
annotations:
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
name: tortoise-monitor-mercari
namespace: default
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: mercari-app
updatePolicy:
updateMode: "Off"
status:
conditions:
- lastTransitionTime: null
status: "True"
type: RecommendationProvided
recommendation:
containerRecommendations:
- containerName: app
lowerBound:
cpu: "3"
memory: 3Gi
target:
cpu: "3"
memory: 3Gi
upperBound:
cpu: "5"
memory: 5Gi
- containerName: istio-proxy
lowerBound:
cpu: "3"
memory: 3Gi
target:
cpu: "3"
memory: 3Gi
upperBound:
cpu: "5"
memory: 5Gi
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
metadata:
name: mercari-app
namespace: default
spec:
selector:
matchLabels:
app: mercari
strategy: {}
template:
metadata:
annotations:
sidecar.istio.io/inject: "true"
sidecar.istio.io/proxyCPU: "4"
sidecar.istio.io/proxyMemory: "4Gi"
labels:
app: mercari
spec:
containers:
- name: istio-proxy # will be ignored.
image: auto
- image: awesome-mercari-app-image
name: app
resources:
requests:
cpu: "10"
memory: 10Gi
replicas: 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
metadata:
annotations:
tortoise.autoscaling.mercari.com/managed-by-tortoise: "true"
name: tortoise-hpa-mercari
namespace: default
status:
conditions:
- status: "True"
type: AbleToScale
message: "recommended size matches current size"
- status: "False"
type: ScalingActive
message: "the HPA was unable to compute the replica count: failed to get cpu utilization"
spec:
behavior:
scaleDown:
policies:
- periodSeconds: 90
type: Percent
value: 2
selectPolicy: Max
scaleUp:
policies:
- periodSeconds: 60
type: Percent
value: 100
selectPolicy: Max
stabilizationWindowSeconds: 0
maxReplicas: 15
metrics:
- containerResource:
container: app
name: cpu
target:
averageUtilization: 30
type: Utilization
type: ContainerResource
- containerResource:
container: istio-proxy
name: cpu
target:
averageUtilization: 30
type: Utilization
type: ContainerResource
minReplicas: 3
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: mercari-app

Loading

0 comments on commit 12c7b05

Please sign in to comment.