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

Issue 211: Adding annotation to segment store service for external dns #240

Merged
merged 3 commits into from
Aug 2, 2019

Conversation

pbelgundi
Copy link
Contributor

Signed-off-by: pbelgundi [email protected]

Change log description

Added external-dns annotation to segment store external service that can be used by external-dns provider to assign a DNS name to the service.

Purpose of the change

Fixes #211

What the code does

Added domainName to Pravega Cluster Spec, that can be set via manifest to arrive at the FQDN for a single segment store node.
FQDN for segment store pod = SegmentStore_Pod_Name.domainName. ( ends with a . )

Added annotation external-dns.alpha.kubernetes.io/hostname to external service for each segment store container.

If external access=true, but domain name is not set in manifest, it would default to "pravega.io"

How to verify it

  1. In Pravega spec set externalaccess=true, and domainName=example.com. 2 kubectl svc pravega-pravega-segmentstore-0 -o yamlshould show : external-dns.alpha.kubernetes.io/hostname: pravega-pravega-segmentstore-0.example.com.`
  2. Check External-DNS component creates a DNS record for the segment store.

@pbelgundi
Copy link
Contributor Author

Service shows annotation set correctly:

$kubectl get svc pravega-pravega-segmentstore-0 -o yaml
apiVersion: v1
kind: Service
metadata:
  annotations:
    external-dns.alpha.kubernetes.io/hostname: pravega-pravega-segmentstore-0.example.com.
    ncp/internal_ip_for_policy: 100.64.65.241
  creationTimestamp: "2019-07-25T12:10:39Z"
 . . .

@pbelgundi
Copy link
Contributor Author

pbelgundi commented Jul 25, 2019

When external_access = true, but 'domainName' is not set in manifest, external-dns annotation is not added to the service:

$ kubectl get svc pravega-pravega-segmentstore-0 -o yaml
apiVersion: v1
kind: Service
metadata:
  annotations:
    ncp/internal_ip_for_policy: 100.64.192.5
  creationTimestamp: "2019-07-31T10:23:43Z"

Copy link
Member

@Tristan1900 Tristan1900 left a comment

Choose a reason for hiding this comment

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

LGTM

pkg/controller/pravega/pravega_segmentstore.go Outdated Show resolved Hide resolved
pkg/controller/pravega/pravega_segmentstore.go Outdated Show resolved Hide resolved
pkg/apis/pravega/v1alpha1/pravegacluster_types.go Outdated Show resolved Hide resolved
@pbelgundi pbelgundi force-pushed the issue-211-external-dns branch from 0f5d7dc to e709573 Compare July 31, 2019 19:03
@pbelgundi pbelgundi requested a review from EronWright July 31, 2019 19:06
@@ -329,18 +333,35 @@ func MakeSegmentStoreHeadlessService(pravegaCluster *api.PravegaCluster) *corev1

func MakeSegmentStoreExternalServices(pravegaCluster *api.PravegaCluster) []*corev1.Service {
var service *corev1.Service
var ssPodName string
var ssFQDN string
var annotationMap map[string]string
Copy link
Contributor

Choose a reason for hiding this comment

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

In my opinion, the above variables would best be defined within the for loop.

Copy link
Contributor

@EronWright EronWright left a comment

Choose a reason for hiding this comment

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

Looks good, thanks.

@pbelgundi pbelgundi merged commit 81c1592 into master Aug 2, 2019
@Tristan1900 Tristan1900 deleted the issue-211-external-dns branch September 18, 2019 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for External DNS names
3 participants