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
893b740e
Commit
893b740e
authored
Mar 22, 2016
by
jackgr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move kubernetes types out of common
parent
2c295a4c
Show 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 @
893b740e
...
@@ -180,22 +180,6 @@ type TypeInstance struct {
...
@@ -180,22 +180,6 @@ type TypeInstance struct {
Path
string
`json:"path"`
// JSON path within manifest
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.
// TODO: Remove the remainder of this file when the refactoring of pkg/registry is complete.
// BasicAuthCredential holds a username and password.
// BasicAuthCredential holds a username and password.
...
...
pkg/registry/secrets_credential_provider.go
View file @
893b740e
...
@@ -71,7 +71,7 @@ func NewSecretsCredentialProvider() common.CredentialProvider {
...
@@ -71,7 +71,7 @@ func NewSecretsCredentialProvider() common.CredentialProvider {
}
}
func
parseCredential
(
credential
string
)
(
*
common
.
RegistryCredential
,
error
)
{
func
parseCredential
(
credential
string
)
(
*
common
.
RegistryCredential
,
error
)
{
var
c
common
.
KubernetesSecret
var
c
util
.
KubernetesSecret
if
err
:=
json
.
Unmarshal
([]
byte
(
credential
),
&
c
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
([]
byte
(
credential
),
&
c
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal credential '%s' (%#v)"
,
credential
,
err
)
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal credential '%s' (%#v)"
,
credential
,
err
)
}
}
...
@@ -112,7 +112,7 @@ func (scp *SecretsCredentialProvider) SetCredential(name string, credential *com
...
@@ -112,7 +112,7 @@ func (scp *SecretsCredentialProvider) SetCredential(name string, credential *com
metadata
[
"name"
]
=
name
metadata
[
"name"
]
=
name
data
:=
make
(
map
[
string
]
string
)
data
:=
make
(
map
[
string
]
string
)
data
[
"credential"
]
=
enc
data
[
"credential"
]
=
enc
obj
:=
&
common
.
KubernetesSecret
{
obj
:=
&
util
.
KubernetesSecret
{
Kind
:
secretType
,
Kind
:
secretType
,
APIVersion
:
"v1"
,
APIVersion
:
"v1"
,
Metadata
:
metadata
,
Metadata
:
metadata
,
...
...
pkg/repo/secrets_credential_provider.go
View file @
893b740e
...
@@ -24,7 +24,6 @@ import (
...
@@ -24,7 +24,6 @@ import (
"log"
"log"
"github.com/ghodss/yaml"
"github.com/ghodss/yaml"
"github.com/kubernetes/helm/pkg/common"
"github.com/kubernetes/helm/pkg/util"
"github.com/kubernetes/helm/pkg/util"
)
)
...
@@ -71,7 +70,7 @@ func NewSecretsCredentialProvider() ICredentialProvider {
...
@@ -71,7 +70,7 @@ func NewSecretsCredentialProvider() ICredentialProvider {
}
}
func
parseCredential
(
credential
string
)
(
*
Credential
,
error
)
{
func
parseCredential
(
credential
string
)
(
*
Credential
,
error
)
{
var
c
common
.
KubernetesSecret
var
c
util
.
KubernetesSecret
if
err
:=
json
.
Unmarshal
([]
byte
(
credential
),
&
c
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
([]
byte
(
credential
),
&
c
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal credential (%s): %s"
,
credential
,
err
)
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal credential (%s): %s"
,
credential
,
err
)
}
}
...
@@ -116,7 +115,7 @@ func (scp *SecretsCredentialProvider) SetCredential(name string, credential *Cre
...
@@ -116,7 +115,7 @@ func (scp *SecretsCredentialProvider) SetCredential(name string, credential *Cre
metadata
[
"name"
]
=
name
metadata
[
"name"
]
=
name
data
:=
make
(
map
[
string
]
string
)
data
:=
make
(
map
[
string
]
string
)
data
[
"credential"
]
=
enc
data
[
"credential"
]
=
enc
obj
:=
&
common
.
KubernetesSecret
{
obj
:=
&
util
.
KubernetesSecret
{
Kind
:
secretType
,
Kind
:
secretType
,
APIVersion
:
"v1"
,
APIVersion
:
"v1"
,
Metadata
:
metadata
,
Metadata
:
metadata
,
...
...
pkg/util/kubernetes.go
View file @
893b740e
...
@@ -40,3 +40,19 @@ type Kubernetes interface {
...
@@ -40,3 +40,19 @@ type Kubernetes interface {
Delete
(
resource
string
)
(
string
,
error
)
Delete
(
resource
string
)
(
string
,
error
)
Replace
(
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 @
893b740e
...
@@ -26,7 +26,7 @@ import (
...
@@ -26,7 +26,7 @@ import (
// ParseKubernetesObject parses a Kubernetes API object in YAML format.
// ParseKubernetesObject parses a Kubernetes API object in YAML format.
func
ParseKubernetesObject
(
object
[]
byte
)
(
*
common
.
Resource
,
error
)
{
func
ParseKubernetesObject
(
object
[]
byte
)
(
*
common
.
Resource
,
error
)
{
o
:=
&
common
.
KubernetesObject
{}
o
:=
&
KubernetesObject
{}
if
err
:=
yaml
.
Unmarshal
(
object
,
&
o
);
err
!=
nil
{
if
err
:=
yaml
.
Unmarshal
(
object
,
&
o
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot unmarshal native kubernetes object (%#v)"
,
err
)
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