| ... | ... |
@@ -1,7 +1,6 @@ |
| 1 | 1 |
package validation |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- "fmt" |
|
| 5 | 4 |
"regexp" |
| 6 | 5 |
|
| 7 | 6 |
kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| ... | ... |
@@ -40,7 +39,7 @@ func ValidateTemplate(template *Template) (errs ErrorList) {
|
| 40 | 40 |
case *kubeapi.Service: |
| 41 | 41 |
err = ValidateService(obj) |
| 42 | 42 |
default: |
| 43 |
- err = append(err, NewFieldInvalid("kind", fmt.Sprintf("%T", item)))
|
|
| 43 |
+ // Pass-through unknown types. |
|
| 44 | 44 |
} |
| 45 | 45 |
errs = append(errs, err.PrefixIndex(i).Prefix("items")...)
|
| 46 | 46 |
} |
| ... | ... |
@@ -67,7 +67,7 @@ func TestValidateTemplate(t *testing.T) {
|
| 67 | 67 |
template.Parameters[0].Name = "VALID_NAME" |
| 68 | 68 |
shouldPass(template) |
| 69 | 69 |
|
| 70 |
- // Add invalid Item, should fail on Object.kind |
|
| 70 |
+ // Add Item of unknown Kind, should pass |
|
| 71 | 71 |
template.Items = []runtime.Object{{}}
|
| 72 |
- shouldFail(template) |
|
| 72 |
+ shouldPass(template) |
|
| 73 | 73 |
} |
| ... | ... |
@@ -78,6 +78,8 @@ func (p *TemplateProcessor) GetParameterByName(t *api.Template, name string) *ap |
| 78 | 78 |
// |
| 79 | 79 |
// Example of Parameter expression: |
| 80 | 80 |
// - ${PARAMETER_NAME}
|
| 81 |
+// |
|
| 82 |
+// TODO: Implement substitution for more types and fields. |
|
| 81 | 83 |
func (p *TemplateProcessor) SubstituteParameters(t *api.Template) error {
|
| 82 | 84 |
// Make searching for given parameter name/value more effective |
| 83 | 85 |
paramMap := make(map[string]string, len(t.Parameters)) |
| ... | ... |
@@ -94,7 +96,7 @@ func (p *TemplateProcessor) SubstituteParameters(t *api.Template) error {
|
| 94 | 94 |
p.substituteParametersInManifest(&obj.DesiredState.Manifest, paramMap) |
| 95 | 95 |
t.Items[i] = runtime.Object{Object: *obj}
|
| 96 | 96 |
default: |
| 97 |
- glog.V(1).Infof("Unable to process parameters for resource '%T'.", obj)
|
|
| 97 |
+ glog.V(1).Infof("Parameter substitution not implemented for resource '%T'.", obj)
|
|
| 98 | 98 |
} |
| 99 | 99 |
} |
| 100 | 100 |
|