-
Notifications
You must be signed in to change notification settings - Fork 158
CONSOLE 2919: code review adjustments for managed cluster action/views #617
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| namespace: openshift-config-managed | ||
| namespace: openshift-console | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,17 +71,17 @@ func (co *consoleOperator) sync_v400(ctx context.Context, controllerContext fact | |
| return statusHandler.FlushAndReturn(routeErr) | ||
| } | ||
|
|
||
| cm, cmChanged, cmErrReason, cmErr := co.SyncConfigMap(ctx, set.Operator, set.Console, set.Infrastructure, set.OAuth, route, controllerContext.Recorder()) | ||
| // managed-clusters ConfigMap is managed by another controller and is not required, we don't need to exit the sync loop if it's not present | ||
| canMountManagedClusterConfig, managedClusterConfigErrReason, managedClusterConfigErr := co.SyncManagedClusterConfigMap(ctx) | ||
| statusHandler.AddConditions(status.HandleProgressingOrDegraded("ManagedClusterConfigSync", managedClusterConfigErrReason, managedClusterConfigErr)) | ||
|
Comment on lines
+75
to
+76
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I address conditionally adding the managed cluster config file name to the console config in #612. |
||
|
|
||
| cm, cmChanged, cmErrReason, cmErr := co.SyncConfigMap(ctx, set.Operator, set.Console, set.Infrastructure, set.OAuth, route, canMountManagedClusterConfig, controllerContext.Recorder()) | ||
| toUpdate = toUpdate || cmChanged | ||
| statusHandler.AddConditions(status.HandleProgressingOrDegraded("ConfigMapSync", cmErrReason, cmErr)) | ||
| if cmErr != nil { | ||
| return statusHandler.FlushAndReturn(cmErr) | ||
| } | ||
|
|
||
| // managed-clusters ConfigMap is managed by another controller and is not required, we don't need to exit the sync loop if it's not present | ||
| canMountManagedClusterConfig, managedClusterConfigErrReason, managedClusterConfigErr := co.SyncManagedClusterConfigMap(ctx) | ||
| statusHandler.AddConditions(status.HandleProgressingOrDegraded("ManagedClusterConfigSync", managedClusterConfigErrReason, managedClusterConfigErr)) | ||
|
|
||
| serviceCAConfigMap, serviceCAChanged, serviceCAErrReason, serviceCAErr := co.SyncServiceCAConfigMap(ctx, set.Operator) | ||
| toUpdate = toUpdate || serviceCAChanged | ||
| statusHandler.AddConditions(status.HandleProgressingOrDegraded("ServiceCASync", serviceCAErrReason, serviceCAErr)) | ||
|
|
@@ -317,6 +317,7 @@ func (co *consoleOperator) SyncConfigMap( | |
| infrastructureConfig *configv1.Infrastructure, | ||
| oauthConfig *configv1.OAuth, | ||
| activeConsoleRoute *routev1.Route, | ||
| canMountManagedClusterConfig bool, | ||
| recorder events.Recorder, | ||
| ) (consoleConfigMap *corev1.ConfigMap, changed bool, reason string, err error) { | ||
|
|
||
|
|
@@ -349,7 +350,7 @@ func (co *consoleOperator) SyncConfigMap( | |
| } | ||
|
|
||
| pluginsEndpointMap := co.GetPluginsEndpointMap(operatorConfig.Spec.Plugins) | ||
| defaultConfigmap, _, err := configmapsub.DefaultConfigMap(operatorConfig, consoleConfig, managedConfig, infrastructureConfig, activeConsoleRoute, useDefaultCAFile, inactivityTimeoutSeconds, pluginsEndpointMap) | ||
| defaultConfigmap, _, err := configmapsub.DefaultConfigMap(operatorConfig, consoleConfig, managedConfig, infrastructureConfig, activeConsoleRoute, useDefaultCAFile, inactivityTimeoutSeconds, pluginsEndpointMap, canMountManagedClusterConfig) | ||
| if err != nil { | ||
| return nil, false, "FailedConsoleConfigBuilder", err | ||
| } | ||
|
|
@@ -380,7 +381,7 @@ func (co *consoleOperator) SyncManagedClusterConfigMap(ctx context.Context) (boo | |
| // Degraded if managed cluster config map is present but doesn't have the correct data key | ||
| _, ok := managedClusterConfigMap.Data[api.ManagedClusterConfigKey] | ||
| if !ok { | ||
| return false, "MissingManagedClusterConfig", fmt.Errorf("%v ConfigMap is missing %v data key", api.ManagedClusterConfigMapName, api.ManagedClusterConfigKey) | ||
| return false, "MissingManagedClusterConfig", fmt.Errorf("%s ConfigMap is missing %s data key", api.ManagedClusterConfigMapName, api.ManagedClusterConfigKey) | ||
| } | ||
|
|
||
| // Managed cluster config map is present and can be mounted | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,13 @@ func DefaultConfigMap( | |
| activeConsoleRoute *routev1.Route, | ||
| useDefaultCAFile bool, | ||
| inactivityTimeoutSeconds int, | ||
| pluginsEndpoingMap map[string]string) (consoleConfigmap *corev1.ConfigMap, unsupportedOverridesHaveMerged bool, err error) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have implemented similar changes to this file and the related unit test file in #612. |
||
| pluginsEndpoingMap map[string]string, | ||
| canMountManagedClusterConfig bool) (consoleConfigmap *corev1.ConfigMap, unsupportedOverridesHaveMerged bool, err error) { | ||
|
|
||
| managedClusterConfigFile := "" | ||
| if canMountManagedClusterConfig { | ||
| managedClusterConfigFile = fmt.Sprintf("%s/%s", api.ManagedClusterConfigMountDir, api.ManagedClusterConfigKey) | ||
| } | ||
|
|
||
| defaultBuilder := &consoleserver.ConsoleServerCLIConfigBuilder{} | ||
| defaultConfig, err := defaultBuilder.Host(activeConsoleRoute.Spec.Host). | ||
|
|
@@ -53,7 +59,7 @@ func DefaultConfigMap( | |
| OAuthServingCert(useDefaultCAFile). | ||
| APIServerURL(getApiUrl(infrastructureConfig)). | ||
| InactivityTimeout(inactivityTimeoutSeconds). | ||
| ManagedClusterConfigFile(fmt.Sprintf("%v/%v", api.ManagedClusterConfigMountDir, api.ManagedClusterConfigKey)). | ||
| ManagedClusterConfigFile(managedClusterConfigFile). | ||
| ConfigYAML() | ||
| if err != nil { | ||
| klog.Errorf("failed to generate default console-config config: %v", err) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| package managedclusterview | ||
| package managedcluster | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer to keep MCV/MCA subresource modules separated by kind. |
||
|
|
||
| import ( | ||
| operatorv1 "github.com/openshift/api/operator/v1" | ||
|
|
||
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.
Addressed in #612