Skip to content

Provide conversion webhook for CRDs#283

Merged
sgraband merged 6 commits intomainfrom
conversion-webhook
Mar 4, 2024
Merged

Provide conversion webhook for CRDs#283
sgraband merged 6 commits intomainfrom
conversion-webhook

Conversation

@sgraband
Copy link
Contributor

@sgraband sgraband commented Feb 23, 2024

Webhook is called, whenever a CR is requested in a specific version. This allows for a better updating path, as old CRs are still useable.

[conversion] Provide conversion java project:

  • A webhook that offers endpoints for the three CRD types
  • Is buildable as a runnable jar
  • Contains Mappers from all supported versions to a hub

[common] Add Hub and previous version for all CRDs

  • The hub is a superset of all values of a CRD across all versions

  • Keep a copy of the old supported versions to transform back

  • This is useful, as this way the the old operator still works

  • Supported from these versions: - AppDefintion.v1beta8 - Session.v1beta6 - Workspace.v1beta3

  • To showcase the functionality update CRDs to new version: - Move status like fields to status: - Session.v1beta7: Move url, lastActivity and error fields from the spec to the status. - Workspace.v1beta4: Move the error field from the spec to the status. Also add the error field to Workspace.v1beta3 as it was missing

    • Remove timeout.strategy from AppDefinition
      • AppDefinition.v1beta9: Removed timeout.strategy and timeout.limit
        is now just timeout. This was done, as there is only one Strategy left.

[operator] Adjust operator so it works with the above changes.

[service] Adjust service so it works with the above changes.

[documentation] Add build command for conversion-webhook

[.github] Add ci for conversion-webhook

  • Also fix publishing of new next-version (reusable typo)
  • (I pushed the missing images manually)

Contributed on behalf of STMicroelectronics
Co-authored-by: Johannes Faltermeier jfaltermeier@eclipsesource.com

Helm-repo PR: https://github.com/eclipsesource/theia-cloud-helm/pull/49
Fixes #203, #212 and #161.

Webhook is called, whenever a CR is requested in a specific version.
This allows for a better updating path, as old CRs are still useable.

[conversion] Provide conversion java project:
- A webhook that offers endpoints for the three CRD types
- Is buildable as a runnable jar
- Contains Mappers from all supported versions to a hub

[common] Add Hub and previous version for all CRDs
- The hub is a superset of all values of a CRD across all versions
- Keep a copy of the old supported versions to transform back
- This is useful, as this way the the old operator still works
- Supported from these versions:
    - `AppDefintion.v1beta8`
    - `Session.v1beta6`
    - `Workspace.v1beta3`
- To showcase the functionality update CRDs to new version:
    - Move status like fields to status:
        - `Session.v1beta7`: Move `url`, `lastActivity` and `error` fields
        from the spec to the status.
        - `Workspace.v1beta4`: Move the `error` field from the spec to the status.
        Also add the `error` field to `Workspace.v1beta3` as it was missing

    - Remove `timeout.strategy` from AppDefinition
        - `AppDefinition.v1beta9`: Removed `timeout.strategy` and `timeout.limit`
        is now just `timeout`. This was done, as there is only one Strategy left.

[operator] Adjust operator so it works with the above changes.

[service] Adjust service so it works with the above changes.

[documentation] Add build command for `conversion-webhook`

[.github] Add ci for `conversion-webhook`
- Also fix publishing of new `next-version` (reusable typo)

Contributed on behalf of STMicroelectronics
Co-authored-by: Johannes Faltermeier <jfaltermeier@eclipsesource.com>
* add eclipse metadata to be consistent with other java components
* open all projects in Theia IDE with Java once to update settings
@jfaltermeier
Copy link
Contributor

jfaltermeier commented Feb 28, 2024

I've pushed some missing eclipse metadata files and opened all java projects with Eclipse (2023-03), VSCode, and the TheiaIDE and committed the resulting updates to the metadata files.

@jfaltermeier
Copy link
Contributor

I noticed that there are some left over theia.cloud/v1beta8 AppDefinition references in:
demo/dockerfiles/demo-operator-custom-template/templateDeployment.yaml
demo/dockerfiles/demo-operator-custom-template/templateDeploymentWithoutOAuthProxy.yaml
helm/theia.cloud/test/cdt.yaml
terraform/test-configurations/2-01_try-now/theia_cloud.tf
terraform/test-configurations/2-03_try-now_paths/theia_cloud.tf

* add eclipse metadata to be consistent with other java components
* open all projects in Theia IDE with Java once to update settings
@jfaltermeier
Copy link
Contributor

I've pushed some missing eclipse metadata files and opened all java projects with Eclipse (2023-03), VSCode, and the TheiaIDE and committed the resulting updates to the metadata files.

Could you please check if you get changes on the settings in different IDEs? If yes we should check if we can fix this (probably in a follow up ticket), because the settings should not get added to .gitignore, if possible.

Copy link
Contributor

@jfaltermeier jfaltermeier left a comment

Choose a reason for hiding this comment

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

Thanks, I had a first look at the code and it looks very good already.
I will start some testing now as well.

@sgraband
Copy link
Contributor Author

Could you please check if you get changes on the settings in different IDEs? If yes we should check if we can fix this (probably in a follow up ticket), because the settings should not get added to .gitignore, if possible.

Looks good on my side. Tested also with VSCode, TheiaIDE and Eclipse

Copy link
Contributor

@jfaltermeier jfaltermeier left a comment

Choose a reason for hiding this comment

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

I did a first test and found one issue (see inline comment).
Overall everything looks pretty good. I had no issues with certificates and the conversion was triggered smoothly.

I will do more testing on Friday

sgraband and others added 2 commits February 28, 2024 15:04
Update `v1beta8` references to `v1beta9`.
Fix `sessionSecret` in `SessionHub`.
Fix tests.
Use `org.jboss.logging.Logger` in conversion project.
Also log the endpoints that were triggered.
Copy link
Contributor

@jfaltermeier jfaltermeier left a comment

Choose a reason for hiding this comment

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

I've found two more mixups in the Hub.
After those are fixed, I think we can approve and merge this.
This was the only issue I found during the second test.

Also I pushed one commit updating the AppDefinitions in the tf files I used for testing

Fix minor issues in constructors.
@sgraband sgraband requested a review from jfaltermeier March 1, 2024 14:11
Copy link
Contributor

@jfaltermeier jfaltermeier left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM!

@sgraband sgraband merged commit 7c67236 into main Mar 4, 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.

Store status-like properties of CRs in status instead of spec Best practices for CRD updates Remove TimeoutStrategy interface if possible

2 participants