1 /* 2 Copyright 2019 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 /* 18 Package conversion provides interface definitions that an API Type needs to 19 implement for it to be supported by the generic conversion webhook handler 20 defined under pkg/webhook/conversion. 21 */ 22 package conversion 23 24 import "k8s.io/apimachinery/pkg/runtime" 25 26 // Convertible defines capability of a type to convertible i.e. it can be converted to/from a hub type. 27 type Convertible interface { 28 runtime.Object 29 ConvertTo(dst Hub) error 30 ConvertFrom(src Hub) error 31 } 32 33 // Hub marks that a given type is the hub type for conversion. This means that 34 // all conversions will first convert to the hub type, then convert from the hub 35 // type to the destination type. All types besides the hub type should implement 36 // Convertible. 37 type Hub interface { 38 runtime.Object 39 Hub() 40 } 41