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

Update manifests for v0.2 #74

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ patchesStrategicMerge:
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- manager_auth_proxy_patch.yaml
#- manager_auth_proxy_patch.yaml



Expand Down
28 changes: 24 additions & 4 deletions config/manager/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,18 @@ data:
prometheus-metrics-config.yaml: |
resourceRules:
cpu:
containerQuery: sum by (<<.GroupBy>>) (irate(container_cpu_usage_seconds_total{container!="",container!="POD",<<.LabelMatchers>>}[3m]))
readyPodsOnlyContainerQuery: sum by (<<.GroupBy>>) ((kube_pod_status_ready{condition="true"} == 1) * on (pod) group_left sum by (pod) (irate(container_cpu_usage_seconds_total{container!="",container!="POD",<<.LabelMatchers>>}[3m])))
containerQuery: |-
sum by (<<.GroupBy>>) (
irate(container_cpu_usage_seconds_total{container!="",container!="POD",<<.LabelMatchers>>}[3m])
)
readyPodsOnlyContainerQuery: |-
sum by (<<.GroupBy>>) (
(kube_pod_status_ready{condition="true"} == 1)
* on (namespace, pod) group_left ()
sum by (namespace, pod) (
irate(container_cpu_usage_seconds_total{container!="",container!="POD",<<.LabelMatchers>>}[3m])
)
)
resources:
overrides:
namespace:
Expand All @@ -25,8 +35,18 @@ data:
resource: pod
containerLabel: container
memory:
containerQuery: sum by (<<.GroupBy>>) (container_memory_working_set_bytes{container!="",container!="POD",<<.LabelMatchers>>})
readyPodsOnlyContainerQuery: sum by (<<.GroupBy>>) ((kube_pod_status_ready{condition="true"} == 1) * on (pod) group_left sum by (pod) (container_memory_working_set_bytes{container!="",container!="POD",<<.LabelMatchers>>}))
containerQuery: |-
sum by (<<.GroupBy>>) (
container_memory_working_set_bytes{container!="",container!="POD",<<.LabelMatchers>>}
)
readyPodsOnlyContainerQuery: |-
sum by (<<.GroupBy>>) (
(kube_pod_status_ready{condition="true"} == 1)
* on (namespace, pod) group_left ()
sum by (namespace, pod) (
container_memory_working_set_bytes{container!="",container!="POD",<<.LabelMatchers>>}
)
)
resources:
overrides:
namespace:
Expand Down
1 change: 1 addition & 0 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
resources:
- config.yaml
- manager.yaml
- service.yaml
7 changes: 7 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ spec:
- --zap-log-level=1
- --leader-elect
- --prometheus-metrics-config=/etc/kapacity/prometheus-metrics-config.yaml
- --algorithm-job-namespace=kapacity-system
- --algorithm-job-default-service-account=kapacity-algorithm-job
- --algorithm-job-default-metrics-server-addr=kapacity-grpc-service:9090
image: controller:latest
name: manager
securityContext:
Expand All @@ -65,6 +68,10 @@ spec:
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
ports:
- containerPort: 9090
name: grpc-server
protocol: TCP
volumeMounts:
- name: config
mountPath: /etc/kapacity
Expand Down
19 changes: 19 additions & 0 deletions config/manager/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/name: service
app.kubernetes.io/instance: grpc-service
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: kapacity
app.kubernetes.io/part-of: kapacity
app.kubernetes.io/managed-by: kustomize
name: grpc-service
namespace: system
spec:
ports:
- port: 9090
protocol: TCP
targetPort: 9090
selector:
control-plane: controller-manager
44 changes: 44 additions & 0 deletions config/rbac/algorithm_job_role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: algorithm-job-role
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: kapacity
app.kubernetes.io/part-of: kapacity
app.kubernetes.io/managed-by: kustomize
name: algorithm-job-role
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- get
- list
- update
- watch
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
- watch
- apiGroups:
- '*'
resources:
- '*/scale'
verbs:
- get
- apiGroups:
- autoscaling.kapacitystack.io
resources:
- horizontalportraits
verbs:
- get
- list
- watch
19 changes: 19 additions & 0 deletions config/rbac/algorithm_job_role_binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/name: clusterrolebinding
app.kubernetes.io/instance: algorithm-job-rolebinding
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: kapacity
app.kubernetes.io/part-of: kapacity
app.kubernetes.io/managed-by: kustomize
name: algorithm-job-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: algorithm-job-role
subjects:
- kind: ServiceAccount
name: algorithm-job
namespace: system
2 changes: 2 additions & 0 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ resources:
- role_binding.yaml
- leader_election_role.yaml
- leader_election_role_binding.yaml
- algorithm_job_role.yaml
- algorithm_job_role_binding.yaml
# Comment the following 4 lines if you want to disable
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
# which protects your /metrics endpoint.
Expand Down
14 changes: 14 additions & 0 deletions config/rbac/service_account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,17 @@ metadata:
app.kubernetes.io/managed-by: kustomize
name: controller-manager
namespace: system

---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/name: serviceaccount
app.kuberentes.io/instance: algorithm-job
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: kapacity
app.kubernetes.io/part-of: kapacity
app.kubernetes.io/managed-by: kustomize
name: algorithm-job
namespace: system
4 changes: 2 additions & 2 deletions pkg/metric/provider/prometheus/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var (
},
ContainerLabel: "container",
},
ReadyPodsOnlyContainerQuery: `sum by (<<.GroupBy>>) ((kube_pod_status_ready{condition="true"} == 1) * on (pod) group_left sum by (pod) (irate(container_cpu_usage_seconds_total{container!="",container!="POD",<<.LabelMatchers>>}[3m])))`,
ReadyPodsOnlyContainerQuery: `sum by (<<.GroupBy>>) ((kube_pod_status_ready{condition="true"} == 1) * on (namespace, pod) group_left () sum by (namespace, pod) (irate(container_cpu_usage_seconds_total{container!="",container!="POD",<<.LabelMatchers>>}[3m])))`,
},
Memory: ResourceRule{
ResourceRule: promadaptercfg.ResourceRule{
Expand All @@ -76,7 +76,7 @@ var (
},
ContainerLabel: "container",
},
ReadyPodsOnlyContainerQuery: `sum by (<<.GroupBy>>) ((kube_pod_status_ready{condition="true"} == 1) * on (pod) group_left sum by (pod) (container_memory_working_set_bytes{container!="",container!="POD",<<.LabelMatchers>>}))`,
ReadyPodsOnlyContainerQuery: `sum by (<<.GroupBy>>) ((kube_pod_status_ready{condition="true"} == 1) * on (namespace, pod) group_left () sum by (namespace, pod) (container_memory_working_set_bytes{container!="",container!="POD",<<.LabelMatchers>>}))`,
},
Window: prommodel.Duration(3 * time.Minute),
},
Expand Down
Loading