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

Add Backends field to Director #347

Merged
merged 1 commit into from
Apr 27, 2022
Merged

Conversation

Integralist
Copy link
Collaborator

Problem: The Fastly Terraform Provider is inefficiently checking for backend membership within a Director, resulting in API requests reaching 1000+ in some cases for customers.

Solution: Expose the backends field on the director so that the Terraform Provider can quickly validate which service backends are members of the director.

@Integralist Integralist added the enhancement New feature or request label Apr 27, 2022
@Integralist Integralist requested review from a team and kailan and removed request for a team April 27, 2022 11:10
Copy link
Collaborator Author

@Integralist Integralist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick review guidance...

Comment on lines +24 to +46
b, errBackend = c.CreateBackend(&CreateBackendInput{
ServiceID: testServiceID,
ServiceVersion: tv.Number,
Name: "test-backend",
Address: "integ-test.go-fastly.com",
Port: Uint(1234),
ConnectTimeout: Uint(1500),
OverrideHost: "origin.example.com",
SSLCiphers: "DHE-RSA-AES256-SHA:DHE-RSA-CAMELLIA256-SHA:AES256-GCM-SHA384",
})
d, errDirector = c.CreateDirector(&CreateDirectorInput{
ServiceID: testServiceID,
ServiceVersion: tv.Number,
Name: "test-director",
Quorum: Uint(50),
Type: DirectorTypeRandom,
Retries: Uint(5),
})
_, errDirectorBackend = c.CreateDirectorBackend(&CreateDirectorBackendInput{
ServiceID: testServiceID,
ServiceVersion: tv.Number,
Director: "test-director",
Backend: b.Name,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the test suite I ensure when creating a Director we also create a Backend and then create a relationship between the two.

Comment on lines +144 to 146
if len(nb.Backends) == 0 || nb.Backends[0] != b.Name {
t.Error("bad backend: expected a backend")
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test assertion validates that the requested Director contains the Backend we expect it to.

@Integralist
Copy link
Collaborator Author

cc @jdigory who reported this issue.

Copy link
Member

@kailan kailan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants