You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2022/07/06 15:31:33 UTC
[solr-operator] branch main updated: Add app-protocol for all services (#453)
This is an automated email from the ASF dual-hosted git repository.
houston pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-operator.git
The following commit(s) were added to refs/heads/main by this push:
new 6ecf2a5 Add app-protocol for all services (#453)
6ecf2a5 is described below
commit 6ecf2a59eca344f3043469e650da3964cf043894
Author: Houston Putman <ho...@apache.org>
AuthorDate: Wed Jul 6 11:31:27 2022 -0400
Add app-protocol for all services (#453)
---
.../solrcloud_controller_externaldns_test.go | 7 +++
controllers/solrcloud_controller_ingress_test.go | 13 +++++
controllers/solrcloud_controller_test.go | 6 ++
controllers/solrcloud_controller_tls_test.go | 65 ++++++++++++++++++++--
.../solrprometheusexporter_controller_test.go | 3 +
.../solrprometheusexporter_controller_tls_test.go | 11 ++++
controllers/util/prometheus_exporter_util.go | 10 +++-
controllers/util/solr_util.go | 32 ++++++++++-
helm/solr-operator/Chart.yaml | 7 +++
9 files changed, 146 insertions(+), 8 deletions(-)
diff --git a/controllers/solrcloud_controller_externaldns_test.go b/controllers/solrcloud_controller_externaldns_test.go
index 5273096..c3f5d4e 100644
--- a/controllers/solrcloud_controller_externaldns_test.go
+++ b/controllers/solrcloud_controller_externaldns_test.go
@@ -23,6 +23,7 @@ import (
"github.com/apache/solr-operator/controllers/util"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -118,6 +119,9 @@ var _ = FDescribe("SolrCloud controller - External DNS", func() {
Expect(commonService.Spec.Ports[0].Name).To(Equal("solr-client"), "Wrong port name on common Service")
Expect(commonService.Spec.Ports[0].Port).To(Equal(int32(4000)), "Wrong port on common Service")
Expect(commonService.Spec.Ports[0].TargetPort.StrVal).To(Equal("solr-client"), "Wrong podPort name on common Service")
+ Expect(commonService.Spec.Ports[0].Protocol).To(Equal(corev1.ProtocolTCP), "Wrong protocol on common Service")
+ Expect(commonService.Spec.Ports[0].AppProtocol).ToNot(BeNil(), "AppProtocol on common Service should not be nil")
+ Expect(*commonService.Spec.Ports[0].AppProtocol).To(Equal("http"), "Wrong appProtocol on common Service")
By("testing the Solr Headless Service")
headlessService := expectService(ctx, solrCloud, solrCloud.HeadlessServiceName(), statefulSet.Spec.Selector.MatchLabels, true)
@@ -128,6 +132,9 @@ var _ = FDescribe("SolrCloud controller - External DNS", func() {
Expect(headlessService.Spec.Ports[0].Name).To(Equal("solr-client"), "Wrong port name on common Service")
Expect(headlessService.Spec.Ports[0].Port).To(Equal(int32(3000)), "Wrong port on headless Service")
Expect(headlessService.Spec.Ports[0].TargetPort.StrVal).To(Equal("solr-client"), "Wrong podPort name on headless Service")
+ Expect(headlessService.Spec.Ports[0].Protocol).To(Equal(corev1.ProtocolTCP), "Wrong protocol on headless Service")
+ Expect(headlessService.Spec.Ports[0].AppProtocol).ToNot(BeNil(), "AppProtocol on headless Service should not be nil")
+ Expect(*headlessService.Spec.Ports[0].AppProtocol).To(Equal("http"), "Wrong appProtocol on headless Service")
By("making sure no individual Solr Node Services exist")
expectNoServices(ctx, solrCloud, "Node service shouldn't exist, but it does.", solrCloud.GetAllSolrPodNames())
diff --git a/controllers/solrcloud_controller_ingress_test.go b/controllers/solrcloud_controller_ingress_test.go
index de8f455..0f1a6c9 100644
--- a/controllers/solrcloud_controller_ingress_test.go
+++ b/controllers/solrcloud_controller_ingress_test.go
@@ -23,6 +23,7 @@ import (
"github.com/apache/solr-operator/controllers/util"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ corev1 "k8s.io/api/core/v1"
netv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"strconv"
@@ -231,6 +232,9 @@ var _ = FDescribe("SolrCloud controller - Ingress", func() {
Expect(commonService.Spec.Ports[0].Name).To(Equal("solr-client"), "Wrong port name on common Service")
Expect(commonService.Spec.Ports[0].Port).To(Equal(int32(4000)), "Wrong port on common Service")
Expect(commonService.Spec.Ports[0].TargetPort.StrVal).To(Equal("solr-client"), "Wrong podPort name on common Service")
+ Expect(commonService.Spec.Ports[0].Protocol).To(Equal(corev1.ProtocolTCP), "Wrong protocol on common Service")
+ Expect(commonService.Spec.Ports[0].AppProtocol).ToNot(BeNil(), "AppProtocol on common Service should not be nil")
+ Expect(*commonService.Spec.Ports[0].AppProtocol).To(Equal("http"), "Wrong appProtocol on common Service")
By("testing the Solr Headless Service")
headlessService := expectService(ctx, solrCloud, solrCloud.HeadlessServiceName(), statefulSet.Spec.Selector.MatchLabels, true)
@@ -238,6 +242,9 @@ var _ = FDescribe("SolrCloud controller - Ingress", func() {
Expect(headlessService.Spec.Ports[0].Name).To(Equal("solr-client"), "Wrong port name on common Service")
Expect(headlessService.Spec.Ports[0].Port).To(Equal(int32(3000)), "Wrong port on headless Service")
Expect(headlessService.Spec.Ports[0].TargetPort.StrVal).To(Equal("solr-client"), "Wrong podPort name on headless Service")
+ Expect(headlessService.Spec.Ports[0].Protocol).To(Equal(corev1.ProtocolTCP), "Wrong protocol on headless Service")
+ Expect(headlessService.Spec.Ports[0].AppProtocol).ToNot(BeNil(), "AppProtocol on headless Service should not be nil")
+ Expect(*headlessService.Spec.Ports[0].AppProtocol).To(Equal("http"), "Wrong appProtocol on headless Service")
By("making sure no individual Solr Node Services exist")
expectNoServices(ctx, solrCloud, "Node service shouldn't exist, but it does.", solrCloud.GetAllSolrPodNames())
@@ -304,6 +311,9 @@ var _ = FDescribe("SolrCloud controller - Ingress", func() {
Expect(commonService.Spec.Ports[0].Name).To(Equal("solr-client"), "Wrong port name on common Service")
Expect(commonService.Spec.Ports[0].Port).To(Equal(int32(4000)), "Wrong port on common Service")
Expect(commonService.Spec.Ports[0].TargetPort.StrVal).To(Equal("solr-client"), "Wrong podPort name on common Service")
+ Expect(commonService.Spec.Ports[0].Protocol).To(Equal(corev1.ProtocolTCP), "Wrong protocol on common Service")
+ Expect(commonService.Spec.Ports[0].AppProtocol).ToNot(BeNil(), "AppProtocol on common Service should not be nil")
+ Expect(*commonService.Spec.Ports[0].AppProtocol).To(Equal("http"), "Wrong appProtocol on common Service")
By("ensuring the Solr Headless Service does not exist")
expectNoService(ctx, solrCloud, solrCloud.HeadlessServiceName(), "Headless service shouldn't exist, but it does.")
@@ -319,6 +329,9 @@ var _ = FDescribe("SolrCloud controller - Ingress", func() {
Expect(service.Spec.Ports[0].Name).To(Equal("solr-client"), "Wrong port name on common Service")
Expect(service.Spec.Ports[0].Port).To(Equal(int32(100)), "Wrong port on node Service")
Expect(service.Spec.Ports[0].TargetPort.StrVal).To(Equal("solr-client"), "Wrong podPort name on node Service")
+ Expect(service.Spec.Ports[0].Protocol).To(Equal(corev1.ProtocolTCP), "Wrong protocol on node Service")
+ Expect(service.Spec.Ports[0].AppProtocol).ToNot(BeNil(), "AppProtocol on node Service should not be nil")
+ Expect(*service.Spec.Ports[0].AppProtocol).To(Equal("http"), "Wrong appProtocol on node Service")
}
By("making sure Ingress was created correctly")
diff --git a/controllers/solrcloud_controller_test.go b/controllers/solrcloud_controller_test.go
index 848e913..3753af3 100644
--- a/controllers/solrcloud_controller_test.go
+++ b/controllers/solrcloud_controller_test.go
@@ -260,12 +260,18 @@ var _ = FDescribe("SolrCloud controller - General", func() {
expectedCommonServiceLabels := util.MergeLabelsOrAnnotations(solrCloud.SharedLabelsWith(solrCloud.Labels), map[string]string{"service-type": "common"})
Expect(commonService.Labels).To(Equal(util.MergeLabelsOrAnnotations(expectedCommonServiceLabels, testCommonServiceLabels)), "Incorrect common service labels")
Expect(commonService.Annotations).To(Equal(testCommonServiceAnnotations), "Incorrect common service annotations")
+ Expect(commonService.Spec.Ports[0].Protocol).To(Equal(corev1.ProtocolTCP), "Wrong protocol on common Service")
+ Expect(commonService.Spec.Ports[0].AppProtocol).ToNot(BeNil(), "AppProtocol on common Service should not be nil")
+ Expect(*commonService.Spec.Ports[0].AppProtocol).To(Equal("http"), "Wrong appProtocol on common Service")
By("testing the Solr Headless Service")
headlessService := expectService(ctx, solrCloud, solrCloud.HeadlessServiceName(), statefulSet.Spec.Selector.MatchLabels, true)
expectedHeadlessServiceLabels := util.MergeLabelsOrAnnotations(solrCloud.SharedLabelsWith(solrCloud.Labels), map[string]string{"service-type": "headless"})
Expect(headlessService.Labels).To(Equal(util.MergeLabelsOrAnnotations(expectedHeadlessServiceLabels, testHeadlessServiceLabels)), "Incorrect headless service labels")
Expect(headlessService.Annotations).To(Equal(testHeadlessServiceAnnotations), "Incorrect headless service annotations")
+ Expect(headlessService.Spec.Ports[0].Protocol).To(Equal(corev1.ProtocolTCP), "Wrong protocol on headless Service")
+ Expect(headlessService.Spec.Ports[0].AppProtocol).ToNot(BeNil(), "AppProtocol on headless Service should not be nil")
+ Expect(*headlessService.Spec.Ports[0].AppProtocol).To(Equal("http"), "Wrong appProtocol on headless Service")
})
})
diff --git a/controllers/solrcloud_controller_tls_test.go b/controllers/solrcloud_controller_tls_test.go
index b5d1b2e..4983dd8 100644
--- a/controllers/solrcloud_controller_tls_test.go
+++ b/controllers/solrcloud_controller_tls_test.go
@@ -98,7 +98,10 @@ var _ = FDescribe("SolrCloud controller - TLS", func() {
By("checking that the User supplied TLS Config is correct in the generated StatefulSet")
verifyReconcileUserSuppliedTLS(ctx, solrCloud, false, false)
By("checking that the BasicAuth works as expected when using TLS")
- expectStatefulSetBasicAuthConfig(ctx, solrCloud, true)
+ foundStatefulSet := expectStatefulSetBasicAuthConfig(ctx, solrCloud, true)
+
+ By("Checking that the Service has the correct settings")
+ expectTLSService(ctx, solrCloud, foundStatefulSet.Spec.Selector.MatchLabels, true)
By("Checking that the Ingress will passthrough with Server TLS")
expectPassthroughIngressTLSConfig(ctx, solrCloud, tlsSecretName)
@@ -141,7 +144,10 @@ var _ = FDescribe("SolrCloud controller - TLS", func() {
By("checking that the User supplied TLS Config is correct in the generated StatefulSet")
verifyReconcileUserSuppliedTLS(ctx, solrCloud, false, false)
By("checking that the BasicAuth works as expected when using TLS")
- expectStatefulSetBasicAuthConfig(ctx, solrCloud, true)
+ foundStatefulSet := expectStatefulSetBasicAuthConfig(ctx, solrCloud, true)
+
+ By("Checking that the Service has the correct settings")
+ expectTLSService(ctx, solrCloud, foundStatefulSet.Spec.Selector.MatchLabels, true)
})
})
@@ -223,10 +229,14 @@ var _ = FDescribe("SolrCloud controller - TLS", func() {
MountedTLSDir: mountedClientTLSDir,
CheckPeerName: true,
}
+ solrCloud.Spec.SolrAddressability.External.HideNodes = true
})
FIt("has the correct resources", func() {
By("checking that the Mounted TLS Config is correct in the generated StatefulSet")
- expectStatefulSetMountedTLSDirConfig(ctx, solrCloud)
+ foundStatefulSet := expectStatefulSetMountedTLSDirConfig(ctx, solrCloud)
+
+ By("Checking that the Service has the correct settings")
+ expectTLSService(ctx, solrCloud, foundStatefulSet.Spec.Selector.MatchLabels, true)
})
})
@@ -384,6 +394,11 @@ var _ = FDescribe("SolrCloud controller - TLS", func() {
g.Expect(found.ExternalCommonAddress).To(Not(BeNil()), "External common address in Status should not be nil.")
g.Expect(*found.ExternalCommonAddress).To(Equal("https://"+solrCloud.Namespace+"-"+solrCloud.Name+"-solrcloud."+testDomain), "Wrong external common address in status")
})
+
+ foundStatefulSet := expectStatefulSet(ctx, solrCloud, solrCloud.StatefulSetName())
+
+ By("Checking that the Service has the correct settings")
+ expectTLSService(ctx, solrCloud, foundStatefulSet.Spec.Selector.MatchLabels, false)
})
})
})
@@ -692,7 +707,7 @@ func createMockTLSSecret(ctx context.Context, parentObject client.Object, secret
return mockTLSSecret
}
-func expectStatefulSetMountedTLSDirConfig(ctx context.Context, solrCloud *solrv1beta1.SolrCloud) {
+func expectStatefulSetMountedTLSDirConfig(ctx context.Context, solrCloud *solrv1beta1.SolrCloud) *appsv1.StatefulSet {
statefulSet := expectStatefulSet(ctx, solrCloud, solrCloud.StatefulSetName())
podTemplate := &statefulSet.Spec.Template
expectMountedTLSDirConfigOnPodTemplate(podTemplate, solrCloud)
@@ -718,6 +733,7 @@ func expectStatefulSetMountedTLSDirConfig(ctx context.Context, solrCloud *solrv1
Expect(expInitContainer.Command[2]).To(Not(ContainSubstring("SOLR_SSL_CLIENT_KEY_STORE_PASSWORD")), "Wrong shell command for init container: %s", name)
Expect(expInitContainer.Command[2]).To(Not(ContainSubstring("SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD")), "Wrong shell command for init container: %s", name)
}
+ return statefulSet
}
func expectMountedTLSDirConfigOnPodTemplate(podTemplate *corev1.PodTemplateSpec, solrCloud *solrv1beta1.SolrCloud) {
@@ -816,6 +832,47 @@ func expectZkSetupInitContainerForTLSWithGomega(g Gomega, solrCloud *solrv1beta1
}
}
+func expectTLSService(ctx context.Context, solrCloud *solrv1beta1.SolrCloud, selectorLables map[string]string, podsHaveTLSEnabled bool) {
+ appProtocol := "http"
+ podPort := 8983
+ servicePort := 80
+ if podsHaveTLSEnabled {
+ appProtocol = "https"
+ servicePort = 443
+ }
+ By("testing the Solr Common Service")
+ commonService := expectService(ctx, solrCloud, solrCloud.CommonServiceName(), selectorLables, false)
+ Expect(commonService.Spec.Ports[0].Name).To(Equal("solr-client"), "Wrong port name on common Service")
+ Expect(commonService.Spec.Ports[0].Port).To(Equal(int32(servicePort)), "Wrong port on common Service")
+ Expect(commonService.Spec.Ports[0].TargetPort.StrVal).To(Equal("solr-client"), "Wrong podPort name on common Service")
+ Expect(commonService.Spec.Ports[0].Protocol).To(Equal(corev1.ProtocolTCP), "Wrong protocol on common Service")
+ Expect(commonService.Spec.Ports[0].AppProtocol).ToNot(BeNil(), "AppProtocol on common Service should not be nil")
+ Expect(*commonService.Spec.Ports[0].AppProtocol).To(Equal(appProtocol), "Wrong appProtocol on common Service")
+
+ if solrCloud.Spec.SolrAddressability.External.UsesIndividualNodeServices() {
+ nodeNames := solrCloud.GetAllSolrPodNames()
+ By("testing the Solr Node Service(s)")
+ for _, nodeName := range nodeNames {
+ service := expectService(ctx, solrCloud, nodeName, util.MergeLabelsOrAnnotations(selectorLables, map[string]string{"statefulset.kubernetes.io/pod-name": nodeName}), false)
+ Expect(service.Spec.Ports[0].Name).To(Equal("solr-client"), "Wrong port name on common Service")
+ Expect(service.Spec.Ports[0].Port).To(Equal(int32(servicePort)), "Wrong port on node Service")
+ Expect(service.Spec.Ports[0].TargetPort.StrVal).To(Equal("solr-client"), "Wrong podPort name on node Service")
+ Expect(service.Spec.Ports[0].Protocol).To(Equal(corev1.ProtocolTCP), "Wrong protocol on node Service")
+ Expect(service.Spec.Ports[0].AppProtocol).ToNot(BeNil(), "AppProtocol on node Service should not be nil")
+ Expect(*service.Spec.Ports[0].AppProtocol).To(Equal(appProtocol), "Wrong appProtocol on node Service")
+ }
+ } else {
+ By("testing the Solr Headless Service")
+ headlessService := expectService(ctx, solrCloud, solrCloud.HeadlessServiceName(), selectorLables, true)
+ Expect(headlessService.Spec.Ports[0].Name).To(Equal("solr-client"), "Wrong port name on common Service")
+ Expect(headlessService.Spec.Ports[0].Port).To(Equal(int32(podPort)), "Wrong port on headless Service")
+ Expect(headlessService.Spec.Ports[0].TargetPort.StrVal).To(Equal("solr-client"), "Wrong podPort name on headless Service")
+ Expect(headlessService.Spec.Ports[0].Protocol).To(Equal(corev1.ProtocolTCP), "Wrong protocol on headless Service")
+ Expect(headlessService.Spec.Ports[0].AppProtocol).ToNot(BeNil(), "AppProtocol on headless Service should not be nil")
+ Expect(*headlessService.Spec.Ports[0].AppProtocol).To(Equal(appProtocol), "Wrong appProtocol on headless Service")
+ }
+}
+
func expectPassthroughIngressTLSConfig(ctx context.Context, solrCloud *solrv1beta1.SolrCloud, expectedTLSSecretName string) {
ingress := expectIngress(ctx, solrCloud, solrCloud.CommonIngressName())
Expect(ingress.Spec.TLS).To(Not(BeEmpty()), "Ingress does not have TLS secrets provided")
diff --git a/controllers/solrprometheusexporter_controller_test.go b/controllers/solrprometheusexporter_controller_test.go
index c9c8541..3c63b13 100644
--- a/controllers/solrprometheusexporter_controller_test.go
+++ b/controllers/solrprometheusexporter_controller_test.go
@@ -272,6 +272,9 @@ var _ = FDescribe("SolrPrometheusExporter controller - General", func() {
Expect(service.Spec.Ports[0].TargetPort).To(Equal(intstr.FromInt(util.SolrMetricsPort)), "Wrong target port on metrics Service")
Expect(service.Spec.Ports[0].Name).To(Equal(util.SolrMetricsPortName), "Wrong port name on metrics Service")
Expect(service.Spec.Ports[0].Port).To(Equal(int32(80)), "Wrong port number on metrics Service")
+ Expect(service.Spec.Ports[0].Protocol).To(Equal(corev1.ProtocolTCP), "Wrong protocol on metrics Service")
+ Expect(service.Spec.Ports[0].AppProtocol).ToNot(BeNil(), "AppProtocol on metrics Service should not be nil")
+ Expect(*service.Spec.Ports[0].AppProtocol).To(Equal("http"), "Wrong appProtocol on metrics Service")
})
})
diff --git a/controllers/solrprometheusexporter_controller_tls_test.go b/controllers/solrprometheusexporter_controller_tls_test.go
index 5720a34..73b6d44 100644
--- a/controllers/solrprometheusexporter_controller_tls_test.go
+++ b/controllers/solrprometheusexporter_controller_tls_test.go
@@ -24,6 +24,7 @@ import (
"github.com/apache/solr-operator/controllers/util"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
+ "k8s.io/apimachinery/pkg/util/intstr"
"strings"
"time"
@@ -322,6 +323,16 @@ var _ = FDescribe("SolrPrometheusExporter controller - TLS", func() {
), "Init container command does not have necessary arguments")
Expect(expInitContainer.Image).To(Equal("myBBImage:test"), "Wrong image for BusyBox initContainer")
+
+ By("testing the SolrPrometheusExporter Service")
+ service := expectService(ctx, solrPrometheusExporter, solrPrometheusExporter.MetricsServiceName(), deployment.Spec.Selector.MatchLabels, false)
+ Expect(service.Annotations).To(HaveKeyWithValue("prometheus.io/scrape", "true"), "Metrics Service Prometheus scraping is not enabled.")
+ Expect(service.Spec.Ports[0].TargetPort).To(Equal(intstr.FromInt(util.SolrMetricsPort)), "Wrong target port on metrics Service")
+ Expect(service.Spec.Ports[0].Name).To(Equal(util.SolrMetricsPortName), "Wrong port name on metrics Service")
+ Expect(service.Spec.Ports[0].Port).To(Equal(int32(80)), "Wrong port number on metrics Service")
+ Expect(service.Spec.Ports[0].Protocol).To(Equal(corev1.ProtocolTCP), "Wrong protocol on metrics Service")
+ Expect(service.Spec.Ports[0].AppProtocol).ToNot(BeNil(), "AppProtocol on metrics Service should not be nil")
+ Expect(*service.Spec.Ports[0].AppProtocol).To(Equal("http"), "Wrong appProtocol on metrics Service")
})
})
})
diff --git a/controllers/util/prometheus_exporter_util.go b/controllers/util/prometheus_exporter_util.go
index b8722c6..3fb2029 100644
--- a/controllers/util/prometheus_exporter_util.go
+++ b/controllers/util/prometheus_exporter_util.go
@@ -396,6 +396,8 @@ func GenerateSolrMetricsService(solrPrometheusExporter *solr.SolrPrometheusExpor
annotations = MergeLabelsOrAnnotations(annotations, customOptions.Annotations)
}
+ appProtocol := "http"
+
service := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: solrPrometheusExporter.MetricsServiceName(),
@@ -405,7 +407,13 @@ func GenerateSolrMetricsService(solrPrometheusExporter *solr.SolrPrometheusExpor
},
Spec: corev1.ServiceSpec{
Ports: []corev1.ServicePort{
- {Name: SolrMetricsPortName, Port: ExtSolrMetricsPort, Protocol: corev1.ProtocolTCP, TargetPort: intstr.FromInt(SolrMetricsPort)},
+ {
+ Name: SolrMetricsPortName,
+ Port: ExtSolrMetricsPort,
+ Protocol: corev1.ProtocolTCP,
+ TargetPort: intstr.FromInt(SolrMetricsPort),
+ AppProtocol: &appProtocol,
+ },
},
Selector: selectorLabels,
},
diff --git a/controllers/util/solr_util.go b/controllers/util/solr_util.go
index a7650bf..6f929eb 100644
--- a/controllers/util/solr_util.go
+++ b/controllers/util/solr_util.go
@@ -713,6 +713,14 @@ func GenerateAdditionalLibXMLPart(solrModules []string, additionalLibs []string)
return libXml
}
+func getAppProtocol(solrCloud *solr.SolrCloud) *string {
+ appProtocol := "http"
+ if solrCloud.Spec.SolrTLS != nil {
+ appProtocol = "https"
+ }
+ return &appProtocol
+}
+
// GenerateCommonService returns a new corev1.Service pointer generated for the entire SolrCloud instance
// solrCloud: SolrCloud instance
func GenerateCommonService(solrCloud *solr.SolrCloud) *corev1.Service {
@@ -750,7 +758,13 @@ func GenerateCommonService(solrCloud *solr.SolrCloud) *corev1.Service {
},
Spec: corev1.ServiceSpec{
Ports: []corev1.ServicePort{
- {Name: SolrClientPortName, Port: int32(solrCloud.Spec.SolrAddressability.CommonServicePort), Protocol: corev1.ProtocolTCP, TargetPort: intstr.FromString(SolrClientPortName)},
+ {
+ Name: SolrClientPortName,
+ Port: int32(solrCloud.Spec.SolrAddressability.CommonServicePort),
+ Protocol: corev1.ProtocolTCP,
+ TargetPort: intstr.FromString(SolrClientPortName),
+ AppProtocol: getAppProtocol(solrCloud),
+ },
},
Selector: selectorLabels,
},
@@ -796,7 +810,13 @@ func GenerateHeadlessService(solrCloud *solr.SolrCloud) *corev1.Service {
},
Spec: corev1.ServiceSpec{
Ports: []corev1.ServicePort{
- {Name: SolrClientPortName, Port: int32(solrCloud.NodePort()), Protocol: corev1.ProtocolTCP, TargetPort: intstr.FromString(SolrClientPortName)},
+ {
+ Name: SolrClientPortName,
+ Port: int32(solrCloud.NodePort()),
+ Protocol: corev1.ProtocolTCP,
+ TargetPort: intstr.FromString(SolrClientPortName),
+ AppProtocol: getAppProtocol(solrCloud),
+ },
},
Selector: selectorLabels,
ClusterIP: corev1.ClusterIPNone,
@@ -836,7 +856,13 @@ func GenerateNodeService(solrCloud *solr.SolrCloud, nodeName string) *corev1.Ser
Spec: corev1.ServiceSpec{
Selector: selectorLabels,
Ports: []corev1.ServicePort{
- {Name: SolrClientPortName, Port: int32(solrCloud.NodePort()), Protocol: corev1.ProtocolTCP, TargetPort: intstr.FromString(SolrClientPortName)},
+ {
+ Name: SolrClientPortName,
+ Port: int32(solrCloud.NodePort()),
+ Protocol: corev1.ProtocolTCP,
+ TargetPort: intstr.FromString(SolrClientPortName),
+ AppProtocol: getAppProtocol(solrCloud),
+ },
},
PublishNotReadyAddresses: true,
},
diff --git a/helm/solr-operator/Chart.yaml b/helm/solr-operator/Chart.yaml
index 992b453..bbd45ef 100644
--- a/helm/solr-operator/Chart.yaml
+++ b/helm/solr-operator/Chart.yaml
@@ -129,6 +129,13 @@ annotations:
url: https://github.com/apache/solr-operator/issues/445
- name: Github PR
url: https://github.com/apache/solr-operator/pull/450
+ - kind: added
+ description: SolrCloud and SolrPrometheusExporter Services now have the appropriate (http or https) appProtocol set.
+ links:
+ - name: Github Issue
+ url: https://github.com/apache/solr-operator/issues/427
+ - name: Github PR
+ url: https://github.com/apache/solr-operator/pull/453
artifacthub.io/images: |
- name: solr-operator
image: apache/solr-operator:v0.6.0-prerelease