Change Denied to *string
This commit is contained in:
parent
62191fc3e2
commit
53538acbaf
4 changed files with 6 additions and 5 deletions
|
@ -81,7 +81,7 @@ type Ingress struct {
|
||||||
CustomHTTPErrors []int
|
CustomHTTPErrors []int
|
||||||
DefaultBackend *apiv1.Service
|
DefaultBackend *apiv1.Service
|
||||||
//TODO: Change this back into an error when https://github.com/imdario/mergo/issues/100 is resolved
|
//TODO: Change this back into an error when https://github.com/imdario/mergo/issues/100 is resolved
|
||||||
Denied string
|
Denied *string
|
||||||
ExternalAuth authreq.Config
|
ExternalAuth authreq.Config
|
||||||
HTTP2PushPreload bool
|
HTTP2PushPreload bool
|
||||||
Proxy proxy.Config
|
Proxy proxy.Config
|
||||||
|
@ -183,7 +183,8 @@ func (e Extractor) Extract(ing *extensions.Ingress) *Ingress {
|
||||||
|
|
||||||
_, alreadyDenied := data[DeniedKeyName]
|
_, alreadyDenied := data[DeniedKeyName]
|
||||||
if !alreadyDenied {
|
if !alreadyDenied {
|
||||||
data[DeniedKeyName] = err.Error()
|
errString := err.Error()
|
||||||
|
data[DeniedKeyName] = &errString
|
||||||
klog.Errorf("error reading %v annotation in Ingress %v/%v: %v", name, ing.GetNamespace(), ing.GetName(), err)
|
klog.Errorf("error reading %v annotation in Ingress %v/%v: %v", name, ing.GetNamespace(), ing.GetName(), err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -611,7 +611,7 @@ func isLocationAllowed(input interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return loc.Denied == ""
|
return loc.Denied == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -468,7 +468,7 @@ func TestIsLocationAllowed(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
loc := ingress.Location{
|
loc := ingress.Location{
|
||||||
Denied: "",
|
Denied: nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
isAllowed := isLocationAllowed(&loc)
|
isAllowed := isLocationAllowed(&loc)
|
||||||
|
|
|
@ -239,7 +239,7 @@ type Location struct {
|
||||||
BasicDigestAuth auth.Config `json:"basicDigestAuth,omitempty"`
|
BasicDigestAuth auth.Config `json:"basicDigestAuth,omitempty"`
|
||||||
// Denied returns an error when this location cannot not be allowed
|
// Denied returns an error when this location cannot not be allowed
|
||||||
// Requesting a denied location should return HTTP code 403.
|
// Requesting a denied location should return HTTP code 403.
|
||||||
Denied string `json:"denied,omitempty"`
|
Denied *string `json:"denied,omitempty"`
|
||||||
// CorsConfig returns the Cors Configuration for the ingress rule
|
// CorsConfig returns the Cors Configuration for the ingress rule
|
||||||
// +optional
|
// +optional
|
||||||
CorsConfig cors.Config `json:"corsConfig,omitempty"`
|
CorsConfig cors.Config `json:"corsConfig,omitempty"`
|
||||||
|
|
Loading…
Reference in a new issue