Skip to content

Commit aacf78e

Browse files
feat: Rename discovery service
1 parent 3f57fd1 commit aacf78e

15 files changed

Lines changed: 31 additions & 20 deletions

File tree

rust/operator-binary/src/controller/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ mod tests {
105105
);
106106
assert_eq!(
107107
vec![
108-
"my-opensearch",
108+
"my-opensearch-discovery",
109109
"my-opensearch-nodes-cluster-manager-headless",
110110
"my-opensearch-nodes-coordinating-headless",
111111
"my-opensearch-nodes-data-headless"

rust/operator-binary/src/controller/build/role_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ mod tests {
427427
"app.kubernetes.io/version": "3.1.0",
428428
"stackable.tech/vendor": "Stackable"
429429
},
430-
"name": "my-opensearch-cluster",
430+
"name": "my-opensearch-cluster-discovery",
431431
"namespace": "default",
432432
"ownerReferences": [
433433
{

rust/operator-binary/src/framework/role_utils.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,18 @@ impl ResourceNames {
222222
}
223223

224224
pub fn discovery_service_name(&self) -> ServiceName {
225+
const SUFFIX: &str = "-discovery";
226+
225227
// compile-time checks
226228
const _: () = assert!(
227-
ClusterName::MAX_LENGTH <= ServiceName::MAX_LENGTH,
228-
"The string `<cluster_name>` must not exceed the limit of Service names."
229+
ClusterName::MAX_LENGTH + SUFFIX.len() <= ServiceName::MAX_LENGTH,
230+
"The string `<cluster_name>-discovery` must not exceed the limit of Service names."
229231
);
230232
let _ = ClusterName::IS_RFC_1035_LABEL_NAME;
231233
let _ = ClusterName::IS_VALID_LABEL_VALUE;
232234

233-
ServiceName::from_str(self.cluster_name.as_ref()).expect("should be a valid Service name")
235+
ServiceName::from_str(&format!("{}{SUFFIX}", self.cluster_name.as_ref()))
236+
.expect("should be a valid Service name")
234237
}
235238
}
236239

@@ -411,7 +414,7 @@ mod tests {
411414
resource_names.cluster_role_name()
412415
);
413416
assert_eq!(
414-
ServiceName::from_str_unsafe("my-cluster"),
417+
ServiceName::from_str_unsafe("my-cluster-discovery"),
415418
resource_names.discovery_service_name()
416419
);
417420
}

tests/templates/kuttl/backup-restore/22-create-testuser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ data:
7272
client = OpenSearch(
7373
http_auth=('admin', 'AJVFsGJBbpT6mChn'),
7474
hosts=[{
75-
'host': f'opensearch-1-nodes-default.{namespace}.svc.cluster.local',
75+
'host': f'opensearch-1-nodes-default-headless.{namespace}.svc.cluster.local',
7676
'port': 9200
7777
}],
7878
http_compress=True,

tests/templates/kuttl/backup-restore/23-create-data.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ data:
7272
client = OpenSearch(
7373
http_auth=('testuser', 'L9hUHtLVVEsrcLzZ'),
7474
hosts=[{
75-
'host': f'opensearch-1-nodes-default.{namespace}.svc.cluster.local',
75+
'host': f'opensearch-1-nodes-default-headless.{namespace}.svc.cluster.local',
7676
'port': 9200
7777
}],
7878
http_compress=True,

tests/templates/kuttl/backup-restore/30-create-snapshot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ data:
7070
7171
client = OpenSearch(
7272
hosts=[{
73-
'host': f'opensearch-1-nodes-default.{namespace}.svc.cluster.local',
73+
'host': f'opensearch-1-nodes-default-headless.{namespace}.svc.cluster.local',
7474
'port': 9200
7575
}],
7676
http_auth=('admin', 'AJVFsGJBbpT6mChn'),

tests/templates/kuttl/backup-restore/61-restore-snapshot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ data:
7070
7171
client = OpenSearch(
7272
hosts=[{
73-
'host': f'opensearch-2-nodes-default.{namespace}.svc.cluster.local',
73+
'host': f'opensearch-2-nodes-default-headless.{namespace}.svc.cluster.local',
7474
'port': 9200
7575
}],
7676
http_auth=('admin', 'AJVFsGJBbpT6mChn'),

tests/templates/kuttl/backup-restore/70-test-opensearch-2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ data:
7272
client = OpenSearch(
7373
http_auth=('testuser', 'L9hUHtLVVEsrcLzZ'),
7474
hosts=[{
75-
'host': f'opensearch-2-nodes-default.{namespace}.svc.cluster.local',
75+
'host': f'opensearch-2-nodes-default-headless.{namespace}.svc.cluster.local',
7676
'port': 9200
7777
}],
7878
http_compress=True,

tests/templates/kuttl/external-access/20-assert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ spec:
5757
apiVersion: v1
5858
kind: Service
5959
metadata:
60-
name: opensearch
60+
name: opensearch-discovery
6161
spec:
6262
type: ClusterIP

tests/templates/kuttl/ldap/30-test-opensearch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ data:
7777
7878
namespace = os.environ['NAMESPACE']
7979
80-
host = f'opensearch.{namespace}.svc.cluster.local'
80+
host = f'opensearch-nodes-default-headless.{namespace}.svc.cluster.local'
8181
port = 9200
8282
auth = ('integrationtest', 'integrationtest')
8383
ca_certs_path = '/stackable/tls/ca.crt'

0 commit comments

Comments
 (0)