Skip to content

Commit 307f0ff

Browse files
committed
add migration support to the party allocator
[static] Signed-off-by: Nicu Reut <nicu.reut@digitalasset.com>
1 parent 67081ef commit 307f0ff

File tree

7 files changed

+88
-11
lines changed

7 files changed

+88
-11
lines changed

cluster/expected/validator-runbook/expected.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,11 @@
564564
"validatorApiUrl": "http://validator-app:5003"
565565
},
566566
"imageRepo": "us-central1-docker.pkg.dev/da-cn-shared/ghcr/digital-asset/decentralized-canton-sync-dev/docker",
567+
"pvc": {
568+
"name": "party-allocator-keys",
569+
"size": 100,
570+
"storageClassName": "standard-rwo"
571+
},
567572
"tolerations": [
568573
{
569574
"effect": "NoSchedule",

cluster/helm/splice-party-allocator/templates/party-allocator.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ spec:
5454
apiVersion: v1
5555
kind: PersistentVolumeClaim
5656
metadata:
57-
name: party-allocator-keys
57+
name: {{ .Values.pvc.name }}
5858
namespace: {{ $.Release.Namespace }}
5959
annotations:
6060
helm.sh/resource-policy: keep
@@ -63,8 +63,12 @@ spec:
6363
- ReadWriteOnce
6464
resources:
6565
requests:
66-
storage: 20G
66+
storage: {{ .Values.pvc.size }}
6767
storageClassName: {{ .Values.pvc.volumeStorageClass }}
68+
{{- with .Values.pvc.dataSource }}
69+
dataSource:
70+
{{- toYaml . | nindent 4 }}
71+
{{- end }}
6872
---
6973
apiVersion: v1
7074
kind: Service
@@ -77,8 +81,8 @@ spec:
7781
selector:
7882
app: {{ .Release.Name }}
7983
ports:
80-
- name: metrics
81-
port: 10013
84+
- name: metrics
85+
port: 10013
8286
---
8387
apiVersion: monitoring.coreos.com/v1
8488
kind: ServiceMonitor
@@ -89,11 +93,11 @@ metadata:
8993
namespace: {{ .Release.Namespace }}
9094
spec:
9195
endpoints:
92-
- port: metrics
93-
interval: {{ .Values.metrics.interval }}
96+
- port: metrics
97+
interval: {{ .Values.metrics.interval }}
9498
selector:
9599
matchLabels:
96100
app: {{ .Release.Name }}
97101
namespaceSelector:
98102
matchNames:
99-
- {{ .Release.Namespace }}
103+
- {{ .Release.Namespace }}

cluster/helm/splice-party-allocator/values-template.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
imageRepo: "ghcr.io/digital-asset/decentralized-canton-sync/docker"
55

66
pvc:
7+
name: party-allocator-keys
78
volumeStorageClass: standard-rwo
9+
size: 20Gi
810

911
metrics:
1012
release: prometheus-grafana-monitoring

cluster/pulumi/common-validator/src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export const PartyAllocatorConfigSchema = z.object({
111111
maxParties: z.number().default(1000000),
112112
preapprovalRetries: z.number().default(120),
113113
preapprovalRetryDelayMs: z.number().default(1000),
114+
pvcSize: z.number().default(100),
114115
});
115116
export type PartyAllocatorConfig = z.infer<typeof PartyAllocatorConfigSchema>;
116117

cluster/pulumi/common/src/storage/storageClass.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,11 @@ export const standardStorageClassName = hyperdiskSupportConfig.hyperdiskSupport.
66
? 'hyperdisk-standard-rwo'
77
: 'standard-rwo';
88

9+
export const infraStandardStorageClassName = hyperdiskSupportConfig.hyperdiskSupport.enabled
10+
? 'hyperdisk-standard-rwo'
11+
: 'standard-rwo';
12+
13+
export const infraPremiumStorageClassName = hyperdiskSupportConfig.hyperdiskSupport.enabled
14+
? 'hyperdisk-balanced-rwo'
15+
: 'premium-rwo';
916
export const pvcSuffix = hyperdiskSupportConfig.hyperdiskSupport.enabled ? 'hd-pvc' : 'pvc';

cluster/pulumi/infra/src/observability.ts

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ import {
1111
CLUSTER_NAME,
1212
clusterProdLike,
1313
commandScriptPath,
14+
createVolumeSnapshot,
1415
ExactNamespace,
1516
GCP_PROJECT,
1617
GrafanaKeys,
1718
HELM_MAX_HISTORY_SIZE,
1819
infraAffinityAndTolerations,
20+
infraPremiumStorageClassName,
21+
infraStandardStorageClassName,
1922
isMainNet,
2023
loadTesterConfig,
2124
ObservabilityReleaseName,
@@ -32,6 +35,7 @@ import { local } from '@pulumi/command';
3235
import { getSecretVersionOutput } from '@pulumi/gcp/secretmanager/getSecretVersion';
3336
import { Input } from '@pulumi/pulumi';
3437

38+
import { hyperdiskSupportConfig } from '../../common/src/config/hyperdiskSupportConfig';
3539
import {
3640
clusterIsResetPeriodically,
3741
enableAlertEmailToSupportTeam,
@@ -91,9 +95,9 @@ const grafanaExternalUrl = `https://grafana.${CLUSTER_HOSTNAME}`;
9195
const alertManagerExternalUrl = `https://alertmanager.${CLUSTER_HOSTNAME}`;
9296
const prometheusExternalUrl = `https://prometheus.${CLUSTER_HOSTNAME}`;
9397
const shouldIgnoreNoDataOrDataSourceError = clusterIsResetPeriodically;
98+
const namespaceName = 'observability';
9499

95100
export function configureObservability(dependsOn: pulumi.Resource[] = []): pulumi.Resource {
96-
const namespaceName = 'observability';
97101
const namespace = new k8s.core.v1.Namespace(
98102
namespaceName,
99103
{
@@ -116,6 +120,7 @@ export function configureObservability(dependsOn: pulumi.Resource[] = []): pulum
116120
const prometheusStackCrdVersion = '0.85.0';
117121
const postgres = installPostgres({ ns: namespace, logicalName: namespaceName });
118122
const adminPassword = grafanaKeysFromSecret().adminPassword;
123+
const migrationSnapshots = getVolumeSnapshotsForHyperdiskMigration();
119124
const prometheusStack = new k8s.helm.v3.Release(
120125
'observability-metrics',
121126
{
@@ -205,13 +210,14 @@ export function configureObservability(dependsOn: pulumi.Resource[] = []): pulum
205210
storage: {
206211
volumeClaimTemplate: {
207212
spec: {
208-
storageClassName: 'standard-rwo',
213+
storageClassName: infraStandardStorageClassName,
209214
accessModes: ['ReadWriteOnce'],
210215
resources: {
211216
requests: {
212217
storage: '5Gi',
213218
},
214219
},
220+
...(migrationSnapshots.alertManager ? migrationSnapshots.alertManager : {}),
215221
},
216222
},
217223
},
@@ -266,13 +272,14 @@ export function configureObservability(dependsOn: pulumi.Resource[] = []): pulum
266272
storageSpec: {
267273
volumeClaimTemplate: {
268274
spec: {
269-
storageClassName: 'premium-rwo',
275+
storageClassName: infraPremiumStorageClassName,
270276
accessModes: ['ReadWriteOnce'],
271277
resources: {
272278
requests: {
273279
storage: infraConfig.prometheus.storageSize,
274280
},
275281
},
282+
...(migrationSnapshots.prometheus ? migrationSnapshots.prometheus : {}),
276283
},
277284
},
278285
},
@@ -398,7 +405,7 @@ export function configureObservability(dependsOn: pulumi.Resource[] = []): pulum
398405
type: 'Recreate',
399406
},
400407
persistence: {
401-
enabled: true,
408+
enabled: !hyperdiskSupportConfig.hyperdiskSupport.migratingInfra,
402409
type: 'pvc',
403410
accessModes: ['ReadWriteOnce'],
404411
size: '5Gi',
@@ -1065,3 +1072,30 @@ function installPostgres(namespace: ExactNamespace): SplicePostgres {
10651072
true // useInfraAffinityAndTolerations
10661073
);
10671074
}
1075+
1076+
function getVolumeSnapshotsForHyperdiskMigration() {
1077+
if (hyperdiskSupportConfig.hyperdiskSupport.migratingInfra) {
1078+
const { dataSource: prometheusDataSource } = createVolumeSnapshot({
1079+
resourceName: `prometheus-hd-migration-snapshot`,
1080+
snapshotName: `prometheus-migration-snapshot`,
1081+
namespace: namespaceName,
1082+
pvcName: `prometheus-prometheus-prometheus-db-prometheus-prometheus-prometheus-0`,
1083+
});
1084+
const { dataSource: alertManagerDataSource } = createVolumeSnapshot({
1085+
resourceName: `alertmanager-hd-migration-snapshot`,
1086+
snapshotName: `alertmanager-migration-snapshot`,
1087+
namespace: namespaceName,
1088+
pvcName: `alertmanager-prometheus-alertmanager-db-alertmanager-prometheus-alertmanager-0`,
1089+
});
1090+
return {
1091+
prometheus: {
1092+
dataSource: prometheusDataSource,
1093+
},
1094+
alertManager: {
1095+
dataSource: alertManagerDataSource,
1096+
},
1097+
};
1098+
} else {
1099+
return {};
1100+
}
1101+
}

cluster/pulumi/validator-runbook/src/partyAllocator.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,34 @@ import * as pulumi from '@pulumi/pulumi';
44
import {
55
activeVersion,
66
CnInput,
7+
createVolumeSnapshot,
78
DecentralizedSynchronizerUpgradeConfig,
89
ExactNamespace,
910
InstalledHelmChart,
1011
installSpliceHelmChart,
12+
standardStorageClassName,
1113
} from '@lfdecentralizedtrust/splice-pulumi-common';
1214
import { PartyAllocatorConfig } from '@lfdecentralizedtrust/splice-pulumi-common-validator';
1315

16+
import { hyperdiskSupportConfig } from '../../common/src/config/hyperdiskSupportConfig';
17+
1418
export function installPartyAllocator(
1519
xns: ExactNamespace,
1620
config: PartyAllocatorConfig,
1721
dependsOn: CnInput<pulumi.Resource>[]
1822
): InstalledHelmChart {
23+
const dataSource =
24+
hyperdiskSupportConfig.hyperdiskSupport.enabled &&
25+
hyperdiskSupportConfig.hyperdiskSupport.migrating
26+
? {
27+
dataSource: createVolumeSnapshot({
28+
resourceName: `party-allocator-keys-migration-snapshot`,
29+
snapshotName: `party-allocator-keys-snapshot`,
30+
namespace: xns.logicalName,
31+
pvcName: `party-allocator-keys`,
32+
}).dataSource,
33+
}
34+
: {};
1935
return installSpliceHelmChart(
2036
xns,
2137
'party-allocator',
@@ -33,6 +49,14 @@ export function installPartyAllocator(
3349
preapprovalRetries: config.preapprovalRetries,
3450
preapprovalRetryDelayMs: config.preapprovalRetryDelayMs,
3551
},
52+
pvc: {
53+
size: config.pvcSize,
54+
storageClassName: standardStorageClassName,
55+
name: hyperdiskSupportConfig.hyperdiskSupport.enabled
56+
? 'party-allocator-keys-hd-pvc'
57+
: 'party-allocator-keys',
58+
...dataSource,
59+
},
3660
},
3761
activeVersion,
3862
{ dependsOn }

0 commit comments

Comments
 (0)