Skip to content

Commit

Permalink
Init / system-logger containers are not defining the resources to use. (
Browse files Browse the repository at this point in the history
#184)

Co-authored-by: Jim Dickinson <jimdickinson>

Closes #183
  • Loading branch information
rcosnita authored Aug 17, 2020
1 parent 7f26e0f commit 94634ba
Show file tree
Hide file tree
Showing 9 changed files with 387 additions and 1 deletion.
85 changes: 85 additions & 0 deletions charts/cass-operator-chart/templates/customresourcedefinition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,33 @@ spec:
configBuilderImage:
description: Container image for the config builder init container.
type: string
configBuilderResources:
description: Kubernetes resource requests and limits per server config
initialization container.
properties:
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-compute-resources-container/'
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. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
type: object
dseWorkloads:
properties:
analyticsEnabled:
Expand Down Expand Up @@ -5931,6 +5958,35 @@ spec:
description: PullPolicy describes a policy for if/when to pull a
container image
type: string
resources:
description: Kubernetes resource requests and limits per reaper
container.
properties:
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-compute-resources-container/'
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. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
type: object
required:
- resources
type: object
replaceNodes:
description: A list of pod names that need to be replaced.
Expand Down Expand Up @@ -6131,6 +6187,33 @@ spec:
description: This secret defines the username and password for the Cassandra
server superuser. If it is omitted, we will generate a secret instead.
type: string
systemLoggerResources:
description: Kubernetes resource requests and limits per system logger
container.
properties:
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-compute-resources-container/'
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. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
type: object
users:
description: Cassandra users to bootstrap
items:
Expand All @@ -6146,10 +6229,12 @@ spec:
type: array
required:
- clusterName
- configBuilderResources
- serverType
- serverVersion
- size
- storageConfig
- systemLoggerResources
type: object
status:
description: CassandraDatacenterStatus defines the observed state of CassandraDatacenter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,33 @@ spec:
configBuilderImage:
description: Container image for the config builder init container.
type: string
configBuilderResources:
description: Kubernetes resource requests and limits per server config
initialization container.
properties:
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-compute-resources-container/'
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. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
type: object
dseWorkloads:
properties:
analyticsEnabled:
Expand Down Expand Up @@ -5921,6 +5948,35 @@ spec:
description: PullPolicy describes a policy for if/when to pull a
container image
type: string
resources:
description: Kubernetes resource requests and limits per reaper
container.
properties:
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-compute-resources-container/'
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. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
type: object
required:
- resources
type: object
replaceNodes:
description: A list of pod names that need to be replaced.
Expand Down Expand Up @@ -6121,6 +6177,33 @@ spec:
description: This secret defines the username and password for the Cassandra
server superuser. If it is omitted, we will generate a secret instead.
type: string
systemLoggerResources:
description: Kubernetes resource requests and limits per system logger
container.
properties:
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-compute-resources-container/'
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. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
type: object
users:
description: Cassandra users to bootstrap
items:
Expand All @@ -6136,10 +6219,12 @@ spec:
type: array
required:
- clusterName
- configBuilderResources
- serverType
- serverVersion
- size
- storageConfig
- systemLoggerResources
type: object
status:
description: CassandraDatacenterStatus defines the observed state of CassandraDatacenter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ type CassandraDatacenterSpec struct {
// Kubernetes resource requests and limits, per pod
Resources corev1.ResourceRequirements `json:"resources,omitempty"`

// Kubernetes resource requests and limits per system logger container.
SystemLoggerResources corev1.ResourceRequirements `json:"systemLoggerResources, omitempty"`

// Kubernetes resource requests and limits per server config initialization container.
ConfigBuilderResources corev1.ResourceRequirements `json:"configBuilderResources, omitempty"`

// A list of the named racks in the datacenter, representing independent failure domains. The
// number of racks should match the replication factor in the keyspaces you plan to create, and
// the number of racks cannot easily be changed once a datacenter is deployed.
Expand Down Expand Up @@ -395,6 +401,9 @@ type ReaperConfig struct {
Image string `json:"image,omitempty"`

ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`

// Kubernetes resource requests and limits per reaper container.
Resources corev1.ResourceRequirements `json:"resources, omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
5 changes: 4 additions & 1 deletion operator/pkg/apis/cassandra/v1beta1/zz_generated.deepcopy.go

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

2 changes: 2 additions & 0 deletions operator/pkg/reconciliation/constructor.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ func buildContainers(dc *api.CassandraDatacenter, serverVolumeMounts []corev1.Vo
"/bin/sh", "-c", "tail -n+1 -F /var/log/cassandra/system.log",
}
loggerContainer.VolumeMounts = []corev1.VolumeMount{cassServerLogsMount}
loggerContainer.Resources = *getResourcesOrDefault(&dc.Spec.SystemLoggerResources, &DefaultsLoggerContainer)

containers := []corev1.Container{cassContainer, loggerContainer}
if dc.Spec.Reaper != nil && dc.Spec.Reaper.Enabled && dc.Spec.ServerType == "cassandra" {
Expand All @@ -550,6 +551,7 @@ func buildInitContainers(dc *api.CassandraDatacenter, rackName string) ([]corev1
MountPath: "/config",
}
serverCfg.VolumeMounts = []corev1.VolumeMount{serverCfgMount}
serverCfg.Resources = *getResourcesOrDefault(&dc.Spec.ConfigBuilderResources, &DefaultsConfigInitContainer)

// Convert the bool to a string for the env var setting
useHostIpForBroadcast := "false"
Expand Down
Loading

0 comments on commit 94634ba

Please sign in to comment.