Change common.Template to hold a chart. Comment out (most) broken code

pull/391/head
Dave Cunningham 10 years ago
parent 759d80dc0a
commit b2d07ccea6

@ -20,9 +20,9 @@ import (
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
"github.com/kubernetes/helm/pkg/common" "github.com/kubernetes/helm/pkg/common"
"github.com/kubernetes/helm/pkg/util" //"github.com/kubernetes/helm/pkg/util"
"archive/tar" //"archive/tar"
"bytes" "bytes"
"encoding/json" "encoding/json"
"flag" "flag"
@ -33,7 +33,7 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
"strconv" // "strconv"
"strings" "strings"
"time" "time"
) )
@ -179,6 +179,7 @@ func execute() {
path := fmt.Sprintf("types/%s/metadata", url.QueryEscape(args[1])) path := fmt.Sprintf("types/%s/metadata", url.QueryEscape(args[1]))
callService(path, "GET", "get metadata for type", nil) callService(path, "GET", "get metadata for type", nil)
/*
case "expand": case "expand":
template := loadTemplate(args) template := loadTemplate(args)
callService("expand", "POST", "expand configuration", marshalTemplate(template)) callService("expand", "POST", "expand configuration", marshalTemplate(template))
@ -186,6 +187,7 @@ func execute() {
template := loadTemplate(args) template := loadTemplate(args)
action := fmt.Sprintf("deploy configuration named %s", template.Name) action := fmt.Sprintf("deploy configuration named %s", template.Name)
callService("deployments", "POST", action, marshalTemplate(template)) callService("deployments", "POST", action, marshalTemplate(template))
*/
case "list": case "list":
callService("deployments", "GET", "list deployments", nil) callService("deployments", "GET", "list deployments", nil)
case "getcredential": case "getcredential":
@ -242,11 +244,13 @@ func execute() {
path := fmt.Sprintf("deployments/%s", url.QueryEscape(args[1])) path := fmt.Sprintf("deployments/%s", url.QueryEscape(args[1]))
action := fmt.Sprintf("delete deployment named %s", args[1]) action := fmt.Sprintf("delete deployment named %s", args[1])
callService(path, "DELETE", action, nil) callService(path, "DELETE", action, nil)
/*
case "update": case "update":
template := loadTemplate(args) template := loadTemplate(args)
path := fmt.Sprintf("deployments/%s", url.QueryEscape(template.Name)) path := fmt.Sprintf("deployments/%s", url.QueryEscape(template.Name))
action := fmt.Sprintf("delete deployment named %s", template.Name) action := fmt.Sprintf("delete deployment named %s", template.Name)
callService(path, "PUT", action, marshalTemplate(template)) callService(path, "PUT", action, marshalTemplate(template))
*/
case "deployed-types": case "deployed-types":
callService("types", "GET", "list deployed types", nil) callService("types", "GET", "list deployed types", nil)
case "deployed-instances": case "deployed-instances":
@ -318,6 +322,7 @@ func callHTTP(path, method, action string, reader io.ReadCloser) string {
return string(body) return string(body)
} }
/*
func loadTemplate(args []string) *common.Template { func loadTemplate(args []string) *common.Template {
var template *common.Template var template *common.Template
var err error var err error
@ -404,6 +409,7 @@ func buildTemplateFromType(t string) *common.Template {
return template return template
} }
*/
func marshalTemplate(template *common.Template) io.ReadCloser { func marshalTemplate(template *common.Template) io.ReadCloser {
j, err := json.Marshal(template) j, err := json.Marshal(template)

@ -109,10 +109,12 @@ func TestExpandTemplateFromReader(t *testing.T) {
testExpandTemplateFromFile(t, validFileName, baseName, importFileNames, util.NewTemplateFromReader) testExpandTemplateFromFile(t, validFileName, baseName, importFileNames, util.NewTemplateFromReader)
} }
/*
func TestExpandTemplateFromArchive(t *testing.T) { func TestExpandTemplateFromArchive(t *testing.T) {
baseName := path.Base(validFileName) baseName := path.Base(validFileName)
testExpandTemplateFromFile(t, archiveFileName, baseName, nil, util.NewTemplateFromArchive) testExpandTemplateFromFile(t, archiveFileName, baseName, nil, util.NewTemplateFromArchive)
} }
*/
var ExpanderTestCases = []ExpanderTestCase{ var ExpanderTestCases = []ExpanderTestCase{
{ {

@ -97,21 +97,39 @@ type Manifest struct {
Layout *Layout `json:"layout,omitempty"` Layout *Layout `json:"layout,omitempty"`
} }
type Expander struct {
Name string `json:"name"`
Entrypoint string `json:"entry_point"`
}
type ChartFile struct {
Path string `json:"path"` // Path from the root of the chart.
Content string `json:"content"` // Base64 encoded file content.
}
type Chart struct {
Name string `json:"name"`
Expander *Expander `json:"expander"`
Schema interface{} `json:"schema"`
Files []*ChartFile `json:"files"`
}
// Template describes a set of resources to be deployed. // Template describes a set of resources to be deployed.
// Manager expands a Template into a Configuration, which // Manager expands a Template into a Configuration, which
// describes the set in a form that can be instantiated. // describes the set in a form that can be instantiated.
type Template struct { type Template struct {
Name string `json:"name"` Name string `json:"name"`
Content string `json:"content"` ChartInvocation *Resource `json:"content"`
Imports []*ImportFile `json:"imports"` Chart Chart `json:"chart"`
} }
/*
// ImportFile describes a base64 encoded file imported by a Template. // ImportFile describes a base64 encoded file imported by a Template.
type ImportFile struct { type ImportFile struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
Path string `json:"path,omitempty"` // Actual URL for the file Chart Chart `json:"chart"`
Content string `json:"content"`
} }
*/
// Configuration describes a set of resources in a form // Configuration describes a set of resources in a form
// that can be instantiated. // that can be instantiated.

@ -14,8 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package util package util
/*
import ( import (
"archive/tar" "archive/tar"
"fmt" "fmt"
@ -194,3 +196,4 @@ func collectImportFiles(importFileNames []string) ([]*common.ImportFile, error)
return imports, nil return imports, nil
} }
*/

Loading…
Cancel
Save