k8s.io/apiserver@v0.31.1/pkg/server/dynamiccertificates/interfaces.go (about) 1 /* 2 Copyright 2021 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package dynamiccertificates 18 19 import ( 20 "crypto/x509" 21 ) 22 23 // Listener is an interface to use to notify interested parties of a change. 24 type Listener interface { 25 // Enqueue should be called when an input may have changed 26 Enqueue() 27 } 28 29 // Notifier is a way to add listeners 30 type Notifier interface { 31 // AddListener is adds a listener to be notified of potential input changes. 32 // This is a noop on static providers. 33 AddListener(listener Listener) 34 } 35 36 // CAContentProvider provides ca bundle byte content 37 type CAContentProvider interface { 38 Notifier 39 40 // Name is just an identifier. 41 Name() string 42 // CurrentCABundleContent provides ca bundle byte content. Errors can be 43 // contained to the controllers initializing the value. By the time you get 44 // here, you should always be returning a value that won't fail. 45 CurrentCABundleContent() []byte 46 // VerifyOptions provides VerifyOptions for authenticators. 47 VerifyOptions() (x509.VerifyOptions, bool) 48 } 49 50 // CertKeyContentProvider provides a certificate and matching private key. 51 type CertKeyContentProvider interface { 52 Notifier 53 54 // Name is just an identifier. 55 Name() string 56 // CurrentCertKeyContent provides cert and key byte content. 57 CurrentCertKeyContent() ([]byte, []byte) 58 } 59 60 // SNICertKeyContentProvider provides a certificate and matching private key as 61 // well as optional explicit names. 62 type SNICertKeyContentProvider interface { 63 Notifier 64 65 CertKeyContentProvider 66 // SNINames provides names used for SNI. May return nil. 67 SNINames() []string 68 }