Skip to content

Commit

Permalink
handle long yaml strings in a special way (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
bobmex authored Jan 4, 2019
1 parent 9f49ea5 commit 367651a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mexos/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ func GetKubeManifest(mf *Manifest) (string, error) {
mani := mf.Config.ConfigDetail.Manifest
//XXX controlling pass full yaml text in parameter of another yaml
log.DebugLog(log.DebugLevelMexos, "getting kubernetes manifest", "base", base, "manifest", mani)
if !strings.Contains(mani, "://") {
if !strings.HasPrefix(mani, "apiVersion: v1") {
fn := fmt.Sprintf("%s/%s", base, mani)
log.DebugLog(log.DebugLevelMexos, "getting manifest file", "uri", fn)
res, err := GetURIFile(mf, fn)
Expand Down
17 changes: 10 additions & 7 deletions mexos/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ config:
kind:
source:
detail:
resources: "{{.Config.Resources}}"
resources: {{.Config.Resources}}
deployment: {{.Config.Deployment}}
manifest: "{{.Config.Manifest}}"
manifest: {{.Config.Manifest}}
template: {{.Config.Template}}
base: {{.Config.Base}}
overlay: {{.Config.Overlay}}
Expand Down Expand Up @@ -253,11 +253,11 @@ func fillAppTemplate(rootLB *MEXRootLB, appInst *edgeproto.AppInst, app *edgepro
NetworkScheme: vp.Network.Scheme, //XXX "external-ip," + GetMEXExternalNetwork(rootLB.PlatConf),
Config: templateConfig{
Deployment: app.Deployment, //vp.Application.Deployment
Resources: config.Resources,
Manifest: app.DeploymentManifest, //XXX vp.Application.Manifest,controller passes entire YAML
Template: vp.Application.Template,
Base: vp.Application.Base,
Overlay: vp.Application.Overlay,
//Resources: config.Resources,
//Manifest: app.DeploymentManifest, //XXX vp.Application.Manifest,controller passes entire YAML
Template: vp.Application.Template,
Base: vp.Application.Base,
Overlay: vp.Application.Overlay,
},
SpecPorts: vp.Application.Ports,
Command: strings.Split(app.Command, " "),
Expand All @@ -266,6 +266,9 @@ func fillAppTemplate(rootLB *MEXRootLB, appInst *edgeproto.AppInst, app *edgepro
if err != nil {
return nil, err
}
//XXX these are passed in unmarshallable format from controller. it can contain entire YAML content
mf.Config.ConfigDetail.Resources = config.Resources
mf.Config.ConfigDetail.Manifest = app.DeploymentManifest
switch appDeploymentType {
case cloudcommon.AppDeploymentTypeKubernetes:
case cloudcommon.AppDeploymentTypeDockerSwarm:
Expand Down

0 comments on commit 367651a

Please sign in to comment.