-
-
Notifications
You must be signed in to change notification settings - Fork 4
feat: HBase Listener integration #639
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
Open
adwk67
wants to merge
54
commits into
main
Choose a base branch
from
feat/integrate-listener-operator
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 46 commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
05e5c16
output listener refs
adwk67 776e273
add listener refs to config map
adwk67 d824b50
Merge branch 'main' into feat/integrate-listener-operator
adwk67 967239d
changelog
adwk67 4eb4e35
changed logging statement
adwk67 96593c7
integration test
adwk67 ae1654a
changed listener class designation
adwk67 53ea8bc
update listener class docs
adwk67 f8cc1c7
working tests
adwk67 7a2756b
wip: experimental command
adwk67 2affa65
cleanup start command
adwk67 652999e
added hostname/port to hbase-env.sh
adwk67 c8a2644
wip: will move startup logic to hbase-entrypoint.sh
adwk67 dd793c0
cleaned up/reverted previous wip
adwk67 bd1db17
cleaned up/reverted previous wip II
adwk67 80adf71
correct callout
adwk67 aee4fc2
use pvcs for externally-reachable endpoints
adwk67 bf969a0
added comment
adwk67 90efe2b
docs
adwk67 0030bfb
merge main
adwk67 8313995
resolve listener-class across role-groups/role
adwk67 465d0f1
merge conflicts
adwk67 fb8efde
regenerate nix
adwk67 5ddbff2
updated tokio and nix packages
adwk67 6146593
merge main
adwk67 8acadff
merge main
adwk67 68ab9cc
added listener-relevant config settings
adwk67 9a4231a
merged main
adwk67 61c79a5
Try a different tack at reconfiguring hbase
nightkr 7b742c0
formatting and partial clean-up
adwk67 fde3c8a
formatting and partial clean-up
adwk67 550ea47
merge main and fix conflicts
adwk67 71015a5
replaced listener-class enum with string
adwk67 c555448
Merge branch 'main' into feat/integrate-listener-operator
adwk67 8b3e650
tweak test cases
adwk67 39740fa
add generic properties for listener endpoints
adwk67 00ef5c9
write endpoints to hbase-site instead of dedicated config map
adwk67 74bfc29
remove unused error defs
adwk67 6c616a1
remove unused error def/function
adwk67 4309b9d
fix some tests inline with 2.6.1, add UI port type
adwk67 51b2837
use listener service resolved in entrypoint script rather than passin…
adwk67 a51003c
Merge branch 'main' into feat/integrate-listener-operator
adwk67 4ceb588
updated env-vars based on patch changes
adwk67 4122baf
merge main and fix conflicts
adwk67 fda8ca3
fix smoke test
adwk67 2c41938
fixed orphaned-resources test
adwk67 16e7c45
fixed opa test
adwk67 88d7458
Update CHANGELOG.md
adwk67 42148aa
Update docs/modules/hbase/pages/usage-guide/listenerclass.adoc
adwk67 67d6e54
review feedback
adwk67 474bdfe
added constant
adwk67 e8469ab
replace expects with snafu error
adwk67 1aa786a
correct property usage to match latest image changes
adwk67 9177c2f
provide bound address to match defaults used in patch
adwk67 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,37 @@ | ||
= Service exposition with ListenerClasses | ||
:description: Configure HBase service exposure using ListenerClasses to control internal and external access for all roles. | ||
|
||
Apache HBase offers an API. | ||
The operator deploys a service called `<name>` (where `<name>` is the name of the HbaseCluster) through which HBase can be reached. | ||
The operator deploys a xref:listener-operator:listener.adoc[Listener] for each Master, Regionserver and Restserver pod. | ||
They all default to only being accessible from within the Kubernetes cluster, but this can be changed by setting `.spec.{masters,regionServers,restServers}.config.listenerClass`: | ||
|
||
This service can have either the `cluster-internal` or `external-unstable` type. | ||
`external-stable` is not supported for HBase at the moment. | ||
Read more about the types in the xref:concepts:service-exposition.adoc[service exposition] documentation at platform level. | ||
[source,yaml] | ||
---- | ||
spec: | ||
masters: | ||
config: | ||
listenerClass: external-unstable # <1> | ||
regionServers: | ||
config: | ||
listenerClass: external-unstable | ||
restServers: | ||
config: | ||
listenerClass: external-unstable | ||
---- | ||
<1> Specify one of `external-stable`, `external-unstable`, `cluster-internal` (the default setting is `cluster-internal`). | ||
This can be set separately for all three roles. | ||
adwk67 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
This is how the listener class is configured: | ||
Externally-reachable endpoints (i.e. where listener-class = `external-unstable` or `external-unstable`) are written to a ConfigMap called `<cluster-name>-ui-endpoints`, listing each rolegroup by replica: | ||
maltesander marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
[source,yaml] | ||
---- | ||
spec: | ||
clusterConfig: | ||
listenerClass: cluster-internal # <1> | ||
apiVersion: v1 | ||
data: | ||
hbase.master-0.ui: 172.19.0.3:32353 | ||
hbase.master-1.ui: 172.19.0.5:31817 | ||
hbase.regionserver-0.ui: 172.19.0.3:31719 | ||
hbase.regionserver-1.ui: 172.19.0.5:30626 | ||
hbase.restserver-0.ui: 172.19.0.3:31790 | ||
hbase.restserver-1.ui: 172.19.0.5:32292 | ||
kind: ConfigMap | ||
maltesander marked this conversation as resolved.
Show resolved
Hide resolved
|
||
... | ||
---- | ||
<1> The default `cluster-internal` setting. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,8 +59,6 @@ pub const SSL_CLIENT_XML: &str = "ssl-client.xml"; | |
|
||
pub const HBASE_CLUSTER_DISTRIBUTED: &str = "hbase.cluster.distributed"; | ||
pub const HBASE_ROOTDIR: &str = "hbase.rootdir"; | ||
pub const HBASE_UNSAFE_REGIONSERVER_HOSTNAME_DISABLE_MASTER_REVERSEDNS: &str = | ||
"hbase.unsafe.regionserver.hostname.disable.master.reversedns"; | ||
|
||
pub const HBASE_UI_PORT_NAME_HTTP: &str = "ui-http"; | ||
pub const HBASE_UI_PORT_NAME_HTTPS: &str = "ui-https"; | ||
|
@@ -76,6 +74,8 @@ pub const HBASE_REGIONSERVER_PORT: u16 = 16020; | |
pub const HBASE_REGIONSERVER_UI_PORT: u16 = 16030; | ||
pub const HBASE_REST_PORT: u16 = 8080; | ||
pub const HBASE_REST_UI_PORT: u16 = 8085; | ||
pub const LISTENER_VOLUME_NAME: &str = "listener"; | ||
pub const LISTENER_VOLUME_DIR: &str = "/stackable/listener"; | ||
|
||
const DEFAULT_REGION_MOVER_TIMEOUT: Duration = Duration::from_minutes_unchecked(59); | ||
const DEFAULT_REGION_MOVER_DELTA_TO_SHUTDOWN: Duration = Duration::from_minutes_unchecked(1); | ||
|
@@ -102,6 +102,9 @@ pub enum Error { | |
|
||
#[snafu(display("incompatible merge types"))] | ||
IncompatibleMergeTypes, | ||
|
||
#[snafu(display("role-group is not valid"))] | ||
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. This error message says nothing; why is it not valid? |
||
NoRoleGroup, | ||
} | ||
|
||
#[versioned(version(name = "v1alpha1"))] | ||
|
@@ -171,18 +174,6 @@ pub mod versioned { | |
/// for a ZooKeeper cluster. | ||
pub zookeeper_config_map_name: String, | ||
|
||
/// This field controls which type of Service the Operator creates for this HbaseCluster: | ||
/// | ||
/// * cluster-internal: Use a ClusterIP service | ||
/// | ||
/// * external-unstable: Use a NodePort service | ||
/// | ||
/// This is a temporary solution with the goal to keep yaml manifests forward compatible. | ||
/// In the future, this setting will control which [ListenerClass](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listenerclass.html) | ||
/// will be used to expose the service, and ListenerClass names will stay the same, allowing for a non-breaking change. | ||
#[serde(default)] | ||
pub listener_class: CurrentlySupportedListenerClasses, | ||
|
||
/// Settings related to user [authentication](DOCS_BASE_URL_PLACEHOLDER/usage-guide/security). | ||
pub authentication: Option<AuthenticationConfig>, | ||
|
||
|
@@ -212,6 +203,11 @@ impl v1alpha1::HbaseCluster { | |
let defaults = | ||
AnyConfigFragment::default_for(role, &self.name_any(), hdfs_discovery_cm_name); | ||
|
||
// Trivial values for role-groups are not allowed | ||
if role_group.is_empty() { | ||
return Err(Error::NoRoleGroup); | ||
} | ||
Comment on lines
+211
to
+214
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. Validating this feels like a broader question across the SDP, not something to sneak in here. |
||
|
||
let (mut role_config, mut role_group_config) = match role { | ||
HbaseRole::RegionServer => { | ||
let role = self | ||
|
@@ -227,7 +223,9 @@ impl v1alpha1::HbaseCluster { | |
.role_groups | ||
.get(role_group) | ||
.map(|rg| rg.config.config.clone()) | ||
.unwrap_or_default(); | ||
.expect( | ||
"Cannot be empty as trivial values of role-group have already been checked", | ||
); | ||
|
||
( | ||
AnyConfigFragment::RegionServer(role_config), | ||
|
@@ -249,7 +247,9 @@ impl v1alpha1::HbaseCluster { | |
.role_groups | ||
.get(role_group) | ||
.map(|rg| rg.config.config.clone()) | ||
.unwrap_or_default(); | ||
.expect( | ||
"Cannot be empty as trivial values of role-group have already been checked", | ||
); | ||
|
||
// Retrieve role resource config | ||
( | ||
|
@@ -269,7 +269,9 @@ impl v1alpha1::HbaseCluster { | |
.role_groups | ||
.get(role_group) | ||
.map(|rg| rg.config.config.clone()) | ||
.unwrap_or_default(); | ||
.expect( | ||
"Cannot be empty as trivial values of role-group have already been checked", | ||
); | ||
|
||
// Retrieve role resource config | ||
( | ||
|
@@ -526,7 +528,7 @@ impl v1alpha1::HbaseCluster { | |
} | ||
|
||
/// Name of the port used by the Web UI, which depends on HTTPS usage | ||
fn ui_port_name(&self) -> String { | ||
pub fn ui_port_name(&self) -> String { | ||
if self.has_https_enabled() { | ||
HBASE_UI_PORT_NAME_HTTPS | ||
} else { | ||
|
@@ -552,27 +554,6 @@ pub fn merged_env(rolegroup_config: Option<&BTreeMap<String, String>>) -> Vec<En | |
merged_env | ||
} | ||
|
||
// TODO: Temporary solution until listener-operator is finished | ||
#[derive(Clone, Debug, Default, Display, Deserialize, Eq, JsonSchema, PartialEq, Serialize)] | ||
#[serde(rename_all = "PascalCase")] | ||
pub enum CurrentlySupportedListenerClasses { | ||
#[default] | ||
#[serde(rename = "cluster-internal")] | ||
ClusterInternal, | ||
|
||
#[serde(rename = "external-unstable")] | ||
ExternalUnstable, | ||
} | ||
|
||
impl CurrentlySupportedListenerClasses { | ||
pub fn k8s_service_type(&self) -> String { | ||
match self { | ||
CurrentlySupportedListenerClasses::ClusterInternal => "ClusterIP".to_string(), | ||
CurrentlySupportedListenerClasses::ExternalUnstable => "NodePort".to_string(), | ||
} | ||
} | ||
} | ||
|
||
#[derive(Clone, Debug, Deserialize, Eq, Hash, JsonSchema, PartialEq, Serialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct KerberosConfig { | ||
|
@@ -696,6 +677,7 @@ impl HbaseRole { | |
affinity: get_affinity(cluster_name, self, hdfs_discovery_cm_name), | ||
graceful_shutdown_timeout: Some(graceful_shutdown_timeout), | ||
requested_secret_lifetime: Some(requested_secret_lifetime), | ||
listener_class: Some("cluster-internal".to_string()), | ||
maltesander marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
|
||
|
@@ -796,6 +778,7 @@ impl AnyConfigFragment { | |
cli_opts: None, | ||
}, | ||
requested_secret_lifetime: Some(HbaseRole::DEFAULT_REGION_SECRET_LIFETIME), | ||
listener_class: Some("cluster-internal".to_string()), | ||
}) | ||
} | ||
HbaseRole::RestServer => AnyConfigFragment::RestServer(HbaseConfigFragment { | ||
|
@@ -807,6 +790,7 @@ impl AnyConfigFragment { | |
HbaseRole::DEFAULT_REST_SERVER_GRACEFUL_SHUTDOWN_TIMEOUT, | ||
), | ||
requested_secret_lifetime: Some(HbaseRole::DEFAULT_REST_SECRET_LIFETIME), | ||
listener_class: Some("cluster-internal".to_string()), | ||
}), | ||
HbaseRole::Master => AnyConfigFragment::Master(HbaseConfigFragment { | ||
hbase_rootdir: None, | ||
|
@@ -817,6 +801,7 @@ impl AnyConfigFragment { | |
HbaseRole::DEFAULT_MASTER_GRACEFUL_SHUTDOWN_TIMEOUT, | ||
), | ||
requested_secret_lifetime: Some(HbaseRole::DEFAULT_MASTER_SECRET_LIFETIME), | ||
listener_class: Some("cluster-internal".to_string()), | ||
}), | ||
} | ||
} | ||
|
@@ -894,6 +879,9 @@ pub struct HbaseConfig { | |
/// Please note that this can be shortened by the `maxCertificateLifetime` setting on the SecretClass issuing the TLS certificate. | ||
#[fragment_attrs(serde(default))] | ||
pub requested_secret_lifetime: Option<Duration>, | ||
|
||
/// This field controls which [ListenerClass](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listenerclass.html) is used to expose this rolegroup. | ||
pub listener_class: String, | ||
} | ||
|
||
impl Configuration for HbaseConfigFragment { | ||
|
@@ -952,10 +940,6 @@ impl Configuration for HbaseConfigFragment { | |
HBASE_CLUSTER_DISTRIBUTED.to_string(), | ||
Some("true".to_string()), | ||
); | ||
result.insert( | ||
HBASE_UNSAFE_REGIONSERVER_HOSTNAME_DISABLE_MASTER_REVERSEDNS.to_string(), | ||
Some("true".to_string()), | ||
); | ||
result.insert(HBASE_ROOTDIR.to_string(), self.hbase_rootdir.clone()); | ||
} | ||
_ => {} | ||
|
@@ -1047,6 +1031,9 @@ pub struct RegionServerConfig { | |
/// The operator will compute a timeout period for the region move that will not exceed the graceful shutdown timeout. | ||
#[fragment_attrs(serde(default))] | ||
pub region_mover: RegionMover, | ||
|
||
/// This field controls which [ListenerClass](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listenerclass.html) is used to expose this rolegroup. | ||
pub listener_class: String, | ||
} | ||
|
||
impl Configuration for RegionServerConfigFragment { | ||
|
@@ -1103,10 +1090,6 @@ impl Configuration for RegionServerConfigFragment { | |
HBASE_CLUSTER_DISTRIBUTED.to_string(), | ||
Some("true".to_string()), | ||
); | ||
result.insert( | ||
HBASE_UNSAFE_REGIONSERVER_HOSTNAME_DISABLE_MASTER_REVERSEDNS.to_string(), | ||
Some("true".to_string()), | ||
); | ||
result.insert(HBASE_ROOTDIR.to_string(), self.hbase_rootdir.clone()); | ||
} | ||
_ => {} | ||
|
@@ -1172,6 +1155,14 @@ impl AnyServiceConfig { | |
} | ||
} | ||
|
||
pub fn listener_class(&self) -> String { | ||
match self { | ||
AnyServiceConfig::Master(config) => config.listener_class.clone(), | ||
AnyServiceConfig::RegionServer(config) => config.listener_class.clone(), | ||
AnyServiceConfig::RestServer(config) => config.listener_class.clone(), | ||
} | ||
} | ||
|
||
/// Returns command line arguments to pass on to the region mover tool. | ||
/// The following arguments are excluded because they are already part of the | ||
/// hbase-entrypoint.sh script. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.