Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions api/v1beta1/solrcloud_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,11 @@ type ExternalAddressability struct {
// +optional
AdditionalDomainNames []string `json:"additionalDomainNames,omitempty"`

// Provide a custom host / dns name for the ingress resource that gets created.
// This uses the DomainName, so you only specify the actual Host in front of it.
// e.g. given.domain.name.com -> my-solr-ingress.given.domain.name.com
HostName string `json:"hostName,omitempty"`

// NodePortOverride defines the port to have all Solr node service(s) listen on and advertise itself as if advertising through an Ingress or LoadBalancer.
// This overrides the default usage of the podPort.
//
Expand Down Expand Up @@ -1459,6 +1464,12 @@ func (sc *SolrCloud) ExternalCommonUrl(domainName string, withPort bool) (url st
return url
}

// ExternalHostNameUrl assumes we are using Ingress as the Addressability method
func (sc *SolrCloud) ExternalHostNameUrl(domainName string, withPort bool) (url string) {
url = fmt.Sprintf("%s.%s", sc.Spec.SolrAddressability.External.HostName, domainName)
return url
}

func (ea *ExternalAddressability) HasIngressTLSTermination() bool {
if ea != nil && ea.Method == Ingress && ea.IngressTLSTermination != nil {
return ea.IngressTLSTermination.UseDefaultTLSSecret || ea.IngressTLSTermination.TLSSecret != ""
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/solr.apache.org_solrbackups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
operator.solr.apache.org/version: v0.10.0-prerelease
operator.solr.apache.org/version: v0.11.0-prerelease
argocd.argoproj.io/sync-options: Replace=true
controller-gen.kubebuilder.io/version: v0.16.4
name: solrbackups.solr.apache.org
Expand Down
8 changes: 7 additions & 1 deletion config/crd/bases/solr.apache.org_solrclouds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
operator.solr.apache.org/version: v0.10.0-prerelease
operator.solr.apache.org/version: v0.11.0-prerelease
argocd.argoproj.io/sync-options: Replace=true
controller-gen.kubebuilder.io/version: v0.16.4
name: solrclouds.solr.apache.org
Expand Down Expand Up @@ -9899,6 +9899,12 @@ spec:
The number of services this affects could range from 1 (a headless service for ExternalDNS) to the number of Solr pods your cloud contains (individual node services for Ingress/LoadBalancer).
Defaults to false.
type: boolean
hostName:
description: |-
Provide a custom host / dns name for the ingress resource that gets created.
This uses the DomainName, so you only specify the actual Host in front of it.
e.g. given.domain.name.com -> my-solr-ingress.given.domain.name.com
type: string
ingressTLSTermination:
description: |-
IngressTLSTermination tells the SolrCloud Ingress to terminate TLS on incoming connections.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
operator.solr.apache.org/version: v0.10.0-prerelease
operator.solr.apache.org/version: v0.11.0-prerelease
argocd.argoproj.io/sync-options: Replace=true
controller-gen.kubebuilder.io/version: v0.16.4
name: solrprometheusexporters.solr.apache.org
Expand Down
35 changes: 35 additions & 0 deletions controllers/util/solr_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,13 @@ func CreateSolrIngressRules(solrCloud *solr.SolrCloud, nodeNames []string, domai
}
}
}
if solrCloud.Spec.SolrAddressability.External.HostName != "" {
for _, domainName := range domainNames {
rule := CreateHostNameIngressRule(solrCloud, domainName)
ingressRules = append(ingressRules, rule)
allHosts = append(allHosts, rule.Host)
}
}
return
}

Expand Down Expand Up @@ -1229,6 +1236,34 @@ func CreateNodeIngressRule(solrCloud *solr.SolrCloud, nodeName string, domainNam
return ingressRule
}

// CreateHostNameIngressRule returns a new Ingress Rule generated for a SolrCloud under the given hostName in the solrCloud instance
// solrCloud: SolrCloud instance
// domainName: string Domain for the ingress rule to use
func CreateHostNameIngressRule(solrCloud *solr.SolrCloud, domainName string) (ingressRule netv1.IngressRule) {
pathType := netv1.PathTypeImplementationSpecific
ingressRule = netv1.IngressRule{
Host: solrCloud.ExternalHostNameUrl(domainName, false),
IngressRuleValue: netv1.IngressRuleValue{
HTTP: &netv1.HTTPIngressRuleValue{
Paths: []netv1.HTTPIngressPath{
{
Backend: netv1.IngressBackend{
Service: &netv1.IngressServiceBackend{
Name: solrCloud.CommonServiceName(),
Port: netv1.ServiceBackendPort{
Number: int32(solrCloud.Spec.SolrAddressability.CommonServicePort),
},
},
},
PathType: &pathType,
},
},
},
},
}
return ingressRule
}

// TODO: Have this replace the postStart hook for creating the chroot
func generateZKInteractionInitContainer(solrCloud *solr.SolrCloud, solrCloudStatus *solr.SolrCloudStatus, security *SecurityConfig) (bool, corev1.Container) {
allSolrOpts := make([]string, 0)
Expand Down
1 change: 1 addition & 0 deletions docs/solr-cloud/solr-cloud-crd.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ Under `SolrCloud.Spec.solrAddressability`:
Currently available options are [`Ingress`](https://kubernetes.io/docs/concepts/services-networking/ingress/) and [`ExternalDNS`](https://github.com/kubernetes-sigs/external-dns).
The goal is to support more methods in the future, such as LoadBalanced Services.
- **`domainName`** - (Required) The primary domain name to open your cloud endpoints on. If `useExternalAddress` is set to `true`, then this is the domain that will be used in Solr Node names.
- **`hostName`** - (Optional) Provide a custom host / dns name for the ingress resource that gets created. This uses the `domainName`, so you only specify the actual Host in front of it, e.g. k8s.solr.cloud -> solr-ingress.k8s.solr.cloud
- **`additionalDomainNames`** - You can choose to listen on additional domains for each endpoint, however Solr will not register itself under these names.
- **`useExternalAddress`** - Use the external address to advertise the SolrNode. If a domain name is required for the chosen external `method`, then the one provided in `domainName` will be used. \
This can not be set to `true` when **`hideNodes`** is set to `true` or **`ingressTLSTermination`** is used.
Expand Down
12 changes: 9 additions & 3 deletions helm/solr-operator/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
operator.solr.apache.org/version: v0.10.0-prerelease
operator.solr.apache.org/version: v0.11.0-prerelease
argocd.argoproj.io/sync-options: Replace=true
controller-gen.kubebuilder.io/version: v0.16.4
name: solrbackups.solr.apache.org
Expand Down Expand Up @@ -275,7 +275,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
operator.solr.apache.org/version: v0.10.0-prerelease
operator.solr.apache.org/version: v0.11.0-prerelease
argocd.argoproj.io/sync-options: Replace=true
controller-gen.kubebuilder.io/version: v0.16.4
name: solrclouds.solr.apache.org
Expand Down Expand Up @@ -10157,6 +10157,12 @@ spec:
The number of services this affects could range from 1 (a headless service for ExternalDNS) to the number of Solr pods your cloud contains (individual node services for Ingress/LoadBalancer).
Defaults to false.
type: boolean
hostName:
description: |-
Provide a custom host / dns name for the ingress resource that gets created.
This uses the DomainName, so you only specify the actual Host in front of it.
e.g. given.domain.name.com -> my-solr-ingress.given.domain.name.com
type: string
ingressTLSTermination:
description: |-
IngressTLSTermination tells the SolrCloud Ingress to terminate TLS on incoming connections.
Expand Down Expand Up @@ -17870,7 +17876,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
operator.solr.apache.org/version: v0.10.0-prerelease
operator.solr.apache.org/version: v0.11.0-prerelease
argocd.argoproj.io/sync-options: Replace=true
controller-gen.kubebuilder.io/version: v0.16.4
name: solrprometheusexporters.solr.apache.org
Expand Down
3 changes: 2 additions & 1 deletion tests/scripts/manage_e2e_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ fi
if [[ "${SOLR_IMAGE}" != *":"* ]]; then
SOLR_IMAGE="solr:${SOLR_IMAGE}"
fi
IFS=$'\036'; RAW_GINKGO=(${RAW_GINKGO:-}); unset IFS
#IFS=$'\036'; RAW_GINKGO=(${RAW_GINKGO:-}); unset IFS
IFS=$'\036'; RAW_GINKGO=(${RAW_GINKGO[@]:-()}); unset IFS

CLUSTER_NAME="$(echo "solr-op-e2e-${OPERATOR_IMAGE##*:}-k-${KUBERNETES_VERSION}-s-${SOLR_IMAGE##*:}" | tr '[:upper:]' '[:lower:]' | sed "s/snapshot/snap/" | sed "s/prerelease/pre/")"
export CLUSTER_NAME
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package version

var (
// Version information for the Solr Operator
Version = "v0.10.0"
Version = "v0.11.0"
VersionSuffix = "prerelease"
BuildTime string
GitSHA string
Expand Down