diff --git a/docs/accessing.md b/docs/accessing.md index 9ab769a2..d394ec4b 100644 --- a/docs/accessing.md +++ b/docs/accessing.md @@ -129,7 +129,18 @@ Cassandra nodes. There are the following options: the native transport port on the nodes - EXTERNAL_RPC_PORT="9160" The external port that is forwarded to the rpc port on the nodes +- EXTERNAL_SERVICE_ANNOTATIONS Annotations that are added to the external + service. E.g., this can be used to configure ExternalDNS access :warning: The external service definition will at the moment not be deleted if you set EXTERNAL_NATIVE_TRANSPORT and EXTERNAL_RPC to "false". If you need to remove external access, you have to remove the external service manually. + +### ExternalDNS annotations + +The EXTERNAL_SERVICE_ANNOTATIONS parameter can be used to set up ExternalDNS +access when the external service is enabled. For example, one can set + +``` +EXTERNAL_SERVICE_ANNOTATIONS={"external-dns.alpha.kubernetes.io/hostname": "cassandra.example.org"} +``` diff --git a/docs/parameters.md b/docs/parameters.md index 77ee14ba..4131890f 100644 --- a/docs/parameters.md +++ b/docs/parameters.md @@ -117,6 +117,7 @@ Allow access to the Cassandra Cluster from outside Kubernetes. | **EXTERNAL_RPC** | This exposes the Cassandra cluster via an external service so it can be accessed from outside the Kubernetes cluster. Works only if START_RPC is true. | False | | **EXTERNAL_NATIVE_TRANSPORT_PORT** | The external port to use for Cassandra native transport protocol. | 9042 | | **EXTERNAL_RPC_PORT** | The external port to use for Cassandra rpc protocol. | 9160 | +| **EXTERNAL_SERVICE_ANNOTATIONS** | Custom annotations for the external service. | | ## Metrics Export diff --git a/operator/params.yaml b/operator/params.yaml index a99bd7e0..fecb222c 100644 --- a/operator/params.yaml +++ b/operator/params.yaml @@ -338,6 +338,14 @@ parameters: default: "9160" group: external + - name: EXTERNAL_SERVICE_ANNOTATIONS + displayName: "External service annotations" + hint: "Key-Value Pairs of annotations." + type: map + description: "Custom annotations for the external service." + default: + group: external + - name: BOOTSTRAP_TIMEOUT displayName: "Bootstrap Timeout" type: string diff --git a/operator/templates/external-service.yaml b/operator/templates/external-service.yaml index 7b0e17dd..3d44e1c8 100644 --- a/operator/templates/external-service.yaml +++ b/operator/templates/external-service.yaml @@ -3,6 +3,8 @@ kind: Service metadata: name: {{ .Name }}-svc-external namespace: {{ .Namespace }} + annotations: + {{ toYaml .Params.EXTERNAL_SERVICE_ANNOTATIONS }} spec: type: LoadBalancer externalTrafficPolicy: Local diff --git a/templates/operator/params.yaml.template b/templates/operator/params.yaml.template index 0bb9ea78..84cfb73b 100644 --- a/templates/operator/params.yaml.template +++ b/templates/operator/params.yaml.template @@ -338,6 +338,14 @@ parameters: default: "9160" group: external + - name: EXTERNAL_SERVICE_ANNOTATIONS + displayName: "External service annotations" + hint: "Key-Value Pairs of annotations." + type: map + description: "Custom annotations for the external service." + default: + group: external + - name: BOOTSTRAP_TIMEOUT displayName: "Bootstrap Timeout" type: string