2016-11-16 18:24:26 +00:00
|
|
|
/*
|
|
|
|
Copyright 2016 The Kubernetes Authors.
|
|
|
|
|
|
|
|
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 ingress
|
|
|
|
|
|
|
|
import (
|
2017-08-10 03:27:57 +00:00
|
|
|
"crypto/x509"
|
2017-06-14 21:33:12 +00:00
|
|
|
"time"
|
|
|
|
|
2017-09-17 18:42:31 +00:00
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
2017-04-01 14:39:42 +00:00
|
|
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
2016-11-16 18:24:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// SSLCert describes a SSL certificate to be used in a server
|
|
|
|
type SSLCert struct {
|
2017-09-17 18:42:31 +00:00
|
|
|
metav1.ObjectMeta `json:"metadata,omitempty"`
|
|
|
|
Certificate *x509.Certificate `json:"certificate,omitempty"`
|
2016-11-16 18:24:26 +00:00
|
|
|
// CAFileName contains the path to the file with the root certificate
|
|
|
|
CAFileName string `json:"caFileName"`
|
|
|
|
// PemFileName contains the path to the file with the certificate and key concatenated
|
|
|
|
PemFileName string `json:"pemFileName"`
|
|
|
|
// PemSHA contains the sha1 of the pem file.
|
|
|
|
// This is used to detect changes in the secret that contains the certificates
|
|
|
|
PemSHA string `json:"pemSha"`
|
|
|
|
// CN contains all the common names defined in the SSL certificate
|
|
|
|
CN []string `json:"cn"`
|
2017-06-12 12:45:08 +00:00
|
|
|
// ExpiresTime contains the expiration of this SSL certificate in timestamp format
|
|
|
|
ExpireTime time.Time `json:"expires"`
|
2018-06-04 21:48:30 +00:00
|
|
|
// Pem encoded certificate and key concatenated
|
2019-06-25 11:49:00 +00:00
|
|
|
PemCertKey string `json:"pemCertKey,omitempty"`
|
2016-11-16 18:24:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetObjectKind implements the ObjectKind interface as a noop
|
2017-04-01 14:39:42 +00:00
|
|
|
func (s SSLCert) GetObjectKind() schema.ObjectKind {
|
|
|
|
return schema.EmptyObjectKind
|
|
|
|
}
|
2018-07-07 17:46:18 +00:00
|
|
|
|
|
|
|
// HashInclude defines if a field should be used or not to calculate the hash
|
|
|
|
func (s SSLCert) HashInclude(field string, v interface{}) (bool, error) {
|
|
|
|
return (field != "PemSHA" && field != "ExpireTime"), nil
|
|
|
|
}
|