Skip to content

Commit

Permalink
add services plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
qmhu committed May 31, 2023
1 parent 9776243 commit 4b8fee2
Show file tree
Hide file tree
Showing 15 changed files with 70,268 additions and 63 deletions.
44 changes: 44 additions & 0 deletions examples/analytics/load-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
k8s-app: load-test1
qcloud-app: load-test1
name: load-test1
namespace: default
spec:
progressDeadlineSeconds: 600
replicas: 3
revisionHistoryLimit: 10
selector:
matchLabels:
k8s-app: load-test1
qcloud-app: load-test1
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
k8s-app: load-test1
qcloud-app: load-test1
spec:
affinity: {}
containers:
- command:
- /bin/bash
- -c
- sleep 36000
image: docker.io/gocrane/stress-ng:v0.12.09
imagePullPolicy: IfNotPresent
name: stress
resources:
limits:
cpu: "4"
memory: 4Gi
requests:
cpu: 250m
memory: 256Mi
20 changes: 19 additions & 1 deletion examples/analytics/preinstall-rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,22 @@ spec:
namespaceSelector:
any: true # 扫描所有namespace
recommenders:
- name: IdleNode
- name: IdleNode

---

apiVersion: analysis.crane.io/v1alpha1
kind: RecommendationRule
metadata:
name: services-rule
labels:
analysis.crane.io/recommendation-rule-preinstall: "true"
spec:
runInterval: 24h # 每24h运行一次
resourceSelectors: # 资源的信息
- kind: Service
apiVersion: v1
namespaceSelector:
any: true # 扫描所有namespace
recommenders:
- name: Service
8 changes: 8 additions & 0 deletions examples/analytics/recommendation-configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ recommenders:
apiVersion: apps/v1
- kind: StatefulSet
apiVersion: apps/v1
- name: Volumes
acceptedResources:
- kind: PersistentVolume
apiVersion: v1
- name: Service
acceptedResources:
- kind: Service
apiVersion: v1
16 changes: 16 additions & 0 deletions examples/analytics/test-rule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: analysis.crane.io/v1alpha1
kind: RecommendationRule
metadata:
name: test-rule
spec:
runInterval: 5m # run every 2 minutes
resourceSelectors: # how to select resource to process
- kind: Deployment
apiVersion: apps/v1
name: coredns
namespaceSelector:
any: true # scan all namespace
recommenders: # recommenders to run
- name: Resource
config:
cpu-request-percentile: "0.9"
25 changes: 25 additions & 0 deletions examples/analytics/tomcat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: tomcatinfra
spec:
replicas: 1
selector:
matchLabels:
app: tomcatinfra
template:
metadata:
name: tomcatinfra
labels:
app: tomcatinfra
spec:
containers:
- image: saravak/tomcat8
name: tomcatapp
resources:
limits:
cpu: "100m"
memory: 1Mi
requests:
cpu: "100m"
memory: 1Mi
31 changes: 31 additions & 0 deletions examples/autoscaling/effective-hpa-coder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: autoscaling.crane.io/v1alpha1
kind: EffectiveHorizontalPodAutoscaler
metadata:
name: recognizehealthcodeocr-gpu-youtu
namespace: ns-prjggssf-1565189-production
spec:
# ScaleTargetRef is the reference to the workload that should be scaled.
scaleTargetRef:
apiVersion: platform.stke/v1alpha1
kind: StatefulSetPlus
name: recognizehealthcodeocr-gpu-youtu
minReplicas: 5 # MinReplicas is the lower limit replicas to the scale target which the autoscaler can scale down to.
maxReplicas: 50 # MaxReplicas is the upper limit replicas to the scale target which the autoscaler can scale up to.
scaleStrategy: Preview # ScaleStrategy indicate the strategy to scaling target, value can be "Auto" and "Preview".
# Metrics contains the specifications for which to use to calculate the desired replica count.
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 30
# Prediction defines configurations for predict resources.
# If unspecified, defaults don't enable prediction.
prediction:
predictionWindowSeconds: 3600 # PredictionWindowSeconds is the time window to predict metrics in the future.
predictionAlgorithm:
algorithmType: dsp
dsp:
sampleInterval: "60s"
historyLength: "14d"
Loading

0 comments on commit 4b8fee2

Please sign in to comment.