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

Client AutoUpdate proto structure changes #47532

Merged
merged 6 commits into from
Oct 17, 2024

Conversation

vapopov
Copy link
Contributor

@vapopov vapopov commented Oct 12, 2024

In this PR reflected proposed changes from #47498

Version (from -> to):

kind: autoupdate_version
spec:
  tools_version: X.Y.Z
kind: autoupdate_version
spec:
  tools:
    target_version: X.Y.Z

Config (from -> to):

kind: autoupdate_config
spec:
  tools_autoupdate: on|off
kind: autoupdate_config
spec:
  tools:
    mode: enabled|disabled

@vapopov vapopov added the no-changelog Indicates that a PR does not require a changelog entry label Oct 12, 2024
@github-actions github-actions bot requested review from greedy52 and tigrato October 12, 2024 01:07
}

// ToolsMode type for client tools enabling state.
enum ToolsMode {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
enum ToolsMode {
enum ToolsUpdateMode {


// AutoUpdateVersionTools encodes the parameters for client tools auto updates.
message AutoUpdateVersionTools {
// TargetVersion is the semantic version required for tools autoupdates.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the target version we want you to upgrade to or is it the version required for you to be able to update to something else?

Copy link
Contributor

Choose a reason for hiding this comment

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

@vapopov what's the correct version here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tigrato TargetVersion is mandatory version for update, if mode is enabled so everyone who is connected to the cluster going to be updated to this version (except client tools executed with disabling env variable)

Copy link
Contributor

@tigrato tigrato Oct 16, 2024

Choose a reason for hiding this comment

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

Can we rename it to:

// TargetVersion specifies the semantic version required for tools to establish a connection with the cluster.

The way it's written today is misleading and reads as the version required for auto updates and not the target auto update version

@@ -34,7 +34,26 @@ message AutoUpdateConfig {
// AutoUpdateConfigSpec encodes the parameters of the autoupdate config object.
message AutoUpdateConfigSpec {
// ToolsAutoupdate encodes the feature flag to enable/disable tools autoupdates.
// Deprecated: use AutoUpdateConfigTools instead.
Copy link
Contributor

Choose a reason for hiding this comment

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

is this being used in prod? If no, we can reserve the field and continue

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 let's reserve the fields and deprecate

@@ -60,11 +60,13 @@ func ValidateAutoUpdateVersion(v *autoupdate.AutoUpdateVersion) error {
return trace.BadParameter("Spec is nil")
}

if v.Spec.ToolsVersion == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

you no longer validate v.Spec.ToolsVersion. Is it used in prod? Should we keep it if not used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually we decided to rename before actual usage in prod, so this resource is not used previously

@vapopov vapopov force-pushed the vapopov/update-autoupdate-proto-structure branch from 1b4e023 to b9449c9 Compare October 15, 2024 20:33
Comment on lines 42 to 45
message AutoUpdateConfigTools {
// Mode defines state of the client tools auto update.
ToolsUpdateMode mode = 1;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this message be named AutoUpdateConficSpecTools? That's what we put in RFD 184 but I cvan change the RFD if needed.

Copy link
Contributor Author

@vapopov vapopov Oct 16, 2024

Choose a reason for hiding this comment

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

since it's already in rfd, changing this one, and for version

Comment on lines 44 to 54
ToolsUpdateMode mode = 1;
}

// ToolsMode type for client tools enabling state.
enum ToolsUpdateMode {
// TOOLS_UPDATE_MODE_UNSPECIFIED is undefined mode.
TOOLS_UPDATE_MODE_UNSPECIFIED = 0;
// TOOLS_UPDATE_MODE_ENABLED client tools auto update is enabled.
TOOLS_UPDATE_MODE_ENABLED = 1;
// TOOLS_UPDATE_MODE_DISABLED client tools auto update is disabled.
TOOLS_UPDATE_MODE_DISABLED = 2;
Copy link
Contributor

@hugoShaka hugoShaka Oct 16, 2024

Choose a reason for hiding this comment

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

Can you make the mode a string instead of an enum? Sorry for the last minute change, I made a mistake in the RFD and this should have been a string.

There is nothing wrong technically with it being an enum (technically it's better as we have stricter content validation), however we use the protobuf messages to generate Kubernetes CRDs and Terraform Schemas. Seeing integers instead of strings is not user friendly as it's not clear that mode: 2 means "updates are disabled".

I will update RFD 184 to fix the protos.

@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from sclevine October 17, 2024 14:07
@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from greedy52 October 17, 2024 14:07
@vapopov vapopov added this pull request to the merge queue Oct 17, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 17, 2024
@hugoShaka hugoShaka added this pull request to the merge queue Oct 17, 2024
Merged via the queue into master with commit 10fb784 Oct 17, 2024
43 checks passed
@hugoShaka hugoShaka deleted the vapopov/update-autoupdate-proto-structure branch October 17, 2024 15:07
vapopov added a commit that referenced this pull request Oct 17, 2024
* Update client autoupdate proto structure

* Replace with reserved

* Fix unit tests

* Add more info in proto

* Rename proto to be aligned RFD namings

* Replace enum type for ToolsMode to string
vapopov added a commit that referenced this pull request Oct 17, 2024
* Update client autoupdate proto structure

* Replace with reserved

* Fix unit tests

* Add more info in proto

* Rename proto to be aligned RFD namings

* Replace enum type for ToolsMode to string
vapopov added a commit that referenced this pull request Oct 17, 2024
* Update client autoupdate proto structure

* Replace with reserved

* Fix unit tests

* Add more info in proto

* Rename proto to be aligned RFD namings

* Replace enum type for ToolsMode to string
vapopov added a commit that referenced this pull request Oct 17, 2024
* Update client autoupdate proto structure

* Replace with reserved

* Fix unit tests

* Add more info in proto

* Rename proto to be aligned RFD namings

* Replace enum type for ToolsMode to string
vapopov added a commit that referenced this pull request Nov 8, 2024
* Update client autoupdate proto structure

* Replace with reserved

* Fix unit tests

* Add more info in proto

* Rename proto to be aligned RFD namings

* Replace enum type for ToolsMode to string
vapopov added a commit that referenced this pull request Nov 8, 2024
* Update client autoupdate proto structure

* Replace with reserved

* Fix unit tests

* Add more info in proto

* Rename proto to be aligned RFD namings

* Replace enum type for ToolsMode to string
github-merge-queue bot pushed a commit that referenced this pull request Dec 4, 2024
* Expose client tools auto update for find endpoint (#46785)

* Expose client tools auto update for find endpoint

* Group auto update settings in find response
Log error instead returning error
Add tests auto update settings in find endpoint
Add check for not implemented error

* Add more test cases

* Client AutoUpdate proto structure changes (#47532)

* Update client autoupdate proto structure

* Replace with reserved

* Fix unit tests

* Add more info in proto

* Rename proto to be aligned RFD namings

* Replace enum type for ToolsMode to string

* Add packaging utility for client tools auto updates (#47060)

* Add packaging utility for client tools auto updates

* Add error handling for close functions

* Move archive to existing utils package

* Move archive helpers to integration/helper
CR changes

* CR changes

* CR changes

* CR changes
Replace creating directory with extract path as argument

* CR changes

* Validate full size before un-archive
Extract files to extractDir with ignore dir structure

* Change compressing with relative paths
Add test for cleanup and fix skip logic

* CR changes

* CR changes

* Fix linter

* Client tools auto update (#47466)

* Add client tools auto update

* Replace fork for posix platform for re-exec
Move integration tests to client tools specific dir
Use context cancellation with SIGTERM, SIGINT
Remove cancelable tee reader with context replacement
Renaming

* Fix syscall path execution
Fix archive cleanup if hash is not valid
Limit the archive write bytes

* Cover the case with single package for darwin platform after v17

* Move updater logic to tools package

* Move context out from the library
Base URL renaming

* Add more context in comments

* Changes in find endpoint

* Replace test http server with `httptest`
Replace hash for bytes matching
Proper temp file close for archive download

* Add more context to comments

* Move feature flag to main package to be reused

* Constant rename

* Replace build tag with lib/modules to identify enterprise build

* Replace fips tag with modules flag

* Client auto updates integration for {tctl,tsh} (#47815)

* Client auto updates integration for tctl/tsh

* Add version validation
Fix recursive version check for darwin platform
Fix cleanup for multi-package support

* Fix identifying tools removal from home directory

* Replace ToolsMode with ToolsAutoUpdate

* Reuse insecure flag for tests

* Fix CheckRemote with login

* Fix windows administrative access requirement
Update must be able to be canceled, re-execute with latest version or last updated
Show progress bar before request is made

* Fix update cancellation for login action
Address review comments

* Add signal handler with stack context cancellation

* Use copy instead of hard link for windows
Fix progress bar if we can't receive size of package

* Replace with list in order to support manual cancel

* Download archive package to temp directory

* Decrease timeout for client tools proxy call

* Add audit logs for auto update resources (#48218)

* Connect: Make sure tsh auto-updates are turned off (#49180)

* Add dir for code shared between Node.js processes

* Connect: Make sure tsh auto-updates are turned off

* Pass TELEPORT_TOOLS_VERSION=off to tsh vnet-daemon

* Disable client tools auto update disabled if there are no home dir (#49159)

Move updater to general tools package

* Move client auto update helper to lib package (#49247)

---------

Co-authored-by: Rafał Cieślak <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Dec 11, 2024
* Expose client tools auto update for find endpoint (#46785)

* Expose client tools auto update for find endpoint

* Group auto update settings in find response
Log error instead returning error
Add tests auto update settings in find endpoint
Add check for not implemented error

* Add more test cases

* Client AutoUpdate proto structure changes (#47532)

* Update client autoupdate proto structure

* Replace with reserved

* Fix unit tests

* Add more info in proto

* Rename proto to be aligned RFD namings

* Replace enum type for ToolsMode to string

* Add packaging utility for client tools auto updates (#47060)

* Add packaging utility for client tools auto updates

* Add error handling for close functions

* Move archive to existing utils package

* Move archive helpers to integration/helper
CR changes

* CR changes

* CR changes

* CR changes
Replace creating directory with extract path as argument

* CR changes

* Validate full size before un-archive
Extract files to extractDir with ignore dir structure

* Change compressing with relative paths
Add test for cleanup and fix skip logic

* CR changes

* CR changes

* Fix linter

* Client tools auto update (#47466)

* Add client tools auto update

* Replace fork for posix platform for re-exec
Move integration tests to client tools specific dir
Use context cancellation with SIGTERM, SIGINT
Remove cancelable tee reader with context replacement
Renaming

* Fix syscall path execution
Fix archive cleanup if hash is not valid
Limit the archive write bytes

* Cover the case with single package for darwin platform after v17

* Move updater logic to tools package

* Move context out from the library
Base URL renaming

* Add more context in comments

* Changes in find endpoint

* Replace test http server with `httptest`
Replace hash for bytes matching
Proper temp file close for archive download

* Add more context to comments

* Move feature flag to main package to be reused

* Constant rename

* Replace build tag with lib/modules to identify enterprise build

* Replace fips tag with modules flag

* Client auto updates integration for {tctl,tsh} (#47815)

* Client auto updates integration for tctl/tsh

* Add version validation
Fix recursive version check for darwin platform
Fix cleanup for multi-package support

* Fix identifying tools removal from home directory

* Replace ToolsMode with ToolsAutoUpdate

* Reuse insecure flag for tests

* Fix CheckRemote with login

* Fix windows administrative access requirement
Update must be able to be canceled, re-execute with latest version or last updated
Show progress bar before request is made

* Fix update cancellation for login action
Address review comments

* Add signal handler with stack context cancellation

* Use copy instead of hard link for windows
Fix progress bar if we can't receive size of package

* Replace with list in order to support manual cancel

* Download archive package to temp directory

* Decrease timeout for client tools proxy call

* Add audit logs for auto update resources (#48218)

* Connect: Make sure tsh auto-updates are turned off

* Add dir for code shared between Node.js processes

* Connect: Make sure tsh auto-updates are turned off

* Pass TELEPORT_TOOLS_VERSION=off to tsh vnet-daemon

* Disable client tools auto update disabled if there are no home dir (#49159)

Move updater to general tools package

* Move client auto update helper to lib package (#49247)

---------

Co-authored-by: Rafał Cieślak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a PR does not require a changelog entry size/sm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants