mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-28 06:29:29 +01:00
Add json tags to internal fields and basic config test
This commit is contained in:
38
.github/workflows/manifests.yaml
vendored
Normal file
38
.github/workflows/manifests.yaml
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: manifests
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
k8s-version: ["v1.26.0"]
|
||||||
|
descheduler-version: ["v0.26.1"]
|
||||||
|
descheduler-api: ["v1alpha1", "v1alpha2"]
|
||||||
|
manifest: ["deployment"]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Create kind cluster
|
||||||
|
uses: helm/kind-action@v1.5.0
|
||||||
|
with:
|
||||||
|
node_image: kindest/node:${{ matrix.k8s-version }}
|
||||||
|
kubectl_version: ${{ matrix.k8s-version }}
|
||||||
|
config: test/kind-config.yaml
|
||||||
|
- name: Build image
|
||||||
|
run: |
|
||||||
|
VERSION="dev" make dev-image
|
||||||
|
docker tag descheduler:dev registry.k8s.io/descheduler/descheduler:${{ matrix.descheduler-version }}
|
||||||
|
- name: Kind load image
|
||||||
|
run: |
|
||||||
|
kind load docker-image registry.k8s.io/descheduler/descheduler:${{ matrix.descheduler-version }} --name chart-testing
|
||||||
|
- name: Create k8s manifests
|
||||||
|
run: |
|
||||||
|
kubectl create -f kubernetes/base/rbac.yaml
|
||||||
|
kubectl create -f test/manifests/${{ matrix.descheduler-api }}/configmap.yaml
|
||||||
|
kubectl create -f kubernetes/${{ matrix.manifest }}/${{ matrix.manifest }}.yaml
|
||||||
|
- name: Wait for ready condition
|
||||||
|
run: |
|
||||||
|
kubectl wait --for=condition=Available --timeout=60s ${{ matrix.manifest }} descheduler -n kube-system
|
||||||
@@ -6,23 +6,26 @@ metadata:
|
|||||||
namespace: kube-system
|
namespace: kube-system
|
||||||
data:
|
data:
|
||||||
policy.yaml: |
|
policy.yaml: |
|
||||||
apiVersion: "descheduler/v1alpha1"
|
apiVersion: "descheduler/v1alpha2"
|
||||||
kind: "DeschedulerPolicy"
|
kind: "DeschedulerPolicy"
|
||||||
strategies:
|
profiles:
|
||||||
"RemoveDuplicates":
|
- name: ProfileName
|
||||||
enabled: true
|
pluginConfig:
|
||||||
"RemovePodsViolatingInterPodAntiAffinity":
|
- name: "DefaultEvictor"
|
||||||
enabled: true
|
- name: "RemovePodsViolatingInterPodAntiAffinity"
|
||||||
"LowNodeUtilization":
|
- name: "LowNodeUtilization"
|
||||||
enabled: true
|
args:
|
||||||
params:
|
thresholds:
|
||||||
nodeResourceUtilizationThresholds:
|
"cpu" : 20
|
||||||
thresholds:
|
"memory": 20
|
||||||
"cpu" : 20
|
"pods": 20
|
||||||
"memory": 20
|
targetThresholds:
|
||||||
"pods": 20
|
"cpu" : 50
|
||||||
targetThresholds:
|
"memory": 50
|
||||||
"cpu" : 50
|
"pods": 50
|
||||||
"memory": 50
|
plugins:
|
||||||
"pods": 50
|
balance:
|
||||||
|
enabled:
|
||||||
|
- "LowNodeUtilization"
|
||||||
|
- "RemovePodsViolatingInterPodAntiAffinity"
|
||||||
|
- "RemoveDuplicates
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ type DeschedulerPolicy struct {
|
|||||||
// Namespaces carries a list of included/excluded namespaces
|
// Namespaces carries a list of included/excluded namespaces
|
||||||
// for which a given strategy is applicable
|
// for which a given strategy is applicable
|
||||||
type Namespaces struct {
|
type Namespaces struct {
|
||||||
Include []string
|
Include []string `json:"include"`
|
||||||
Exclude []string
|
Exclude []string `json:"exclude"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -53,8 +53,8 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type PriorityThreshold struct {
|
type PriorityThreshold struct {
|
||||||
Value *int32
|
Value *int32 `json:"value"`
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeschedulerProfile struct {
|
type DeschedulerProfile struct {
|
||||||
|
|||||||
6
test/kind-config.yaml
Normal file
6
test/kind-config.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
kind: Cluster
|
||||||
|
apiVersion: kind.x-k8s.io/v1alpha4
|
||||||
|
nodes:
|
||||||
|
- role: control-plane
|
||||||
|
- role: worker
|
||||||
|
- role: worker
|
||||||
27
test/manifests/v1alpha1/configmap.yaml
Normal file
27
test/manifests/v1alpha1/configmap.yaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: descheduler-policy-configmap
|
||||||
|
namespace: kube-system
|
||||||
|
data:
|
||||||
|
policy.yaml: |
|
||||||
|
apiVersion: "descheduler/v1alpha1"
|
||||||
|
kind: "DeschedulerPolicy"
|
||||||
|
strategies:
|
||||||
|
"RemoveDuplicates":
|
||||||
|
enabled: true
|
||||||
|
"RemovePodsViolatingInterPodAntiAffinity":
|
||||||
|
enabled: true
|
||||||
|
"LowNodeUtilization":
|
||||||
|
enabled: true
|
||||||
|
params:
|
||||||
|
nodeResourceUtilizationThresholds:
|
||||||
|
thresholds:
|
||||||
|
"cpu" : 20
|
||||||
|
"memory": 20
|
||||||
|
"pods": 20
|
||||||
|
targetThresholds:
|
||||||
|
"cpu" : 50
|
||||||
|
"memory": 50
|
||||||
|
"pods": 50
|
||||||
29
test/manifests/v1alpha2/configmap.yaml
Normal file
29
test/manifests/v1alpha2/configmap.yaml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: descheduler-policy-configmap
|
||||||
|
namespace: kube-system
|
||||||
|
data:
|
||||||
|
policy.yaml: |
|
||||||
|
apiVersion: "descheduler/v1alpha2"
|
||||||
|
kind: "DeschedulerPolicy"
|
||||||
|
profiles:
|
||||||
|
- name: ProfileName
|
||||||
|
pluginConfig:
|
||||||
|
- name: "DefaultEvictor"
|
||||||
|
args:
|
||||||
|
priorityThreshold:
|
||||||
|
value: 10000
|
||||||
|
- name: "PodLifeTime"
|
||||||
|
args:
|
||||||
|
maxPodLifeTimeSeconds: 86400
|
||||||
|
namespaces:
|
||||||
|
include:
|
||||||
|
- "namespace1"
|
||||||
|
- "namespace2"
|
||||||
|
plugins:
|
||||||
|
deschedule:
|
||||||
|
enabled:
|
||||||
|
- "PodLifeTime"
|
||||||
|
|
||||||
Reference in New Issue
Block a user