|
|
|
@ -23,6 +23,7 @@ func init() {
|
|
|
|
|
registerRestorer(structs.IntentionRequestType, restoreIntention)
|
|
|
|
|
registerRestorer(structs.ConnectCARequestType, restoreConnectCA)
|
|
|
|
|
registerRestorer(structs.ConnectCAProviderStateType, restoreConnectCAProviderState)
|
|
|
|
|
registerRestorer(structs.ConnectCAConfigType, restoreConnectCAConfig)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func persistOSS(s *snapshot, sink raft.SnapshotSink, encoder *codec.Encoder) error {
|
|
|
|
@ -56,6 +57,9 @@ func persistOSS(s *snapshot, sink raft.SnapshotSink, encoder *codec.Encoder) err
|
|
|
|
|
if err := s.persistConnectCAProviderState(sink, encoder); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
if err := s.persistConnectCAConfig(sink, encoder); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -285,6 +289,23 @@ func (s *snapshot) persistConnectCA(sink raft.SnapshotSink,
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *snapshot) persistConnectCAConfig(sink raft.SnapshotSink,
|
|
|
|
|
encoder *codec.Encoder) error {
|
|
|
|
|
config, err := s.state.CAConfig()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if _, err := sink.Write([]byte{byte(structs.ConnectCAConfigType)}); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
if err := encoder.Encode(config); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -463,3 +484,14 @@ func restoreConnectCAProviderState(header *snapshotHeader, restore *state.Restor
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func restoreConnectCAConfig(header *snapshotHeader, restore *state.Restore, decoder *codec.Decoder) error {
|
|
|
|
|
var req structs.CAConfiguration
|
|
|
|
|
if err := decoder.Decode(&req); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
if err := restore.CAConfig(&req); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|