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

Implement devEnvironments.workspacesPodAnnotations to provide annotations to all workspace pods #1862

Merged
merged 2 commits into from
Jun 27, 2024

Conversation

dkwon17
Copy link
Contributor

@dkwon17 dkwon17 commented Jun 19, 2024

This PR is a draft PR for now because it requires the latest unreleased version of the devworkspace-operator

What does this PR do?

This PR implements the devEnvironments.workspacesPodAnnotations field in the CheCluster CR to provide annotations to all workspace pods

Screenshot/screencast of this PR

image

What issues does this PR fix or reference?

Related to:
https://issues.redhat.com/browse/CRW-6550
eclipse-che/che#22809

How to test this PR?

  1. Prepare a patch file with an annotation hello: world:
cat > /tmp/cr-patch.yaml <<EOF
apiVersion: org.eclipse.che/v2
kind: CheCluster
spec:
  devEnvironments:
    workpsacesPodAnnotations:
      hello: world
EOF
  1. Deploy the operator:

OpenShift

./build/scripts/olm/test-catalog-from-sources.sh --cr-patch-yaml /tmp/cr-patch.yaml

on Minikube

./build/scripts/minikube-tests/test-operator-from-sources.sh --cr-patch-yaml /tmp/cr-patch.yaml
  1. Start a workspace and verify that the workspace pod has the hello: world annotation
  2. Remove the devEnvironments.workspacesPodAnnotations field in the CheCluster CR and restart the workspace.
  3. Verify that the hello: world annotation is removed

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.

Copy link

openshift-ci bot commented Jun 19, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@dkwon17 dkwon17 force-pushed the devworkspace-annotations branch 2 times, most recently from 7ba6ad8 to 8fb52b8 Compare June 25, 2024 15:46
@dkwon17 dkwon17 marked this pull request as ready for review June 25, 2024 15:46
dwoc := &controllerv1alpha1.DevWorkspaceOperatorConfig{}
err = deployContext.ClusterAPI.Client.Get(context.TODO(), types.NamespacedName{Name: devWorkspaceConfigName, Namespace: testCase.cheCluster.Namespace}, dwoc)
assert.NoError(t, err)
assert.Equal(t, testCase.expectedOperatorConfig.Workspace.ImagePullPolicy, dwoc.Config.Workspace.ImagePullPolicy)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this was intended to check the config annotations?

assert.Equal(t, testCase.expectedOperatorConfig.Workspace.podAnnotations, dwoc.Config.Workspace.podAnnotations)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, fixed

@@ -5,7 +5,7 @@ go 1.19
require (
github.com/che-incubator/kubernetes-image-puller-operator v0.0.0-20210929175054-0128446f5af7
github.com/devfile/api/v2 v2.2.2
github.com/devfile/devworkspace-operator v0.25.0
github.com/devfile/devworkspace-operator v0.29.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update DEPENDENCIES.md file with a new DWO version and link to https://clearlydefined.io/

@@ -14,7 +14,7 @@ require (
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.8.4
go.uber.org/zap v1.24.0
golang.org/x/net v0.19.0
golang.org/x/net v0.23.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update DEPENDENCIES.md file to update the version of the following libs (no links to https://clearlydefined.io/ are requested)

  • golang.org/x/net v0.23.0
  • golang.org/x/sys v0.18.0
  • golang.org/x/term v0.18.0

@@ -189,6 +189,9 @@ type CheClusterDevEnvironments struct {
// +optional
// +kubebuilder:validation:Enum=Always;IfNotPresent;Never
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
// Annotations defines additional annotations for workspace pods.
// +optional
Annotations map[string]string `json:"annotations,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think?

Suggested change
Annotations map[string]string `json:"annotations,omitempty"`
WorkspacesPodAnnotations map[string]string `json:"workspacesPodAnnotations,omitempty"`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, updated

@openshift-ci openshift-ci bot removed the lgtm label Jun 26, 2024
@dkwon17
Copy link
Contributor Author

dkwon17 commented Jun 26, 2024

Thank you for the review @tolusha , WDYT?

@tolusha
Copy link
Contributor

tolusha commented Jun 27, 2024

/test v14-devworkspace-happy-path

Copy link

openshift-ci bot commented Jun 27, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dkwon17, ibuziuk, 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

@dkwon17 dkwon17 force-pushed the devworkspace-annotations branch from 941d418 to 0a1cc70 Compare June 27, 2024 13:58
@openshift-ci openshift-ci bot removed the lgtm label Jun 27, 2024
Copy link

openshift-ci bot commented Jun 27, 2024

New changes are detected. LGTM label has been removed.

@dkwon17
Copy link
Contributor Author

dkwon17 commented Jun 27, 2024

I've squashed the commits, merging soon

Copy link

openshift-ci bot commented Jun 27, 2024

@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/v14-che-behind-proxy 0a1cc70 link true /test v14-che-behind-proxy

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-sigs/prow repository. I understand the commands that are listed here.

@dkwon17 dkwon17 force-pushed the devworkspace-annotations branch from 0a1cc70 to db792ec Compare June 27, 2024 14:24
@dkwon17 dkwon17 merged commit f5d60a0 into eclipse-che:main Jun 27, 2024
15 of 19 checks passed
@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.16 :: get-sources-rhpkg-container-build_3.x/6950: FAILURE

devspaces-operator-bundle : 3.x :: Failed in 62253699 : BREW:BUILD/STATUS:UNKNOWN
FAILURE:; copied to quay

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.16 :: get-sources-rhpkg-container-build_3.x/6952: FAILURE

devspaces-operator-bundle : 3.x :: Failed in 62253993 : BREW:BUILD/STATUS:UNKNOWN
FAILURE:; copied to quay

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.16 :: get-sources-rhpkg-container-build_3.x/6954: FAILURE

devspaces-operator-bundle : 3.x :: Failed in 62255856 : BREW:BUILD/STATUS:UNKNOWN
FAILURE:; copied to quay

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.16 :: get-sources-rhpkg-container-build_3.x/6956: FAILURE

devspaces-operator-bundle : 3.x :: Failed in 62258212 : BREW:BUILD/STATUS:UNKNOWN
FAILURE:; copied to quay

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.16 :: get-sources-rhpkg-container-build_3.x/6957: FAILURE

devspaces-operator-bundle : 3.x :: Failed in 62258381 : BREW:BUILD/STATUS:UNKNOWN
FAILURE:; copied to quay

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.16 :: get-sources-rhpkg-container-build_3.x/6958: FAILURE

devspaces-operator-bundle : 3.x :: Failed in 62258967 : BREW:BUILD/STATUS:UNKNOWN
FAILURE:; copied to quay

@dkwon17 dkwon17 changed the title Implement devEnvironments.annotations to provide annotations to all workspace pods Implement devEnvironments.workspacesPodAnnotations to provide annotations to all workspace pods Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants