-
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
Changes from 4 commits
7f24cf5
3afa085
42b8f57
e64be05
ed65c85
9215b65
f17930d
ca2e9cf
259321d
319ef14
38d3292
9b40b98
168f991
bf3a7c7
ab729e2
3fea4c4
140da4d
8956cef
3aa4da5
7a1e70f
File filter
Filter by extension
Conversations
Jump to
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.
| 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;authinfo"; | ||
|
|
||
| // AuthInfo holds meta-information for specific server. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| 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. | ||
|
vapopov marked this conversation as resolved.
Outdated
|
||
| string teleport_version = 1; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /* | ||
| 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/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" | ||
| "github.com/gravitational/trace" | ||
| ) | ||
|
|
||
| // NewAuthInfo creates a new auth info resource. | ||
| func NewAuthInfo(spec *authinfo.AuthInfoSpec) (*authinfo.AuthInfo, error) { | ||
| info := &authinfo.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(c *authinfo.AuthInfo) error { | ||
| if c == nil { | ||
| return trace.BadParameter("AuthInfo is nil") | ||
| } | ||
| if c.Metadata == nil { | ||
| return trace.BadParameter("Metadata is nil") | ||
| } | ||
| if c.Spec == nil { | ||
| return trace.BadParameter("Spec is nil") | ||
| } | ||
|
vapopov marked this conversation as resolved.
Outdated
|
||
|
|
||
|
vapopov marked this conversation as resolved.
Outdated
|
||
| return nil | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.