Skip to content

Commit f42f32c

Browse files
committed
Added backendtlpolicy support
1 parent 180c1c4 commit f42f32c

15 files changed

Lines changed: 4625 additions & 1274 deletions

api/v1beta1/solrcloud_types.go

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,16 @@ type SolrGatewayOptions struct {
656656
// Labels to add to HTTPRoute resources
657657
// +optional
658658
Labels map[string]string `json:"labels,omitempty"`
659+
660+
// BackendTLSPolicy defines TLS configuration for backend connections from Gateway to Solr pods.
661+
//
662+
// This is used when Solr pods are running with TLS enabled (spec.solrTLS) and the Gateway
663+
// needs to establish secure connections to the backend services.
664+
//
665+
// The Solr Operator will create BackendTLSPolicy resources for each HTTPRoute.
666+
//
667+
// +optional
668+
BackendTLSPolicy *SolrBackendTLSPolicy `json:"backendTLSPolicy,omitempty"`
659669
}
660670

661671
// GatewayParentReference identifies a parent Gateway resource to attach HTTPRoutes to
@@ -674,6 +684,44 @@ type GatewayParentReference struct {
674684
SectionName *string `json:"sectionName,omitempty"`
675685
}
676686

687+
// SolrBackendTLSPolicy defines backend TLS configuration for Gateway API
688+
// +kubebuilder:validation:MaxProperties=1
689+
type SolrBackendTLSPolicy struct {
690+
// CACertificateRefs contains one or more references to Kubernetes objects that contain
691+
// TLS certificates of the Certificate Authorities that can be used as a trust anchor
692+
// to validate the certificates presented by the backend.
693+
//
694+
// +optional
695+
// +kubebuilder:validation:MaxItems=8
696+
CACertificateRefs []GatewayCertificateReference `json:"caCertificateRefs,omitempty"`
697+
698+
// WellKnownCACertificates specifies whether system CA certificates may be used in the
699+
// TLS handshake between the gateway and backend pod.
700+
//
701+
// If WellKnownCACertificates is unspecified or empty (""), then CACertificateRefs must be
702+
// specified with at least one entry for a valid configuration.
703+
//
704+
// Only one of CACertificateRefs or WellKnownCACertificates may be specified, not both.
705+
//
706+
// +optional
707+
WellKnownCACertificates *string `json:"wellKnownCACertificates,omitempty"`
708+
}
709+
710+
// GatewayCertificateReference identifies a certificate object in Kubernetes
711+
type GatewayCertificateReference struct {
712+
// Name of the Kubernetes resource (e.g., ConfigMap or Secret)
713+
Name string `json:"name"`
714+
715+
// Kind of the resource (e.g., "ConfigMap" or "Secret")
716+
// +optional
717+
// +kubebuilder:default="ConfigMap"
718+
Kind *string `json:"kind,omitempty"`
719+
720+
// Group of the resource
721+
// +optional
722+
Group *string `json:"group,omitempty"`
723+
}
724+
677725
type SolrUpdateStrategy struct {
678726
// Method defines the way in which SolrClouds should be updated when the podSpec changes.
679727
// +optional
@@ -1355,6 +1403,16 @@ func (sc *SolrCloud) NodeHTTPRouteName(nodeName string) string {
13551403
return nodeName
13561404
}
13571405

1406+
// CommonBackendTLSPolicyName returns the name of the common BackendTLSPolicy for the cloud
1407+
func (sc *SolrCloud) CommonBackendTLSPolicyName() string {
1408+
return fmt.Sprintf("%s-solrcloud-common", sc.GetName())
1409+
}
1410+
1411+
// NodeBackendTLSPolicyName returns the name of the BackendTLSPolicy for a specific node
1412+
func (sc *SolrCloud) NodeBackendTLSPolicyName(nodeName string) string {
1413+
return nodeName
1414+
}
1415+
13581416
// ProvidedZookeeperName returns the provided zk cluster
13591417
func (sc *SolrCloud) ProvidedZookeeperName() string {
13601418
return fmt.Sprintf("%s-solrcloud-zookeeper", sc.GetName())
@@ -1529,6 +1587,14 @@ func (ea *ExternalAddressability) HasIngressTLSTermination() bool {
15291587
return false
15301588
}
15311589

1590+
func (ea *ExternalAddressability) HasBackendTLSPolicy() bool {
1591+
if ea != nil && ea.Method == Gateway && ea.Gateway != nil && ea.Gateway.BackendTLSPolicy != nil {
1592+
return (ea.Gateway.BackendTLSPolicy.CACertificateRefs != nil && len(ea.Gateway.BackendTLSPolicy.CACertificateRefs) > 0) ||
1593+
(ea.Gateway.BackendTLSPolicy.WellKnownCACertificates != nil && *ea.Gateway.BackendTLSPolicy.WellKnownCACertificates != "")
1594+
}
1595+
return false
1596+
}
1597+
15321598
func (sc *SolrCloud) UrlScheme(external bool) string {
15331599
urlScheme := "http"
15341600
if sc.Spec.SolrTLS != nil {

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)