-
Notifications
You must be signed in to change notification settings - Fork 85
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
Automatically propagate ca-certs configmap content into server and identity provider #487
Merged
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
37c5dda
Automatically propagate serverTrustStoreConfigMap context to server a…
tolusha f249f08
Add missed files
tolusha da574bb
Fixes
tolusha f269994
Fixes
tolusha 1e2d175
Fix
tolusha 118ce6c
Fix
tolusha f3da3ab
Fix
tolusha 04efd68
Fixes
tolusha 3b73704
Fixes
tolusha 36e3abe
Move resources version to annotations
tolusha 5206038
Fix
tolusha f6db2a6
Fiex
tolusha 9cf64d1
Revert cr.yaml
tolusha 67e7e54
Fix remarks
tolusha 60be304
revert go.mod go.sum
tolusha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,12 +13,13 @@ package identity_provider | |
|
||
import ( | ||
"context" | ||
"github.com/eclipse/che-operator/pkg/deploy" | ||
"github.com/eclipse/che-operator/pkg/deploy/postgres" | ||
"regexp" | ||
"strconv" | ||
"strings" | ||
|
||
"github.com/eclipse/che-operator/pkg/deploy" | ||
"github.com/eclipse/che-operator/pkg/deploy/postgres" | ||
|
||
orgv1 "github.com/eclipse/che-operator/pkg/apis/org/v1" | ||
"github.com/eclipse/che-operator/pkg/util" | ||
"github.com/google/go-cmp/cmp" | ||
|
@@ -58,15 +59,15 @@ var ( | |
} | ||
) | ||
|
||
func SyncKeycloakDeploymentToCluster(deployContext *deploy.DeployContext) deploy.DeploymentProvisioningStatus { | ||
func SyncKeycloakDeploymentToCluster(deployContext *deploy.DeployContext, cmRevisions string) deploy.DeploymentProvisioningStatus { | ||
clusterDeployment, err := deploy.GetClusterDeployment(KeycloakDeploymentName, deployContext.CheCluster.Namespace, deployContext.ClusterAPI.Client) | ||
if err != nil { | ||
return deploy.DeploymentProvisioningStatus{ | ||
ProvisioningStatus: deploy.ProvisioningStatus{Err: err}, | ||
} | ||
} | ||
|
||
specDeployment, err := getSpecKeycloakDeployment(deployContext, clusterDeployment) | ||
specDeployment, err := getSpecKeycloakDeployment(deployContext, clusterDeployment, cmRevisions) | ||
if err != nil { | ||
return deploy.DeploymentProvisioningStatus{ | ||
ProvisioningStatus: deploy.ProvisioningStatus{Err: err}, | ||
|
@@ -78,7 +79,8 @@ func SyncKeycloakDeploymentToCluster(deployContext *deploy.DeployContext) deploy | |
|
||
func getSpecKeycloakDeployment( | ||
deployContext *deploy.DeployContext, | ||
clusterDeployment *appsv1.Deployment) (*appsv1.Deployment, error) { | ||
clusterDeployment *appsv1.Deployment, | ||
cmRevisions string) (*appsv1.Deployment, error) { | ||
optionalEnv := true | ||
labels := deploy.GetLabels(deployContext.CheCluster, KeycloakDeploymentName) | ||
cheFlavor := deploy.DefaultCheFlavor(deployContext.CheCluster) | ||
|
@@ -221,6 +223,10 @@ func getSpecKeycloakDeployment( | |
} | ||
|
||
keycloakEnv := []corev1.EnvVar{ | ||
{ | ||
Name: "CM_REVISIONS", | ||
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. Why do we need this in the Keycloak and Che containers env? If we need to mark something, isn't labels does the work? 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. Moved. |
||
Value: cmRevisions, | ||
}, | ||
{ | ||
Name: "PROXY_ADDRESS_FORWARDING", | ||
Value: "true", | ||
|
@@ -348,6 +354,10 @@ func getSpecKeycloakDeployment( | |
|
||
if cheFlavor == "codeready" { | ||
keycloakEnv = []corev1.EnvVar{ | ||
{ | ||
Name: "CM_REVISIONS", | ||
Value: cmRevisions, | ||
}, | ||
{ | ||
Name: "PROXY_ADDRESS_FORWARDING", | ||
Value: "true", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// Copyright (c) 2012-2019 Red Hat, Inc. | ||
AndrienkoAleksandr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// This program and the accompanying materials are made | ||
// available under the terms of the Eclipse Public License 2.0 | ||
// which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 | ||
// | ||
// Contributors: | ||
// Red Hat, Inc. - initial API and implementation | ||
// | ||
package deploy | ||
|
||
import ( | ||
"context" | ||
stderrors "errors" | ||
|
||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" | ||
) | ||
|
||
func HasCheClusterOwner(deployContext *DeployContext, object v1.Object) bool { | ||
for _, owner := range object.GetOwnerReferences() { | ||
if owner.Name == deployContext.CheCluster.Name { | ||
return true | ||
} | ||
} | ||
|
||
return false | ||
} | ||
|
||
func UpdateCheClusterOwner(deployContext *DeployContext, object v1.Object) error { | ||
if err := controllerutil.SetControllerReference(deployContext.CheCluster, object, deployContext.ClusterAPI.Scheme); err != nil { | ||
return err | ||
} | ||
|
||
robj, ok := object.(runtime.Object) | ||
if !ok { | ||
return stderrors.New("object " + object.GetName() + " is not a runtime.Object. Cannot update it") | ||
AndrienkoAleksandr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
return deployContext.ClusterAPI.Client.Update(context.TODO(), robj) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 ? Isn't the main method run regularly anyway ?
Not sure what the requirement for an owner will mean when we select all the config maps that have a given label.