diff --git a/api/v1alpha1/drupalsiteconfigoverride_types.go b/api/v1alpha1/drupalsiteconfigoverride_types.go index 13b5b5d5499e1d8ea7790f97f9a572b41af3f942..a17937fe331b967705a4427a700c55201adf4d1a 100644 --- a/api/v1alpha1/drupalsiteconfigoverride_types.go +++ b/api/v1alpha1/drupalsiteconfigoverride_types.go @@ -23,6 +23,8 @@ import ( // DrupalSiteConfigOverrideSpec defines the desired state of DrupalSiteConfigOverride type DrupalSiteConfigOverrideSpec struct { + // Replicas overrides the number of pod replicas for the deployment + Replicas int32 `json:"replicas,omitempty"` // Php includes configuration for the PHP container of the DrupalSite server pods Php Resources `json:"php,omitempty"` // Nginx includes configuration for the Nginx container of the DrupalSite server pods diff --git a/config/crd/bases/drupal.webservices.cern.ch_drupalsiteconfigoverrides.yaml b/config/crd/bases/drupal.webservices.cern.ch_drupalsiteconfigoverrides.yaml index 977bde900048b41294eea05c07f882abb61ca869..3a86196f070357cb805faa231d7ba83e71b015b0 100644 --- a/config/crd/bases/drupal.webservices.cern.ch_drupalsiteconfigoverrides.yaml +++ b/config/crd/bases/drupal.webservices.cern.ch_drupalsiteconfigoverrides.yaml @@ -54,7 +54,7 @@ spec: 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-compute-resources-container/' + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object requests: additionalProperties: @@ -66,7 +66,7 @@ spec: 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. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object type: object @@ -86,7 +86,7 @@ spec: 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-compute-resources-container/' + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object requests: additionalProperties: @@ -98,7 +98,7 @@ spec: 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. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object type: object @@ -118,7 +118,7 @@ spec: 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-compute-resources-container/' + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object requests: additionalProperties: @@ -130,7 +130,7 @@ spec: 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. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object type: object @@ -150,7 +150,7 @@ spec: 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-compute-resources-container/' + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object requests: additionalProperties: @@ -162,7 +162,7 @@ spec: 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. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object type: object @@ -182,7 +182,7 @@ spec: 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-compute-resources-container/' + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object requests: additionalProperties: @@ -194,10 +194,15 @@ spec: 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. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object type: object + replicas: + description: Replicas overrides the number of pod replicas for the + deployment + format: int32 + type: integer webdav: description: Webdav includes configuration for the Webdav container of the DrupalSite server pods @@ -214,7 +219,7 @@ spec: 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-compute-resources-container/' + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object requests: additionalProperties: @@ -226,7 +231,7 @@ spec: 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. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' + to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' type: object type: object type: object diff --git a/config/samples/drupal.webservices_v1alpha1_drupalsiteconfigoverride.yaml b/config/samples/drupal.webservices_v1alpha1_drupalsiteconfigoverride.yaml index ccee14727a9b3176603822ecd3b7d3c53f6e095f..27b972fb9aa21ba46668d968008ef110f0e88802 100644 --- a/config/samples/drupal.webservices_v1alpha1_drupalsiteconfigoverride.yaml +++ b/config/samples/drupal.webservices_v1alpha1_drupalsiteconfigoverride.yaml @@ -3,6 +3,8 @@ kind: DrupalSiteConfigOverride metadata: name: drupalsiteconfigoverride-sample spec: + # Increase the replicas + replicas: 4 php: resources: requests: diff --git a/controllers/drupalsite_resources.go b/controllers/drupalsite_resources.go index 91ccc5c93b6625b5e24a62dbe6fbb78c66167ac6..3cc91142c294b27010730764506ee5e411f33413 100644 --- a/controllers/drupalsite_resources.go +++ b/controllers/drupalsite_resources.go @@ -2215,6 +2215,9 @@ func (r *DrupalSiteReconciler) getDeploymentConfiguration(ctx context.Context, d if !reflect.DeepEqual(configOverride.DrupalLogs.Resources, corev1.ResourceRequirements{}) { drupalLogsResources = configOverride.DrupalLogs.Resources } + if configOverride.Replicas != 0 { + replicas = configOverride.Replicas + } } config = DeploymentConfig{replicas: replicas,