aboutsummaryrefslogtreecommitdiff
path: root/pkg/k8s.io/api/core/v1/register.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-03-11 15:02:04 +0100
committerPaul Holzinger <pholzing@redhat.com>2022-03-15 14:46:29 +0100
commit918fc88a983ea1c1ee7e0abb0fc1dce3c0a35be3 (patch)
treec967a39935b452f4cc61f425188bdbf42111c10a /pkg/k8s.io/api/core/v1/register.go
parent68ce83fe919f2d37762b8b746a73495f45e550f3 (diff)
downloadpodman-918fc88a983ea1c1ee7e0abb0fc1dce3c0a35be3.tar.gz
podman-918fc88a983ea1c1ee7e0abb0fc1dce3c0a35be3.tar.bz2
podman-918fc88a983ea1c1ee7e0abb0fc1dce3c0a35be3.zip
move k8s deps into podman
We only need a small part of the k8s dependencies but they are the biggest dependencies in podman by far. Moving them into podman allows us to remove the unnecessary parts. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg/k8s.io/api/core/v1/register.go')
-rw-r--r--pkg/k8s.io/api/core/v1/register.go99
1 files changed, 99 insertions, 0 deletions
diff --git a/pkg/k8s.io/api/core/v1/register.go b/pkg/k8s.io/api/core/v1/register.go
new file mode 100644
index 000000000..32b11ec57
--- /dev/null
+++ b/pkg/k8s.io/api/core/v1/register.go
@@ -0,0 +1,99 @@
+/*
+Copyright 2015 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 v1
+
+import (
+ metav1 "github.com/containers/podman/v4/pkg/k8s.io/apimachinery/pkg/apis/meta/v1"
+ "github.com/containers/podman/v4/pkg/k8s.io/apimachinery/pkg/runtime"
+ "github.com/containers/podman/v4/pkg/k8s.io/apimachinery/pkg/runtime/schema"
+)
+
+// GroupName is the group name use in this package
+const GroupName = ""
+
+// SchemeGroupVersion is group version used to register these objects
+var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
+
+// Resource takes an unqualified resource and returns a Group qualified GroupResource
+func Resource(resource string) schema.GroupResource {
+ return SchemeGroupVersion.WithResource(resource).GroupResource()
+}
+
+var (
+ // We only register manually written functions here. The registration of the
+ // generated functions takes place in the generated files. The separation
+ // makes the code compile even when the generated files are missing.
+ SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
+ AddToScheme = SchemeBuilder.AddToScheme
+)
+
+// Adds the list of known types to the given scheme.
+func addKnownTypes(scheme *runtime.Scheme) error {
+ scheme.AddKnownTypes(SchemeGroupVersion,
+ &Pod{},
+ &PodList{},
+ &PodStatusResult{},
+ &PodTemplate{},
+ &PodTemplateList{},
+ &ReplicationController{},
+ &ReplicationControllerList{},
+ &Service{},
+ &ServiceProxyOptions{},
+ &ServiceList{},
+ &Endpoints{},
+ &EndpointsList{},
+ &Node{},
+ &NodeList{},
+ &NodeProxyOptions{},
+ &Binding{},
+ &Event{},
+ &EventList{},
+ &List{},
+ &LimitRange{},
+ &LimitRangeList{},
+ &ResourceQuota{},
+ &ResourceQuotaList{},
+ &Namespace{},
+ &NamespaceList{},
+ &Secret{},
+ &SecretList{},
+ &ServiceAccount{},
+ &ServiceAccountList{},
+ &PersistentVolume{},
+ &PersistentVolumeList{},
+ &PersistentVolumeClaim{},
+ &PersistentVolumeClaimList{},
+ &PodAttachOptions{},
+ &PodLogOptions{},
+ &PodExecOptions{},
+ &PodPortForwardOptions{},
+ &PodProxyOptions{},
+ &ComponentStatus{},
+ &ComponentStatusList{},
+ &SerializedReference{},
+ &RangeAllocation{},
+ &ConfigMap{},
+ &ConfigMapList{},
+ )
+
+ // Add common types
+ scheme.AddKnownTypes(SchemeGroupVersion, &metav1.Status{})
+
+ // Add the watch version that applies
+ metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
+ return nil
+}