-
Notifications
You must be signed in to change notification settings - Fork 97
CHE-15493: <username>-che as default namespace #166
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
Merged
Merged
Changes from all commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
83d2544
don't create che-workspace serviceaccount and give needed permissions…
sparkoo 3ade531
don't create roles and rolebindings when oauth enabled
sparkoo 9e5bce3
Merge branch 'master' into che-workspace-rem
sparkoo 3b1e777
grant more permissions to support running workspaces in pre-created n…
sparkoo 6786dd5
add needed permissions to create namespace and run workspace in diffe…
sparkoo cd48a3c
license headers, cleanup
sparkoo aca6124
update permissions
sparkoo 092a2d2
Merge branch 'master' of https://github.com/eclipse/che-operator into…
AndrienkoAleksandr e5dbf1e
Fix issue with Che 'update' namespace permission and other stuff
AndrienkoAleksandr 9390c16
Fix issue with clusterrolebindings and clusterrole finalizers
AndrienkoAleksandr e7a29d9
Fix deploy Che using olm on the minikube Fix deploy Che using olm on …
AndrienkoAleksandr 6baaa73
Address changes.
AndrienkoAleksandr 1922ae6
Fix service account wrongly generated by operator-sdk for some cluste…
AndrienkoAleksandr caf9bd8
Merge branch 'master' of https://github.com/eclipse/che-operator into…
AndrienkoAleksandr aa4635f
Clean up.
AndrienkoAleksandr f5aab7c
Remove optional quotes
AndrienkoAleksandr ee5a7a6
Merge branch 'master' of https://github.com/eclipse/che-operator into…
AndrienkoAleksandr 4cc7542
Move cluster role to the one clusterrole.
AndrienkoAleksandr d7fb5a9
Remove duplication, sort yaml in the same maner.
AndrienkoAleksandr b4fd750
Remove deploy_k8s.sh. We should use chectl or OLM instead of it.
AndrienkoAleksandr a014b45
Merge branch 'master' of https://github.com/eclipse/che-operator into…
AndrienkoAleksandr e4785fa
Clean up.
AndrienkoAleksandr fa65bf5
Merge remote-tracking branch 'origin' into CHE-15493
AndrienkoAleksandr b827d31
Add docs information about workspace strategy
AndrienkoAleksandr 8371164
Fix permissions.
AndrienkoAleksandr a6802b0
Add finalizers. Code not stable yet.
AndrienkoAleksandr 82315cf
Fix permission finalizer when user removed namespace.
AndrienkoAleksandr f9437bb
Split code. Add tests. Some code clean up.
AndrienkoAleksandr 3d574eb
Turn back accidental removed code.
AndrienkoAleksandr ee2f180
Clean up.
AndrienkoAleksandr 92c1e9f
Fix compilation.
AndrienkoAleksandr 69f2f90
Improve custom signal handler.
AndrienkoAleksandr 775a34c
Add permission fallback for workspace namespaces strategy.
AndrienkoAleksandr 9d86be5
Merge branch 'master' of github.com:eclipse/che-operator into CHE-15493
AndrienkoAleksandr 2e80bbd
Update csv files.
AndrienkoAleksandr d5c82d5
Merge branch 'master' of github.com:eclipse/che-operator into CHE-15493
AndrienkoAleksandr 225c0df
Format code.
AndrienkoAleksandr b898ce6
Add more information about permission stuff.
AndrienkoAleksandr 8c89ce6
Try to fix ci tests.
AndrienkoAleksandr 04df9cd
Address code review changes.
AndrienkoAleksandr 0c32fe3
Fix up.
AndrienkoAleksandr 1e462c4
Update OLM bundle.
AndrienkoAleksandr 7419030
Remove single workspaces namespace permissions, when differ workspace…
AndrienkoAleksandr 42ff0e3
Handle code review changes.
AndrienkoAleksandr 4a38bb6
Fix up.
AndrienkoAleksandr 3093529
Fix up.
AndrienkoAleksandr c80c848
Handle one more review feedback.
AndrienkoAleksandr 48bc5b9
Fix up.
AndrienkoAleksandr b230a72
Update pkg/util/util.go
AndrienkoAleksandr 46f9545
Update pkg/controller/che/che_controller.go
AndrienkoAleksandr 7aff08a
Update pkg/controller/che/che_controller.go
AndrienkoAleksandr 44b1e88
Update pkg/controller/che/cluster_permissions_finalizer.go
AndrienkoAleksandr 5d82eab
Update pkg/controller/che/workspace_namespace_permission.go
AndrienkoAleksandr e1bd915
Update pkg/controller/che/workspace_namespace_permission.go
AndrienkoAleksandr 651b892
Handle code review changes.
AndrienkoAleksandr ee12aa7
Update pkg/controller/che/workspace_namespace_permission.go
AndrienkoAleksandr 6344e94
Update pkg/controller/che/workspace_namespace_permission.go
AndrienkoAleksandr 21b5820
Update pkg/controller/che/workspace_namespace_permission.go
AndrienkoAleksandr 8aa5fb4
Update pkg/controller/che/workspace_namespace_permission.go
AndrienkoAleksandr 57e4010
Update pkg/controller/che/workspace_namespace_permission.go
AndrienkoAleksandr 2a3d12a
Update pkg/controller/che/workspace_namespace_permission.go
AndrienkoAleksandr 668652a
Handle code review changes.
AndrienkoAleksandr a67ac77
Fix up. Clean up permissions when oauth enabled.
AndrienkoAleksandr 622688f
Fix workspace starting for oauth enabled.
AndrienkoAleksandr 31e97cc
Fix up.
AndrienkoAleksandr 6a6a1c0
Fix up.
AndrienkoAleksandr 55238ec
Fix up.
AndrienkoAleksandr b97794e
Fix workspace starting on the k8s, when Che installed via OLM.
AndrienkoAleksandr 102dc51
Improve code.
AndrienkoAleksandr 345f689
Add logs.
AndrienkoAleksandr 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 hidden or 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 hidden or 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 hidden or 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,94 @@ | ||
| // | ||
| // Copyright (c) 2012-2020 Red Hat, Inc. | ||
| // 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 signal | ||
|
|
||
| import ( | ||
| "context" | ||
| "os" | ||
| "os/signal" | ||
| "syscall" | ||
| "time" | ||
|
|
||
| "github.com/sirupsen/logrus" | ||
| appsv1 "k8s.io/api/apps/v1" | ||
| "k8s.io/apimachinery/pkg/types" | ||
| "sigs.k8s.io/controller-runtime/pkg/client" | ||
| ) | ||
|
|
||
| // SetupSignalHandler set up custom signal handler for main process. | ||
| func SetupSignalHandler(terminationPeriod int64) (stopCh <-chan struct{}) { | ||
| logrus.Info("Set up process signal handler") | ||
| var shutdownSignals = []os.Signal{os.Interrupt, syscall.SIGTERM, syscall.SIGINT} | ||
|
|
||
| stop := make(chan struct{}) | ||
| c := make(chan os.Signal, 1) | ||
| signal.Notify(c, shutdownSignals...) | ||
| go func() { | ||
| sig := <-c | ||
| printSignal(sig) | ||
|
|
||
| // We need provide more time for Che controller go routing to complete finalizers logic. | ||
| // Otherwise resource won't be clean up gracefully | ||
| // and Che custom resource will stay with non empty "finalizers" field. | ||
| time.Sleep(time.Duration(terminationPeriod) * time.Second) | ||
| logrus.Info("Stop and exit operator.") | ||
| // Stop Che controller | ||
| close(stop) | ||
| // Exit from main process directly. | ||
| os.Exit(1) | ||
| }() | ||
|
|
||
| return stop | ||
| } | ||
|
|
||
| func printSignal(signal os.Signal) { | ||
| switch signal { | ||
| case syscall.SIGHUP: | ||
| logrus.Info("Signal SIGHUP") | ||
|
|
||
| case syscall.SIGINT: | ||
| logrus.Println("Signal SIGINT (ctrl+c)") | ||
|
|
||
| case syscall.SIGTERM: | ||
| logrus.Println("Signal SIGTERM stop") | ||
|
|
||
| case syscall.SIGQUIT: | ||
| logrus.Println("Signal SIGQUIT (top and core dump)") | ||
|
|
||
| default: | ||
| logrus.Println("Unknown signal") | ||
| } | ||
| } | ||
|
|
||
| func GetTerminationGracePeriodSeconds(k8sClient client.Reader, namespace string) int64 { | ||
| cheFlavor := os.Getenv("CHE_FLAVOR") | ||
| if cheFlavor == "" { | ||
| cheFlavor = "che" | ||
| } | ||
| defaultTerminationGracePeriodSeconds := int64(20) | ||
|
|
||
| deployment := &appsv1.Deployment{} | ||
| namespacedName := types.NamespacedName{Namespace: namespace, Name: cheFlavor + "-operator"} | ||
| if err := k8sClient.Get(context.TODO(), namespacedName, deployment); err != nil { | ||
| logrus.Warnf("Unable to find '%s' deployment in namespace '%s', err: %s", cheFlavor+"-operator", namespace, err.Error()) | ||
| } else { | ||
| terminationPeriod := deployment.Spec.Template.Spec.TerminationGracePeriodSeconds | ||
| if terminationPeriod != nil { | ||
| logrus.Infof("Use 'terminationGracePeriodSeconds' %d sec. from operator deployment.", *terminationPeriod) | ||
| return *terminationPeriod | ||
| } | ||
| } | ||
|
|
||
| logrus.Infof("Use default 'terminationGracePeriodSeconds' %d sec.", defaultTerminationGracePeriodSeconds) | ||
| return defaultTerminationGracePeriodSeconds | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -23,4 +23,6 @@ rules: | |
| - namespaces | ||
| verbs: | ||
| - update | ||
| - list | ||
| - create | ||
| - get | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.