diff --git a/api/v1/ytsaurus_types.go b/api/v1/ytsaurus_types.go index ed769f78..33062230 100644 --- a/api/v1/ytsaurus_types.go +++ b/api/v1/ytsaurus_types.go @@ -92,6 +92,14 @@ type LocationSpec struct { // Disk space quota, default is size of related volume. //+optional Quota *resource.Quantity `json:"quota,omitempty"` + // Location watermark threshold in percents of volume size. + //+kubebuilder:default:=10 + //+kubebuilder:validation:Minimum:=1 + //+kubebuilder:validation:Maximum:=50 + Watermark int32 `json:"watermark,omitempty"` + // Max TTL of trash in milliseconds. + //+kubebuilder:validation:Minimum:=60000 + MaxTrashMilliseconds *int64 `json:"maxTrashMilliseconds,omitempty"` } // LogLevel string describes possible Ytsaurus logging level. diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index a3690272..3e4d356c 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -775,6 +775,11 @@ func (in *LocationSpec) DeepCopyInto(out *LocationSpec) { x := (*in).DeepCopy() *out = &x } + if in.MaxTrashMilliseconds != nil { + in, out := &in.MaxTrashMilliseconds, &out.MaxTrashMilliseconds + *out = new(int64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocationSpec. diff --git a/config/crd/bases/cluster.ytsaurus.tech_remoteexecnodes.yaml b/config/crd/bases/cluster.ytsaurus.tech_remoteexecnodes.yaml index e1b99826..15b8568a 100644 --- a/config/crd/bases/cluster.ytsaurus.tech_remoteexecnodes.yaml +++ b/config/crd/bases/cluster.ytsaurus.tech_remoteexecnodes.yaml @@ -883,6 +883,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -896,6 +901,14 @@ spec: description: Disk space quota, default is size of related volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of volume + size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: diff --git a/config/crd/bases/cluster.ytsaurus.tech_remoteytsaurus.yaml b/config/crd/bases/cluster.ytsaurus.tech_remoteytsaurus.yaml index bf98fbee..5640f7cb 100644 --- a/config/crd/bases/cluster.ytsaurus.tech_remoteytsaurus.yaml +++ b/config/crd/bases/cluster.ytsaurus.tech_remoteytsaurus.yaml @@ -664,6 +664,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -677,6 +682,14 @@ spec: description: Disk space quota, default is size of related volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of volume + size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: diff --git a/config/crd/bases/cluster.ytsaurus.tech_ytsaurus.yaml b/config/crd/bases/cluster.ytsaurus.tech_ytsaurus.yaml index 445684ec..58b62ad6 100644 --- a/config/crd/bases/cluster.ytsaurus.tech_ytsaurus.yaml +++ b/config/crd/bases/cluster.ytsaurus.tech_ytsaurus.yaml @@ -777,6 +777,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -791,6 +796,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -3132,6 +3145,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -3146,6 +3164,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents + of volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -5499,6 +5525,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -5513,6 +5544,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -8040,6 +8079,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -8054,6 +8098,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents + of volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -10435,6 +10487,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -10449,6 +10506,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents + of volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -12842,6 +12907,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -12856,6 +12926,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -15245,6 +15323,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -15259,6 +15342,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -17602,6 +17693,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -17616,6 +17712,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -19948,6 +20052,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -19962,6 +20071,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -22301,6 +22418,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -22315,6 +22437,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents + of volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -24690,6 +24820,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -24704,6 +24839,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -27051,6 +27194,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -27065,6 +27213,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents + of volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -29477,6 +29633,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -29491,6 +29652,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents + of volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -31850,6 +32019,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -31864,6 +32038,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents + of volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -34425,6 +34607,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -34439,6 +34626,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: diff --git a/docs/api.md b/docs/api.md index c5ba9a90..9d3fe533 100644 --- a/docs/api.md +++ b/docs/api.md @@ -679,6 +679,8 @@ _Appears in:_ | `path` _string_ | | | MinLength: 1
| | `medium` _string_ | | default | | | `quota` _[Quantity](#quantity)_ | Disk space quota, default is size of related volume. | | | +| `watermark` _integer_ | Location watermark threshold in percents of volume size. | 10 | Maximum: 50
Minimum: 1
| +| `maxTrashMilliseconds` _integer_ | Max TTL of trash in milliseconds. | | Minimum: 60000
| #### LocationType diff --git a/pkg/ytconfig/canondata/TestGetDataNodeConfig/with-trash-ttl/test.canondata b/pkg/ytconfig/canondata/TestGetDataNodeConfig/with-trash-ttl/test.canondata new file mode 100644 index 00000000..1e02c184 --- /dev/null +++ b/pkg/ytconfig/canondata/TestGetDataNodeConfig/with-trash-ttl/test.canondata @@ -0,0 +1,135 @@ +{ + "address_resolver"={ + "enable_ipv4"=%true; + "enable_ipv6"=%false; + retries=1000; + }; + "solomon_exporter"={ + host="{POD_SHORT_HOSTNAME}"; + "instance_tags"={ + pod="{K8S_POD_NAME}"; + }; + }; + logging={ + writers={ + info={ + type=file; + "file_name"="/var/log/data-node.info.log"; + format="plain_text"; + "enable_system_messages"=%true; + }; + stderr={ + type=stderr; + format="plain_text"; + "enable_system_messages"=%true; + }; + }; + rules=[ + { + "min_level"=info; + writers=[ + info; + ]; + family="plain_text"; + }; + { + "min_level"=error; + writers=[ + stderr; + ]; + family="plain_text"; + }; + ]; + "flush_period"=3000; + }; + "monitoring_port"=10012; + "rpc_port"=9012; + "timestamp_provider"={ + addresses=[ + "ms-test-0.masters-test.fake.svc.fake.zone:9010"; + ]; + }; + "cluster_connection"={ + "cluster_name"=test; + "primary_master"={ + addresses=[ + "ms-test-0.masters-test.fake.svc.fake.zone:9010"; + ]; + peers=[ + { + address="ms-test-0.masters-test.fake.svc.fake.zone:9010"; + voting=%true; + }; + ]; + "cell_id"="65726e65-ad6b7562-259-79747361"; + }; + "discovery_connection"={ + addresses=[ + "ds-test-0.discovery-test.fake.svc.fake.zone:9020"; + "ds-test-1.discovery-test.fake.svc.fake.zone:9020"; + "ds-test-2.discovery-test.fake.svc.fake.zone:9020"; + ]; + }; + "master_cache"={ + addresses=[ + "msc-test-0.master-caches-test.fake.svc.fake.zone:9018"; + "msc-test-1.master-caches-test.fake.svc.fake.zone:9018"; + "msc-test-2.master-caches-test.fake.svc.fake.zone:9018"; + ]; + "cell_id"="65726e65-ad6b7562-259-79747361"; + "enable_master_cache_discovery"=%false; + }; + }; + "cypress_annotations"={ + "k8s_node_name"="{K8S_NODE_NAME}"; + "k8s_pod_name"="{K8S_POD_NAME}"; + "k8s_pod_namespace"="{K8S_POD_NAMESPACE}"; + "physical_host"="{K8S_NODE_NAME}"; + }; + flavors=[ + data; + ]; + "resource_limits"={ + "total_memory"=5368709120; + "total_cpu"=0.000000; + "node_dedicated_cpu"=0.000000; + }; + tags=[ + "rack:xn-a"; + ]; + rack=fake; + "skynet_http_port"=11012; + "data_node"={ + "store_locations"=[ + { + path="/yt/hdd1/chunk-store"; + "medium_name"=nvme; + quota=10737418240; + "high_watermark"=2684354560; + "low_watermark"=5368709120; + "disable_writes_watermark"=1342177280; + "trash_cleanup_watermark"=5368709120; + "max_trash_ttl"=60000; + }; + ]; + "cache_locations"=[ + ]; + "block_cache"={ + "compressed_data"={ + capacity=0; + }; + "uncompressed_data"={ + capacity=0; + }; + }; + "blocks_ext_cache"={ + capacity=0; + }; + "chunk_meta_cache"={ + capacity=0; + }; + "block_meta_cache"={ + capacity=0; + }; + }; +} \ No newline at end of file diff --git a/pkg/ytconfig/canondata/TestGetDataNodeConfig/with-watermark/test.canondata b/pkg/ytconfig/canondata/TestGetDataNodeConfig/with-watermark/test.canondata new file mode 100644 index 00000000..00369b95 --- /dev/null +++ b/pkg/ytconfig/canondata/TestGetDataNodeConfig/with-watermark/test.canondata @@ -0,0 +1,134 @@ +{ + "address_resolver"={ + "enable_ipv4"=%true; + "enable_ipv6"=%false; + retries=1000; + }; + "solomon_exporter"={ + host="{POD_SHORT_HOSTNAME}"; + "instance_tags"={ + pod="{K8S_POD_NAME}"; + }; + }; + logging={ + writers={ + info={ + type=file; + "file_name"="/var/log/data-node.info.log"; + format="plain_text"; + "enable_system_messages"=%true; + }; + stderr={ + type=stderr; + format="plain_text"; + "enable_system_messages"=%true; + }; + }; + rules=[ + { + "min_level"=info; + writers=[ + info; + ]; + family="plain_text"; + }; + { + "min_level"=error; + writers=[ + stderr; + ]; + family="plain_text"; + }; + ]; + "flush_period"=3000; + }; + "monitoring_port"=10012; + "rpc_port"=9012; + "timestamp_provider"={ + addresses=[ + "ms-test-0.masters-test.fake.svc.fake.zone:9010"; + ]; + }; + "cluster_connection"={ + "cluster_name"=test; + "primary_master"={ + addresses=[ + "ms-test-0.masters-test.fake.svc.fake.zone:9010"; + ]; + peers=[ + { + address="ms-test-0.masters-test.fake.svc.fake.zone:9010"; + voting=%true; + }; + ]; + "cell_id"="65726e65-ad6b7562-259-79747361"; + }; + "discovery_connection"={ + addresses=[ + "ds-test-0.discovery-test.fake.svc.fake.zone:9020"; + "ds-test-1.discovery-test.fake.svc.fake.zone:9020"; + "ds-test-2.discovery-test.fake.svc.fake.zone:9020"; + ]; + }; + "master_cache"={ + addresses=[ + "msc-test-0.master-caches-test.fake.svc.fake.zone:9018"; + "msc-test-1.master-caches-test.fake.svc.fake.zone:9018"; + "msc-test-2.master-caches-test.fake.svc.fake.zone:9018"; + ]; + "cell_id"="65726e65-ad6b7562-259-79747361"; + "enable_master_cache_discovery"=%false; + }; + }; + "cypress_annotations"={ + "k8s_node_name"="{K8S_NODE_NAME}"; + "k8s_pod_name"="{K8S_POD_NAME}"; + "k8s_pod_namespace"="{K8S_POD_NAMESPACE}"; + "physical_host"="{K8S_NODE_NAME}"; + }; + flavors=[ + data; + ]; + "resource_limits"={ + "total_memory"=5368709120; + "total_cpu"=0.000000; + "node_dedicated_cpu"=0.000000; + }; + tags=[ + "rack:xn-a"; + ]; + rack=fake; + "skynet_http_port"=11012; + "data_node"={ + "store_locations"=[ + { + path="/yt/hdd1/chunk-store"; + "medium_name"=nvme; + quota=107374182400; + "high_watermark"=10737418240; + "low_watermark"=21474836480; + "disable_writes_watermark"=5368709120; + "trash_cleanup_watermark"=21474836480; + }; + ]; + "cache_locations"=[ + ]; + "block_cache"={ + "compressed_data"={ + capacity=0; + }; + "uncompressed_data"={ + capacity=0; + }; + }; + "blocks_ext_cache"={ + capacity=0; + }; + "chunk_meta_cache"={ + capacity=0; + }; + "block_meta_cache"={ + capacity=0; + }; + }; +} \ No newline at end of file diff --git a/pkg/ytconfig/canondata/TestGetDataNodeConfig/test.canondata b/pkg/ytconfig/canondata/TestGetDataNodeConfig/without-trash-ttl/test.canondata similarity index 94% rename from pkg/ytconfig/canondata/TestGetDataNodeConfig/test.canondata rename to pkg/ytconfig/canondata/TestGetDataNodeConfig/without-trash-ttl/test.canondata index 1e693909..c9b66c39 100644 --- a/pkg/ytconfig/canondata/TestGetDataNodeConfig/test.canondata +++ b/pkg/ytconfig/canondata/TestGetDataNodeConfig/without-trash-ttl/test.canondata @@ -105,9 +105,10 @@ path="/yt/hdd1/chunk-store"; "medium_name"=nvme; quota=10737418240; - "high_watermark"=536870912; - "low_watermark"=1073741824; - "disable_writes_watermark"=268435456; + "high_watermark"=2684354560; + "low_watermark"=5368709120; + "disable_writes_watermark"=1342177280; + "trash_cleanup_watermark"=5368709120; }; ]; "cache_locations"=[ diff --git a/pkg/ytconfig/canondata/TestGetDataNodeWithoutYtsaurusConfig/test.canondata b/pkg/ytconfig/canondata/TestGetDataNodeWithoutYtsaurusConfig/test.canondata index cd14a7bb..a83c19d4 100644 --- a/pkg/ytconfig/canondata/TestGetDataNodeWithoutYtsaurusConfig/test.canondata +++ b/pkg/ytconfig/canondata/TestGetDataNodeWithoutYtsaurusConfig/test.canondata @@ -114,9 +114,10 @@ path="/yt/hdd1/chunk-store"; "medium_name"=nvme; quota=10737418240; - "high_watermark"=536870912; - "low_watermark"=1073741824; - "disable_writes_watermark"=268435456; + "high_watermark"=2684354560; + "low_watermark"=5368709120; + "disable_writes_watermark"=1342177280; + "trash_cleanup_watermark"=5368709120; }; ]; "cache_locations"=[ diff --git a/pkg/ytconfig/generator_test.go b/pkg/ytconfig/generator_test.go index cb24edcd..77ebac4c 100644 --- a/pkg/ytconfig/generator_test.go +++ b/pkg/ytconfig/generator_test.go @@ -56,6 +56,21 @@ var ( Path: "/yt/hdd1/chunk-store", Medium: "nvme", } + testMaxTrashMilliseconds int64 = 60000 + testLocationChunkStoreMaxTrash = ytv1.LocationSpec{ + LocationType: "ChunkStore", + Path: "/yt/hdd1/chunk-store", + Medium: "nvme", + MaxTrashMilliseconds: &testMaxTrashMilliseconds, + } + testLocationChunkStoreQuota = resource.MustParse("100Gi") + testLocationChunkStoreWatermark = ytv1.LocationSpec{ + LocationType: "ChunkStore", + Path: "/yt/hdd1/chunk-store", + Medium: "nvme", + Quota: &testLocationChunkStoreQuota, + Watermark: 20, + } testLocationChunkCache = ytv1.LocationSpec{ LocationType: "ChunkCache", Path: "/yt/hdd1/chunk-cache", @@ -116,10 +131,28 @@ func TestGetControllerAgentsConfig(t *testing.T) { } func TestGetDataNodeConfig(t *testing.T) { - g := NewLocalNodeGenerator(getYtsaurusWithEverything(), testClusterDomain) - cfg, err := g.GetDataNodeConfig(getDataNodeSpec()) - require.NoError(t, err) - canonize.Assert(t, cfg) + cases := map[string]struct { + Location ytv1.LocationSpec + }{ + "without-trash-ttl": { + Location: testLocationChunkStore, + }, + "with-trash-ttl": { + Location: testLocationChunkStoreMaxTrash, + }, + "with-watermark": { + Location: testLocationChunkStoreWatermark, + }, + } + + for name, test := range cases { + t.Run(name, func(t *testing.T) { + g := NewLocalNodeGenerator(getYtsaurusWithEverything(), testClusterDomain) + cfg, err := g.GetDataNodeConfig(getDataNodeSpec(test.Location)) + require.NoError(t, err) + canonize.Assert(t, cfg) + }) + } } func TestGetDataNodeWithoutYtsaurusConfig(t *testing.T) { @@ -130,7 +163,7 @@ func TestGetDataNodeWithoutYtsaurusConfig(t *testing.T) { getMasterConnectionSpecWithFixedMasterHosts(), getMasterCachesSpecWithFixedHosts(), ) - cfg, err := g.GetDataNodeConfig(getDataNodeSpec()) + cfg, err := g.GetDataNodeConfig(getDataNodeSpec(testLocationChunkStore)) require.NoError(t, err) canonize.Assert(t, cfg) } @@ -599,13 +632,13 @@ func withFixedMasterCachesHosts(ytsaurus *ytv1.Ytsaurus) *ytv1.Ytsaurus { return ytsaurus } -func getDataNodeSpec() ytv1.DataNodesSpec { +func getDataNodeSpec(locations ...ytv1.LocationSpec) ytv1.DataNodesSpec { return ytv1.DataNodesSpec{ InstanceSpec: ytv1.InstanceSpec{ InstanceCount: 20, MonitoringPort: ptr.Int32(consts.DataNodeMonitoringPort), Resources: testResourceReqs, - Locations: []ytv1.LocationSpec{testLocationChunkStore}, + Locations: locations, VolumeMounts: testVolumeMounts, VolumeClaimTemplates: testVolumeClaimTemplates, }, diff --git a/pkg/ytconfig/node.go b/pkg/ytconfig/node.go index d5061ff3..866865cb 100644 --- a/pkg/ytconfig/node.go +++ b/pkg/ytconfig/node.go @@ -33,6 +33,8 @@ type StoreLocation struct { HighWatermark int64 `yson:"high_watermark,omitempty"` LowWatermark int64 `yson:"low_watermark,omitempty"` DisableWritesWatermark int64 `yson:"disable_writes_watermark,omitempty"` + TrashCleanupWatermark int64 `yson:"trash_cleanup_watermark"` + MaxTrashTtl *int64 `yson:"max_trash_ttl,omitempty"` } type ResourceLimits struct { @@ -325,9 +327,11 @@ func getDataNodeServerCarcass(spec *ytv1.DataNodesSpec) (DataNodeServer, error) // These are just simple heuristics. gb := float64(1024 * 1024 * 1024) - storeLocation.LowWatermark = int64(math.Min(0.1*float64(storeLocation.Quota), float64(5)*gb)) + storeLocation.LowWatermark = int64(math.Max(float64(location.Watermark)/100*float64(storeLocation.Quota), float64(5)*gb)) storeLocation.HighWatermark = storeLocation.LowWatermark / 2 storeLocation.DisableWritesWatermark = storeLocation.HighWatermark / 2 + storeLocation.TrashCleanupWatermark = storeLocation.LowWatermark + storeLocation.MaxTrashTtl = location.MaxTrashMilliseconds } c.DataNode.StoreLocations = append(c.DataNode.StoreLocations, storeLocation) } diff --git a/ytop-chart/templates/remoteexecnodes-crd.yaml b/ytop-chart/templates/remoteexecnodes-crd.yaml index c69d6f9c..5078d7ea 100644 --- a/ytop-chart/templates/remoteexecnodes-crd.yaml +++ b/ytop-chart/templates/remoteexecnodes-crd.yaml @@ -867,6 +867,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -880,6 +885,14 @@ spec: description: Disk space quota, default is size of related volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of volume + size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: diff --git a/ytop-chart/templates/remoteytsaurus-crd.yaml b/ytop-chart/templates/remoteytsaurus-crd.yaml index 0a892141..a6a06979 100644 --- a/ytop-chart/templates/remoteytsaurus-crd.yaml +++ b/ytop-chart/templates/remoteytsaurus-crd.yaml @@ -648,6 +648,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -661,6 +666,14 @@ spec: description: Disk space quota, default is size of related volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of volume + size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: diff --git a/ytop-chart/templates/ytsaurus-crd.yaml b/ytop-chart/templates/ytsaurus-crd.yaml index e7eac2ca..24a3f82c 100644 --- a/ytop-chart/templates/ytsaurus-crd.yaml +++ b/ytop-chart/templates/ytsaurus-crd.yaml @@ -787,6 +787,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -801,6 +806,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of volume + size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -3120,6 +3133,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -3134,6 +3152,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -5477,6 +5503,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -5491,6 +5522,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of volume + size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -7996,6 +8035,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -8010,6 +8054,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -10378,6 +10430,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -10392,6 +10449,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -12775,6 +12840,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -12789,6 +12859,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of volume + size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -15159,6 +15237,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -15173,6 +15256,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of volume + size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -17497,6 +17588,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -17511,6 +17607,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of volume + size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -19824,6 +19928,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -19838,6 +19947,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of volume + size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -22155,6 +22272,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -22169,6 +22291,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -24534,6 +24664,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -24548,6 +24683,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of volume + size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -26873,6 +27016,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -26887,6 +27035,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -29286,6 +29442,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -29300,6 +29461,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -31646,6 +31815,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -31660,6 +31834,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of + volume size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: @@ -34209,6 +34391,11 @@ spec: description: LocationType string describes types of disk locations for YT components. type: string + maxTrashMilliseconds: + description: Max TTL of trash in milliseconds. + format: int64 + minimum: 60000 + type: integer medium: default: default type: string @@ -34223,6 +34410,14 @@ spec: volume. pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true + watermark: + default: 10 + description: Location watermark threshold in percents of volume + size. + format: int32 + maximum: 50 + minimum: 1 + type: integer type: object type: array loggers: