Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EC2 labels concurrent write bug #13072

Merged
merged 4 commits into from
Jun 1, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix EC2 labels concurrent write
atburke committed Jun 1, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 87a25403f137930f883d48bfc1d06c7dc608de0f
3 changes: 1 addition & 2 deletions integration/ec2_test.go
Original file line number Diff line number Diff line change
@@ -411,8 +411,7 @@ func TestEC2Labels(t *testing.T) {
}

// TestEC2Hostname is an integration test which asserts that Teleport sets its
// hostname if the EC2 tag `TeleportHostname` is available. This test must be
// run on an instance with tag `TeleportHostname=fakehost.example.com`.
// hostname if the EC2 tag `TeleportHostname` is available.
func TestEC2Hostname(t *testing.T) {
teleportHostname := "fakehost.example.com"

6 changes: 5 additions & 1 deletion lib/labels/ec2/ec2.go
Original file line number Diff line number Diff line change
@@ -87,7 +87,11 @@ func New(ctx context.Context, c *Config) (*EC2, error) {
func (l *EC2) Get() map[string]string {
l.mu.RLock()
defer l.mu.RUnlock()
return l.labels
labels := make(map[string]string)
for k, v := range l.labels {
labels[k] = v
}
return labels
}

// Apply adds EC2 labels to the provided resource.