Skip to content

Commit 2d751d7

Browse files
nightkrsbernauergithub-actions[bot]siegfriedweber
authored
Listener support/external access (#450)
* Remove pod svc controller * Add listener volume * Dont deploy rolegroup Service * Deploy rolegroup services again, namenode/journalnode listeners * Advertise as pod address * Run manual tests against 3.3.4, fix børked registration keys * Use listener addresses to generate discovery * Fix datanode port for HTTPS * Use configured listenerclasses * Move listenerclass into role config * Remove useless journalnode listenerclass option * Docs * Changelog * Disabled start of test * Update CRD * Remove reference to custom image * Document namenode_listener_refs * Break out the listener volume name to a constant * Update tests/templates/kuttl/external-access/operate-on-cluster.sh Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Avoid cloning FQDN override path * Use the port name constants we already have * Re-remove redundant role argument from ContainerConfig::volumes * Bounds-check port number * Separate data volumes from listener volume * Add a comment on discovery ordering * Remove stale TODO * bash != fish * Break other volumes out of `container_log_config` * Update docs/modules/hdfs/pages/usage-guide/listenerclass.adoc Co-authored-by: Siegfried Weber <mail@siegfriedweber.net> * Drop external access test limit range --------- Co-authored-by: Sebastian Bernauer <sebastian.bernauer@stackable.de> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Siegfried Weber <mail@siegfriedweber.net>
1 parent 4b47b2c commit 2d751d7

File tree

24 files changed

+455
-297
lines changed

24 files changed

+455
-297
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ All notable changes to this project will be documented in this file.
77
### Added
88

99
- More CRD documentation ([#433]).
10+
- Support for exposing HDFS clusters to clients outside of Kubernetes ([#450]).
1011

1112
### Changed
1213

1314
- `operator-rs` `0.56.1` -> `0.57.0` ([#433]).
15+
- [BREAKING] `.spec.clusterConfig.listenerClass` has been renamed to `.spec.nameNodes.config.listenerClass`, migration will be required when using `external-unstable` ([#450]).
1416
- Change default value of `dfs.ha.nn.not-become-active-in-safemode` from `true` to `false` ([#458]).
1517

1618
### Fixed
@@ -19,6 +21,7 @@ All notable changes to this project will be documented in this file.
1921
and `dfs.datanode.kerberos.principal` in the discovery ConfigMap in case Kerberos is enabled ([#451]).
2022

2123
[#433]: https://github.com/stackabletech/hdfs-operator/pull/433
24+
[#450]: https://github.com/stackabletech/hdfs-operator/pull/450
2225
[#451]: https://github.com/stackabletech/hdfs-operator/pull/451
2326
[#458]: https://github.com/stackabletech/hdfs-operator/pull/458
2427

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/helm/hdfs-operator/crds/crds.yaml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,6 @@ spec:
5757
format: uint8
5858
minimum: 0.0
5959
type: integer
60-
listenerClass:
61-
default: cluster-internal
62-
description: |-
63-
This field controls which type of Service the Operator creates for this HdfsCluster:
64-
65-
* cluster-internal: Use a ClusterIP service
66-
67-
* external-unstable: Use a NodePort service
68-
69-
This is a temporary solution with the goal to keep yaml manifests forward compatible. In the future, this setting will control which [ListenerClass](https://docs.stackable.tech/home/nightly/listener-operator/listenerclass.html) will be used to expose the service, and ListenerClass names will stay the same, allowing for a non-breaking change.
70-
enum:
71-
- cluster-internal
72-
- external-unstable
73-
type: string
7460
vectorAggregatorConfigMapName:
7561
description: Name of the Vector aggregator [discovery ConfigMap](https://docs.stackable.tech/home/nightly/concepts/service_discovery). It must contain the key `ADDRESS` with the address of the Vector aggregator. Follow the [logging tutorial](https://docs.stackable.tech/home/nightly/tutorials/logging-vector-aggregator) to learn how to configure log aggregation with Vector.
7662
nullable: true
@@ -585,6 +571,10 @@ spec:
585571
description: Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details.
586572
nullable: true
587573
type: string
574+
listenerClass:
575+
description: This field controls which [ListenerClass](https://docs.stackable.tech/home/nightly/listener-operator/listenerclass.html) is used to expose this rolegroup. DataNodes should have a direct ListenerClass, such as `cluster-internal` or `external-unstable`.
576+
nullable: true
577+
type: string
588578
logging:
589579
default:
590580
enableVectorAgent: null
@@ -4093,6 +4083,10 @@ spec:
40934083
description: Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details.
40944084
nullable: true
40954085
type: string
4086+
listenerClass:
4087+
description: This field controls which [ListenerClass](https://docs.stackable.tech/home/nightly/listener-operator/listenerclass.html) is used to expose this rolegroup. DataNodes should have a direct ListenerClass, such as `cluster-internal` or `external-unstable`.
4088+
nullable: true
4089+
type: string
40964090
logging:
40974091
default:
40984092
enableVectorAgent: null
@@ -14669,6 +14663,10 @@ spec:
1466914663
description: Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details.
1467014664
nullable: true
1467114665
type: string
14666+
listenerClass:
14667+
description: This field controls which [ListenerClass](https://docs.stackable.tech/home/nightly/listener-operator/listenerclass.html) is used to expose this rolegroup. NameNodes should have a stable ListenerClass, such as `cluster-internal` or `external-stable`.
14668+
nullable: true
14669+
type: string
1467214670
logging:
1467314671
default:
1467414672
enableVectorAgent: null
@@ -18168,6 +18166,10 @@ spec:
1816818166
description: Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details.
1816918167
nullable: true
1817018168
type: string
18169+
listenerClass:
18170+
description: This field controls which [ListenerClass](https://docs.stackable.tech/home/nightly/listener-operator/listenerclass.html) is used to expose this rolegroup. NameNodes should have a stable ListenerClass, such as `cluster-internal` or `external-stable`.
18171+
nullable: true
18172+
type: string
1817118173
logging:
1817218174
default:
1817318175
enableVectorAgent: null

deploy/helm/hdfs-operator/templates/roles.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ rules:
8888
- events
8989
verbs:
9090
- create
91+
- apiGroups:
92+
- listeners.stackable.tech
93+
resources:
94+
- listeners
95+
verbs:
96+
- get
9197
- apiGroups:
9298
- {{ include "operator.name" . }}.stackable.tech
9399
resources:

docs/modules/hdfs/examples/getting_started/hdfs.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@ metadata:
55
name: simple-hdfs
66
spec:
77
image:
8-
productVersion: 3.3.6
8+
productVersion: 3.3.4
99
clusterConfig:
1010
zookeeperConfigMapName: simple-hdfs-znode
11-
listenerClass: external-unstable
1211
dfsReplication: 1
1312
nameNodes:
13+
config:
14+
listenerClass: external-stable
1415
roleGroups:
1516
default:
1617
replicas: 2
1718
dataNodes:
19+
config:
20+
listenerClass: external-unstable
1821
roleGroups:
1922
default:
2023
replicas: 1
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
= Service exposition with ListenerClasses
22

3-
The Operator deploys a service called `<name>-<role>-<rolegroup>` (where `<name>` is the name of the HdfsCluster, `<role>` is the role and `<rolegroup>` the name of the role group) through which the different HDFS processes can be accessed. Unlike many other Stackable Operators, the HDFS Operator does not deploy role-level Services.
3+
The operator deploys a xref:listener-operator:listener.adoc[Listener] for each DataNode and NameNode pod. They both default to only being accessible from within the Kubernetes cluster, but this can be changed by setting `.spec.{data,name}Nodes.config.listenerClass`.
44

5-
These services can have either the `cluster-internal` or `external-unstable` type. `external-stable` is not supported for HDFS at the moment. Read more about the types in the xref:concepts:service-exposition.adoc[service exposition] documentation at platform level.
6-
7-
This is how the listener class is configured:
5+
The cluster can be configured to be accessible from outside of Kubernetes like this:
86

97
[source,yaml]
108
----
119
spec:
12-
clusterConfig:
13-
listenerClass: cluster-internal # <1>
10+
dataNodes:
11+
config:
12+
listenerClass: external-unstable # <1>
13+
nameNodes:
14+
config:
15+
listenerClass: external-stable # <2>
1416
----
15-
<1> The default `cluster-internal` setting.
17+
<1> DataNode listeners should prioritize having a direct connection, to minimize network transfer overhead.
18+
<2> NameNode listeners should prioritize having a stable address, since they will be baked into the client configuration.

rust/crd/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ stackable-operator.workspace = true
1717
product-config.workspace = true
1818
strum.workspace = true
1919
tracing.workspace = true
20+
futures.workspace = true
2021

2122
[dev-dependencies]
2223
serde_yaml.workspace = true

rust/crd/src/constants.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ pub const FIELD_MANAGER_SCOPE_POD: &str = "pod-service";
99

1010
pub const APP_NAME: &str = "hdfs";
1111

12-
pub const LABEL_ENABLE: &str = "hdfs.stackable.tech/pod-service";
13-
pub const LABEL_STS_POD_NAME: &str = "statefulset.kubernetes.io/pod-name";
14-
1512
pub const HDFS_SITE_XML: &str = "hdfs-site.xml";
1613
pub const CORE_SITE_XML: &str = "core-site.xml";
1714
pub const HADOOP_POLICY_XML: &str = "hadoop-policy.xml";
@@ -27,6 +24,8 @@ pub const SERVICE_PORT_NAME_HTTPS: &str = "https";
2724
pub const SERVICE_PORT_NAME_DATA: &str = "data";
2825
pub const SERVICE_PORT_NAME_METRICS: &str = "metrics";
2926

27+
pub const DEFAULT_LISTENER_CLASS: &str = "cluster-internal";
28+
3029
pub const DEFAULT_NAME_NODE_METRICS_PORT: u16 = 8183;
3130
pub const DEFAULT_NAME_NODE_HTTP_PORT: u16 = 9870;
3231
pub const DEFAULT_NAME_NODE_HTTPS_PORT: u16 = 9871;
@@ -77,4 +76,7 @@ pub const JOURNALNODE_ROOT_DATA_DIR: &str = "/stackable/data/journalnode";
7776
pub const DATANODE_ROOT_DATA_DIR_PREFIX: &str = "/stackable/data/";
7877
pub const DATANODE_ROOT_DATA_DIR_SUFFIX: &str = "/datanode";
7978

79+
pub const LISTENER_VOLUME_NAME: &str = "listener";
80+
pub const LISTENER_VOLUME_DIR: &str = "/stackable/listener";
81+
8082
pub const HDFS_UID: i64 = 1000;

0 commit comments

Comments
 (0)