-
Notifications
You must be signed in to change notification settings - Fork 38
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
Issue 430: Exposing Segmentstore Service on single IP #431
Changes from 14 commits
33788cf
19856fa
d426d06
f0eada8
4aa8864
b108e87
e4ce1f9
6be7fba
ea5bafc
c4bc278
54ac927
32628a4
4b43e13
faea44c
bf746a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ metadata: | |
labels: | ||
{{ include "pravega.commonLabels" . | indent 4 }} | ||
spec: | ||
{{- if .Values.tls }} | ||
{{- if .Values.tls }} | ||
SrishT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
tls: | ||
static: | ||
controllerSecret: {{ .Values.tls.secret.controller }} | ||
|
@@ -33,6 +33,10 @@ spec: | |
{{- if .Values.externalAccess.enabled }} | ||
controllerServiceAccountName: {{ .Values.serviceAccount.name }} | ||
segmentStoreServiceAccountName: {{ .Values.serviceAccount.name }} | ||
{{- if .Values.segmentStore.service.segmentStoreLoadBalancerIP }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that conditional needed at all? If we remove the conditional and
Which is the same as not setting it (thus, we don't need that conditional) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried doing that but I am getting this error |
||
segmentStoreLoadBalancerIP: {{ .Values.segmentStore.service.segmentStoreLoadBalancerIP }} | ||
{{- end }} | ||
segmentStoreExternalTrafficPolicy: {{ .Values.segmentStore.service.segmentStoreExternalTrafficPolicy }} | ||
{{- if .Values.controller.service.type }} | ||
controllerExtServiceType: {{ .Values.controller.service.type }} | ||
{{- end }} | ||
|
@@ -45,7 +49,7 @@ spec: | |
{{- end }} | ||
{{- if .Values.segmentStore.service.annotations }} | ||
segmentStoreSvcAnnotations: | ||
{{ toYaml .Values.segmentStore.service.annotations | indent 6 }} | ||
{{ toYaml .Values.segmentStore.service.annotations | indent 6}} | ||
SrishT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{{- end }} | ||
{{- end }} | ||
image: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -238,3 +238,31 @@ IP: 10.100.200.183 | |
LoadBalancer Ingress: 10.247.108.104 | ||
. . . | ||
``` | ||
# Exposing Segmentstore Service on single IP address and Different ports | ||
|
||
For Exposing SegmentStoreservices on the same I/P address we will use MetalLB, | ||
SrishT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
MetalLB hooks into Kubernetes cluster, and provides a network load-balancer implementation. In short, it allows to create Kubernetes services of type “LoadBalancer” in clusters that don’t run on a cloud provider and thus cannot simply hook into paid products to provide load-balancers. | ||
|
||
By default, Services do not share an IP address, for providing same IP address to all the services we need to set the following configurations while creating the External Service: | ||
|
||
1) Provide annotation key as metallb.universe.tf/allow-shared-ip for all the services. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also the annotation could be highlighted like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
||
2) All the services which want to share the IP address need to have the same value for the above annotation, for example "shared-ss-ip". | ||
|
||
3) The port for all the services should be different | ||
|
||
4) All the services should use External Traffic Policy as Cluster | ||
|
||
5) Finally, we need to provide the I/P address that we want our service to provide to the segment store pod as spec.loadBalancerIP while creating the service | ||
|
||
To enable this we need to provide segmentStoreSvcAnnotations, segmentStoreLoadBalancerIP, segmentStoreExternalTrafficPolicy in the manifest as shown below | ||
|
||
Example: | ||
``` | ||
pravega: | ||
. . . | ||
segmentStoreLoadBalancerIP: "10.243.39.103" | ||
segmentStoreExternalTrafficPolicy: "cluster" | ||
segmentStoreSvcAnnotations: | ||
metallb.universe.tf/allow-shared-ip: "shared-ss-ip" | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -450,20 +450,16 @@ func generateDNSAnnotationForSvc(domainName string, podName string) (dnsAnnotati | |
|
||
func MakeSegmentStoreExternalServices(p *api.PravegaCluster) []*corev1.Service { | ||
var service *corev1.Service | ||
|
||
serviceType := getSSServiceType(p) | ||
services := make([]*corev1.Service, p.Spec.Pravega.SegmentStoreReplicas) | ||
|
||
for i := int32(0); i < p.Spec.Pravega.SegmentStoreReplicas; i++ { | ||
ssPodName := p.ServiceNameForSegmentStore(i) | ||
annotationMap := p.Spec.Pravega.SegmentStoreServiceAnnotations | ||
annotationValue := generateDNSAnnotationForSvc(p.Spec.ExternalAccess.DomainName, ssPodName) | ||
|
||
if annotationValue != "" { | ||
annotationMap = cloneMap(p.Spec.Pravega.SegmentStoreServiceAnnotations) | ||
annotationMap[externalDNSAnnotationKey] = annotationValue | ||
} | ||
|
||
service = &corev1.Service{ | ||
TypeMeta: metav1.TypeMeta{ | ||
Kind: "Service", | ||
|
@@ -491,6 +487,15 @@ func MakeSegmentStoreExternalServices(p *api.PravegaCluster) []*corev1.Service { | |
}, | ||
}, | ||
} | ||
if strings.EqualFold(p.Spec.Pravega.SegmentStoreExternalTrafficPolicy, "cluster") == true { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change "cluster" to "Cluster" to be consistent with k8s documentation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
service.Spec.ExternalTrafficPolicy = corev1.ServiceExternalTrafficPolicyTypeCluster | ||
} else { | ||
service.Spec.ExternalTrafficPolicy = corev1.ServiceExternalTrafficPolicyTypeLocal | ||
} | ||
if p.Spec.Pravega.SegmentStoreLoadBalancerIP != "" { | ||
service.Spec.Ports[0].Port = 12345 + i | ||
service.Spec.LoadBalancerIP = p.Spec.Pravega.SegmentStoreLoadBalancerIP | ||
} | ||
services[i] = service | ||
} | ||
return services | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't
IP address
the standard way of writing it? (rather thanI/P
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done