Skip to content

Commit

Permalink
Add autoupdate resources config/version (#46173)
Browse files Browse the repository at this point in the history
* Add autoupdate resources config/version

* Rename Autoupdate to AutoUpdate
Add auto update to audit events

* Rename Autoupdate to AutoUpdate
  • Loading branch information
vapopov committed Sep 4, 2024
1 parent 42ce406 commit 8b0fd08
Show file tree
Hide file tree
Showing 9 changed files with 7,435 additions and 2,847 deletions.
537 changes: 294 additions & 243 deletions api/client/proto/event.pb.go

Large diffs are not rendered by default.

456 changes: 456 additions & 0 deletions api/gen/proto/go/teleport/autoupdate/v1/autoupdate.pb.go

Large diffs are not rendered by default.

832 changes: 832 additions & 0 deletions api/gen/proto/go/teleport/autoupdate/v1/autoupdate_service.pb.go

Large diffs are not rendered by default.

477 changes: 477 additions & 0 deletions api/gen/proto/go/teleport/autoupdate/v1/autoupdate_service_grpc.pb.go

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions api/proto/teleport/autoupdate/v1/autoupdate.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright 2024 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.autoupdate.v1;

import "teleport/header/v1/metadata.proto";

option go_package = "github.com/gravitational/teleport/api/gen/proto/go/teleport/autoupdate/v1;autoupdate";

// AutoUpdateConfig is a config singleton used to configure cluster
// autoupdate settings.
message AutoUpdateConfig {
string kind = 1;
string sub_kind = 2;
string version = 3;
teleport.header.v1.Metadata metadata = 4;

AutoUpdateConfigSpec spec = 5;
}

// AutoUpdateConfigSpec encodes the parameters of the autoupdate config object.
message AutoUpdateConfigSpec {
// ToolsAutoupdate encodes the feature flag to enable/disable tools autoupdates.
bool tools_autoupdate = 1;
}

// AutoUpdateVersion is a resource singleton with version required for
// tools autoupdate.
message AutoUpdateVersion {
string kind = 1;
string sub_kind = 2;
string version = 3;
teleport.header.v1.Metadata metadata = 4;

AutoUpdateVersionSpec spec = 5;
}

// AutoUpdateVersionSpec encodes the parameters of the autoupdate versions.
message AutoUpdateVersionSpec {
// ToolsVersion is the semantic version required for tools autoupdates.
string tools_version = 1;
}
97 changes: 97 additions & 0 deletions api/proto/teleport/autoupdate/v1/autoupdate_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// Copyright 2024 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.autoupdate.v1;

import "google/protobuf/empty.proto";
import "teleport/autoupdate/v1/autoupdate.proto";

option go_package = "github.com/gravitational/teleport/api/gen/proto/go/teleport/autoupdate/v1;autoupdate";

// AutoUpdateService provides an API to manage autoupdates.
service AutoUpdateService {
// GetAutoUpdateConfig gets the current autoupdate config singleton.
rpc GetAutoUpdateConfig(GetAutoUpdateConfigRequest) returns (AutoUpdateConfig);

// CreateAutoUpdateConfig creates a new AutoUpdateConfig.
rpc CreateAutoUpdateConfig(CreateAutoUpdateConfigRequest) returns (AutoUpdateConfig);

// CreateAutoUpdateConfig updates AutoUpdateConfig singleton.
rpc UpdateAutoUpdateConfig(UpdateAutoUpdateConfigRequest) returns (AutoUpdateConfig);

// UpsertAutoUpdateConfig creates a new AutoUpdateConfig or replaces an existing AutoUpdateConfig.
rpc UpsertAutoUpdateConfig(UpsertAutoUpdateConfigRequest) returns (AutoUpdateConfig);

// DeleteAutoUpdateConfig hard deletes the specified AutoUpdateConfig.
rpc DeleteAutoUpdateConfig(DeleteAutoUpdateConfigRequest) returns (google.protobuf.Empty);

// GetAutoUpdateVersion gets the current autoupdate version singleton.
rpc GetAutoUpdateVersion(GetAutoUpdateVersionRequest) returns (AutoUpdateVersion);

// CreateAutoUpdateVersion creates a new AutoUpdateVersion.
rpc CreateAutoUpdateVersion(CreateAutoUpdateVersionRequest) returns (AutoUpdateVersion);

// UpdateAutoUpdateVersion updates AutoUpdateVersion singleton.
rpc UpdateAutoUpdateVersion(UpdateAutoUpdateVersionRequest) returns (AutoUpdateVersion);

// UpsertAutoUpdateVersion creates a new AutoUpdateVersion or replaces an existing AutoUpdateVersion.
rpc UpsertAutoUpdateVersion(UpsertAutoUpdateVersionRequest) returns (AutoUpdateVersion);

// DeleteAutoUpdateVersion hard deletes the specified AutoUpdateVersionRequest.
rpc DeleteAutoUpdateVersion(DeleteAutoUpdateVersionRequest) returns (google.protobuf.Empty);
}

// Request for GetAutoUpdateConfig.
message GetAutoUpdateConfigRequest {}

// Request for CreateAutoUpdateConfig.
message CreateAutoUpdateConfigRequest {
AutoUpdateConfig config = 1;
}

// Request for UpdateAutoUpdateConfig.
message UpdateAutoUpdateConfigRequest {
AutoUpdateConfig config = 1;
}

// Request for UpsertAutoUpdateConfig.
message UpsertAutoUpdateConfigRequest {
AutoUpdateConfig config = 1;
}

// Request for DeleteAutoUpdateConfig.
message DeleteAutoUpdateConfigRequest {}

// Request for GetAutoUpdateVersion.
message GetAutoUpdateVersionRequest {}

// Request for CreateAutoUpdateVersion.
message CreateAutoUpdateVersionRequest {
AutoUpdateVersion version = 1;
}

// Request for UpdateAutoUpdateConfig.
message UpdateAutoUpdateVersionRequest {
AutoUpdateVersion version = 1;
}

// Request for UpsertAutoUpdateVersion.
message UpsertAutoUpdateVersionRequest {
AutoUpdateVersion version = 1;
}

// Request for DeleteAutoUpdateVersion.
message DeleteAutoUpdateVersionRequest {}
5 changes: 5 additions & 0 deletions api/proto/teleport/legacy/client/proto/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ syntax = "proto3";
package proto;

import "teleport/accesslist/v1/accesslist.proto";
import "teleport/autoupdate/v1/autoupdate.proto";
import "teleport/discoveryconfig/v1/discoveryconfig.proto";
import "teleport/kubewaitingcontainer/v1/kubewaitingcontainer.proto";
import "teleport/legacy/types/types.proto";
Expand Down Expand Up @@ -151,5 +152,9 @@ message Event {
// KubernetesWaitingContainer is a Kubernetes ephemeral container
// waiting to be created.
teleport.kubewaitingcontainer.v1.KubernetesWaitingContainer KubernetesWaitingContainer = 55;
// AutoUpdateConfig is a resource for autoupdate config.
teleport.autoupdate.v1.AutoUpdateConfig AutoUpdateConfig = 64;
// AutoUpdateVersion is a resource for autoupdate version.
teleport.autoupdate.v1.AutoUpdateVersion AutoUpdateVersion = 65;
}
}
192 changes: 192 additions & 0 deletions api/proto/teleport/legacy/types/events/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3946,6 +3946,12 @@ message OneOf {
events.IntegrationCreate IntegrationCreate = 165;
events.IntegrationUpdate IntegrationUpdate = 166;
events.IntegrationDelete IntegrationDelete = 167;
events.AutoUpdateConfigCreate AutoUpdateConfigCreate = 173;
events.AutoUpdateConfigUpdate AutoUpdateConfigUpdate = 174;
events.AutoUpdateConfigDelete AutoUpdateConfigDelete = 175;
events.AutoUpdateVersionCreate AutoUpdateVersionCreate = 176;
events.AutoUpdateVersionUpdate AutoUpdateVersionUpdate = 177;
events.AutoUpdateVersionDelete AutoUpdateVersionDelete = 178;
}
}

Expand Down Expand Up @@ -5825,3 +5831,189 @@ message ExternalAuditStorageDetails {
// Region is the AWS region where the infrastructure is hosted.
string region = 11;
}

// AutoUpdateConfigCreate is emitted when an auto update config is created.
message AutoUpdateConfigCreate {
// Metadata is a common event metadata
Metadata Metadata = 1 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ResourceMetadata is a common resource event metadata
ResourceMetadata Resource = 2 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// User is a common user event metadata
UserMetadata User = 3 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ConnectionMetadata holds information about the connection
ConnectionMetadata Connection = 4 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];
}

// AutoUpdateConfigUpdate is emitted when an auto update config is updated.
message AutoUpdateConfigUpdate {
// Metadata is a common event metadata
Metadata Metadata = 1 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// Status indicates whether the update was successful.
Status Status = 2 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// User is a common user event metadata
UserMetadata User = 3 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ConnectionMetadata holds information about the connection
ConnectionMetadata Connection = 4 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];
}

// AutoUpdateConfigDelete is emitted when an auto update config is deleted.
message AutoUpdateConfigDelete {
// Metadata is a common event metadata
Metadata Metadata = 1 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ResourceMetadata is a common resource event metadata
ResourceMetadata Resource = 2 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// User is a common user event metadata
UserMetadata User = 3 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ConnectionMetadata holds information about the connection
ConnectionMetadata Connection = 4 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];
}

// AutoUpdateVersionCreate is emitted when an auto update version is created.
message AutoUpdateVersionCreate {
// Metadata is a common event metadata
Metadata Metadata = 1 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ResourceMetadata is a common resource event metadata
ResourceMetadata Resource = 2 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// User is a common user event metadata
UserMetadata User = 3 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ConnectionMetadata holds information about the connection
ConnectionMetadata Connection = 4 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];
}

// AutoUpdateVersionUpdate is emitted when an auto update version is updated.
message AutoUpdateVersionUpdate {
// Metadata is a common event metadata
Metadata Metadata = 1 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// Status indicates whether the update was successful.
Status Status = 2 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// User is a common user event metadata
UserMetadata User = 3 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ConnectionMetadata holds information about the connection
ConnectionMetadata Connection = 4 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];
}

// AutoUpdateVersionDelete is emitted when an auto update version is deleted.
message AutoUpdateVersionDelete {
// Metadata is a common event metadata
Metadata Metadata = 1 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ResourceMetadata is a common resource event metadata
ResourceMetadata Resource = 2 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// User is a common user event metadata
UserMetadata User = 3 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ConnectionMetadata holds information about the connection
ConnectionMetadata Connection = 4 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];
}
Loading

0 comments on commit 8b0fd08

Please sign in to comment.