Skip to content

File based bindings #1669

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

File based bindings #1669

wants to merge 5 commits into from

Conversation

theghost5800
Copy link
Contributor

No description provided.

@@ -39,7 +39,7 @@
<jackson.databind.version>2.19.1</jackson.databind.version>
<liquibase.version>4.32.0</liquibase.version>
<liquibase-slf4j.version>5.1.0</liquibase-slf4j.version>
<cloudfoundry-client.version>2.58.0</cloudfoundry-client.version>
Copy link
Contributor

Choose a reason for hiding this comment

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

Revert this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change in adopted cloudfoundrry client is done temporary to test the change. Before merge It will be necessary to adopt new release of cf-java-client or just move whole project into multiapps-controller 😆

Comment on lines 45 to 51
Map<String, Boolean> appFeatures = (Map<String, Boolean>) PropertiesUtil.getPropertyValue(parametersList,
SupportedParameters.APP_FEATURES,
Collections.emptyMap());
Map<String, Boolean> appFeaturesWithOverriddenSsh = new HashMap<>(appFeatures);
if (isSshEnabled != null && !appFeatures.containsKey(Constants.APP_FEATURE_SSH)) {
appFeaturesWithOverriddenSsh.put(Constants.APP_FEATURE_SSH, isSshEnabled);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please extract this logic in separate method like:

Map<String, Boolean> appFeatures = getNormalizedAppFeatures(parametersList, isSshEnabled);

Also do we need to use two Map objects?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is necessary in case when app-features parameter is not set and still ssh-enabled is used. This is done in order to be backwards compatible.

// (48) app-features parameter with multiple features enabled/disabled
Arguments.of(
"/mta/app-features/mtad-app-features.yaml", "/mta/app-features/config-app-features.mtaext", "/mta/cf-platform.json", null, null, false,
new String[] { "feature-app" }, // mtaArchiveModules
Copy link
Contributor

Choose a reason for hiding this comment

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

extract constants


private static Stream<Arguments> testIsValid() {
return Stream.of(
// (1) All features are boolean
Copy link
Contributor

Choose a reason for hiding this comment

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

extract constants

</extensionElements>
</callActivity>
<sequenceFlow id="sid-26C87D1E-88D5-47E3-907B-0F8EBBCD2C36" sourceRef="executeTasksCallActivity" targetRef="publishProvidedDependenciesTask"></sequenceFlow>
<callActivity id="hooksCallActivity" name="Execute Hooks Call Activity" flowable:async="true" calledElement="${hookProcessGetter.get(hookForExecution, execution)}" flowable:calledElementType="key" flowable:inheritVariables="false" flowable:completeAsync="true" flowable:fallbackToDefaultTenant="false">
Copy link
Contributor

Choose a reason for hiding this comment

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

why this is removed inheritVariables="false"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is really interesting topic how was set at first place because flowable modeler did remove this explicit set to false.

</extensionElements>
<multiInstanceLoopCharacteristics isSequential="false" flowable:collection="hooksForExecution" flowable:elementVariable="hookForExecution"></multiInstanceLoopCharacteristics>
<multiInstanceLoopCharacteristics isSequential="false" flowable:collection="hooksForExecution" flowable:elementVariable="hookForExecution">
<extensionElements></extensionElements>
Copy link
Contributor

Choose a reason for hiding this comment

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

why this is added

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all these changes in bpmn diagrams were generated by flowable-modeler.

@@ -120,23 +122,25 @@
<sequenceFlow id="sid-74CBBBDE-B4B8-451B-8193-8B1A08835E23" sourceRef="publishProvidedDependenciesTask" targetRef="shouldDeleteIdleRoutes"></sequenceFlow>
<sequenceFlow id="flow90" sourceRef="exclusivegateway6" targetRef="timerintermediatecatchevent3"></sequenceFlow>
<sequenceFlow id="sid-EDE0C6AF-FE13-4120-94B8-406BFCE8A407" sourceRef="stopAppTask" targetRef="hooksCallActivity"></sequenceFlow>
<callActivity id="sid-F6B2FD75-29A0-4347-B49F-94B4CD7C1469" name="Execute Hooks Call Activity" flowable:async="true" calledElement="${hookProcessGetter.get(hookForExecution, execution)}" flowable:calledElementType="key" flowable:inheritVariables="false" flowable:completeAsync="true" flowable:fallbackToDefaultTenant="false">
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all these changes in bpmn diagrams were generated by flowable-modeler.

</extensionElements>
<multiInstanceLoopCharacteristics isSequential="false" flowable:collection="hooksForExecution" flowable:elementVariable="hookForExecution"></multiInstanceLoopCharacteristics>
<multiInstanceLoopCharacteristics isSequential="false" flowable:collection="hooksForExecution" flowable:elementVariable="hookForExecution">
<extensionElements></extensionElements>
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all these changes in bpmn diagrams were generated by flowable-modeler.

<omgdi:waypoint x="143.0" y="917.9401335311574"></omgdi:waypoint>
<omgdi:waypoint x="143.0" y="999.0"></omgdi:waypoint>
<omgdi:waypoint x="141.0" y="999.0"></omgdi:waypoint>
<omgdi:waypoint x="141.0" y="1126.0"></omgdi:waypoint>
<omgdi:waypoint x="140.1357142857143" y="1125.1360544217687"></omgdi:waypoint>
Copy link
Contributor

Choose a reason for hiding this comment

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

why the positions are changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all these changes in bpmn diagrams were generated by flowable-modeler.

Copy link
Contributor

@s-yonkov-yonkov s-yonkov-yonkov left a comment

Choose a reason for hiding this comment

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

Check comments

.dockerInfo(dockerInfo)
.lifecycleType(lifecycleType)
.build();
}

@SuppressWarnings("unchecked")
private Map<String, Boolean> getAppFeatures(List<Map<String, Object>> parametersList, Boolean isSshEnabled) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this method does too many things, split it and reduce number of params

@@ -39,6 +42,7 @@ public Staging parse(List<Map<String, Object>> parametersList) {
SupportedParameters.HEALTH_CHECK_HTTP_ENDPOINT,
getDefaultHealthCheckHttpEndpoint(healthCheckType));
Boolean isSshEnabled = (Boolean) PropertiesUtil.getPropertyValue(parametersList, SupportedParameters.ENABLE_SSH, null);
Copy link
Contributor

Choose a reason for hiding this comment

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

will we depracate this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't have such discussion yet but most probably yes because app-feature parameter will unite all similar settings including ssh enablement. With this change if ssh-enabled and app-features: ssh: true/false were specified, it will print warning and will ignore ssh-enabled parameter value.

}

private boolean isCommandDifferent(String newCommand) {
return !StringUtils.isBlank(newCommand) && !Objects.equals(newCommand, existingProcess.getCommand());
}

private boolean isAppFeaturesChanged(Map<String, Boolean> newAppFeatures, Map<String, Boolean> existingAppFeatures) {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename to areAppFeaturesChanged ?

Comment on lines +55 to +57
return newAppFeatures.entrySet()
.stream()
.anyMatch(newAppFeature -> !Objects.equals(newAppFeature.getValue(),
Copy link
Contributor

Choose a reason for hiding this comment

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

what will happen if someone deletes their app features from the descriptor?
this will result in false, and we will not modify the already existing app features -> in context of cf deploy
in blue-green we will creata a new app and it will have the CF defaults?
Is this an inconsisteny and should we provide default values for app features?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's not good idea to set default values on our own, it is already done by cloudfoundry itself. In the case where application already exist is interesting what to do because we cannot just get default values from cf, the only app feature which is configured per space is ssh enablement - https://v3-apidocs.cloudfoundry.org/version/3.196.0/#list-space-features
if we set explicitly now default values for app features, in future when new app features are added we won't have default values for them. The whole feature parameter is implemented in a way that allows customers easily to specify all app feature parameters in the future.

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.

3 participants