Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/console/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func NewConsoleOperator(
factory.NamesFilter(api.OAuthClientName),
oauthClientSwitchedInformer.Informer(),
).WithFilteredEventsInformers(
util.IncludeNamesFilter(deployment.ConsoleOauthConfigName),
util.IncludeNamesFilter(deployment.ConsoleOauthConfigName, api.ConsoleServingCertName),
secretsInformer.Informer(),
).WithFilteredEventsInformers(
util.IncludeNamesFilter(telemetry.TelemetryConfigMapName),
Expand Down
9 changes: 9 additions & 0 deletions pkg/console/operator/sync_v400.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ func (co *consoleOperator) sync_v400(ctx context.Context, controllerContext fact
return statusHandler.FlushAndReturn(secErr)
}

consoleServingCertSecret, servingCertErr := co.secretsLister.Secrets(api.TargetNamespace).Get(api.ConsoleServingCertName)
statusHandler.AddConditions(status.HandleProgressingOrDegraded("ConsoleServingCertSecretGet", "FailedGet", servingCertErr))
if servingCertErr != nil {
return statusHandler.FlushAndReturn(servingCertErr)
}

actualDeployment, depErrReason, depErr := co.SyncDeployment(
ctx,
set.Operator,
Expand All @@ -187,6 +193,7 @@ func (co *consoleOperator) sync_v400(ctx context.Context, controllerContext fact
trustedCAConfigMap,
clientSecret,
sessionSecret,
consoleServingCertSecret,
set.Proxy,
set.Infrastructure,
controllerContext.Recorder(),
Expand Down Expand Up @@ -274,6 +281,7 @@ func (co *consoleOperator) SyncDeployment(
trustedCAConfigMap *corev1.ConfigMap,
sec *corev1.Secret,
sessionSecret *corev1.Secret,
consoleServingCertSecret *corev1.Secret,
proxyConfig *configv1.Proxy,
infrastructureConfig *configv1.Infrastructure,
recorder events.Recorder,
Expand All @@ -288,6 +296,7 @@ func (co *consoleOperator) SyncDeployment(
trustedCAConfigMap,
sec,
sessionSecret,
consoleServingCertSecret,
proxyConfig,
infrastructureConfig,
)
Expand Down
6 changes: 6 additions & 0 deletions pkg/console/subresource/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const (
authnConfigVersionAnnotation = "console.openshift.io/authentication-config-version"
authnCATrustConfigMapResourceVersionAnnotation = "console.openshift.io/authn-ca-trust-config-version"
sessionSecretRVAnnotation = "console.openshift.io/session-secret-version"
servingCertSecretResourceVersionAnnotation = "console.openshift.io/serving-cert-secret-version"
)

var (
Expand All @@ -51,6 +52,7 @@ var (
trustedCAConfigMapResourceVersionAnnotation,
secretResourceVersionAnnotation,
consoleImageAnnotation,
servingCertSecretResourceVersionAnnotation,
}
)

Expand All @@ -73,6 +75,7 @@ func DefaultDeployment(
trustedCAConfigMap *corev1.ConfigMap,
oAuthClientSecret *corev1.Secret,
sessionSecret *corev1.Secret,
consoleServingCertSecret *corev1.Secret,
proxyConfig *configv1.Proxy,
infrastructureConfig *configv1.Infrastructure,
) *appsv1.Deployment {
Expand All @@ -93,6 +96,7 @@ func DefaultDeployment(
trustedCAConfigMap,
oAuthClientSecret,
sessionSecret,
consoleServingCertSecret,
proxyConfig,
infrastructureConfig,
)
Expand Down Expand Up @@ -200,6 +204,7 @@ func withConsoleAnnotations(
trustedCAConfigMap *corev1.ConfigMap,
oAuthClientSecret *corev1.Secret,
sessionSecret *corev1.Secret,
consoleServingCertSecret *corev1.Secret,
proxyConfig *configv1.Proxy,
infrastructureConfig *configv1.Infrastructure,
) {
Expand All @@ -211,6 +216,7 @@ func withConsoleAnnotations(
infrastructureConfigResourceVersionAnnotation: infrastructureConfig.GetResourceVersion(),
secretResourceVersionAnnotation: oAuthClientSecret.GetResourceVersion(),
consoleImageAnnotation: util.GetImageEnv("CONSOLE_IMAGE"),
servingCertSecretResourceVersionAnnotation: consoleServingCertSecret.GetResourceVersion(),
}

if authServerCAConfigMap != nil {
Expand Down
70 changes: 44 additions & 26 deletions pkg/console/subresource/deployment/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func TestDefaultDeployment(t *testing.T) {
trustedCAConfigMap *corev1.ConfigMap
oAuthClientSecret *corev1.Secret
sessionSecret *corev1.Secret
consoleServingCertSecret *corev1.Secret
proxyConfig *configv1.Proxy
infrastructureConfig *configv1.Infrastructure
}
Expand Down Expand Up @@ -82,6 +83,7 @@ func TestDefaultDeployment(t *testing.T) {
proxyConfigResourceVersionAnnotation: "",
infrastructureConfigResourceVersionAnnotation: "",
consoleImageAnnotation: "",
servingCertSecretResourceVersionAnnotation: "",
},
OwnerReferences: []metav1.OwnerReference{{
APIVersion: "operator.openshift.io/v1",
Expand Down Expand Up @@ -136,6 +138,7 @@ func TestDefaultDeployment(t *testing.T) {
proxyConfigResourceVersionAnnotation: "",
infrastructureConfigResourceVersionAnnotation: "",
consoleImageAnnotation: "",
servingCertSecretResourceVersionAnnotation: "",
workloadManagementAnnotation: workloadManagementAnnotationValue,
requiredSCCAnnotation: "restricted-v2",
}
Expand Down Expand Up @@ -213,8 +216,9 @@ func TestDefaultDeployment(t *testing.T) {
StringData: nil,
Type: "",
},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigHighlyAvailable,
consoleServingCertSecret: &corev1.Secret{},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigHighlyAvailable,
},
want: &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -292,8 +296,9 @@ func TestDefaultDeployment(t *testing.T) {
StringData: nil,
Type: "",
},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigHighlyAvailable,
consoleServingCertSecret: &corev1.Secret{},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigHighlyAvailable,
},
want: &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -370,8 +375,9 @@ func TestDefaultDeployment(t *testing.T) {
StringData: nil,
Type: "",
},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigSingleReplica,
consoleServingCertSecret: &corev1.Secret{},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigSingleReplica,
},
want: &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -441,8 +447,9 @@ func TestDefaultDeployment(t *testing.T) {
StringData: nil,
Type: "",
},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigExternalTopologyMode,
consoleServingCertSecret: &corev1.Secret{},
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfigExternalTopologyMode,
},
want: &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -514,6 +521,7 @@ func TestDefaultDeployment(t *testing.T) {
tt.args.trustedCAConfigMap,
tt.args.oAuthClientSecret,
tt.args.sessionSecret,
tt.args.consoleServingCertSecret,
tt.args.proxyConfig,
tt.args.infrastructureConfig,
), tt.want); diff != nil {
Expand All @@ -525,16 +533,17 @@ func TestDefaultDeployment(t *testing.T) {

func TestWithConsoleAnnotations(t *testing.T) {
type args struct {
deployment *appsv1.Deployment
consoleConfigMap *corev1.ConfigMap
serviceCAConfigMap *corev1.ConfigMap
authServerCAConfigMap *corev1.ConfigMap
trustedCAConfigMap *corev1.ConfigMap
oAuthClientSecret *corev1.Secret
sessionSecret *corev1.Secret
proxyConfig *configv1.Proxy
infrastructureConfig *configv1.Infrastructure
authnConfig *configv1.Authentication
deployment *appsv1.Deployment
consoleConfigMap *corev1.ConfigMap
serviceCAConfigMap *corev1.ConfigMap
authServerCAConfigMap *corev1.ConfigMap
trustedCAConfigMap *corev1.ConfigMap
oAuthClientSecret *corev1.Secret
sessionSecret *corev1.Secret
consoleServingCertSecret *corev1.Secret
proxyConfig *configv1.Proxy
infrastructureConfig *configv1.Infrastructure
authnConfig *configv1.Authentication
}

consoleConfigMap := &corev1.ConfigMap{
Expand Down Expand Up @@ -584,6 +593,12 @@ func TestWithConsoleAnnotations(t *testing.T) {
},
}

consoleServingCertSecret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "202020",
},
}

tests := []struct {
name string
args args
Expand All @@ -606,13 +621,14 @@ func TestWithConsoleAnnotations(t *testing.T) {
},
},
},
consoleConfigMap: consoleConfigMap,
serviceCAConfigMap: serviceCAConfigMap,
authServerCAConfigMap: oauthServingCertConfigMap,
trustedCAConfigMap: trustedCAConfigMap,
oAuthClientSecret: oAuthClientSecret,
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfig,
consoleConfigMap: consoleConfigMap,
serviceCAConfigMap: serviceCAConfigMap,
authServerCAConfigMap: oauthServingCertConfigMap,
trustedCAConfigMap: trustedCAConfigMap,
oAuthClientSecret: oAuthClientSecret,
consoleServingCertSecret: consoleServingCertSecret,
proxyConfig: proxyConfig,
infrastructureConfig: infrastructureConfig,
},
want: &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -625,6 +641,7 @@ func TestWithConsoleAnnotations(t *testing.T) {
infrastructureConfigResourceVersionAnnotation: infrastructureConfig.GetResourceVersion(),
secretResourceVersionAnnotation: oAuthClientSecret.GetResourceVersion(),
consoleImageAnnotation: util.GetImageEnv("CONSOLE_IMAGE"),
servingCertSecretResourceVersionAnnotation: consoleServingCertSecret.GetResourceVersion(),
},
},
Spec: appsv1.DeploymentSpec{
Expand All @@ -640,6 +657,7 @@ func TestWithConsoleAnnotations(t *testing.T) {
infrastructureConfigResourceVersionAnnotation: infrastructureConfig.GetResourceVersion(),
secretResourceVersionAnnotation: oAuthClientSecret.GetResourceVersion(),
consoleImageAnnotation: util.GetImageEnv("CONSOLE_IMAGE"),
servingCertSecretResourceVersionAnnotation: consoleServingCertSecret.GetResourceVersion(),
},
},
},
Expand All @@ -649,7 +667,7 @@ func TestWithConsoleAnnotations(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
withConsoleAnnotations(tt.args.deployment, tt.args.consoleConfigMap, tt.args.serviceCAConfigMap, tt.args.authServerCAConfigMap, tt.args.trustedCAConfigMap, tt.args.oAuthClientSecret, tt.args.sessionSecret, tt.args.proxyConfig, tt.args.infrastructureConfig)
withConsoleAnnotations(tt.args.deployment, tt.args.consoleConfigMap, tt.args.serviceCAConfigMap, tt.args.authServerCAConfigMap, tt.args.trustedCAConfigMap, tt.args.oAuthClientSecret, tt.args.sessionSecret, tt.args.consoleServingCertSecret, tt.args.proxyConfig, tt.args.infrastructureConfig)
if diff := deep.Equal(tt.args.deployment, tt.want); diff != nil {
t.Error(diff)
}
Expand Down