diff --git a/go.mod b/go.mod index 8b90edf20..d2c2affec 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( k8s.io/kube-aggregator v0.31.4 k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 open-cluster-management.io/addon-framework v0.11.1-0.20241129080247-57b1d2859f50 - open-cluster-management.io/api v0.15.1-0.20241210025410-0ba6809d0ae2 + open-cluster-management.io/api v0.15.1-0.20250109024121-1a5e25a78a43 open-cluster-management.io/sdk-go v0.15.1-0.20241125015855-1536c3970f8f sigs.k8s.io/cluster-inventory-api v0.0.0-20240730014211-ef0154379848 sigs.k8s.io/controller-runtime v0.19.3 diff --git a/go.sum b/go.sum index c72858eca..104bd4eba 100644 --- a/go.sum +++ b/go.sum @@ -453,8 +453,8 @@ k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 h1:MDF6h2H/h4tbzmtIKTuctcwZmY0tY k8s.io/utils v0.0.0-20240921022957-49e7df575cb6/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= open-cluster-management.io/addon-framework v0.11.1-0.20241129080247-57b1d2859f50 h1:TXRd6OdGjArh6cwlCYOqlIcyx21k81oUIYj4rmHlYx0= open-cluster-management.io/addon-framework v0.11.1-0.20241129080247-57b1d2859f50/go.mod h1:tsBSNs9mGfVQQjXBnjgpiX6r0UM+G3iNfmzQgKhEfw4= -open-cluster-management.io/api v0.15.1-0.20241210025410-0ba6809d0ae2 h1:zkp3VJnvexYk5fMf9/yFt6P0fQmp1WFd6Q/Y2t2jF5Q= -open-cluster-management.io/api v0.15.1-0.20241210025410-0ba6809d0ae2/go.mod h1:9erZEWEn4bEqh0nIX2wA7f/s3KCuFycQdBrPrRzi0QM= +open-cluster-management.io/api v0.15.1-0.20250109024121-1a5e25a78a43 h1:9kgKRQQHMGNM1t+J+OrmF7hgZmND9kRwyRVnHIULzqw= +open-cluster-management.io/api v0.15.1-0.20250109024121-1a5e25a78a43/go.mod h1:9erZEWEn4bEqh0nIX2wA7f/s3KCuFycQdBrPrRzi0QM= open-cluster-management.io/sdk-go v0.15.1-0.20241125015855-1536c3970f8f h1:zeC7QrFNarfK2zY6jGtd+mX+yDrQQmnH/J8A7n5Nh38= open-cluster-management.io/sdk-go v0.15.1-0.20241125015855-1536c3970f8f/go.mod h1:fi5WBsbC5K3txKb8eRLuP0Sim/Oqz/PHX18skAEyjiA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 h1:2770sDpzrjjsAtVhSeUFseziht227YAWYHLGNM8QPwY= diff --git a/manifests/cluster-manager/hub/0000_02_addon.open-cluster-management.io_addondeploymentconfigs.crd.yaml b/manifests/cluster-manager/hub/0000_02_addon.open-cluster-management.io_addondeploymentconfigs.crd.yaml index f2c023bd4..4dc853ad0 100644 --- a/manifests/cluster-manager/hub/0000_02_addon.open-cluster-management.io_addondeploymentconfigs.crd.yaml +++ b/manifests/cluster-manager/hub/0000_02_addon.open-cluster-management.io_addondeploymentconfigs.crd.yaml @@ -179,6 +179,89 @@ spec: - mirror type: object type: array + resourceRequirements: + description: |- + ResourceRequirements specify the resources required by add-on agents. + If a container matches multiple ContainerResourceRequirements, the last matched configuration in the + array will take precedence. + items: + description: ContainerResourceRequirements defines resources required + by one or a group of containers. + properties: + containerID: + description: |- + ContainerID is a unique identifier for an agent container. It consists of three parts: resource types, + resource name, and container name, separated by ':'. The format follows + '{resource_types}:{resource_name}:{container_name}' where + 1). Supported resource types include deployments, daemonsets, statefulsets, replicasets, jobs, + cronjobs and pods; + 2). Wildcards (*) can be used in any part to match multiple containers. For example, '*:*:*' + matches all containers of the agent. + pattern: ^(deployments|daemonsets|statefulsets|replicasets|jobs|cronjobs|pods|\*):.+:.+$ + type: string + resources: + description: Compute resources required by matched containers. + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + required: + - containerID + - resources + type: object + type: array + x-kubernetes-list-map-keys: + - containerID + x-kubernetes-list-type: map type: object type: object served: true diff --git a/vendor/modules.txt b/vendor/modules.txt index 510923cc7..bff73e5ae 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1584,7 +1584,7 @@ open-cluster-management.io/addon-framework/pkg/agent open-cluster-management.io/addon-framework/pkg/assets open-cluster-management.io/addon-framework/pkg/index open-cluster-management.io/addon-framework/pkg/utils -# open-cluster-management.io/api v0.15.1-0.20241210025410-0ba6809d0ae2 +# open-cluster-management.io/api v0.15.1-0.20250109024121-1a5e25a78a43 ## explicit; go 1.22.0 open-cluster-management.io/api/addon/v1alpha1 open-cluster-management.io/api/client/addon/clientset/versioned diff --git a/vendor/open-cluster-management.io/api/addon/v1alpha1/0000_02_addon.open-cluster-management.io_addondeploymentconfigs.crd.yaml b/vendor/open-cluster-management.io/api/addon/v1alpha1/0000_02_addon.open-cluster-management.io_addondeploymentconfigs.crd.yaml index f2c023bd4..4dc853ad0 100644 --- a/vendor/open-cluster-management.io/api/addon/v1alpha1/0000_02_addon.open-cluster-management.io_addondeploymentconfigs.crd.yaml +++ b/vendor/open-cluster-management.io/api/addon/v1alpha1/0000_02_addon.open-cluster-management.io_addondeploymentconfigs.crd.yaml @@ -179,6 +179,89 @@ spec: - mirror type: object type: array + resourceRequirements: + description: |- + ResourceRequirements specify the resources required by add-on agents. + If a container matches multiple ContainerResourceRequirements, the last matched configuration in the + array will take precedence. + items: + description: ContainerResourceRequirements defines resources required + by one or a group of containers. + properties: + containerID: + description: |- + ContainerID is a unique identifier for an agent container. It consists of three parts: resource types, + resource name, and container name, separated by ':'. The format follows + '{resource_types}:{resource_name}:{container_name}' where + 1). Supported resource types include deployments, daemonsets, statefulsets, replicasets, jobs, + cronjobs and pods; + 2). Wildcards (*) can be used in any part to match multiple containers. For example, '*:*:*' + matches all containers of the agent. + pattern: ^(deployments|daemonsets|statefulsets|replicasets|jobs|cronjobs|pods|\*):.+:.+$ + type: string + resources: + description: Compute resources required by matched containers. + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. Requests cannot exceed Limits. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + required: + - containerID + - resources + type: object + type: array + x-kubernetes-list-map-keys: + - containerID + x-kubernetes-list-type: map type: object type: object served: true diff --git a/vendor/open-cluster-management.io/api/addon/v1alpha1/types_addondeploymentconfig.go b/vendor/open-cluster-management.io/api/addon/v1alpha1/types_addondeploymentconfig.go index 69cd70595..ea91310b8 100644 --- a/vendor/open-cluster-management.io/api/addon/v1alpha1/types_addondeploymentconfig.go +++ b/vendor/open-cluster-management.io/api/addon/v1alpha1/types_addondeploymentconfig.go @@ -58,6 +58,34 @@ type AddOnDeploymentConfigSpec struct { // +kubebuilder:validation:MaxLength=63 // +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ AgentInstallNamespace string `json:"agentInstallNamespace,omitempty"` + + // ResourceRequirements specify the resources required by add-on agents. + // If a container matches multiple ContainerResourceRequirements, the last matched configuration in the + // array will take precedence. + // +optional + // +listType=map + // +listMapKey=containerID + ResourceRequirements []ContainerResourceRequirements `json:"resourceRequirements,omitempty"` +} + +// ContainerResourceRequirements defines resources required by one or a group of containers. +type ContainerResourceRequirements struct { + // ContainerID is a unique identifier for an agent container. It consists of three parts: resource types, + // resource name, and container name, separated by ':'. The format follows + // '{resource_types}:{resource_name}:{container_name}' where + // 1). Supported resource types include deployments, daemonsets, statefulsets, replicasets, jobs, + // cronjobs and pods; + // 2). Wildcards (*) can be used in any part to match multiple containers. For example, '*:*:*' + // matches all containers of the agent. + // +required + // +kubebuilder:validation:Required + // +kubebuilder:validation:Pattern=`^(deployments|daemonsets|statefulsets|replicasets|jobs|cronjobs|pods|\*):.+:.+$` + ContainerID string `json:"containerID"` + + // Compute resources required by matched containers. + // +required + // +kubebuilder:validation:Required + Resources corev1.ResourceRequirements `json:"resources"` } // CustomizedVariable represents a customized variable for add-on deployment. diff --git a/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.deepcopy.go b/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.deepcopy.go index c0f0917e5..9530a30c9 100644 --- a/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.deepcopy.go @@ -108,6 +108,13 @@ func (in *AddOnDeploymentConfigSpec) DeepCopyInto(out *AddOnDeploymentConfigSpec copy(*out, *in) } in.ProxyConfig.DeepCopyInto(&out.ProxyConfig) + if in.ResourceRequirements != nil { + in, out := &in.ResourceRequirements, &out.ResourceRequirements + *out = make([]ContainerResourceRequirements, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -453,6 +460,23 @@ func (in *ConfigSpecHash) DeepCopy() *ConfigSpecHash { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerResourceRequirements) DeepCopyInto(out *ContainerResourceRequirements) { + *out = *in + in.Resources.DeepCopyInto(&out.Resources) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerResourceRequirements. +func (in *ContainerResourceRequirements) DeepCopy() *ContainerResourceRequirements { + if in == nil { + return nil + } + out := new(ContainerResourceRequirements) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CurrentClusterBindingConfig) DeepCopyInto(out *CurrentClusterBindingConfig) { *out = *in diff --git a/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.swagger_doc_generated.go b/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.swagger_doc_generated.go index c5a3dd7c7..14b0e2c06 100644 --- a/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.swagger_doc_generated.go @@ -36,12 +36,23 @@ var map_AddOnDeploymentConfigSpec = map[string]string{ "registries": "Registries describes how to override images used by the addon agent on the managed cluster. the following example will override image \"quay.io/open-cluster-management/addon-agent\" to \"quay.io/ocm/addon-agent\" when deploying the addon agent\n\nregistries:\n - source: quay.io/open-cluster-management/addon-agent\n mirror: quay.io/ocm/addon-agent", "proxyConfig": "ProxyConfig holds proxy settings for add-on agent on the managed cluster. Empty means no proxy settings is available.", "agentInstallNamespace": "AgentInstallNamespace is the namespace where the add-on agent should be installed on the managed cluster.", + "resourceRequirements": "ResourceRequirements specify the resources required by add-on agents. If a container matches multiple ContainerResourceRequirements, the last matched configuration in the array will take precedence.", } func (AddOnDeploymentConfigSpec) SwaggerDoc() map[string]string { return map_AddOnDeploymentConfigSpec } +var map_ContainerResourceRequirements = map[string]string{ + "": "ContainerResourceRequirements defines resources required by one or a group of containers.", + "containerID": "ContainerID is a unique identifier for an agent container. It consists of three parts: resource types, resource name, and container name, separated by ':'. The format follows '{resource_types}:{resource_name}:{container_name}' where\n 1). Supported resource types include deployments, daemonsets, statefulsets, replicasets, jobs,\n cronjobs and pods;\n 2). Wildcards (*) can be used in any part to match multiple containers. For example, '*:*:*'\n matches all containers of the agent.", + "resources": "Compute resources required by matched containers.", +} + +func (ContainerResourceRequirements) SwaggerDoc() map[string]string { + return map_ContainerResourceRequirements +} + var map_CustomizedVariable = map[string]string{ "": "CustomizedVariable represents a customized variable for add-on deployment.", "name": "Name of this variable.",