Skip to content

Commit

Permalink
chore(validator) rename configuration import
Browse files Browse the repository at this point in the history
Use configurationv1 for the controller configuration v1 package import,
following convention elsewhere.
  • Loading branch information
Travis Raines authored and rainest committed Feb 18, 2021
1 parent 9448eb7 commit 1033dee
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/admission/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"

"github.com/kong/go-kong/kong"
configuration "github.com/kong/kubernetes-ingress-controller/pkg/apis/configuration/v1"
configurationv1 "github.com/kong/kubernetes-ingress-controller/pkg/apis/configuration/v1"
"github.com/kong/kubernetes-ingress-controller/pkg/kongstate"
"github.com/kong/kubernetes-ingress-controller/pkg/store"
"github.com/sirupsen/logrus"
Expand All @@ -15,8 +15,8 @@ import (

// KongValidator validates Kong entities.
type KongValidator interface {
ValidateConsumer(ctx context.Context, consumer configuration.KongConsumer) (bool, string, error)
ValidatePlugin(consumer configuration.KongPlugin) (bool, string, error)
ValidateConsumer(ctx context.Context, consumer configurationv1.KongConsumer) (bool, string, error)
ValidatePlugin(consumer configurationv1.KongPlugin) (bool, string, error)
ValidateCredential(secret corev1.Secret) (bool, string, error)
}

Expand All @@ -34,7 +34,7 @@ type KongHTTPValidator struct {
// The first boolean communicates if the consumer is valid or not and string
// holds a message if the entity is not valid.
func (validator KongHTTPValidator) ValidateConsumer(ctx context.Context,
consumer configuration.KongConsumer) (bool, string, error) {
consumer configurationv1.KongConsumer) (bool, string, error) {
if consumer.Username == "" {
return false, "username cannot be empty", nil
}
Expand All @@ -58,7 +58,7 @@ func (validator KongHTTPValidator) ValidateConsumer(ctx context.Context,
// The first boolean communicates if k8sPluign is valid or not and string
// holds a message if the entity is not valid.
func (validator KongHTTPValidator) ValidatePlugin(
k8sPlugin configuration.KongPlugin) (bool, string, error) {
k8sPlugin configurationv1.KongPlugin) (bool, string, error) {
if k8sPlugin.PluginName == "" {
return false, "plugin name cannot be empty", nil
}
Expand All @@ -67,7 +67,7 @@ func (validator KongHTTPValidator) ValidatePlugin(
if k8sPlugin.Config != nil {
plugin.Config = kong.Configuration(k8sPlugin.Config)
}
if k8sPlugin.ConfigFrom.SecretValue != (configuration.SecretValueFromSource{}) {
if k8sPlugin.ConfigFrom.SecretValue != (configurationv1.SecretValueFromSource{}) {
if k8sPlugin.Config != nil {
return false, "plugin cannot use both Config and ConfigFrom", nil
}
Expand Down

0 comments on commit 1033dee

Please sign in to comment.