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 authored Sep 4, 2024
1 parent 6205e30 commit 920d69a
Show file tree
Hide file tree
Showing 9 changed files with 7,491 additions and 2,881 deletions.
671 changes: 361 additions & 310 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.

502 changes: 502 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 @@ -18,6 +18,7 @@ package proto;

import "teleport/accesslist/v1/accesslist.proto";
import "teleport/accessmonitoringrules/v1/access_monitoring_rules.proto";
import "teleport/autoupdate/v1/autoupdate.proto";
import "teleport/clusterconfig/v1/access_graph_settings.proto";
import "teleport/crownjewel/v1/crownjewel.proto";
import "teleport/dbobject/v1/dbobject.proto";
Expand Down Expand Up @@ -177,5 +178,9 @@ message Event {
teleport.machineid.v1.SPIFFEFederation SPIFFEFederation = 62;
// StaticHostUser is a resource for static host users.
teleport.userprovisioning.v1.StaticHostUser StaticHostUser = 63;
// 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 @@ -4586,6 +4586,12 @@ message OneOf {
events.PluginCreate PluginCreate = 170;
events.PluginUpdate PluginUpdate = 171;
events.PluginDelete PluginDelete = 172;
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 @@ -6858,3 +6864,189 @@ message SPIFFEFederationDelete {
(gogoproto.jsontag) = ""
];
}

// 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 920d69a

Please sign in to comment.