-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Print messages about ports that can't change at runtime for K8s #33789
Conversation
@iocanel @cescoffier I'm not sure if this is what you had in mind for the task 3 of #33307. |
LOG.info(String.format("The target '%s' is mapping the container to the port '%s' which value is '%d'. " | ||
+ "You won't be able to change it at runtime using the property '%s'.", | ||
target, port.getName(), port.getContainerPort(), portWithConfig.getValue().propertyName)); |
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.
LOG.info(String.format("The target '%s' is mapping the container to the port '%s' which value is '%d'. " | |
+ "You won't be able to change it at runtime using the property '%s'.", | |
target, port.getName(), port.getContainerPort(), portWithConfig.getValue().propertyName)); | |
LOG.warn(String.format("'%s' manifests are generated with container port '%s' having value '%d'. " | |
+ "The above is influenced by property '%s' which may change at runtime. Such change is likely to cause problems as the application and the container configuration will get out of sync.", | |
target, port.getName(), port.getContainerPort(), portWithConfig.getValue().propertyName)); |
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 think the message is now too long. Also, using a warning might cause some panic among users that as far as I know, never complained about this.
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.
let's use info instead.
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 found the message a bit misleading, so I suggested something different.
Also, since this pattern
is something used in others places too, I am wondering if we should have a utility that does the config reading and logging. It would provide a more concise user experience and possibly make our lives easier years from now when we'll have forgotten all about it.
This comment has been minimized.
This comment has been minimized.
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 like @iocanel suggestion.
I agree about having a utility class with a consistent, wellformed, not misleading message. |
I'm -1 with the Ioannis' suggestion because the message is too long (imagine having the management port plus the HTTP port enabled), and I think that using the warning log level will cause some panic to users that as far as I know, never complained about this. |
After speaking with @iocanel , we agreed with changing the message to: PR updated |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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 -1 to include these changes as it overcomplicates the logic for very little benefit (printing messages for users that as far as I know, they never complained about it).
Though, aside of my comments, I don't want to block this change as long as @iocanel and @cescoffier are ok with proceeding.
this.runtime = runtime; | ||
} | ||
|
||
public static <T> Property<T> fromBuildTimeConfiguration(String name, Class<T> type, T defaultValue) { |
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.
Since these changes are meant to print messages for runtime properties-related only.
What I was asking was to get rid of this method (and the runtime
field) and use the PortConfig class directly in the printMessages
method.
int port = ConfigProvider.getConfig().getOptionalValue("quarkus.grpc.server.port", Integer.class) | ||
.orElse(9000); | ||
return new KubernetesPortBuildItem(port, "grpc"); | ||
return KubernetesPortBuildItem.fromRuntimeConfiguration("https", "quarkus.grpc.server.port", 9000); |
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 "enabled" flag here should be based on useSeparateServer
boolean, not in the presence of the property.
return new KubernetesPortBuildItem(port, name, enabled, Optional.of(origin)); | ||
} | ||
|
||
public static KubernetesPortBuildItem fromRuntimeConfiguration(String name, String propertyName, Integer defaultValue) { |
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.
According to my previous comment, I think this method can be deleted.
// If no kubernetes property is provided, this will be used instead. | ||
String defaultOrProvided = extensionProperty.getValue().isPresent() ? "provided" : "default"; | ||
String stringValue = String.valueOf(extensionProperty.getValue().orElse(extensionProperty.getDefaultValue())); | ||
LOG.infof("Kubernetes manifests are generated with '%s' having %s value '%s'. " |
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 message can be confused when using the OpenShift, Knative, etc. Kubernetes
should be replaced with the target generator.
// We have conflicting properties that need to be aligned. Maybe warn? | ||
String runtimeOrBuildTime = extensionProperty.isRuntime() ? "runtime" : "buildtime"; | ||
LOG.debugf( | ||
"Kubernetes property '%s' has been set with value '%s' while %s property '%s' is set with '%s'. %s will be set using the former.", |
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 here, Kubernetes
should be replaced with the target generator.
@@ -291,8 +291,7 @@ public List<DecoratorBuildItem> createDecorators(ApplicationInfoBuildItem applic | |||
result.add(new DecoratorBuildItem(KUBERNETES, new RemovePortFromServiceDecorator(name, MANAGEMENT_PORT_NAME))); | |||
} | |||
|
|||
printMessageAboutPortsThatCantChange(KUBERNETES, ports, config); | |||
|
|||
printMessageAboutPortsThatCantChange(name, ports, config); |
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 think, name should be KUBERNETES
@@ -380,8 +380,7 @@ public List<DecoratorBuildItem> createDecorators(ApplicationInfoBuildItem applic | |||
result.add(new DecoratorBuildItem(OPENSHIFT, new RemovePortFromServiceDecorator(name, MANAGEMENT_PORT_NAME))); | |||
} | |||
|
|||
printMessageAboutPortsThatCantChange(OPENSHIFT, ports, config); | |||
|
|||
printMessageAboutPortsThatCantChange(name, ports, config); |
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 think, name should be OPENSHIFT
* For example the presence `quarkus.http.ssl-port` also is not enought to tell us if enabled. | ||
* Still, we need to communicate its value and let `quarkus-kubernetes` extension decide. | ||
**/ | ||
private final boolean enabled; |
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 still confuses me to generate build items that are not enabled.
I know you explained to me that this is necessary for the case when users add quarkus.kubernetes.ports.https.tls=true
, so the container port for https is resolved from here.
@cescoffier can you take another look to this pull request after the changes made by Ioannis please? |
fc94e67
to
fe95708
Compare
This comment has been minimized.
This comment has been minimized.
The CI issues might be related. |
Related to quarkusio#33307, task 3. Fix quarkusio#32882
Failing Jobs - Building de116aa
Full information is available in the Build summary check run. Failures⚙️ JVM Tests - JDK 11 #- Failing: integration-tests/grpc-hibernate
📦 integration-tests/grpc-hibernate✖
⚙️ JVM Tests - JDK 17 #- Failing: integration-tests/grpc-hibernate
📦 integration-tests/grpc-hibernate✖
⚙️ Maven Tests - JDK 11 Windows #📦 integration-tests/maven✖
✖
|
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.
LGTM
Don't think the failures are related. |
Verified that the same tests fail in other pull requests too. So, I'll merge. |
Related to #33307, task 3.
Fix #32882
I didn't add this logic to Knative (because knative is renaming the port to http1) and Kind/Minikube because these are for DEV purposes only.