From 0c11c941e57532206d76714f6542ed4d0539cf48 Mon Sep 17 00:00:00 2001 From: "Muyassarov, Feruzjon" Date: Wed, 10 May 2023 14:22:30 +0300 Subject: [PATCH] helm: add helm chart for plugins installations This commit adds a helm chart to install balloons and topology-aware NRI plugins. Signed-off-by: Feruzjon Muyassarov --- .../balloons/Chart.yaml | 11 + .../balloons/crds/noderesourcetopology.yaml | 270 ++++++++++++++++++ .../balloons/templates/_helpers.tpl | 8 + .../balloons/templates/clusterrole.yaml | 24 ++ .../templates/clusterrolebinding.yaml | 14 + .../balloons/templates/configmap.yaml | 8 + .../balloons/templates/daemonset.yaml | 80 ++++++ .../balloons/templates/role.yaml | 15 + .../balloons/templates/rolebinding.yaml | 15 + .../balloons/templates/serviceaccount.yaml | 7 + .../balloons/values.yaml | 19 ++ .../topology-aware/Chart.yaml | 12 + .../crds/noderesourcetopology.yaml | 270 ++++++++++++++++++ .../topology-aware/templates/_helpers.tpl | 8 + .../topology-aware/templates/clusterrole.yaml | 24 ++ .../templates/clusterrolebinding.yaml | 14 + .../topology-aware/templates/configmap.yaml | 10 + .../topology-aware/templates/daemonset.yaml | 80 ++++++ .../topology-aware/templates/role.yaml | 15 + .../topology-aware/templates/rolebinding.yaml | 15 + .../templates/serviceaccount.yaml | 7 + .../topology-aware/values.yaml | 19 ++ 22 files changed, 945 insertions(+) create mode 100644 deployment/helm/resource-management-policies/balloons/Chart.yaml create mode 100644 deployment/helm/resource-management-policies/balloons/crds/noderesourcetopology.yaml create mode 100644 deployment/helm/resource-management-policies/balloons/templates/_helpers.tpl create mode 100644 deployment/helm/resource-management-policies/balloons/templates/clusterrole.yaml create mode 100644 deployment/helm/resource-management-policies/balloons/templates/clusterrolebinding.yaml create mode 100644 deployment/helm/resource-management-policies/balloons/templates/configmap.yaml create mode 100644 deployment/helm/resource-management-policies/balloons/templates/daemonset.yaml create mode 100644 deployment/helm/resource-management-policies/balloons/templates/role.yaml create mode 100644 deployment/helm/resource-management-policies/balloons/templates/rolebinding.yaml create mode 100644 deployment/helm/resource-management-policies/balloons/templates/serviceaccount.yaml create mode 100644 deployment/helm/resource-management-policies/balloons/values.yaml create mode 100644 deployment/helm/resource-management-policies/topology-aware/Chart.yaml create mode 100644 deployment/helm/resource-management-policies/topology-aware/crds/noderesourcetopology.yaml create mode 100644 deployment/helm/resource-management-policies/topology-aware/templates/_helpers.tpl create mode 100644 deployment/helm/resource-management-policies/topology-aware/templates/clusterrole.yaml create mode 100644 deployment/helm/resource-management-policies/topology-aware/templates/clusterrolebinding.yaml create mode 100644 deployment/helm/resource-management-policies/topology-aware/templates/configmap.yaml create mode 100644 deployment/helm/resource-management-policies/topology-aware/templates/daemonset.yaml create mode 100644 deployment/helm/resource-management-policies/topology-aware/templates/role.yaml create mode 100644 deployment/helm/resource-management-policies/topology-aware/templates/rolebinding.yaml create mode 100644 deployment/helm/resource-management-policies/topology-aware/templates/serviceaccount.yaml create mode 100644 deployment/helm/resource-management-policies/topology-aware/values.yaml diff --git a/deployment/helm/resource-management-policies/balloons/Chart.yaml b/deployment/helm/resource-management-policies/balloons/Chart.yaml new file mode 100644 index 000000000..c809fa673 --- /dev/null +++ b/deployment/helm/resource-management-policies/balloons/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v2 +appVersion: main +description: | + The balloons NRI resource policy plugin implements workload placement into + “balloons” that are disjoint CPU pools. +name: nri-resource-policy-balloons +sources: + - https://github.com/containers/nri-plugins +home: https://github.com/containers/nri-plugins +type: application +version: 0.0.0 diff --git a/deployment/helm/resource-management-policies/balloons/crds/noderesourcetopology.yaml b/deployment/helm/resource-management-policies/balloons/crds/noderesourcetopology.yaml new file mode 100644 index 000000000..3719f2c2d --- /dev/null +++ b/deployment/helm/resource-management-policies/balloons/crds/noderesourcetopology.yaml @@ -0,0 +1,270 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + api-approved.kubernetes.io: https://github.com/kubernetes/enhancements/pull/1870 + controller-gen.kubebuilder.io/version: v0.11.2 + creationTimestamp: null + name: noderesourcetopologies.topology.node.k8s.io +spec: + group: topology.node.k8s.io + names: + kind: NodeResourceTopology + listKind: NodeResourceTopologyList + plural: noderesourcetopologies + shortNames: + - node-res-topo + singular: noderesourcetopology + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: NodeResourceTopology describes node resources and their topology. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + topologyPolicies: + items: + type: string + type: array + zones: + description: ZoneList contains an array of Zone objects. + items: + description: Zone represents a resource topology zone, e.g. socket, + node, die or core. + properties: + attributes: + description: AttributeList contains an array of AttributeInfo objects. + items: + description: AttributeInfo contains one attribute of a Zone. + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + costs: + description: CostList contains an array of CostInfo objects. + items: + description: CostInfo describes the cost (or distance) between + two Zones. + properties: + name: + type: string + value: + format: int64 + type: integer + required: + - name + - value + type: object + type: array + name: + type: string + parent: + type: string + resources: + description: ResourceInfoList contains an array of ResourceInfo + objects. + items: + description: ResourceInfo contains information about one resource + type. + properties: + allocatable: + anyOf: + - type: integer + - type: string + description: Allocatable quantity of the resource, corresponding + to allocatable in node status, i.e. total amount of this + resource available to be used by pods. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + available: + anyOf: + - type: integer + - type: string + description: Available is the amount of this resource currently + available for new (to be scheduled) pods, i.e. Allocatable + minus the resources reserved by currently running pods. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + capacity: + anyOf: + - type: integer + - type: string + description: Capacity of the resource, corresponding to capacity + in node status, i.e. total amount of this resource that + the node has. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + name: + description: Name of the resource. + type: string + required: + - allocatable + - available + - capacity + - name + type: object + type: array + type: + type: string + required: + - name + - type + type: object + type: array + required: + - topologyPolicies + - zones + type: object + served: true + storage: false + - name: v1alpha2 + schema: + openAPIV3Schema: + description: NodeResourceTopology describes node resources and their topology. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + attributes: + description: AttributeList contains an array of AttributeInfo objects. + items: + description: AttributeInfo contains one attribute of a Zone. + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + topologyPolicies: + description: 'DEPRECATED (to be removed in v1beta1): use top level attributes + if needed' + items: + type: string + type: array + zones: + description: ZoneList contains an array of Zone objects. + items: + description: Zone represents a resource topology zone, e.g. socket, + node, die or core. + properties: + attributes: + description: AttributeList contains an array of AttributeInfo objects. + items: + description: AttributeInfo contains one attribute of a Zone. + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + costs: + description: CostList contains an array of CostInfo objects. + items: + description: CostInfo describes the cost (or distance) between + two Zones. + properties: + name: + type: string + value: + format: int64 + type: integer + required: + - name + - value + type: object + type: array + name: + type: string + parent: + type: string + resources: + description: ResourceInfoList contains an array of ResourceInfo + objects. + items: + description: ResourceInfo contains information about one resource + type. + properties: + allocatable: + anyOf: + - type: integer + - type: string + description: Allocatable quantity of the resource, corresponding + to allocatable in node status, i.e. total amount of this + resource available to be used by pods. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + available: + anyOf: + - type: integer + - type: string + description: Available is the amount of this resource currently + available for new (to be scheduled) pods, i.e. Allocatable + minus the resources reserved by currently running pods. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + capacity: + anyOf: + - type: integer + - type: string + description: Capacity of the resource, corresponding to capacity + in node status, i.e. total amount of this resource that + the node has. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + name: + description: Name of the resource. + type: string + required: + - allocatable + - available + - capacity + - name + type: object + type: array + type: + type: string + required: + - name + - type + type: object + type: array + required: + - zones + type: object + served: true + storage: true diff --git a/deployment/helm/resource-management-policies/balloons/templates/_helpers.tpl b/deployment/helm/resource-management-policies/balloons/templates/_helpers.tpl new file mode 100644 index 000000000..35112e696 --- /dev/null +++ b/deployment/helm/resource-management-policies/balloons/templates/_helpers.tpl @@ -0,0 +1,8 @@ +{{/* +Common labels +*/}} +{{- define "balloons-plugin.labels" -}} +app: nri-resource-policy-balloons +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} diff --git a/deployment/helm/resource-management-policies/balloons/templates/clusterrole.yaml b/deployment/helm/resource-management-policies/balloons/templates/clusterrole.yaml new file mode 100644 index 000000000..a657cf620 --- /dev/null +++ b/deployment/helm/resource-management-policies/balloons/templates/clusterrole.yaml @@ -0,0 +1,24 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: nri-resource-policy-balloons + labels: + {{- include "balloons-plugin.labels" . | nindent 4 }} +rules: +- apiGroups: + - "" + resources: + - nodes + verbs: + - get + - watch +- apiGroups: + - topology.node.k8s.io + resources: + - noderesourcetopologies + verbs: + - create + - get + - list + - update + - delete diff --git a/deployment/helm/resource-management-policies/balloons/templates/clusterrolebinding.yaml b/deployment/helm/resource-management-policies/balloons/templates/clusterrolebinding.yaml new file mode 100644 index 000000000..58f8c2929 --- /dev/null +++ b/deployment/helm/resource-management-policies/balloons/templates/clusterrolebinding.yaml @@ -0,0 +1,14 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: nri-resource-policy-balloons + labels: + {{- include "balloons-plugin.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: nri-resource-policy-balloons +subjects: +- kind: ServiceAccount + name: nri-resource-policy-balloons + namespace: {{ .Release.Namespace }} diff --git a/deployment/helm/resource-management-policies/balloons/templates/configmap.yaml b/deployment/helm/resource-management-policies/balloons/templates/configmap.yaml new file mode 100644 index 000000000..335e5c2e5 --- /dev/null +++ b/deployment/helm/resource-management-policies/balloons/templates/configmap.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nri-resource-policy-balloons-config + namespace: {{ .Release.Namespace }} +data: + policy: |+ + {{- toYaml .Values.config | nindent 4 }} diff --git a/deployment/helm/resource-management-policies/balloons/templates/daemonset.yaml b/deployment/helm/resource-management-policies/balloons/templates/daemonset.yaml new file mode 100644 index 000000000..e0783d341 --- /dev/null +++ b/deployment/helm/resource-management-policies/balloons/templates/daemonset.yaml @@ -0,0 +1,80 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + labels: + {{- include "balloons-plugin.labels" . | nindent 4 }} + name: nri-resource-policy-balloons + namespace: {{ .Release.Namespace }} +spec: + selector: + matchLabels: + {{- include "balloons-plugin.labels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "balloons-plugin.labels" . | nindent 8 }} + spec: + serviceAccount: nri-resource-policy-balloons + nodeSelector: + kubernetes.io/os: "linux" + containers: + - name: nri-resource-policy-balloons + args: + - --host-root + - /host + - --fallback-config + - /etc/nri-resource-policy/nri-resource-policy.cfg + - --pid-file + - /tmp/nri-resource-policy.pid + - -metrics-interval + - 5s + ports: + - containerPort: 8891 + protocol: TCP + hostPort: {{ .Values.hostPort }} + name: metrics + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + image: {{ .Values.image.name }}:{{ .Values.image.tag | default .Chart.AppVersion }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + resources: + requests: + cpu: {{ .Values.resources.cpu }} + memory: {{ .Values.resources.memory }} + volumeMounts: + - name: resource-policydata + mountPath: /var/lib/nri-resource-policy + - name: hostsysfs + mountPath: /host/sys + - name: resource-policysockets + mountPath: /var/run/nri-resource-policy + - name: resource-policyconfig + mountPath: /etc/nri-resource-policy + - name: nrisockets + mountPath: /var/run/nri + volumes: + - name: resource-policydata + hostPath: + path: /var/lib/nri-resource-policy + type: DirectoryOrCreate + - name: hostsysfs + hostPath: + path: /sys + type: Directory + - name: resource-policysockets + hostPath: + path: /var/run/nri-resource-policy + - name: resource-policyconfig + configMap: + name: nri-resource-policy-balloons-config + - name: nrisockets + hostPath: + path: /var/run/nri + type: Directory diff --git a/deployment/helm/resource-management-policies/balloons/templates/role.yaml b/deployment/helm/resource-management-policies/balloons/templates/role.yaml new file mode 100644 index 000000000..1e754af16 --- /dev/null +++ b/deployment/helm/resource-management-policies/balloons/templates/role.yaml @@ -0,0 +1,15 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: nri-resource-policy-balloons + namespace: {{ .Release.Namespace }} + labels: + {{- include "balloons-plugin.labels" . | nindent 4 }} +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - watch diff --git a/deployment/helm/resource-management-policies/balloons/templates/rolebinding.yaml b/deployment/helm/resource-management-policies/balloons/templates/rolebinding.yaml new file mode 100644 index 000000000..a6322f950 --- /dev/null +++ b/deployment/helm/resource-management-policies/balloons/templates/rolebinding.yaml @@ -0,0 +1,15 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: nri-resource-policy-balloons + namespace: {{ .Release.Namespace }} + labels: + {{- include "balloons-plugin.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: nri-resource-policy-balloons +subjects: +- kind: ServiceAccount + name: nri-resource-policy-balloons + namespace: {{ .Release.Namespace }} diff --git a/deployment/helm/resource-management-policies/balloons/templates/serviceaccount.yaml b/deployment/helm/resource-management-policies/balloons/templates/serviceaccount.yaml new file mode 100644 index 000000000..3b1791054 --- /dev/null +++ b/deployment/helm/resource-management-policies/balloons/templates/serviceaccount.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: nri-resource-policy-balloons + namespace: {{ .Release.Namespace }} + labels: + {{- include "balloons-plugin.labels" . | nindent 4 }} diff --git a/deployment/helm/resource-management-policies/balloons/values.yaml b/deployment/helm/resource-management-policies/balloons/values.yaml new file mode 100644 index 000000000..8c2f3a1ca --- /dev/null +++ b/deployment/helm/resource-management-policies/balloons/values.yaml @@ -0,0 +1,19 @@ +# Default values for nri-plugins. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +--- +image: + name: ghcr.io/containers/nri-plugins/nri-resource-policy-balloons + # tag, if defined will use the given image tag, otherwise Chart.AppVersion will be used + tag: unstable + pullPolicy: Always + +config: + ReservedResources: + cpu: 750m + +hostPort: 8891 + +resources: + cpu: 500m + memory: 512Mi diff --git a/deployment/helm/resource-management-policies/topology-aware/Chart.yaml b/deployment/helm/resource-management-policies/topology-aware/Chart.yaml new file mode 100644 index 000000000..6168e2aa7 --- /dev/null +++ b/deployment/helm/resource-management-policies/topology-aware/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +appVersion: main +description: | + Topology-aware NRI resource policy plugin is a NRI plugin that will + apply hardware-aware resource allocation policies to the containers + running in the system. +name: nri-resource-policy +sources: + - https://github.com/containers/nri-plugins +home: https://github.com/containers/nri-plugins +type: application +version: 0.0.0 diff --git a/deployment/helm/resource-management-policies/topology-aware/crds/noderesourcetopology.yaml b/deployment/helm/resource-management-policies/topology-aware/crds/noderesourcetopology.yaml new file mode 100644 index 000000000..3719f2c2d --- /dev/null +++ b/deployment/helm/resource-management-policies/topology-aware/crds/noderesourcetopology.yaml @@ -0,0 +1,270 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + api-approved.kubernetes.io: https://github.com/kubernetes/enhancements/pull/1870 + controller-gen.kubebuilder.io/version: v0.11.2 + creationTimestamp: null + name: noderesourcetopologies.topology.node.k8s.io +spec: + group: topology.node.k8s.io + names: + kind: NodeResourceTopology + listKind: NodeResourceTopologyList + plural: noderesourcetopologies + shortNames: + - node-res-topo + singular: noderesourcetopology + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: NodeResourceTopology describes node resources and their topology. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + topologyPolicies: + items: + type: string + type: array + zones: + description: ZoneList contains an array of Zone objects. + items: + description: Zone represents a resource topology zone, e.g. socket, + node, die or core. + properties: + attributes: + description: AttributeList contains an array of AttributeInfo objects. + items: + description: AttributeInfo contains one attribute of a Zone. + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + costs: + description: CostList contains an array of CostInfo objects. + items: + description: CostInfo describes the cost (or distance) between + two Zones. + properties: + name: + type: string + value: + format: int64 + type: integer + required: + - name + - value + type: object + type: array + name: + type: string + parent: + type: string + resources: + description: ResourceInfoList contains an array of ResourceInfo + objects. + items: + description: ResourceInfo contains information about one resource + type. + properties: + allocatable: + anyOf: + - type: integer + - type: string + description: Allocatable quantity of the resource, corresponding + to allocatable in node status, i.e. total amount of this + resource available to be used by pods. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + available: + anyOf: + - type: integer + - type: string + description: Available is the amount of this resource currently + available for new (to be scheduled) pods, i.e. Allocatable + minus the resources reserved by currently running pods. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + capacity: + anyOf: + - type: integer + - type: string + description: Capacity of the resource, corresponding to capacity + in node status, i.e. total amount of this resource that + the node has. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + name: + description: Name of the resource. + type: string + required: + - allocatable + - available + - capacity + - name + type: object + type: array + type: + type: string + required: + - name + - type + type: object + type: array + required: + - topologyPolicies + - zones + type: object + served: true + storage: false + - name: v1alpha2 + schema: + openAPIV3Schema: + description: NodeResourceTopology describes node resources and their topology. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + attributes: + description: AttributeList contains an array of AttributeInfo objects. + items: + description: AttributeInfo contains one attribute of a Zone. + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + topologyPolicies: + description: 'DEPRECATED (to be removed in v1beta1): use top level attributes + if needed' + items: + type: string + type: array + zones: + description: ZoneList contains an array of Zone objects. + items: + description: Zone represents a resource topology zone, e.g. socket, + node, die or core. + properties: + attributes: + description: AttributeList contains an array of AttributeInfo objects. + items: + description: AttributeInfo contains one attribute of a Zone. + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + costs: + description: CostList contains an array of CostInfo objects. + items: + description: CostInfo describes the cost (or distance) between + two Zones. + properties: + name: + type: string + value: + format: int64 + type: integer + required: + - name + - value + type: object + type: array + name: + type: string + parent: + type: string + resources: + description: ResourceInfoList contains an array of ResourceInfo + objects. + items: + description: ResourceInfo contains information about one resource + type. + properties: + allocatable: + anyOf: + - type: integer + - type: string + description: Allocatable quantity of the resource, corresponding + to allocatable in node status, i.e. total amount of this + resource available to be used by pods. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + available: + anyOf: + - type: integer + - type: string + description: Available is the amount of this resource currently + available for new (to be scheduled) pods, i.e. Allocatable + minus the resources reserved by currently running pods. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + capacity: + anyOf: + - type: integer + - type: string + description: Capacity of the resource, corresponding to capacity + in node status, i.e. total amount of this resource that + the node has. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + name: + description: Name of the resource. + type: string + required: + - allocatable + - available + - capacity + - name + type: object + type: array + type: + type: string + required: + - name + - type + type: object + type: array + required: + - zones + type: object + served: true + storage: true diff --git a/deployment/helm/resource-management-policies/topology-aware/templates/_helpers.tpl b/deployment/helm/resource-management-policies/topology-aware/templates/_helpers.tpl new file mode 100644 index 000000000..f2d584abd --- /dev/null +++ b/deployment/helm/resource-management-policies/topology-aware/templates/_helpers.tpl @@ -0,0 +1,8 @@ +{{/* +Common labels +*/}} +{{- define "topology-aware-plugin.labels" -}} +app: nri-resource-policy-topology-aware +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} diff --git a/deployment/helm/resource-management-policies/topology-aware/templates/clusterrole.yaml b/deployment/helm/resource-management-policies/topology-aware/templates/clusterrole.yaml new file mode 100644 index 000000000..9dbf8c13d --- /dev/null +++ b/deployment/helm/resource-management-policies/topology-aware/templates/clusterrole.yaml @@ -0,0 +1,24 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: nri-resource-policy-topology-aware + labels: + {{- include "topology-aware-plugin.labels" . | nindent 4 }} +rules: +- apiGroups: + - "" + resources: + - nodes + verbs: + - get + - watch +- apiGroups: + - topology.node.k8s.io + resources: + - noderesourcetopologies + verbs: + - create + - get + - list + - update + - delete diff --git a/deployment/helm/resource-management-policies/topology-aware/templates/clusterrolebinding.yaml b/deployment/helm/resource-management-policies/topology-aware/templates/clusterrolebinding.yaml new file mode 100644 index 000000000..8afa1fb57 --- /dev/null +++ b/deployment/helm/resource-management-policies/topology-aware/templates/clusterrolebinding.yaml @@ -0,0 +1,14 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: nri-resource-policy-topology-aware + labels: + {{- include "topology-aware-plugin.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: nri-resource-policy-topology-aware +subjects: +- kind: ServiceAccount + name: nri-resource-policy-topology-aware + namespace: {{ .Release.Namespace }} diff --git a/deployment/helm/resource-management-policies/topology-aware/templates/configmap.yaml b/deployment/helm/resource-management-policies/topology-aware/templates/configmap.yaml new file mode 100644 index 000000000..c1760ed38 --- /dev/null +++ b/deployment/helm/resource-management-policies/topology-aware/templates/configmap.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nri-resource-policy-topology-aware-config + namespace: {{ .Release.Namespace }} + labels: + {{- include "topology-aware-plugin.labels" . | nindent 4 }} +data: + policy: |+ + {{- toYaml .Values.config | nindent 4 }} diff --git a/deployment/helm/resource-management-policies/topology-aware/templates/daemonset.yaml b/deployment/helm/resource-management-policies/topology-aware/templates/daemonset.yaml new file mode 100644 index 000000000..61cbd3fb9 --- /dev/null +++ b/deployment/helm/resource-management-policies/topology-aware/templates/daemonset.yaml @@ -0,0 +1,80 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + labels: + {{- include "topology-aware-plugin.labels" . | nindent 4 }} + name: nri-resource-policy-topology-aware + namespace: {{ .Release.Namespace }} +spec: + selector: + matchLabels: + {{- include "topology-aware-plugin.labels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "topology-aware-plugin.labels" . | nindent 8 }} + spec: + serviceAccount: nri-resource-policy-topology-aware + nodeSelector: + kubernetes.io/os: "linux" + containers: + - name: nri-resource-policy-topology-aware + args: + - --host-root + - /host + - --fallback-config + - /etc/nri-resource-policy/nri-resource-policy.cfg + - --pid-file + - /tmp/nri-resource-policy.pid + - -metrics-interval + - 5s + ports: + - containerPort: 8891 + protocol: TCP + hostPort: {{ .Values.hostPort }} + name: metrics + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + image: {{ .Values.image.name }}:{{ .Values.image.tag | default .Chart.AppVersion }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + resources: + requests: + cpu: {{ .Values.resources.cpu }} + memory: {{ .Values.resources.memory }} + volumeMounts: + - name: resource-policydata + mountPath: /var/lib/nri-resource-policy + - name: hostsysfs + mountPath: /host/sys + - name: resource-policysockets + mountPath: /var/run/nri-resource-policy + - name: resource-policyconfig + mountPath: /etc/nri-resource-policy + - name: nrisockets + mountPath: /var/run/nri + volumes: + - name: resource-policydata + hostPath: + path: /var/lib/nri-resource-policy + type: DirectoryOrCreate + - name: hostsysfs + hostPath: + path: /sys + type: Directory + - name: resource-policysockets + hostPath: + path: /var/run/nri-resource-policy + - name: resource-policyconfig + configMap: + name: nri-resource-policy-topology-aware-config + - name: nrisockets + hostPath: + path: /var/run/nri + type: Directory diff --git a/deployment/helm/resource-management-policies/topology-aware/templates/role.yaml b/deployment/helm/resource-management-policies/topology-aware/templates/role.yaml new file mode 100644 index 000000000..5fe82e3b6 --- /dev/null +++ b/deployment/helm/resource-management-policies/topology-aware/templates/role.yaml @@ -0,0 +1,15 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: nri-resource-policy-topology-aware + namespace: {{ .Release.Namespace }} + labels: + {{- include "topology-aware-plugin.labels" . | nindent 4 }} +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - watch diff --git a/deployment/helm/resource-management-policies/topology-aware/templates/rolebinding.yaml b/deployment/helm/resource-management-policies/topology-aware/templates/rolebinding.yaml new file mode 100644 index 000000000..6356600fa --- /dev/null +++ b/deployment/helm/resource-management-policies/topology-aware/templates/rolebinding.yaml @@ -0,0 +1,15 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: nri-resource-policy-topology-aware + namespace: {{ .Release.Namespace }} + labels: + {{- include "topology-aware-plugin.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: nri-resource-policy-topology-aware +subjects: +- kind: ServiceAccount + name: nri-resource-policy-topology-aware + namespace: {{ .Release.Namespace }} diff --git a/deployment/helm/resource-management-policies/topology-aware/templates/serviceaccount.yaml b/deployment/helm/resource-management-policies/topology-aware/templates/serviceaccount.yaml new file mode 100644 index 000000000..51449bec1 --- /dev/null +++ b/deployment/helm/resource-management-policies/topology-aware/templates/serviceaccount.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: nri-resource-policy-topology-aware + namespace: {{ .Release.Namespace }} + labels: + {{- include "topology-aware-plugin.labels" . | nindent 4 }} \ No newline at end of file diff --git a/deployment/helm/resource-management-policies/topology-aware/values.yaml b/deployment/helm/resource-management-policies/topology-aware/values.yaml new file mode 100644 index 000000000..06bf4ec73 --- /dev/null +++ b/deployment/helm/resource-management-policies/topology-aware/values.yaml @@ -0,0 +1,19 @@ +# Default values for nri-plugins. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +--- +image: + name: ghcr.io/containers/nri-plugins/nri-resource-policy-topology-aware + # tag, if defined will use the given image tag, otherwise Chart.AppVersion will be used + tag: unstable + pullPolicy: Always + +config: + ReservedResources: + cpu: 750m + +hostPort: 8891 + +resources: + cpu: 500m + memory: 512Mi