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

Environment: make identifier optional #335

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andmat900
Copy link
Contributor

Applicable Issues

Description of the Change

This change introduces handling of environment requests and environments that aren't bound to suite id/testrun and thus have no identifier attribute. This allows creating EnvironmentRequest / Environment objects without a testrun using Kubernetes API directly.

Alternate Designs

Possible Drawbacks

Sign-off

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

Signed-off-by: Andrei Matveyeu, [email protected]

@andmat900 andmat900 requested a review from a team as a code owner January 2, 2025 15:50
@andmat900 andmat900 requested review from t-persson and fredjn and removed request for a team January 2, 2025 15:50
Copy link
Collaborator

@t-persson t-persson left a comment

Choose a reason for hiding this comment

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

The issue that you are refering to does not say anything about the environment controller or spec.
The issue is for the environmentrequest.spec.identifier which has omitempty and it shall be handled in the environmentrequest controller.

@andmat900
Copy link
Contributor Author

The issue that you are refering to does not say anything about the environment controller or spec. The issue is for the environmentrequest.spec.identifier which has omitempty and it shall be handled in the environmentrequest controller.

Your issue does not say where/how it should be handled.

When no identifier is given in environment request label, are you suggesting to set a zero UUID identifier here?

"etos.eiffel-community.github.io/id": environmentrequest.Spec.Identifier, // TODO: omitempty

If not, how can this handling be limited to environmentrquest controller?

@t-persson
Copy link
Collaborator

The issue that you are refering to does not say anything about the environment controller or spec. The issue is for the environmentrequest.spec.identifier which has omitempty and it shall be handled in the environmentrequest controller.

Your issue does not say where/how it should be handled.

When no identifier is given in environment request label, are you suggesting to set a zero UUID identifier here?

"etos.eiffel-community.github.io/id": environmentrequest.Spec.Identifier, // TODO: omitempty

If not, how can this handling be limited to environmentrquest controller?

The issue refers to this TODO: https://github.com/eiffel-community/etos/blob/main/internal/controller/environmentrequest_controller.go#L235 which states that this parameter may be omitted when creating an environmentrequest as per this line https://github.com/eiffel-community/etos/blob/main/api/v1alpha1/environmentrequest_types.go#L56 . This means that the environmentrequest_controller must handle the cases where it is empty.

Adding omitempty to other parameters is not something that should be done in this case.

@andmat900
Copy link
Contributor Author

When no identifier is given in environment request label, are you suggesting to set a zero UUID identifier here?

"etos.eiffel-community.github.io/id": environmentrequest.Spec.Identifier, // TODO: omitempty

If not, how can this handling be limited to environmentrquest controller?

Please clarify these two questions.

@andmat900 andmat900 requested a review from t-persson February 3, 2025 10:28
@t-persson
Copy link
Collaborator

When no identifier is given in environment request label, are you suggesting to set a zero UUID identifier here?

"etos.eiffel-community.github.io/id": environmentrequest.Spec.Identifier, // TODO: omitempty

If not, how can this handling be limited to environmentrquest controller?

Please clarify these two questions.

identifier := environmentrequest.Spec.Identifier
if identifier == "" {
  identifier = string(uuid.NewUUID())
}
environmentrequest.Labels["etos.eiffel-community.github.io/id"] = identifier

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.

2 participants