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

support cert by reference (#268) #269

Merged
merged 7 commits into from
Feb 13, 2021
Merged
Changes from all commits
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
12 changes: 0 additions & 12 deletions file/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ type stateBuilder struct {

selectTags []string
intermediate *state.KongState
certIDs map[string]bool

err error
}
Expand Down Expand Up @@ -45,7 +44,6 @@ func (b *stateBuilder) build() (*utils.KongRawState, error) {
if err != nil {
return nil, err
}
b.certIDs = map[string]bool{}

// build
b.certificates()
Expand Down Expand Up @@ -105,8 +103,6 @@ func (b *stateBuilder) certificates() {
b.err = err
return
}

b.certIDs[*c.ID] = true
}
}

Expand Down Expand Up @@ -430,14 +426,6 @@ func (b *stateBuilder) services() {
utils.MustMergeTags(&s.Service, b.selectTags)
b.defaulter.MustSet(&s.Service)

if s.ClientCertificate != nil && !utils.Empty(s.ClientCertificate.ID) {
if _, ok := b.certIDs[*s.ClientCertificate.ID]; !ok {
Copy link
Member

Choose a reason for hiding this comment

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

It seems b.certIDs was used only in this one place and can now be completely removed.
Can you delete the following lines as well?

20:     certIDs      map[string]bool
48:     b.certIDs = map[string]bool{}
109:            b.certIDs[*c.ID] = true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, true! Have removed those lines.

b.err = errors.Errorf("client certificate not found: %v",
*s.ClientCertificate.ID)
return
}
}

b.rawState.Services = append(b.rawState.Services, &s.Service)
err := b.intermediate.Services.Add(state.Service{Service: s.Service})
if err != nil {
Expand Down