Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
4471d032
Commit
4471d032
authored
May 24, 2018
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apimachinery: remove unused UnstructuredObjectConverter
parent
eacf6f05
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
42 deletions
+0
-42
helpers.go
....io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
+0
-42
No files found.
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
View file @
4471d032
...
@@ -18,7 +18,6 @@ package unstructured
...
@@ -18,7 +18,6 @@ package unstructured
import
(
import
(
gojson
"encoding/json"
gojson
"encoding/json"
"errors"
"fmt"
"fmt"
"io"
"io"
"strings"
"strings"
...
@@ -450,44 +449,3 @@ func (c JSONFallbackEncoder) Encode(obj runtime.Object, w io.Writer) error {
...
@@ -450,44 +449,3 @@ func (c JSONFallbackEncoder) Encode(obj runtime.Object, w io.Writer) error {
}
}
return
err
return
err
}
}
// UnstructuredObjectConverter is an ObjectConverter for use with
// Unstructured objects. Since it has no schema or type information,
// it will only succeed for no-op conversions. This is provided as a
// sane implementation for APIs that require an object converter.
type
UnstructuredObjectConverter
struct
{}
func
(
UnstructuredObjectConverter
)
Convert
(
in
,
out
,
context
interface
{})
error
{
unstructIn
,
ok
:=
in
.
(
*
Unstructured
)
if
!
ok
{
return
fmt
.
Errorf
(
"input type %T in not valid for unstructured conversion"
,
in
)
}
unstructOut
,
ok
:=
out
.
(
*
Unstructured
)
if
!
ok
{
return
fmt
.
Errorf
(
"output type %T in not valid for unstructured conversion"
,
out
)
}
// maybe deep copy the map? It is documented in the
// ObjectConverter interface that this function is not
// guaranteed to not mutate the input. Or maybe set the input
// object to nil.
unstructOut
.
Object
=
unstructIn
.
Object
return
nil
}
func
(
UnstructuredObjectConverter
)
ConvertToVersion
(
in
runtime
.
Object
,
target
runtime
.
GroupVersioner
)
(
runtime
.
Object
,
error
)
{
if
kind
:=
in
.
GetObjectKind
()
.
GroupVersionKind
();
!
kind
.
Empty
()
{
gvk
,
ok
:=
target
.
KindForGroupVersionKinds
([]
schema
.
GroupVersionKind
{
kind
})
if
!
ok
{
// TODO: should this be a typed error?
return
nil
,
fmt
.
Errorf
(
"%v is unstructured and is not suitable for converting to %q"
,
kind
,
target
)
}
in
.
GetObjectKind
()
.
SetGroupVersionKind
(
gvk
)
}
return
in
,
nil
}
func
(
UnstructuredObjectConverter
)
ConvertFieldLabel
(
version
,
kind
,
label
,
value
string
)
(
string
,
string
,
error
)
{
return
""
,
""
,
errors
.
New
(
"unstructured cannot convert field labels"
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment