Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(containers): refactor deployment #754

Draft
wants to merge 17 commits into
base: feature/application-management
Choose a base branch
from

Conversation

lusergit
Copy link
Collaborator

@lusergit lusergit commented Dec 4, 2024

The PR aims to refactor the deployment infrastructure. This should have various benefits:

  • better device status rapresentation: each resource deployed on the device is rapresenetd trough an appropriate Deploy resource (e.g. Image -> Image.Deployment)
  • better deployment states: each Deployment resource is a state machine that allows transitions based on the semantics of the states
  • better overall status rapresentation: querying the status of the deployment could return the collective status of each Deployment resource
  • ... more to come

@lusergit
Copy link
Collaborator Author

lusergit commented Dec 4, 2024

Tests will not pass for now as the infrastructure is not complete yet

@lusergit lusergit force-pushed the chore/refactor-deployment branch 4 times, most recently from aeb462f to a7b9556 Compare December 5, 2024 14:27
@lusergit lusergit marked this pull request as ready for review December 5, 2024 14:36
@lusergit lusergit force-pushed the chore/refactor-deployment branch 2 times, most recently from 7d244f6 to dbd3464 Compare December 5, 2024 16:39
@lusergit lusergit marked this pull request as draft December 6, 2024 09:28
```
mix ash.gen.resource Edgehog.Containers.Image.Deployment \
    --default-actions read,create,update,destroy \
    --uuid-primary-key id \
    --attribute pulled:boolean:required:public \
    --relationship belongs_to:image:Edgehog.Containers.Image \
    --relationship belongs_to:device:Edgehog.Devices.Device \
    --timestamps
```

Signed-off-by: Luca Zaninotto <[email protected]>
```
mix ash.gen.resource Edgehog.Containers.Container.Deployment
     --default-actions read,create,update,destroy
     --uuid-primary-key id
     --attribute status:Edgehog.Containers.Container.Status:required:public
     --relationship belongs_to:container:Edgehog.Containers.Container
     --relationship belongs_to:device:Edgehog.Devices.Device
     --timestamps
```

Signed-off-by: Luca Zaninotto <[email protected]>
```
mix ash.gen.resource Edgehog.Containers.Network.Deployment
    --default-actions read,create,update,destroy
    --uuid-primary-key id
    --attribute created:boolean:required:public
    --relationship belongs_to:container:Edgehog.Containers.Network
    --relationship belongs_to:device:Edgehog.Devices.Device
    --timestamps
```

Signed-off-by: Luca Zaninotto <[email protected]>
```
mix ash.gen.resource Edgehog.Containers.Volume.Deployment
    --default-actions read,create,update,destroy
    --uuid-primary-key id
    --attribute created:boolean:required:public
    --relationship belongs_to:container:Edgehog.Containers.Volume
    --relationship belongs_to:device:Edgehog.Devices.Device
    --timestamps
```

Signed-off-by: Luca Zaninotto <[email protected]>
moving containers resources to appropriate subfolders, refactoring
according to the rest of the project structure

Signed-off-by: Luca Zaninotto <[email protected]>
Setting up generated resources

Signed-off-by: Luca Zaninotto <[email protected]>
plugging refactor into existing architecture

Signed-off-by: Luca Zaninotto <[email protected]>
The `.Deployment` module of each container resource (images, networks,
etc.) use the `AshStateMachine` extension

Signed-off-by: Luca Zaninotto <[email protected]>
`handle_trigger` handlers for images, networks, volumes and containers
now work with deployments

Signed-off-by: Luca Zaninotto <[email protected]>
generated migrations for the new structure and resources with
```
mix ash_postgers.gen_migrations containers_refactor
```

Signed-off-by: Luca Zaninotto <[email protected]>
some tests had no more reason to exist

Signed-off-by: Luca Zaninotto <[email protected]>
```
mix ash.gen.resource Edgehog.Containers.ReleaseNetworks
--relationship belongs_to:release:Edgehog.Containers.Release:primary_key
--relationship belongs_to:network:Edgehog.Containers.Network:primary_key
--uuid-primary-key id --timestamps
```

Signed-off-by: Luca Zaninotto <[email protected]>
Networks are related to releases instead of single containers

Signed-off-by: Luca Zaninotto <[email protected]>
Networks deployment is now demamded to the release and not to the single
container anymore

Signed-off-by: Luca Zaninotto <[email protected]>
`mix ash_postgres.gen_migrations networks_moved_to_releases`

Signed-off-by: Luca Zaninotto <[email protected]>
adjusted fixtures and tests to accomodate for the new flow and
architecture

Signed-off-by: Luca Zaninotto <[email protected]>
@lusergit lusergit force-pushed the chore/refactor-deployment branch 3 times, most recently from acd3ce3 to 4834683 Compare December 16, 2024 16:20
@lusergit lusergit force-pushed the chore/refactor-deployment branch 3 times, most recently from 837226a to 21640d9 Compare December 20, 2024 13:04
@lusergit lusergit force-pushed the chore/refactor-deployment branch from 21640d9 to 2680b1e Compare December 20, 2024 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant