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

compute service hash with a default DeployConfig #10621

Merged
merged 1 commit into from
May 26, 2023
Merged

compute service hash with a default DeployConfig #10621

merged 1 commit into from
May 26, 2023

Conversation

ndeloof
Copy link
Contributor

@ndeloof ndeloof commented May 25, 2023

What I did
as we compute service hash to compare actual vs expected state, always consider a default DeployConfig as passing --scale service=N will create one, even if the compose.yaml config doesn't define such a section

how to test:

services:
  test:
    image: alpine
    command: ping localhost
 $ docker compose up -d
[+] Building 0.0s (0/0)                                                                                                                                
[+] Running 1/1
 ✔ Container truc-test-1  Started                                                                                                                 0.2s 
 $ docker compose up --scale test=2 -d
[+] Building 0.0s (0/0)                                                                                                                                
[+] Running 2/2
 ✔ Container truc-test-1  Recreated                                                                                                             10.2s 
 ✔ Container truc-test-2  Started 

container test-1 MUST not be re-created

with this PR:

 $ docker compose up -d
[+] Building 0.0s (0/0)                                                                                                                                
[+] Running 1/1
 ✔ Container truc-test-1  Started                                                                                                                 0.2s 
 $ docker compose up --scale test=2 -d
[+] Building 0.0s (0/0)                                                                                                                                
[+] Running 2/2
 ✔ Container truc-test-1  Running                                                                                                                0.0s 
 ✔ Container truc-test-2  Started 

@ndeloof ndeloof requested review from a team, nicksieger, StefanScherer, ulyssessouza, glours, milas and laurazard and removed request for a team May 25, 2023 14:26
@ndeloof
Copy link
Contributor Author

ndeloof commented May 25, 2023

While this would be a significant effort, I wonder we should stop using service hash, but use container inspect to compare the actual vs expected state

@codecov
Copy link

codecov bot commented May 25, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.02 ⚠️

Comparison is base (42cd961) 59.57% compared to head (d3f145a) 59.55%.

Additional details and impacted files
@@            Coverage Diff             @@
##               v2   #10621      +/-   ##
==========================================
- Coverage   59.57%   59.55%   -0.02%     
==========================================
  Files         107      107              
  Lines        9437     9438       +1     
==========================================
- Hits         5622     5621       -1     
- Misses       3239     3241       +2     
  Partials      576      576              
Impacted Files Coverage Δ
pkg/compose/hash.go 80.00% <100.00%> (+1.42%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@glours
Copy link
Contributor

glours commented May 26, 2023

container

This is something we should consider, I agree

Copy link
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ndeloof ndeloof force-pushed the scale_recreate branch 2 times, most recently from 95fa56f to 95d5a04 Compare May 26, 2023 08:58
Copy link
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better with a e2e test 😉🙏

@ndeloof ndeloof merged commit 6f6e163 into v2 May 26, 2023
@ndeloof ndeloof deleted the scale_recreate branch May 26, 2023 12:15
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.

2 participants