Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SessionAffinity and SessionAffinityConfig fields to ServiceOptions #571

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions api/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ type ServiceOptions struct {
// Labels to be added for the Service.
// +optional
Labels map[string]string `json:"labels,omitempty"`

// Supports "ClientIP" and "None". Used to maintain session affinity. Enable client IP based session affinity. Must be ClientIP or None. Defaults to None
// +optional
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// +optional
// +optional
// +kubebuilder:default=None
// +kubebuilder:validation:Enum=None,ClientIP

So we can actually put the default, and the enum constraints into the CRD itself using Kubebuilder CRD markers!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, neat code-gen

SessionAffinity string `json:"sessionAffinity,omitempty"`

// sessionAffinityConfig contains the configurations of session affinity.
// +optional
SessionAffinityConfig corev1.SessionAffinityConfig `json:"sessionAffinityConfig,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SessionAffinityConfig corev1.SessionAffinityConfig `json:"sessionAffinityConfig,omitempty"`
SessionAffinityConfig *corev1.SessionAffinityConfig `json:"sessionAffinityConfig,omitempty"`

Making this field a pointer, makes it easier for us to know whether the user provided one or not!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

}

// IngressOptions defines custom options for ingresses
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.

66 changes: 66 additions & 0 deletions config/crd/bases/solr.apache.org_solrclouds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2041,6 +2041,28 @@ spec:
type: string
description: Labels to be added for the Service.
type: object
sessionAffinity:
description: Supports "ClientIP" and "None". Used to maintain
session affinity. Enable client IP based session affinity.
Must be ClientIP or None. Defaults to None
type: string
sessionAffinityConfig:
description: sessionAffinityConfig contains the configurations
of session affinity.
properties:
clientIP:
description: clientIP contains the configurations of Client
IP based session affinity.
properties:
timeoutSeconds:
description: timeoutSeconds specifies the seconds
of ClientIP type session sticky time. The value
must be >0 && <=86400(for 1 day) if ServiceAffinity
== "ClientIP". Default value is 10800(for 3 hours).
format: int32
type: integer
type: object
type: object
type: object
configMapOptions:
description: ServiceOptions defines the custom options for the
Expand Down Expand Up @@ -2075,6 +2097,28 @@ spec:
type: string
description: Labels to be added for the Service.
type: object
sessionAffinity:
description: Supports "ClientIP" and "None". Used to maintain
session affinity. Enable client IP based session affinity.
Must be ClientIP or None. Defaults to None
type: string
sessionAffinityConfig:
description: sessionAffinityConfig contains the configurations
of session affinity.
properties:
clientIP:
description: clientIP contains the configurations of Client
IP based session affinity.
properties:
timeoutSeconds:
description: timeoutSeconds specifies the seconds
of ClientIP type session sticky time. The value
must be >0 && <=86400(for 1 day) if ServiceAffinity
== "ClientIP". Default value is 10800(for 3 hours).
format: int32
type: integer
type: object
type: object
type: object
ingressOptions:
description: IngressOptions defines the custom options for the
Expand Down Expand Up @@ -2115,6 +2159,28 @@ spec:
type: string
description: Labels to be added for the Service.
type: object
sessionAffinity:
description: Supports "ClientIP" and "None". Used to maintain
session affinity. Enable client IP based session affinity.
Must be ClientIP or None. Defaults to None
type: string
sessionAffinityConfig:
description: sessionAffinityConfig contains the configurations
of session affinity.
properties:
clientIP:
description: clientIP contains the configurations of Client
IP based session affinity.
properties:
timeoutSeconds:
description: timeoutSeconds specifies the seconds
of ClientIP type session sticky time. The value
must be >0 && <=86400(for 1 day) if ServiceAffinity
== "ClientIP". Default value is 10800(for 3 hours).
format: int32
type: integer
type: object
type: object
type: object
podOptions:
description: SolrPodOptions defines the custom options for solrCloud
Expand Down
22 changes: 22 additions & 0 deletions config/crd/bases/solr.apache.org_solrprometheusexporters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6831,6 +6831,28 @@ spec:
type: string
description: Labels to be added for the Service.
type: object
sessionAffinity:
description: Supports "ClientIP" and "None". Used to maintain
session affinity. Enable client IP based session affinity.
Must be ClientIP or None. Defaults to None
type: string
sessionAffinityConfig:
description: sessionAffinityConfig contains the configurations
of session affinity.
properties:
clientIP:
description: clientIP contains the configurations of Client
IP based session affinity.
properties:
timeoutSeconds:
description: timeoutSeconds specifies the seconds
of ClientIP type session sticky time. The value
must be >0 && <=86400(for 1 day) if ServiceAffinity
== "ClientIP". Default value is 10800(for 3 hours).
format: int32
type: integer
type: object
type: object
type: object
type: object
exporterEntrypoint:
Expand Down
88 changes: 88 additions & 0 deletions helm/solr-operator/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2290,6 +2290,28 @@ spec:
type: string
description: Labels to be added for the Service.
type: object
sessionAffinity:
description: Supports "ClientIP" and "None". Used to maintain
session affinity. Enable client IP based session affinity.
Must be ClientIP or None. Defaults to None
type: string
sessionAffinityConfig:
description: sessionAffinityConfig contains the configurations
of session affinity.
properties:
clientIP:
description: clientIP contains the configurations of Client
IP based session affinity.
properties:
timeoutSeconds:
description: timeoutSeconds specifies the seconds
of ClientIP type session sticky time. The value
must be >0 && <=86400(for 1 day) if ServiceAffinity
== "ClientIP". Default value is 10800(for 3 hours).
format: int32
type: integer
type: object
type: object
type: object
configMapOptions:
description: ServiceOptions defines the custom options for the
Expand Down Expand Up @@ -2324,6 +2346,28 @@ spec:
type: string
description: Labels to be added for the Service.
type: object
sessionAffinity:
description: Supports "ClientIP" and "None". Used to maintain
session affinity. Enable client IP based session affinity.
Must be ClientIP or None. Defaults to None
type: string
sessionAffinityConfig:
description: sessionAffinityConfig contains the configurations
of session affinity.
properties:
clientIP:
description: clientIP contains the configurations of Client
IP based session affinity.
properties:
timeoutSeconds:
description: timeoutSeconds specifies the seconds
of ClientIP type session sticky time. The value
must be >0 && <=86400(for 1 day) if ServiceAffinity
== "ClientIP". Default value is 10800(for 3 hours).
format: int32
type: integer
type: object
type: object
type: object
ingressOptions:
description: IngressOptions defines the custom options for the
Expand Down Expand Up @@ -2364,6 +2408,28 @@ spec:
type: string
description: Labels to be added for the Service.
type: object
sessionAffinity:
description: Supports "ClientIP" and "None". Used to maintain
session affinity. Enable client IP based session affinity.
Must be ClientIP or None. Defaults to None
type: string
sessionAffinityConfig:
description: sessionAffinityConfig contains the configurations
of session affinity.
properties:
clientIP:
description: clientIP contains the configurations of Client
IP based session affinity.
properties:
timeoutSeconds:
description: timeoutSeconds specifies the seconds
of ClientIP type session sticky time. The value
must be >0 && <=86400(for 1 day) if ServiceAffinity
== "ClientIP". Default value is 10800(for 3 hours).
format: int32
type: integer
type: object
type: object
type: object
podOptions:
description: SolrPodOptions defines the custom options for solrCloud
Expand Down Expand Up @@ -23626,6 +23692,28 @@ spec:
type: string
description: Labels to be added for the Service.
type: object
sessionAffinity:
description: Supports "ClientIP" and "None". Used to maintain
session affinity. Enable client IP based session affinity.
Must be ClientIP or None. Defaults to None
type: string
sessionAffinityConfig:
description: sessionAffinityConfig contains the configurations
of session affinity.
properties:
clientIP:
description: clientIP contains the configurations of Client
IP based session affinity.
properties:
timeoutSeconds:
description: timeoutSeconds specifies the seconds
of ClientIP type session sticky time. The value
must be >0 && <=86400(for 1 day) if ServiceAffinity
== "ClientIP". Default value is 10800(for 3 hours).
format: int32
type: integer
type: object
type: object
type: object
type: object
exporterEntrypoint:
Expand Down