-
Notifications
You must be signed in to change notification settings - Fork 63
/
register.go
43 lines (34 loc) · 1.04 KB
/
register.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
35
36
37
38
39
40
41
42
43
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors.
// Licensed under the BSD-3-Clause License (the "License").
// You may not use this file except in compliance with the License.
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"kraftkit.sh/api/volume"
)
const Version = "v1alpha1"
var SchemeGroupVersion = schema.GroupVersion{
Group: volume.GroupName,
Version: Version,
}
func AddToScheme(scheme *runtime.Scheme) error {
return AddToSchemeWithGV(scheme, SchemeGroupVersion)
}
func AddToSchemeWithGV(scheme *runtime.Scheme, schemeGroupVersion schema.GroupVersion) error {
scheme.AddKnownTypes(schemeGroupVersion,
&Volume{},
&VolumeList{},
)
// Add common types
scheme.AddKnownTypes(schemeGroupVersion,
&metav1.Status{},
)
if schemeGroupVersion == SchemeGroupVersion {
// Add the watch version that applies
metav1.AddToGroupVersion(scheme, schemeGroupVersion)
}
return nil
}