Skip to content

Commit

Permalink
fix linting errors
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo <eolarteaguinaga@gmail.com>
  • Loading branch information
edurra committed Jan 16, 2024
1 parent 48048c0 commit e273296
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions pkg/sidecar/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func (s *Sidecar) dumpBundles(svidResponse *workloadapi.X509Context) error {
if !found {
return fmt.Errorf("no bundles found for %s trust domain", svid.ID.TrustDomain().String())
}

bundles := bundleSet.X509Authorities()
privateKey, err := x509.MarshalPKCS8PrivateKey(svid.PrivateKey)
if err != nil {
Expand All @@ -239,8 +239,8 @@ func (s *Sidecar) dumpBundles(svidResponse *workloadapi.X509Context) error {
// If using federated domains, add them to the CA bundle
if s.config.IncludeFederatedDomains {
bundleSets := svidResponse.Bundles.Bundles()
for _,bundle := range bundleSets {
//The bundle corresponding to svid.ID.TrustDomain is already stored
for _, bundle := range bundleSets {
// The bundle corresponding to svid.ID.TrustDomain is already stored
if bundle.TrustDomain().Name() != svid.ID.TrustDomain().Name() {
bundles = append(bundles, bundle.X509Authorities()...)
}
Expand Down Expand Up @@ -462,4 +462,4 @@ func (w JWTBundlesWatcher) OnJWTBundlesWatchError(err error) {
if status.Code(err) != codes.Canceled {
w.sidecar.config.Log.Errorf("Error while watching JWT bundles: %v", err)
}
}
}
15 changes: 8 additions & 7 deletions pkg/sidecar/sidecar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func TestSidecar_RunDaemon(t *testing.T) {
// Create an intermediate certificate
domain1Inter := domain1CA.CreateCA()
domain1Bundle := domain1CA.Roots()
//Used for testing federated trust domains

// Used for testing federated trust domains
domain2CA := spiffetest.NewCA(t)
domain2Bundle := domain2CA.Roots()

Expand Down Expand Up @@ -66,8 +66,9 @@ func TestSidecar_RunDaemon(t *testing.T) {
},
}

bundleWithFederatedDomains := append(domain1Bundle, domain2Bundle[0:]...)
//Used to create an additional bundle when testing federated trust domains
bundleWithFederatedDomains := domain1CA.Roots()
bundleWithFederatedDomains = append(bundleWithFederatedDomains, domain2Bundle[0:]...)
// Used to create an additional bundle when testing federated trust domains
federatedSpiffeID, err := spiffeid.FromString("spiffe://foo.test/server")
require.NoError(t, err)

Expand Down Expand Up @@ -163,9 +164,9 @@ func TestSidecar_RunDaemon(t *testing.T) {
Bundles: x509bundle.NewSet(x509bundle.FromX509Authorities(spiffeID.TrustDomain(), domain1CA.Roots()), x509bundle.FromX509Authorities(federatedSpiffeID.TrustDomain(), domain2CA.Roots())),
SVIDs: svid,
},
certs: svidChain,
key: svidKey,
bundle: bundleWithFederatedDomains,
certs: svidChain,
key: svidKey,
bundle: bundleWithFederatedDomains,
federatedDomains: true,
},
}
Expand Down

0 comments on commit e273296

Please sign in to comment.