2016-06-01 18:47:37 +00:00
|
|
|
/*
|
2016-09-08 11:02:39 +00:00
|
|
|
Copyright 2016 The Kubernetes Authors.
|
2016-06-01 18:47:37 +00: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 (
|
2017-04-01 14:39:42 +00:00
|
|
|
extensions "k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
2016-11-16 18:24:26 +00:00
|
|
|
|
|
|
|
"k8s.io/ingress/core/pkg/ingress/annotations/parser"
|
2016-06-01 18:47:37 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2016-06-20 18:57:35 +00:00
|
|
|
secureUpstream = "ingress.kubernetes.io/secure-backends"
|
2016-06-01 18:47:37 +00:00
|
|
|
)
|
|
|
|
|
2016-12-29 20:02:06 +00: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 18:47:37 +00:00
|
|
|
// rule used to indicate if the upstream servers should use SSL
|
2016-12-29 20:02:06 +00:00
|
|
|
func (a su) Parse(ing *extensions.Ingress) (interface{}, error) {
|
2016-11-10 22:56:29 +00:00
|
|
|
return parser.GetBoolAnnotation(secureUpstream, ing)
|
2016-06-01 18:47:37 +00:00
|
|
|
}
|