2016-06-01 14:47:37 -04:00
|
|
|
/*
|
2016-09-08 13:02:39 +02:00
|
|
|
Copyright 2016 The Kubernetes Authors.
|
2016-06-01 14:47:37 -04:00
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package secureupstream
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"k8s.io/kubernetes/pkg/apis/extensions"
|
2016-11-16 15:24:26 -03:00
|
|
|
|
|
|
|
|
"k8s.io/ingress/core/pkg/ingress/annotations/parser"
|
2016-06-01 14:47:37 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
2016-06-20 14:57:35 -04:00
|
|
|
secureUpstream = "ingress.kubernetes.io/secure-backends"
|
2016-06-01 14:47:37 -04:00
|
|
|
)
|
|
|
|
|
|
2016-12-29 17:02:06 -03:00
|
|
|
type su struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NewParser creates a new secure upstream annotation parser
|
|
|
|
|
func NewParser() parser.IngressAnnotation {
|
|
|
|
|
return su{}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parse parses the annotations contained in the ingress
|
2016-06-01 14:47:37 -04:00
|
|
|
// rule used to indicate if the upstream servers should use SSL
|
2016-12-29 17:02:06 -03:00
|
|
|
func (a su) Parse(ing *extensions.Ingress) (interface{}, error) {
|
2016-11-10 19:56:29 -03:00
|
|
|
return parser.GetBoolAnnotation(secureUpstream, ing)
|
2016-06-01 14:47:37 -04:00
|
|
|
}
|