Skip to content

HBase: use config-utils instead of sed in entrypoint.sh script #1191

@adwk67

Description

@adwk67

Description

entrypoint.sh currently contains the following:

# Kerberos
if [ -f /stackable/kerberos/krb5.conf ]; then
  KERBEROS_REALM=$(grep -oP 'default_realm = \K.*' /stackable/kerberos/krb5.conf)
  export KERBEROS_REALM
  sed -i -e s/\$\{env\.KERBEROS_REALM\}/"${KERBEROS_REALM}"/g /stackable/conf/core-site.xml
  sed -i -e s/\$\{env\.KERBEROS_REALM\}/"${KERBEROS_REALM}"/g /stackable/conf/hbase-site.xml
  sed -i -e s/\$\{env\.KERBEROS_REALM\}/"${KERBEROS_REALM}"/g /stackable/conf/hdfs-site.xml
fi

# Service endpoints
HBASE_SERVICE_PORT=$(cat /stackable/listener/default-address/ports/"${HBASE_PORT_NAME}")
HBASE_INFO_PORT=$(cat /stackable/listener/default-address/ports/"${HBASE_UI_PORT_NAME}")
HBASE_LISTENER_ENDPOINT="$HBASE_SERVICE_HOST:$HBASE_INFO_PORT"

sed -i -e s/\$\{HBASE_SERVICE_HOST\}/"${HBASE_SERVICE_HOST}"/g /stackable/conf/hbase-site.xml
sed -i -e s/\$\{HBASE_SERVICE_PORT\}/"${HBASE_SERVICE_PORT}"/g /stackable/conf/hbase-site.xml
sed -i -e s/\$\{HBASE_LISTENER_ENDPOINT\}/"${HBASE_LISTENER_ENDPOINT}"/g /stackable/conf/hbase-site.xml
sed -i -e s/\$\{HBASE_INFO_PORT\}/"${HBASE_INFO_PORT}"/g /stackable/conf/hbase-site.xml

These calls should be replaced with e.g.

config-utils template /stackable/conf/core-site.xml
config-utils template /stackable/conf/hbase-site.xml
...

Corresponding changes should be made to the operator and it should be checked that ${env:KERBEROS_REALM} (colon) can be used instead of ${env.KERBEROS_REALM} (dot) - which is specfic to the hadoop config loader.

Motivation

  • technical debt
  • improves code readability and stability

PRs

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions