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

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

@ -97,21 +97,39 @@ type Manifest struct {
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.
// Manager expands a Template into a Configuration, which
// describes the set in a form that can be instantiated.
type Template struct {
Name string `json:"name"`
Content string `json:"content"`
Imports []*ImportFile `json:"imports"`
ChartInvocation *Resource `json:"content"`
Chart Chart `json:"chart"`
}
/*
// ImportFile describes a base64 encoded file imported by a Template.
type ImportFile struct {
Name string `json:"name,omitempty"`
Path string `json:"path,omitempty"` // Actual URL for the file
Content string `json:"content"`
Chart Chart `json:"chart"`
}
*/
// Configuration describes a set of resources in a form
// that can be instantiated.

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

Loading…
Cancel
Save