Skip to content

Commit

Permalink
chore: address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
binbin-li committed Apr 9, 2024
1 parent 62973ab commit 00e4b21
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions httpserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ func (server *Server) registerHandlers() error {
if err != nil {
return err
}
server.register(http.MethodPost, verifyPath, processTimeout(server.verify, server.GetExecutor(context.Background()).GetVerifyRequestTimeout(), false))
server.register(http.MethodPost, verifyPath, processTimeout(server.verify, server.GetExecutor(server.Context).GetVerifyRequestTimeout(), false))

mutatePath, err := url.JoinPath(ServerRootURL, "mutate")
if err != nil {
return err
}
server.register(http.MethodPost, mutatePath, processTimeout(server.mutate, server.GetExecutor(context.Background()).GetMutationRequestTimeout(), true))
server.register(http.MethodPost, mutatePath, processTimeout(server.mutate, server.GetExecutor(server.Context).GetMutationRequestTimeout(), true))

return nil
}
Expand Down
1 change: 1 addition & 0 deletions pkg/controllers/verifier_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func verifierAddOrReplace(spec configv1beta1.VerifierSpec, objectName string, na
logrus.Error(err, "unable to create verifier from verifier config")
return err
}
// TODO: pass the actual namespace once multi-tenancy is supported.
VerifierMap.AddVerifier(constants.EmptyNamespace, objectName, referenceVerifier)
logrus.Infof("verifier '%v' added to verifier map", referenceVerifier.Name())

Expand Down
4 changes: 2 additions & 2 deletions pkg/customresources/verifiers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
vr "github.com/deislabs/ratify/pkg/verifier"
)

// Verifiers is an interface that defines the methods for managing verifiers across different scopes.
type Verifiers interface {
// VerifierManager is an interface that defines the methods for managing verifiers across different scopes.
type VerifierManager interface {
// GetVerifiers returns verifiers under the given scope.
GetVerifiers(scope string) []vr.ReferenceVerifier

Expand Down
5 changes: 3 additions & 2 deletions pkg/customresources/verifiers/verifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
vr "github.com/deislabs/ratify/pkg/verifier"
)

// ActiveVerifiers implements Verifiers interface.
// ActiveVerifiers implements VerifierManger interface.
type ActiveVerifiers struct {
// TODO: Implement concurrent safety using sync.Map
// The structure of the map is as follows:
Expand All @@ -32,10 +32,11 @@ type ActiveVerifiers struct {
// "verifier2": verifier2
// }
// }
// Note: Scope is utilized for organizing and isolating verifiers. In a Kubernetes (K8s) environment, the scope can be either a namespace or an empty string ("") for cluster-wide verifiers.
NamespacedVerifiers map[string]map[string]vr.ReferenceVerifier
}

func NewActiveVerifiers() Verifiers {
func NewActiveVerifiers() VerifierManager {
return &ActiveVerifiers{
NamespacedVerifiers: make(map[string]map[string]vr.ReferenceVerifier),
}
Expand Down

0 comments on commit 00e4b21

Please sign in to comment.