Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

Commit

Permalink
Make AEE containers resources configurable
Browse files Browse the repository at this point in the history
"Creating a pod without CPU requests or limits will effectively allow it to be scheduled on any suitable node, regardless of the amount of CPU left on that node. In practice, it will still get some minimal CPU guarantees. However, it will not be able to use much CPU time when there is node pressure"

https://www.datadoghq.com/blog/kubernetes-cpu-requests-limits/
Signed-off-by: Fabricio Aguiar <[email protected]>
  • Loading branch information
fao89 committed May 20, 2024
1 parent 3094bea commit 305e5b4
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 0 deletions.
31 changes: 31 additions & 0 deletions api/bases/ansibleee.openstack.org_openstackansibleees.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,37 @@ spec:
- true
- false
type: boolean
resources:
properties:
claims:
items:
properties:
name:
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
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
type: object
type: object
restartPolicy:
default: Never
enum:
Expand Down
4 changes: 4 additions & 0 deletions api/v1beta1/openstack_ansibleee_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ type OpenStackAnsibleEESpec struct {
// +kubebuilder:validation:Optional
// InitContainers allows the passing of an array of containers that will be executed before the ansibleee execution itself
InitContainers []corev1.Container `json:"initContainers,omitempty"`
// Compute Resources required by this ansibleee job.
// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
// +kubebuilder:validation:Optional
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
// +kubebuilder:validation:Optional
// ServiceAccountName allows to specify what ServiceAccountName do we want the ansible execution run with. Without specifying,
// it will run with default serviceaccount
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions config/crd/bases/ansibleee.openstack.org_openstackansibleees.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,37 @@ spec:
- true
- false
type: boolean
resources:
properties:
claims:
items:
properties:
name:
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
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
type: object
type: object
restartPolicy:
default: Never
enum:
Expand Down
1 change: 1 addition & 0 deletions controllers/openstack_ansibleee_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ func (r *OpenStackAnsibleEEReconciler) jobForOpenStackAnsibleEE(ctx context.Cont
Name: instance.Spec.Name,
Args: args,
Env: instance.Spec.Env,
Resources: instance.Spec.Resources,
}},
}

Expand Down
5 changes: 5 additions & 0 deletions docs/assemblies/openstack_ansibleee.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ OpenStackAnsibleEESpec defines the desired state of OpenStackAnsibleEE
| []corev1.Container
| false
| resources
| Compute Resources required by this ansibleee job. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
| corev1.ResourceRequirements
| false
| serviceAccountName
| ServiceAccountName allows to specify what ServiceAccountName do we want the ansible execution run with. Without specifying, it will run with default serviceaccount
| string
Expand Down

0 comments on commit 305e5b4

Please sign in to comment.