Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support generating DeploymentConfigs from run
Define "run/v1" as DeploymentConfig, and "run-controller/v1" as the upstream.
- Loading branch information
1 parent
f16467f
commit 91fe6d4
Showing
5 changed files
with
59 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package generator | ||
|
||
import ( | ||
"fmt" | ||
"reflect" | ||
|
||
kapi "k8s.io/kubernetes/pkg/api" | ||
"k8s.io/kubernetes/pkg/kubectl" | ||
"k8s.io/kubernetes/pkg/runtime" | ||
|
||
deployapi "github.com/openshift/origin/pkg/deploy/api" | ||
) | ||
|
||
var basic = kubectl.BasicReplicationController{} | ||
|
||
type BasicDeploymentConfigController struct{} | ||
|
||
func (BasicDeploymentConfigController) ParamNames() []kubectl.GeneratorParam { | ||
return basic.ParamNames() | ||
} | ||
|
||
func (BasicDeploymentConfigController) Generate(genericParams map[string]string) (runtime.Object, error) { | ||
obj, err := basic.Generate(genericParams) | ||
if err != nil { | ||
return nil, err | ||
} | ||
switch t := obj.(type) { | ||
case *kapi.ReplicationController: | ||
obj = &deployapi.DeploymentConfig{ | ||
ObjectMeta: t.ObjectMeta, | ||
Template: deployapi.DeploymentTemplate{ | ||
ControllerTemplate: t.Spec, | ||
}, | ||
} | ||
default: | ||
return nil, fmt.Errorf("unrecognized object type: %v", reflect.TypeOf(t)) | ||
} | ||
return obj, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters