-
Notifications
You must be signed in to change notification settings - Fork 42
remove idle suffix from bg deploy #1697
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
base: master
Are you sure you want to change the base?
Conversation
| public void handleApplicationName() { | ||
| if (!context.getVariable(Variables.KEEP_ORIGINAL_APP_NAMES_AFTER_DEPLOY)) { | ||
| getStepLogger().warn( | ||
| Variables.KEEP_ORIGINAL_APP_NAMES_AFTER_DEPLOY + " is set to false. The application name will not be updated."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If KEEP_ORIGINAL_APP_NAMES_AFTER_DEPLOY is false, why The application name will not be updated? I presume that if the original name should not be kept, the app name will be updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KEEP_ORIGINAL_APP_NAMES_AFTER_DEPLOY is a flag that determines the use of suffixes during the bg deploy - if true we use the temporary '-idle' suffix, if false we use blue and green colour suffixes and don't rename apps but rotate the names; this check needs to be extended however
...src/main/java/org/cloudfoundry/multiapps/controller/process/steps/CreateOrUpdateAppStep.java
Outdated
Show resolved
Hide resolved
|
|
||
| String oldName = existingApp.getName(); | ||
| String newName = BlueGreenApplicationNameSuffix.removeSuffix(oldName); | ||
| if (oldName.equals(newName)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when this check will return true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will double-check - in general if the new app happens to have the same name (not blue-green deploy?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it is not the not blue green, will it even reach this condition? Maybe during retry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CreateOrUpdateAppStep is a very generic step in the deploy app subprocess, so I think this condition will be reached if we're just updating an app's attributes/environment variables.
...src/main/java/org/cloudfoundry/multiapps/controller/process/steps/CreateOrUpdateAppStep.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| @Override | ||
| public void handleApplicationName() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misleading name, except the renaming it is performing ConfigurationSubscription updates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the subscriptionas are downstream from the appName, feel like it's more important
| int currentInstances = 1; // default instances when creating an app | ||
| if (existingApp != null) { | ||
| currentInstances = client.getApplicationProcess(client.getApplicationGuid(existingApp.getName())) | ||
| currentInstances = client.getApplicationProcess(client.getApplicationGuid(app.getName())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was a bad solution to an issue with the changed app name - now the existingApp is overwritten in the context once the app name is updated
9749112 to
b9b7baa
Compare
| $ref: "#/definitions/Info" | ||
| security: | ||
| - oauth2: [] | ||
| /api/v1/spaces/{spaceGuid}/files: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not delete this. Must be checked why always deleted after build
| flow: "password" | ||
| scopes: {} | ||
| definitions: | ||
| AsyncUploadResult: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
| .shouldKeepExistingEnv() ? UpdateStrategy.MERGE : UpdateStrategy.REPLACE; | ||
| } | ||
|
|
||
| @Override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of creating a new method and flow, can you create a new ApplicationAttributeUpdater. For example, ApplicationNameApplicationAttributeUpdater and update the application name in handleApplicationAttributes (Update flow)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decided on in-between solution - removing the new method but not implementing an ApplicationAttributeUpdater for a specific reason - the attribute updaters are used in a stream but are all dependant on the application name which the new updater would be changing. This makes the order of the attributeUpdaters very important and would be easy to break in the future.
|
|
||
| @Override | ||
| public void handleApplicationName() { | ||
| boolean processIsBlueGreenWithIdleSuffix = StepsUtil.getAppSuffixDeterminer(context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe rename to isBlueGreenProcessAfterResumePhase or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the current name seems more clear since this is only for blueGreen with idle, not with colours
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this resolved?
|
|
||
| String oldName = existingApp.getName(); | ||
| String newName = BlueGreenApplicationNameSuffix.removeSuffix(oldName); | ||
| if (oldName.equals(newName)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it is not the not blue green, will it even reach this condition? Maybe during retry?
...ava/org/cloudfoundry/multiapps/controller/process/steps/RemoveNewApplicationsSuffixStep.java
Show resolved
Hide resolved
| } | ||
|
|
||
| getStepLogger().info(Messages.RENAMING_APPLICATION_0_TO_1, oldName, newName); | ||
| client.rename(oldName, newName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if the MTA operation fail in the resume phase? I mean if the restart of the rename application (now without suffix fails) and the customer executes a new deployment, will the new process detect the "-live" applications as actually live? Is it possible for the new operation to detect the wrong application as live?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm writing this comment because now the renaming is before the restart/restage, which is a potential point of failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thsi was tested with a crash at the end of the CreateOrUpdateStep - the retries handled the resume correctly
| public void handleApplicationName() { | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you agree with my other comment this method will not be needed. If you do not, add some comment why there is no implementation here
| getStepLogger().info(Messages.THE_DETECTED_APPLICATION_HAS_THE_SAME_NAME_AS_THE_NEW_ONE); | ||
| return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can a rename here make this step non-idempotent? What will happen if the step fails during the update of the configuration entries? Or for example instance get shutdown and it gets re-executed by flowable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this resolved/answered?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haven't tested a failure at the point of updating the subscribers but I assume the behaviour will be unchanged - the rename + update of subscribers were handled in the same step (not this one) before my changes as well
| file_url: | ||
| type: "string" | ||
| readOnly: true | ||
| Info: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert the changes to this file.
| static Stream<Arguments> testAppSuffixDeterminer() { | ||
| return Stream.of( | ||
| //@formatter:off | ||
| //@formatter:off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, removed
|
|
||
| @Override | ||
| public void handleApplicationName() { | ||
| boolean processIsBlueGreenWithIdleSuffix = StepsUtil.getAppSuffixDeterminer(context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this resolved?
| getStepLogger().info(Messages.THE_DETECTED_APPLICATION_HAS_THE_SAME_NAME_AS_THE_NEW_ONE); | ||
| return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this resolved/answered?
| String expectedDeploymentDescriptor = new String(getClass().getResourceAsStream("expected-mtad.yaml") | ||
| .readAllBytes()); | ||
| assertEquals(expectedDeploymentDescriptor, actualDeploymentDescriptor); | ||
| assertEquals(expectedDeploymentDescriptor.replace("\r", ""), actualDeploymentDescriptor.replace("\r", "")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already added in master, please remove it
|
|
||
| import jakarta.inject.Inject; | ||
|
|
||
| @RestController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this class modified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like a formatter issue :D
| private AppBoundServiceInstanceNamesGetter appServicesGetter; | ||
| @Mock | ||
| private ConfigurationSubscriptionService subscriptionService; | ||
| @Mock(answer = Answers.RETURNS_SELF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this(answer = Answers.RETURNS_SELF) added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's for mocking the configuration subscriptions update in the test - copied from the deleted test for the deleted separate step
| return expectedEnvMap; | ||
| } | ||
|
|
||
| @Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the straight scenario, how about adding other scenarios, where renaming should not be applied or other?
|
Why is this PR made from a fork? Update/sync the fork as it is 41 commits behind master |
3b384a8 to
2fe0804
Compare
during blue-green deployment, move the idle application renaming before the restage (in CreateOrUpdateAppStep) - ensuring the new name is applied before the restart/restage
fix ArchiveEntryExtractorTest incorrect handling of newline leading to windows errors
See: LMCROSSITXSADEPLOY-2755