Skip to content

Commit 72506cb

Browse files
committed
switch process to produce groupified openshift api resources
1 parent 5f7eae1 commit 72506cb

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

pkg/oc/cli/groupification.go renamed to pkg/api/legacygroupification/groupification.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cli
1+
package legacygroupification
22

33
import (
44
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"

pkg/oc/cli/cli.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"runtime"
88
"strings"
99

10+
"github.com/openshift/origin/pkg/api/legacygroupification"
1011
"github.com/spf13/cobra"
1112

1213
kubecmd "k8s.io/kubernetes/pkg/kubectl/cmd"
@@ -317,8 +318,8 @@ func CommandFor(basename string) *cobra.Command {
317318
cmd = kubecmd.NewKubectlCommand(kcmdutil.NewFactory(nil), in, out, errout)
318319
default:
319320
// we only need this change for `oc`. `kubectl` should behave as close to `kubectl` as we can
320-
resource.OAPIToGroupified = OAPIToGroupified
321-
kcmdutil.OAPIToGroupifiedGVK = OAPIToGroupifiedGVK
321+
resource.OAPIToGroupified = legacygroupification.OAPIToGroupified
322+
kcmdutil.OAPIToGroupifiedGVK = legacygroupification.OAPIToGroupifiedGVK
322323
cmd = NewCommandCLI("oc", "oc", in, out, errout)
323324
}
324325

pkg/template/template.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"regexp"
66
"strings"
77

8+
"github.com/openshift/origin/pkg/api/legacygroupification"
89
"k8s.io/apimachinery/pkg/api/meta"
910
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
1011
"k8s.io/apimachinery/pkg/runtime"
@@ -84,6 +85,10 @@ func (p *Processor) Process(template *templateapi.Template) field.ErrorList {
8485
// referenced namespace.
8586
stripNamespace(item)
8687

88+
gvk := item.GetObjectKind().GroupVersionKind()
89+
legacygroupification.OAPIToGroupifiedGVK(&gvk)
90+
item.GetObjectKind().SetGroupVersionKind(gvk)
91+
8792
newItem, err := p.SubstituteParameters(paramMap, item)
8893
if err != nil {
8994
templateErrors = append(templateErrors, field.Invalid(idxPath.Child("parameters"), template.Parameters, err.Error()))

test/templates/testdata/guestbook_list.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"message": "Your admin credentials are adminQ3H:dwNJiJwW",
1313
"objects": [
1414
{
15-
"apiVersion": "v1",
15+
"apiVersion": "route.openshift.io/v1",
1616
"kind": "Route",
1717
"metadata": {
1818
"creationTimestamp": null,

0 commit comments

Comments
 (0)