autoupdate canary support: proto messages (#56259)

This commit is contained in:
Hugo Shaka
2025-06-30 22:16:46 +00:00
committed by GitHub
parent 0802ab72bb
commit c0ed1fd94f
2 changed files with 169 additions and 33 deletions
@@ -55,6 +55,9 @@ const (
// AUTO_UPDATE_AGENT_GROUP_STATE_ROLLEDBACK represents that the group has been rolled back.
// New agents should run v1, existing agents should update to v1.
AutoUpdateAgentGroupState_AUTO_UPDATE_AGENT_GROUP_STATE_ROLLEDBACK AutoUpdateAgentGroupState = 4
// AUTO_UPDATE_AGENT_GROUP_STATE_CANARY represents that the group is updating a few canary nodes, but that most nodes
// have not started updating yet.
AutoUpdateAgentGroupState_AUTO_UPDATE_AGENT_GROUP_STATE_CANARY AutoUpdateAgentGroupState = 5
)
// Enum value maps for AutoUpdateAgentGroupState.
@@ -65,6 +68,7 @@ var (
2: "AUTO_UPDATE_AGENT_GROUP_STATE_ACTIVE",
3: "AUTO_UPDATE_AGENT_GROUP_STATE_DONE",
4: "AUTO_UPDATE_AGENT_GROUP_STATE_ROLLEDBACK",
5: "AUTO_UPDATE_AGENT_GROUP_STATE_CANARY",
}
AutoUpdateAgentGroupState_value = map[string]int32{
"AUTO_UPDATE_AGENT_GROUP_STATE_UNSPECIFIED": 0,
@@ -72,6 +76,7 @@ var (
"AUTO_UPDATE_AGENT_GROUP_STATE_ACTIVE": 2,
"AUTO_UPDATE_AGENT_GROUP_STATE_DONE": 3,
"AUTO_UPDATE_AGENT_GROUP_STATE_ROLLEDBACK": 4,
"AUTO_UPDATE_AGENT_GROUP_STATE_CANARY": 5,
}
)
@@ -1105,6 +1110,12 @@ type AutoUpdateAgentRolloutStatusGroup struct {
// to the done state if:
// - the ratio present_count/initial_count is above 0.9 (no more than 10% of the nodes dropped during update)
UpToDateCount uint64 `protobuf:"varint,12,opt,name=up_to_date_count,json=upToDateCount,proto3" json:"up_to_date_count,omitempty"`
// canary_count represents how many canaries this group should have to leave the AUTO_UPDATE_AGENT_GROUP_STATE_CANARY
// state.
CanaryCount uint64 `protobuf:"varint,13,opt,name=canary_count,json=canaryCount,proto3" json:"canary_count,omitempty"`
// canaries is the list of canary agents that should be updated.
// This list is empty until we enter the AUTO_UPDATE_AGENT_GROUP_STATE_CANARY state.
Canaries []*Canary `protobuf:"bytes,14,rep,name=canaries,proto3" json:"canaries,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -1216,6 +1227,20 @@ func (x *AutoUpdateAgentRolloutStatusGroup) GetUpToDateCount() uint64 {
return 0
}
func (x *AutoUpdateAgentRolloutStatusGroup) GetCanaryCount() uint64 {
if x != nil {
return x.CanaryCount
}
return 0
}
func (x *AutoUpdateAgentRolloutStatusGroup) GetCanaries() []*Canary {
if x != nil {
return x.Canaries
}
return nil
}
// AutoUpdateAgentReport is a report generated by each Teleport Auth service.
// The report tracks per group and per version how many agents are running.
// The report is used to track which version agents are running.
@@ -1504,6 +1529,82 @@ func (x *AutoUpdateAgentReportSpecOmitted) GetReason() string {
return ""
}
// Canary describes a node that is acting as a canary and being updated before other nodes in its group.
type Canary struct {
state protoimpl.MessageState `protogen:"open.v1"`
// updater_id is reported by the agent in its control stream Hello. This allows us to uniquely identify an updater so
// the proxy can modulate its answer when the request comes from this specific updater.
UpdaterId string `protobuf:"bytes,1,opt,name=updater_id,json=updaterId,proto3" json:"updater_id,omitempty"`
// host_id is the node Host ID, reported by the agent in its control stream Hello.
HostId string `protobuf:"bytes,2,opt,name=host_id,json=hostId,proto3" json:"host_id,omitempty"`
// hostname is the server hostname reported by the agent in its control stream Hello.
// This is purely for debugging purposes: if the agent drops, we won't be able to query the inventory to know which
// agent it was.
Hostname string `protobuf:"bytes,3,opt,name=hostname,proto3" json:"hostname,omitempty"`
// success represents if the agent successfully connected back, running the target version.
Success bool `protobuf:"varint,4,opt,name=success,proto3" json:"success,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Canary) Reset() {
*x = Canary{}
mi := &file_teleport_autoupdate_v1_autoupdate_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Canary) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Canary) ProtoMessage() {}
func (x *Canary) ProtoReflect() protoreflect.Message {
mi := &file_teleport_autoupdate_v1_autoupdate_proto_msgTypes[19]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Canary.ProtoReflect.Descriptor instead.
func (*Canary) Descriptor() ([]byte, []int) {
return file_teleport_autoupdate_v1_autoupdate_proto_rawDescGZIP(), []int{19}
}
func (x *Canary) GetUpdaterId() string {
if x != nil {
return x.UpdaterId
}
return ""
}
func (x *Canary) GetHostId() string {
if x != nil {
return x.HostId
}
return ""
}
func (x *Canary) GetHostname() string {
if x != nil {
return x.Hostname
}
return ""
}
func (x *Canary) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
var File_teleport_autoupdate_v1_autoupdate_proto protoreflect.FileDescriptor
const file_teleport_autoupdate_v1_autoupdate_proto_rawDesc = "" +
@@ -1569,7 +1670,7 @@ const file_teleport_autoupdate_v1_autoupdate_proto_rawDesc = "" +
"\x05state\x18\x02 \x01(\x0e23.teleport.autoupdate.v1.AutoUpdateAgentRolloutStateR\x05state\x129\n" +
"\n" +
"start_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\tstartTime\x12?\n" +
"\rtime_override\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\ftimeOverride\"\xb3\x04\n" +
"\rtime_override\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\ftimeOverride\"\x92\x05\n" +
"!AutoUpdateAgentRolloutStatusGroup\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x129\n" +
"\n" +
@@ -1584,7 +1685,9 @@ const file_teleport_autoupdate_v1_autoupdate_proto_rawDesc = "" +
"\rinitial_count\x18\n" +
" \x01(\x04R\finitialCount\x12#\n" +
"\rpresent_count\x18\v \x01(\x04R\fpresentCount\x12'\n" +
"\x10up_to_date_count\x18\f \x01(\x04R\rupToDateCountJ\x04\b\b\x10\tR\x10config_wait_days\"\xe1\x01\n" +
"\x10up_to_date_count\x18\f \x01(\x04R\rupToDateCount\x12!\n" +
"\fcanary_count\x18\r \x01(\x04R\vcanaryCount\x12:\n" +
"\bcanaries\x18\x0e \x03(\v2\x1e.teleport.autoupdate.v1.CanaryR\bcanariesJ\x04\b\b\x10\tR\x10config_wait_days\"\xe1\x01\n" +
"\x15AutoUpdateAgentReport\x12\x12\n" +
"\x04kind\x18\x01 \x01(\tR\x04kind\x12\x19\n" +
"\bsub_kind\x18\x02 \x01(\tR\asubKind\x12\x18\n" +
@@ -1607,13 +1710,20 @@ const file_teleport_autoupdate_v1_autoupdate_proto_rawDesc = "" +
"\x05count\x18\x01 \x01(\x05R\x05count\"P\n" +
" AutoUpdateAgentReportSpecOmitted\x12\x14\n" +
"\x05count\x18\x01 \x01(\x03R\x05count\x12\x16\n" +
"\x06reason\x18\x02 \x01(\tR\x06reason*\xf7\x01\n" +
"\x06reason\x18\x02 \x01(\tR\x06reason\"v\n" +
"\x06Canary\x12\x1d\n" +
"\n" +
"updater_id\x18\x01 \x01(\tR\tupdaterId\x12\x17\n" +
"\ahost_id\x18\x02 \x01(\tR\x06hostId\x12\x1a\n" +
"\bhostname\x18\x03 \x01(\tR\bhostname\x12\x18\n" +
"\asuccess\x18\x04 \x01(\bR\asuccess*\xa1\x02\n" +
"\x19AutoUpdateAgentGroupState\x12-\n" +
")AUTO_UPDATE_AGENT_GROUP_STATE_UNSPECIFIED\x10\x00\x12+\n" +
"'AUTO_UPDATE_AGENT_GROUP_STATE_UNSTARTED\x10\x01\x12(\n" +
"$AUTO_UPDATE_AGENT_GROUP_STATE_ACTIVE\x10\x02\x12&\n" +
"\"AUTO_UPDATE_AGENT_GROUP_STATE_DONE\x10\x03\x12,\n" +
"(AUTO_UPDATE_AGENT_GROUP_STATE_ROLLEDBACK\x10\x04*\x83\x02\n" +
"(AUTO_UPDATE_AGENT_GROUP_STATE_ROLLEDBACK\x10\x04\x12(\n" +
"$AUTO_UPDATE_AGENT_GROUP_STATE_CANARY\x10\x05*\x83\x02\n" +
"\x1bAutoUpdateAgentRolloutState\x12/\n" +
"+AUTO_UPDATE_AGENT_ROLLOUT_STATE_UNSPECIFIED\x10\x00\x12-\n" +
")AUTO_UPDATE_AGENT_ROLLOUT_STATE_UNSTARTED\x10\x01\x12*\n" +
@@ -1634,7 +1744,7 @@ func file_teleport_autoupdate_v1_autoupdate_proto_rawDescGZIP() []byte {
}
var file_teleport_autoupdate_v1_autoupdate_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_teleport_autoupdate_v1_autoupdate_proto_msgTypes = make([]protoimpl.MessageInfo, 21)
var file_teleport_autoupdate_v1_autoupdate_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_teleport_autoupdate_v1_autoupdate_proto_goTypes = []any{
(AutoUpdateAgentGroupState)(0), // 0: teleport.autoupdate.v1.AutoUpdateAgentGroupState
(AutoUpdateAgentRolloutState)(0), // 1: teleport.autoupdate.v1.AutoUpdateAgentRolloutState
@@ -1657,48 +1767,50 @@ var file_teleport_autoupdate_v1_autoupdate_proto_goTypes = []any{
(*AutoUpdateAgentReportSpecGroup)(nil), // 18: teleport.autoupdate.v1.AutoUpdateAgentReportSpecGroup
(*AutoUpdateAgentReportSpecGroupVersion)(nil), // 19: teleport.autoupdate.v1.AutoUpdateAgentReportSpecGroupVersion
(*AutoUpdateAgentReportSpecOmitted)(nil), // 20: teleport.autoupdate.v1.AutoUpdateAgentReportSpecOmitted
nil, // 21: teleport.autoupdate.v1.AutoUpdateAgentReportSpec.GroupsEntry
nil, // 22: teleport.autoupdate.v1.AutoUpdateAgentReportSpecGroup.VersionsEntry
(*v1.Metadata)(nil), // 23: teleport.header.v1.Metadata
(*durationpb.Duration)(nil), // 24: google.protobuf.Duration
(*timestamppb.Timestamp)(nil), // 25: google.protobuf.Timestamp
(*Canary)(nil), // 21: teleport.autoupdate.v1.Canary
nil, // 22: teleport.autoupdate.v1.AutoUpdateAgentReportSpec.GroupsEntry
nil, // 23: teleport.autoupdate.v1.AutoUpdateAgentReportSpecGroup.VersionsEntry
(*v1.Metadata)(nil), // 24: teleport.header.v1.Metadata
(*durationpb.Duration)(nil), // 25: google.protobuf.Duration
(*timestamppb.Timestamp)(nil), // 26: google.protobuf.Timestamp
}
var file_teleport_autoupdate_v1_autoupdate_proto_depIdxs = []int32{
23, // 0: teleport.autoupdate.v1.AutoUpdateConfig.metadata:type_name -> teleport.header.v1.Metadata
24, // 0: teleport.autoupdate.v1.AutoUpdateConfig.metadata:type_name -> teleport.header.v1.Metadata
3, // 1: teleport.autoupdate.v1.AutoUpdateConfig.spec:type_name -> teleport.autoupdate.v1.AutoUpdateConfigSpec
4, // 2: teleport.autoupdate.v1.AutoUpdateConfigSpec.tools:type_name -> teleport.autoupdate.v1.AutoUpdateConfigSpecTools
5, // 3: teleport.autoupdate.v1.AutoUpdateConfigSpec.agents:type_name -> teleport.autoupdate.v1.AutoUpdateConfigSpecAgents
24, // 4: teleport.autoupdate.v1.AutoUpdateConfigSpecAgents.maintenance_window_duration:type_name -> google.protobuf.Duration
25, // 4: teleport.autoupdate.v1.AutoUpdateConfigSpecAgents.maintenance_window_duration:type_name -> google.protobuf.Duration
6, // 5: teleport.autoupdate.v1.AutoUpdateConfigSpecAgents.schedules:type_name -> teleport.autoupdate.v1.AgentAutoUpdateSchedules
7, // 6: teleport.autoupdate.v1.AgentAutoUpdateSchedules.regular:type_name -> teleport.autoupdate.v1.AgentAutoUpdateGroup
23, // 7: teleport.autoupdate.v1.AutoUpdateVersion.metadata:type_name -> teleport.header.v1.Metadata
24, // 7: teleport.autoupdate.v1.AutoUpdateVersion.metadata:type_name -> teleport.header.v1.Metadata
9, // 8: teleport.autoupdate.v1.AutoUpdateVersion.spec:type_name -> teleport.autoupdate.v1.AutoUpdateVersionSpec
10, // 9: teleport.autoupdate.v1.AutoUpdateVersionSpec.tools:type_name -> teleport.autoupdate.v1.AutoUpdateVersionSpecTools
11, // 10: teleport.autoupdate.v1.AutoUpdateVersionSpec.agents:type_name -> teleport.autoupdate.v1.AutoUpdateVersionSpecAgents
23, // 11: teleport.autoupdate.v1.AutoUpdateAgentRollout.metadata:type_name -> teleport.header.v1.Metadata
24, // 11: teleport.autoupdate.v1.AutoUpdateAgentRollout.metadata:type_name -> teleport.header.v1.Metadata
13, // 12: teleport.autoupdate.v1.AutoUpdateAgentRollout.spec:type_name -> teleport.autoupdate.v1.AutoUpdateAgentRolloutSpec
14, // 13: teleport.autoupdate.v1.AutoUpdateAgentRollout.status:type_name -> teleport.autoupdate.v1.AutoUpdateAgentRolloutStatus
24, // 14: teleport.autoupdate.v1.AutoUpdateAgentRolloutSpec.maintenance_window_duration:type_name -> google.protobuf.Duration
25, // 14: teleport.autoupdate.v1.AutoUpdateAgentRolloutSpec.maintenance_window_duration:type_name -> google.protobuf.Duration
15, // 15: teleport.autoupdate.v1.AutoUpdateAgentRolloutStatus.groups:type_name -> teleport.autoupdate.v1.AutoUpdateAgentRolloutStatusGroup
1, // 16: teleport.autoupdate.v1.AutoUpdateAgentRolloutStatus.state:type_name -> teleport.autoupdate.v1.AutoUpdateAgentRolloutState
25, // 17: teleport.autoupdate.v1.AutoUpdateAgentRolloutStatus.start_time:type_name -> google.protobuf.Timestamp
25, // 18: teleport.autoupdate.v1.AutoUpdateAgentRolloutStatus.time_override:type_name -> google.protobuf.Timestamp
25, // 19: teleport.autoupdate.v1.AutoUpdateAgentRolloutStatusGroup.start_time:type_name -> google.protobuf.Timestamp
26, // 17: teleport.autoupdate.v1.AutoUpdateAgentRolloutStatus.start_time:type_name -> google.protobuf.Timestamp
26, // 18: teleport.autoupdate.v1.AutoUpdateAgentRolloutStatus.time_override:type_name -> google.protobuf.Timestamp
26, // 19: teleport.autoupdate.v1.AutoUpdateAgentRolloutStatusGroup.start_time:type_name -> google.protobuf.Timestamp
0, // 20: teleport.autoupdate.v1.AutoUpdateAgentRolloutStatusGroup.state:type_name -> teleport.autoupdate.v1.AutoUpdateAgentGroupState
25, // 21: teleport.autoupdate.v1.AutoUpdateAgentRolloutStatusGroup.last_update_time:type_name -> google.protobuf.Timestamp
23, // 22: teleport.autoupdate.v1.AutoUpdateAgentReport.metadata:type_name -> teleport.header.v1.Metadata
17, // 23: teleport.autoupdate.v1.AutoUpdateAgentReport.spec:type_name -> teleport.autoupdate.v1.AutoUpdateAgentReportSpec
25, // 24: teleport.autoupdate.v1.AutoUpdateAgentReportSpec.timestamp:type_name -> google.protobuf.Timestamp
21, // 25: teleport.autoupdate.v1.AutoUpdateAgentReportSpec.groups:type_name -> teleport.autoupdate.v1.AutoUpdateAgentReportSpec.GroupsEntry
20, // 26: teleport.autoupdate.v1.AutoUpdateAgentReportSpec.omitted:type_name -> teleport.autoupdate.v1.AutoUpdateAgentReportSpecOmitted
22, // 27: teleport.autoupdate.v1.AutoUpdateAgentReportSpecGroup.versions:type_name -> teleport.autoupdate.v1.AutoUpdateAgentReportSpecGroup.VersionsEntry
18, // 28: teleport.autoupdate.v1.AutoUpdateAgentReportSpec.GroupsEntry.value:type_name -> teleport.autoupdate.v1.AutoUpdateAgentReportSpecGroup
19, // 29: teleport.autoupdate.v1.AutoUpdateAgentReportSpecGroup.VersionsEntry.value:type_name -> teleport.autoupdate.v1.AutoUpdateAgentReportSpecGroupVersion
30, // [30:30] is the sub-list for method output_type
30, // [30:30] is the sub-list for method input_type
30, // [30:30] is the sub-list for extension type_name
30, // [30:30] is the sub-list for extension extendee
0, // [0:30] is the sub-list for field type_name
26, // 21: teleport.autoupdate.v1.AutoUpdateAgentRolloutStatusGroup.last_update_time:type_name -> google.protobuf.Timestamp
21, // 22: teleport.autoupdate.v1.AutoUpdateAgentRolloutStatusGroup.canaries:type_name -> teleport.autoupdate.v1.Canary
24, // 23: teleport.autoupdate.v1.AutoUpdateAgentReport.metadata:type_name -> teleport.header.v1.Metadata
17, // 24: teleport.autoupdate.v1.AutoUpdateAgentReport.spec:type_name -> teleport.autoupdate.v1.AutoUpdateAgentReportSpec
26, // 25: teleport.autoupdate.v1.AutoUpdateAgentReportSpec.timestamp:type_name -> google.protobuf.Timestamp
22, // 26: teleport.autoupdate.v1.AutoUpdateAgentReportSpec.groups:type_name -> teleport.autoupdate.v1.AutoUpdateAgentReportSpec.GroupsEntry
20, // 27: teleport.autoupdate.v1.AutoUpdateAgentReportSpec.omitted:type_name -> teleport.autoupdate.v1.AutoUpdateAgentReportSpecOmitted
23, // 28: teleport.autoupdate.v1.AutoUpdateAgentReportSpecGroup.versions:type_name -> teleport.autoupdate.v1.AutoUpdateAgentReportSpecGroup.VersionsEntry
18, // 29: teleport.autoupdate.v1.AutoUpdateAgentReportSpec.GroupsEntry.value:type_name -> teleport.autoupdate.v1.AutoUpdateAgentReportSpecGroup
19, // 30: teleport.autoupdate.v1.AutoUpdateAgentReportSpecGroup.VersionsEntry.value:type_name -> teleport.autoupdate.v1.AutoUpdateAgentReportSpecGroupVersion
31, // [31:31] is the sub-list for method output_type
31, // [31:31] is the sub-list for method input_type
31, // [31:31] is the sub-list for extension type_name
31, // [31:31] is the sub-list for extension extendee
0, // [0:31] is the sub-list for field type_name
}
func init() { file_teleport_autoupdate_v1_autoupdate_proto_init() }
@@ -1712,7 +1824,7 @@ func file_teleport_autoupdate_v1_autoupdate_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_teleport_autoupdate_v1_autoupdate_proto_rawDesc), len(file_teleport_autoupdate_v1_autoupdate_proto_rawDesc)),
NumEnums: 2,
NumMessages: 21,
NumMessages: 22,
NumExtensions: 0,
NumServices: 0,
},
@@ -230,6 +230,12 @@ message AutoUpdateAgentRolloutStatusGroup {
// to the done state if:
// - the ratio present_count/initial_count is above 0.9 (no more than 10% of the nodes dropped during update)
uint64 up_to_date_count = 12;
// canary_count represents how many canaries this group should have to leave the AUTO_UPDATE_AGENT_GROUP_STATE_CANARY
// state.
uint64 canary_count = 13;
// canaries is the list of canary agents that should be updated.
// This list is empty until we enter the AUTO_UPDATE_AGENT_GROUP_STATE_CANARY state.
repeated Canary canaries = 14;
}
// AutoUpdateAgentGroupState represents the agent group state. This state controls whether the agents from this group
@@ -247,6 +253,9 @@ enum AutoUpdateAgentGroupState {
// AUTO_UPDATE_AGENT_GROUP_STATE_ROLLEDBACK represents that the group has been rolled back.
// New agents should run v1, existing agents should update to v1.
AUTO_UPDATE_AGENT_GROUP_STATE_ROLLEDBACK = 4;
// AUTO_UPDATE_AGENT_GROUP_STATE_CANARY represents that the group is updating a few canary nodes, but that most nodes
// have not started updating yet.
AUTO_UPDATE_AGENT_GROUP_STATE_CANARY = 5;
}
// AutoUpdateAgentRolloutState represents the rollout state. This tells if Teleport started updating agents from the
@@ -305,3 +314,18 @@ message AutoUpdateAgentReportSpecOmitted {
int64 count = 1;
string reason = 2;
}
// Canary describes a node that is acting as a canary and being updated before other nodes in its group.
message Canary {
// updater_id is reported by the agent in its control stream Hello. This allows us to uniquely identify an updater so
// the proxy can modulate its answer when the request comes from this specific updater.
string updater_id = 1;
// host_id is the node Host ID, reported by the agent in its control stream Hello.
string host_id = 2;
// hostname is the server hostname reported by the agent in its control stream Hello.
// This is purely for debugging purposes: if the agent drops, we won't be able to query the inventory to know which
// agent it was.
string hostname = 3;
// success represents if the agent successfully connected back, running the target version.
bool success = 4;
}