Skip to content

Commit 4108d22

Browse files
committedAug 31, 2020
Make Devfile the default deployment mechanism for odo
**What type of PR is this?** > Uncomment only one ` /kind` line, and delete the rest. > For example, `> /kind bug` would simply become: `/kind bug` /kind feature **What does does this PR do / why we need it**: Makes Devfile the default deployment mechanism, removing S2I in favour of Devfile deployment. **Which issue(s) this PR fixes**: Closes redhat-developer#3550 **How to test changes / Special notes to the reviewer**: Run: ```sh odo preference set experimental false odo create --starter nodejs odo push ```
1 parent bd770a0 commit 4108d22

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+791
-867
lines changed
 

Diff for: ‎pkg/component/component.go

+11-12
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
parsercommon "github.com/openshift/odo/pkg/devfile/parser/data/common"
2626
"github.com/openshift/odo/pkg/log"
2727
"github.com/openshift/odo/pkg/occlient"
28-
"github.com/openshift/odo/pkg/odo/util/experimental"
2928
"github.com/openshift/odo/pkg/odo/util/validation"
3029
"github.com/openshift/odo/pkg/preference"
3130
"github.com/openshift/odo/pkg/storage"
@@ -565,10 +564,10 @@ func ensureAndLogProperResourceUsage(resourceMin, resourceMax *string, resourceN
565564
// envSpecificInfo: Component environment specific information, available if uses devfile
566565
// cmpExist: true if components exists in the cluster
567566
// endpointMap: value is devfile endpoint entry, key is the TargetPort for each enpoint entry
567+
// isS2I: Legacy option. Set as true if you want to use the old S2I method as it differentiates slightly.
568568
// Returns:
569569
// err: Errors if any else nil
570-
func ApplyConfig(client *occlient.Client, kClient *kclient.Client, componentConfig config.LocalConfigInfo, envSpecificInfo envinfo.EnvSpecificInfo, stdout io.Writer, cmpExist bool, endpointMap map[int32]parsercommon.Endpoint) (err error) {
571-
isExperimentalModeEnabled := experimental.IsExperimentalModeEnabled()
570+
func ApplyConfig(client *occlient.Client, kClient *kclient.Client, componentConfig config.LocalConfigInfo, envSpecificInfo envinfo.EnvSpecificInfo, stdout io.Writer, cmpExist bool, endpointMap map[int32]parsercommon.Endpoint, isS2I bool) (err error) {
572571

573572
if client == nil {
574573
var err error
@@ -580,7 +579,7 @@ func ApplyConfig(client *occlient.Client, kClient *kclient.Client, componentConf
580579
client.Namespace = kClient.Namespace
581580
}
582581

583-
if !isExperimentalModeEnabled {
582+
if isS2I {
584583
// if component exist then only call the update function
585584
if cmpExist {
586585
if err = Update(client, componentConfig, componentConfig.GetSourceLocation(), stdout); err != nil {
@@ -591,7 +590,7 @@ func ApplyConfig(client *occlient.Client, kClient *kclient.Client, componentConf
591590

592591
var componentName string
593592
var applicationName string
594-
if !isExperimentalModeEnabled || kClient == nil {
593+
if isS2I || kClient == nil {
595594
componentName = componentConfig.GetName()
596595
applicationName = componentConfig.GetApplication()
597596
} else {
@@ -605,13 +604,13 @@ func ApplyConfig(client *occlient.Client, kClient *kclient.Client, componentConf
605604
}
606605

607606
return urlpkg.Push(client, kClient, urlpkg.PushParameters{
608-
ComponentName: componentName,
609-
ApplicationName: applicationName,
610-
ConfigURLs: componentConfig.GetURL(),
611-
EnvURLS: envSpecificInfo.GetURL(),
612-
IsRouteSupported: isRouteSupported,
613-
IsExperimentalModeEnabled: isExperimentalModeEnabled,
614-
EndpointMap: endpointMap,
607+
ComponentName: componentName,
608+
ApplicationName: applicationName,
609+
ConfigURLs: componentConfig.GetURL(),
610+
EnvURLS: envSpecificInfo.GetURL(),
611+
IsRouteSupported: isRouteSupported,
612+
EndpointMap: endpointMap,
613+
IsS2I: isS2I,
615614
})
616615
}
617616

Diff for: ‎pkg/component/component_full_description.go

+12-13
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"github.com/openshift/odo/pkg/config"
99
"github.com/openshift/odo/pkg/log"
1010
"github.com/openshift/odo/pkg/occlient"
11-
"github.com/openshift/odo/pkg/odo/util/experimental"
1211
"github.com/openshift/odo/pkg/storage"
1312
urlpkg "github.com/openshift/odo/pkg/url"
1413
corev1 "k8s.io/api/core/v1"
@@ -192,22 +191,22 @@ func (cfd *ComponentFullDescription) Print(client *occlient.Client) error {
192191
if len(cfd.Spec.URL.Items) > 0 {
193192
var output string
194193

195-
if !experimental.IsExperimentalModeEnabled() {
196-
// if the component is not pushed
197-
for i, componentURL := range cfd.Spec.URL.Items {
198-
if componentURL.Status.State == urlpkg.StateTypePushed {
199-
output += fmt.Sprintf(" · %v exposed via %v\n", urlpkg.GetURLString(componentURL.Spec.Protocol, componentURL.Spec.Host, "", experimental.IsExperimentalModeEnabled()), componentURL.Spec.Port)
194+
// For S2I Only..
195+
// This MUST be changed before merging (this will automatically show URL routes for S2I despite Devfile being default)
196+
for i, componentURL := range cfd.Spec.URL.Items {
197+
if componentURL.Status.State == urlpkg.StateTypePushed {
198+
output += fmt.Sprintf(" · %v exposed via %v\n", urlpkg.GetURLString(componentURL.Spec.Protocol, componentURL.Spec.Host, "", true), componentURL.Spec.Port)
199+
} else {
200+
var p string
201+
if i >= len(cfd.Spec.Ports) {
202+
p = cfd.Spec.Ports[len(cfd.Spec.Ports)-1]
200203
} else {
201-
var p string
202-
if i >= len(cfd.Spec.Ports) {
203-
p = cfd.Spec.Ports[len(cfd.Spec.Ports)-1]
204-
} else {
205-
p = cfd.Spec.Ports[i]
206-
}
207-
output += fmt.Sprintf(" · URL named %s will be exposed via %v\n", componentURL.Name, p)
204+
p = cfd.Spec.Ports[i]
208205
}
206+
output += fmt.Sprintf(" · URL named %s will be exposed via %v\n", componentURL.Name, p)
209207
}
210208
}
209+
211210
// Cut off the last newline and output
212211
if len(output) > 0 {
213212
output = output[:len(output)-1]

0 commit comments

Comments
 (0)