Commit b60ee806 authored by Brian Downs's avatar Brian Downs

add nodeName to etcd struct, update refs

parent a1220f7f
...@@ -65,13 +65,14 @@ var ( ...@@ -65,13 +65,14 @@ var (
) )
type ETCD struct { type ETCD struct {
client *etcd.Client client *etcd.Client
config *config.Control config *config.Control
name string name string
runtime *config.ControlRuntime runtime *config.ControlRuntime
address string address string
cron *cron.Cron cron *cron.Cron
s3 *s3 s3 *s3
nodeName string
} }
type learnerProgress struct { type learnerProgress struct {
...@@ -91,7 +92,8 @@ type Members struct { ...@@ -91,7 +92,8 @@ type Members struct {
// ETCD with an initialized cron value. // ETCD with an initialized cron value.
func NewETCD() *ETCD { func NewETCD() *ETCD {
return &ETCD{ return &ETCD{
cron: cron.New(), cron: cron.New(),
nodeName: os.Getenv("NODE_NAME"),
} }
} }
...@@ -891,8 +893,6 @@ type snapshotFile struct { ...@@ -891,8 +893,6 @@ type snapshotFile struct {
// snapshots on disk or in S3 along with their relevant // snapshots on disk or in S3 along with their relevant
// metadata. // metadata.
func (e *ETCD) listSnapshots(ctx context.Context, snapshotDir string) ([]snapshotFile, error) { func (e *ETCD) listSnapshots(ctx context.Context, snapshotDir string) ([]snapshotFile, error) {
nodeName := os.Getenv("NODE_NAME")
var snapshots []snapshotFile var snapshots []snapshotFile
if e.config.EtcdS3 { if e.config.EtcdS3 {
...@@ -924,7 +924,7 @@ func (e *ETCD) listSnapshots(ctx context.Context, snapshotDir string) ([]snapsho ...@@ -924,7 +924,7 @@ func (e *ETCD) listSnapshots(ctx context.Context, snapshotDir string) ([]snapsho
snapshots = append(snapshots, snapshotFile{ snapshots = append(snapshots, snapshotFile{
Name: filepath.Base(obj.Key), Name: filepath.Base(obj.Key),
NodeName: nodeName, NodeName: e.nodeName,
CreatedAt: &metav1.Time{ CreatedAt: &metav1.Time{
Time: ca, Time: ca,
}, },
...@@ -952,7 +952,7 @@ func (e *ETCD) listSnapshots(ctx context.Context, snapshotDir string) ([]snapsho ...@@ -952,7 +952,7 @@ func (e *ETCD) listSnapshots(ctx context.Context, snapshotDir string) ([]snapsho
snapshots = append(snapshots, snapshotFile{ snapshots = append(snapshots, snapshotFile{
Name: f.Name(), Name: f.Name(),
Location: "file://" + filepath.Join(snapshotDir, f.Name()), Location: "file://" + filepath.Join(snapshotDir, f.Name()),
NodeName: nodeName, NodeName: e.nodeName,
CreatedAt: &metav1.Time{ CreatedAt: &metav1.Time{
Time: f.ModTime(), Time: f.ModTime(),
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment