Make the generate experiment configuration file optional
@@ -83,7 +83,9 @@ func (o *ExperimentOptions) generate() error {
}
// Start the experiment template
- exp := o.newExperiment()
+ exp := &redskyv1beta1.Experiment{}
+ // TODO Do we want to filter out any of this information?
+ o.ExperimentConfig.ObjectMeta.DeepCopyInto(&exp.ObjectMeta)
// Scan the resources and add the results into the experiment object
s := &experiment.Scanner{
@@ -106,6 +108,7 @@ func (o *ExperimentOptions) generate() error {
func (o *ExperimentOptions) readConfig() error {
// Read the configuration file
+ if o.Filename != "" {
b, err := ioutil.ReadFile(o.Filename)
if err != nil {
return err
@@ -119,6 +122,7 @@ func (o *ExperimentOptions) readConfig() error {
if o.ExperimentConfig.GroupVersionKind() != gvk {
return fmt.Errorf("incorrect input type: %s", o.ExperimentConfig.GroupVersionKind().String())
}
+ }
scheme, err := experiment.SchemeBuilder.Build()
if err != nil {
@@ -133,12 +137,3 @@ func (o *ExperimentOptions) readConfig() error {
return nil
}
-
-func (o *ExperimentOptions) newExperiment() *redskyv1beta1.Experiment {
- exp := &redskyv1beta1.Experiment{}
-
- // TODO Do we want to filter out any of this information?
- o.ExperimentConfig.ObjectMeta.DeepCopyInto(&exp.ObjectMeta)
-
- return exp
-}
