Skip to content

Commit

Permalink
feat: add topologySpreadConstraints pod configuration (grafana#337)
Browse files Browse the repository at this point in the history
* feat: add topologySpreadConstraints pod configuration

Signed-off-by: GitHub <[email protected]>

* Add sample

---------

Signed-off-by: GitHub <[email protected]>
  • Loading branch information
aslafy-z authored Nov 24, 2023
1 parent 9df1f7b commit 08440fe
Show file tree
Hide file tree
Showing 13 changed files with 387 additions and 20 deletions.
37 changes: 19 additions & 18 deletions api/v1alpha1/k6_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,25 @@ type PodMetadata struct {
}

type Pod struct {
Affinity *corev1.Affinity `json:"affinity,omitempty"`
AutomountServiceAccountToken string `json:"automountServiceAccountToken,omitempty"`
Env []corev1.EnvVar `json:"env,omitempty"`
Image string `json:"image,omitempty"`
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
Metadata PodMetadata `json:"metadata,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty"`
SecurityContext corev1.PodSecurityContext `json:"securityContext,omitempty"`
EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty"`
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty"`
InitContainers []InitContainer `json:"initContainers,omitempty"`
Volumes []corev1.Volume `json:"volumes,omitempty"`
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
AutomountServiceAccountToken string `json:"automountServiceAccountToken,omitempty"`
Env []corev1.EnvVar `json:"env,omitempty"`
Image string `json:"image,omitempty"`
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
Metadata PodMetadata `json:"metadata,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty"`
SecurityContext corev1.PodSecurityContext `json:"securityContext,omitempty"`
EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty"`
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty"`
InitContainers []InitContainer `json:"initContainers,omitempty"`
Volumes []corev1.Volume `json:"volumes,omitempty"`
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
}

type InitContainer struct {
Expand Down
7 changes: 7 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

156 changes: 156 additions & 0 deletions config/crd/bases/k6.io_k6s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,58 @@ spec:
type: string
type: object
type: array
topologySpreadConstraints:
items:
properties:
labelSelector:
properties:
matchExpressions:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
matchLabelKeys:
items:
type: string
type: array
x-kubernetes-list-type: atomic
maxSkew:
format: int32
type: integer
minDomains:
format: int32
type: integer
nodeAffinityPolicy:
type: string
nodeTaintsPolicy:
type: string
topologyKey:
type: string
whenUnsatisfiable:
type: string
required:
- maxSkew
- topologyKey
- whenUnsatisfiable
type: object
type: array
volumeMounts:
items:
properties:
Expand Down Expand Up @@ -2560,6 +2612,58 @@ spec:
type: string
type: object
type: array
topologySpreadConstraints:
items:
properties:
labelSelector:
properties:
matchExpressions:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
matchLabelKeys:
items:
type: string
type: array
x-kubernetes-list-type: atomic
maxSkew:
format: int32
type: integer
minDomains:
format: int32
type: integer
nodeAffinityPolicy:
type: string
nodeTaintsPolicy:
type: string
topologyKey:
type: string
whenUnsatisfiable:
type: string
required:
- maxSkew
- topologyKey
- whenUnsatisfiable
type: object
type: array
volumeMounts:
items:
properties:
Expand Down Expand Up @@ -4218,6 +4322,58 @@ spec:
type: string
type: object
type: array
topologySpreadConstraints:
items:
properties:
labelSelector:
properties:
matchExpressions:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
matchLabelKeys:
items:
type: string
type: array
x-kubernetes-list-type: atomic
maxSkew:
format: int32
type: integer
minDomains:
format: int32
type: integer
nodeAffinityPolicy:
type: string
nodeTaintsPolicy:
type: string
topologyKey:
type: string
whenUnsatisfiable:
type: string
required:
- maxSkew
- topologyKey
- whenUnsatisfiable
type: object
type: array
volumeMounts:
items:
properties:
Expand Down
Loading

0 comments on commit 08440fe

Please sign in to comment.