-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix major version check for stateless environment #52837
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7f24cf5
Added auth information resource with persisting teleport version
vapopov 3afa085
Check the set of the auth info to compare with min/max versions in cl…
vapopov 42b8f57
Store only one entity for the cluster version
vapopov e64be05
Merge remote-tracking branch 'origin/master' into vapopov/major-versi…
vapopov ed65c85
Add CRUD endpoints
vapopov 9215b65
Add validation for version, sub kind, kind, name
vapopov f17930d
Rename to authinfo.go
vapopov ca2e9cf
Merge remote-tracking branch 'origin/master' into vapopov/major-versi…
vapopov 259321d
Assigning error after creating new resource
vapopov 319ef14
Move retry logic to version check helper
vapopov 38d3292
Call create/update depends on if resource is created already
vapopov 9b40b98
Restrict major version downgrade
vapopov 168f991
Make `--skip-version-check` available for major upgrade check
vapopov bf3a7c7
Fix linter warnings
vapopov ab729e2
Add logs and make skip more safe in case of broke item in backend
vapopov 3fea4c4
Merge remote-tracking branch 'origin/master' into vapopov/major-versi…
vapopov 140da4d
Remove deleting version item from process database, stateBackend does…
vapopov 8956cef
Rename AuthInfo to BackendInfo
vapopov 3aa4da5
Make skip-version-check to upsert the version in backend
vapopov 7a1e70f
Update lib/auth/version.go
vapopov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // Copyright 2025 Gravitational, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| syntax = "proto3"; | ||
|
|
||
| package teleport.authinfo.v1; | ||
|
|
||
| import "teleport/header/v1/metadata.proto"; | ||
|
|
||
| option go_package = "github.com/gravitational/teleport/api/gen/proto/go/teleport/authinfo/v1;authinfov1"; | ||
|
|
||
| // AuthInfo holds meta-information for specific server. | ||
| message AuthInfo { | ||
| string kind = 1; | ||
| string sub_kind = 2; | ||
| string version = 3; | ||
| teleport.header.v1.Metadata metadata = 4; | ||
|
|
||
| AuthInfoSpec spec = 5; | ||
| } | ||
|
|
||
| // AuthInfoSpec encodes the parameters auth server meta-information. | ||
| message AuthInfoSpec { | ||
| // teleport_version advertises the version of the auth server, e.g., "17.3.3" (without the leading "v"). | ||
| string teleport_version = 1; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| Copyright 2025 Gravitational, Inc. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package authinfo | ||
|
|
||
| import ( | ||
| "github.com/gravitational/trace" | ||
|
|
||
| authinfov1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/authinfo/v1" | ||
| headerv1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/header/v1" | ||
| "github.com/gravitational/teleport/api/types" | ||
| ) | ||
|
|
||
| // NewAuthInfo creates a new auth info resource. | ||
| func NewAuthInfo(spec *authinfov1.AuthInfoSpec) (*authinfov1.AuthInfo, error) { | ||
| info := &authinfov1.AuthInfo{ | ||
| Kind: types.KindAuthInfo, | ||
| Version: types.V1, | ||
| Metadata: &headerv1.Metadata{ | ||
| Name: types.MetaNameAuthInfo, | ||
| }, | ||
| Spec: spec, | ||
| } | ||
| if err := ValidateAuthInfo(info); err != nil { | ||
| return nil, trace.Wrap(err) | ||
| } | ||
|
|
||
| return info, nil | ||
| } | ||
|
|
||
| // ValidateAuthInfo checks that required parameters are set | ||
| // for the specified AuthInfo. | ||
| func ValidateAuthInfo(info *authinfov1.AuthInfo) error { | ||
| switch { | ||
| case info.GetKind() != types.KindAuthInfo: | ||
| return trace.BadParameter("wrong AuthInfo Kind: %+q", info.Kind) | ||
| case info.GetMetadata().Name != types.MetaNameAuthInfo: | ||
| return trace.BadParameter("wrong AuthInfo Metadata name: %+q", info.GetMetadata().Name) | ||
| case info.GetSubKind() != "": | ||
| return trace.BadParameter("wrong AuthInfo SubKind: %+q", info.GetSubKind()) | ||
| case info.GetVersion() != types.V1: | ||
| return trace.BadParameter("wrong AuthInfo Version: %+q", info.GetVersion()) | ||
| default: | ||
| return nil | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, auth info is now meta information about the whole backend, not a specific server. Could you document that it's a singleton?
The comment should also explains who creates the resource, who reads it, and what issue it is solving.