Skip to content
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

feat: implement secondsOfInactivityBeforeIdling and secondsOfRunBefor… #1443

Merged
merged 6 commits into from
Jul 13, 2022

Conversation

dkwon17
Copy link
Contributor

@dkwon17 dkwon17 commented Jul 11, 2022

…eIdling CR config

Signed-off-by: David Kwon dakwon@redhat.com

What does this PR do?

Part of eclipse-che/che#21390.

This PR adds spec.devEnvironments.secondsOfInactivityBeforeIdling and spec.devEnvironments.secondsOfRunBeforeIdling config in the CheCluster CR:
image

This PR reads the above config to create a configmap named che-idle-settings when a user namespace is reconciled. The configmap is created so that the data can be mounted to the devworkspace containers. This PR for che-machine-exec: eclipse-che/che-machine-exec#208 reads these environment variables. Here is an example of the generated config map:
image

What issues does this PR fix or reference?

Part of eclipse-che/che#21390.

How to test this PR?

To test on an OpenShift cluster:

  1. Create and install Che operator with this catalog source file:
apiVersion:  operators.coreos.com/v1alpha1
kind:         CatalogSource
metadata:
  name:         eclipse-che-custom-catalog
  namespace:    openshift-operators
spec:
  image:       quay.io/dkwon17/eclipse-che-openshift-opm-catalog:next
  sourceType:  grpc
  updateStrategy:
    registryPoll:
      interval: 5m

with this che-operator image: quay.io/dkwon17/che-operator:idle-cr

  1. Create a CheCluster CR with spec.devEnvironments.secondsOfInactivityBeforeIdling set to "300" and spec.devEnvironments.secondsOfRunBeforeIdling set to "360".

  2. Open the dashboard to provision a user namespace.

  3. In the user namespace verify that the che-idle-settings configmap in the user namespace is created, with the following data:

SECONDS_OF_DW_INACTIVITY_BEFORE_IDLING: "300"
SECONDS_OF_DW_RUN_BEFORE_IDLING: "360"
  1. Edit the spec.devEnvironments.secondsOfInactivityBeforeIdling and spec.devEnvironments.secondsOfRunBeforeIdling properties in the CheCluster CR to different values and verify that the changes exist in the che-idle-settings configmap.

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

api/v2/checluster_types.go Outdated Show resolved Hide resolved
@tolusha
Copy link
Contributor

tolusha commented Jul 12, 2022

@l0rd
Are you ok to add those fields to DevEnvironemnts section?

@tolusha
Copy link
Contributor

tolusha commented Jul 12, 2022

@dkwon17
You have to add the fields to CheCluster API v1 as well [1] and implement conversion like here for instance [2]

[1] https://github.com/eclipse-che/che-operator/blob/3830ac4e28983dbe928d0777f63c87bed43feb4b/api/v1/checluster_types.go
[2] https://github.com/eclipse-che/che-operator/pull/1395/files

@l0rd
Copy link
Contributor

l0rd commented Jul 12, 2022

@tolusha yes, having the fields in the DevEnvironments is what I suggested in the issue description.

api/v2/checluster_types.go Outdated Show resolved Hide resolved
…eIdling CR config

Signed-off-by: David Kwon <dakwon@redhat.com>
@dkwon17
Copy link
Contributor Author

dkwon17 commented Jul 12, 2022

Thanks all for the feedback

You have to add the fields to CheCluster API v1 as well [1] and implement conversion like here for instance [2]

Fixed

I updated this PR to have default values of 900 and -1 to spec.devEnvironments.secondsOfInactivityBeforeIdling and spec.devEnvironments.secondsOfRunBeforeIdling respectively:

image

Here is the che-idle-settings configmap that is created for a user namespace:
image

Inside a workspace container:
image

api/v2/checluster_types.go Outdated Show resolved Hide resolved
Signed-off-by: David Kwon <dakwon@redhat.com>
@l0rd
Copy link
Contributor

l0rd commented Jul 13, 2022

@dkwon17 900 seconds = 15 minutes and that's too short for the default (15 min is ok for Developer Sandbox because it's a free service and we want to aggressively shut down workspaces if they are not used).

tolusha and others added 4 commits July 13, 2022 17:53
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: David Kwon <dakwon@redhat.com>
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Copy link
Contributor

@tolusha tolusha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's wait for PR checks

@openshift-ci
Copy link

openshift-ci bot commented Jul 13, 2022

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dkwon17, tolusha

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tolusha
Copy link
Contributor

tolusha commented Jul 13, 2022

@dkwon17
It is good to merge.

@dkwon17
Copy link
Contributor Author

dkwon17 commented Jul 13, 2022

Thank you everyone, I will squash and merge

@openshift-ci
Copy link

openshift-ci bot commented Jul 13, 2022

@dkwon17: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/v9-devworkspace-happy-path fdbbcdb link true /test v9-devworkspace-happy-path

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants