Files
Vadym Popov a78cb0e633 Fix major version check for stateless environment (#52837)
* Added auth information resource with persisting teleport version

* Check the set of the auth info to compare with min/max versions in cluster

* Store only one entity for the cluster version

* Add CRUD endpoints
Change to use conditional update and retry
Fix spelling

* Add validation for version, sub kind, kind, name

* Rename to authinfo.go

* Assigning error after creating new resource

* Move retry logic to version check helper

* Call create/update depends on if resource is created already
Read local database once without retry

* Restrict major version downgrade

* Make `--skip-version-check` available for major upgrade check

* Fix linter warnings

* Add logs and make skip more safe in case of broke item in backend

* Remove deleting version item from process database, stateBackend doesn't support deletion (requires implementation for kube secrets storage)

* Rename AuthInfo to BackendInfo
Add cleanup of the version item from process storage after successful migration

* Make skip-version-check to upsert the version in backend

* Update lib/auth/version.go

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

---------

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
2025-05-05 22:51:24 +00:00

40 lines
1.7 KiB
Go

/*
* Teleport
* Copyright (C) 2025 Gravitational, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package services
import (
"context"
backendinfov1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/backendinfo/v1"
)
// BackendInfoService stores information about the backend.
type BackendInfoService interface {
// GetBackendInfo gets the BackendInfo singleton resource.
GetBackendInfo(ctx context.Context) (*backendinfov1.BackendInfo, error)
// CreateBackendInfo creates the BackendInfo singleton resource.
CreateBackendInfo(ctx context.Context, info *backendinfov1.BackendInfo) (*backendinfov1.BackendInfo, error)
// UpdateBackendInfo updates the BackendInfo singleton resource.
UpdateBackendInfo(ctx context.Context, info *backendinfov1.BackendInfo) (*backendinfov1.BackendInfo, error)
// UpsertBackendInfo create or update the BackendInfo singleton resource.
UpsertBackendInfo(ctx context.Context, info *backendinfov1.BackendInfo) (*backendinfov1.BackendInfo, error)
// DeleteBackendInfo deletes the BackendInfo singleton resource.
DeleteBackendInfo(ctx context.Context) error
}