Files
deployment-portal-be/scripts/add_flink_autoscaler_field.py
Ashvin S 1009012a4d INFRA-3988 | Ashvin | Add autoscaling to Flink (#1251)
* INFRA-3988 | Ashvin | Add autoscaling to Flink

Autoscaling will only be supported by Flink versions 1.18 and later.
Migration is done using the following command
```shell
find . -name "manifest*flink*" | xargs -I{} sh -c "jq -r '.flink.flinkDeployment.flinkConfiguration += {\"autoscaler\": { \"enabled\": false }}' {} | sponge {}"
```
Adds validation in JSON schema
Updates kutegen with autoscaler changes

* INFRA-3988 | Ashvin | Remove promgateway configuration from Flink

This field is not required now that we use servicemonitor to fetch the
metrics. Earlier pushgateway was used.

Command used to do the migration is
```shell
find . -name "kub*flink*" | xargs -I {} sh -c "sed -i 's/promgate//' {}"
```

* INFRA-3988 | Ashvin | Add max-parallelism in test fixtures

Command used
```shell
find . -name "kube*flink*json" | xargs -I{} sh -c "jq -r '. | .kubeObject.items |= map(if .kind == \"FlinkDeployment\" then .spec.flinkConfiguration += { \"pipeline.max-parallelism\": \"100\" } else . end)' {} | sponge {}"
```

* Revert "INFRA-3988 | Ashvin | Remove promgateway configuration from Flink"

This reverts commit 3ef63ad31a587814275d5bad6f6d467cf638a0b9.

* INFRA-3988 | Ashvin | Remove promgateway configuration from Flink

This field is not required now that we use servicemonitor to fetch the
metrics. Earlier pushgateway was used.

Command used to do the migration is
```shell
find . -name "*flink*json" | xargs -I {} sh -c "sed -i '/promgate/d' {}"
```

* INFRA-3988 | Add Flink autoscaler field to all manifests

Only Flink manifests will be effected by this migration

* INFRA-3988 | Ashvin | Update kutegen
2024-11-05 18:57:37 +05:30

33 lines
817 B
Python

import asyncio
from _migration_framework.abstract import AbstractMigration
class CustomMigration(AbstractMigration):
def migrate(self, manifest: dict) -> dict:
if 'type' in manifest and manifest['type'] == 'deployment':
return manifest
(manifest.setdefault('flink', {})
.setdefault('flinkDeployment', {})
.setdefault('flinkConfiguration', {})
.setdefault('autoscaler', {})
.setdefault('enabled', False))
return manifest
async def main():
migration = CustomMigration(
"https://deployment-portal-backend.np.navi-tech.in",
"",
# Dry run is enabled by default. Uncomment this line to disable dry run
# dry_run=False
)
await migration.run()
if __name__ == "__main__":
asyncio.run(main())