Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
5a058775
Commit
5a058775
authored
Mar 22, 2016
by
Jack Greenfield
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #438 from jackgr/kubernetes-types
Move kubernetes types out of common
parents
6b6bc405
893b740e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
22 deletions
+21
-22
types.go
pkg/common/types.go
+0
-16
secrets_credential_provider.go
pkg/registry/secrets_credential_provider.go
+2
-2
secrets_credential_provider.go
pkg/repo/secrets_credential_provider.go
+2
-3
kubernetes.go
pkg/util/kubernetes.go
+16
-0
kubernetesutil.go
pkg/util/kubernetesutil.go
+1
-1
No files found.
pkg/common/types.go
View file @
5a058775
...
...
@@ -180,22 +180,6 @@ type TypeInstance struct {
Path
string
`json:"path"`
// JSON path within manifest
}
// KubernetesObject represents a native 'bare' Kubernetes object.
type
KubernetesObject
struct
{
Kind
string
`json:"kind"`
APIVersion
string
`json:"apiVersion"`
Metadata
map
[
string
]
interface
{}
`json:"metadata"`
Spec
map
[
string
]
interface
{}
`json:"spec"`
}
// KubernetesSecret represents a Kubernetes secret
type
KubernetesSecret
struct
{
Kind
string
`json:"kind"`
APIVersion
string
`json:"apiVersion"`
Metadata
map
[
string
]
string
`json:"metadata"`
Data
map
[
string
]
string
`json:"data,omitempty"`
}
// TODO: Remove the remainder of this file when the refactoring of pkg/registry is complete.
// BasicAuthCredential holds a username and password.
...
...
pkg/registry/secrets_credential_provider.go
View file @
5a058775
...
...
@@ -71,7 +71,7 @@ func NewSecretsCredentialProvider() common.CredentialProvider {
}
func
parseCredential
(
credential
string
)
(
*
common
.
RegistryCredential
,
error
)
{
var
c
common
.
KubernetesSecret
var
c
util
.
KubernetesSecret
if
err
:=
json
.
Unmarshal
([]
byte
(
credential
),
&
c
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal credential '%s' (%#v)"
,
credential
,
err
)
}
...
...
@@ -112,7 +112,7 @@ func (scp *SecretsCredentialProvider) SetCredential(name string, credential *com
metadata
[
"name"
]
=
name
data
:=
make
(
map
[
string
]
string
)
data
[
"credential"
]
=
enc
obj
:=
&
common
.
KubernetesSecret
{
obj
:=
&
util
.
KubernetesSecret
{
Kind
:
secretType
,
APIVersion
:
"v1"
,
Metadata
:
metadata
,
...
...
pkg/repo/secrets_credential_provider.go
View file @
5a058775
...
...
@@ -24,7 +24,6 @@ import (
"log"
"github.com/ghodss/yaml"
"github.com/kubernetes/helm/pkg/common"
"github.com/kubernetes/helm/pkg/util"
)
...
...
@@ -71,7 +70,7 @@ func NewSecretsCredentialProvider() ICredentialProvider {
}
func
parseCredential
(
credential
string
)
(
*
Credential
,
error
)
{
var
c
common
.
KubernetesSecret
var
c
util
.
KubernetesSecret
if
err
:=
json
.
Unmarshal
([]
byte
(
credential
),
&
c
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal credential (%s): %s"
,
credential
,
err
)
}
...
...
@@ -116,7 +115,7 @@ func (scp *SecretsCredentialProvider) SetCredential(name string, credential *Cre
metadata
[
"name"
]
=
name
data
:=
make
(
map
[
string
]
string
)
data
[
"credential"
]
=
enc
obj
:=
&
common
.
KubernetesSecret
{
obj
:=
&
util
.
KubernetesSecret
{
Kind
:
secretType
,
APIVersion
:
"v1"
,
Metadata
:
metadata
,
...
...
pkg/util/kubernetes.go
View file @
5a058775
...
...
@@ -40,3 +40,19 @@ type Kubernetes interface {
Delete
(
resource
string
)
(
string
,
error
)
Replace
(
resource
string
)
(
string
,
error
)
}
// KubernetesObject represents a native 'bare' Kubernetes object.
type
KubernetesObject
struct
{
Kind
string
`json:"kind"`
APIVersion
string
`json:"apiVersion"`
Metadata
map
[
string
]
interface
{}
`json:"metadata"`
Spec
map
[
string
]
interface
{}
`json:"spec"`
}
// KubernetesSecret represents a Kubernetes secret
type
KubernetesSecret
struct
{
Kind
string
`json:"kind"`
APIVersion
string
`json:"apiVersion"`
Metadata
map
[
string
]
string
`json:"metadata"`
Data
map
[
string
]
string
`json:"data,omitempty"`
}
pkg/util/kubernetesutil.go
View file @
5a058775
...
...
@@ -26,7 +26,7 @@ import (
// ParseKubernetesObject parses a Kubernetes API object in YAML format.
func
ParseKubernetesObject
(
object
[]
byte
)
(
*
common
.
Resource
,
error
)
{
o
:=
&
common
.
KubernetesObject
{}
o
:=
&
KubernetesObject
{}
if
err
:=
yaml
.
Unmarshal
(
object
,
&
o
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal native kubernetes object (%#v)"
,
err
)
}
...
...
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