forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscheme.go
34 lines (29 loc) · 1.35 KB
/
scheme.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package util
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
coreapi "k8s.io/kubernetes/pkg/apis/core"
appsv1 "github.com/openshift/api/apps/v1"
appsv1helpers "github.com/openshift/origin/pkg/apps/apis/apps/v1"
)
var (
// for decoding, we want to be tolerant of groupified and non-groupified
annotationDecodingScheme = runtime.NewScheme()
annotationDecoder runtime.Decoder
// for encoding, we want to be strict on groupified
annotationEncodingScheme = runtime.NewScheme()
annotationEncoder runtime.Encoder
)
func init() {
utilruntime.Must(appsv1.Install(annotationDecodingScheme))
utilruntime.Must(appsv1.DeprecatedInstallWithoutGroup(annotationDecodingScheme))
utilruntime.Must(appsv1helpers.AddToScheme(annotationDecodingScheme))
utilruntime.Must(appsv1helpers.AddToSchemeInCoreGroup(annotationDecodingScheme))
utilruntime.Must(coreapi.AddToScheme(annotationDecodingScheme))
utilruntime.Must(appsv1.Install(annotationEncodingScheme))
utilruntime.Must(appsv1helpers.AddToScheme(annotationEncodingScheme))
utilruntime.Must(coreapi.AddToScheme(annotationEncodingScheme))
annotationEncoderCodecFactory := serializer.NewCodecFactory(annotationEncodingScheme)
annotationEncoder = annotationEncoderCodecFactory.LegacyCodec(appsv1.SchemeGroupVersion)
}