Commit 893b740e authored by jackgr's avatar jackgr

Move kubernetes types out of common

parent 2c295a4c
......@@ -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.
......
......@@ -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,
......
......@@ -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,
......
......@@ -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"`
}
......@@ -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)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment