Skip to content

Commit 869f4fb

Browse files
Revert gateway api (#547)
* Revert "fix typo (#546)" This reverts commit f449243. * Revert "Cr 14274 - Fix ingress class assignment (#545)" This reverts commit d9f0fe9. * Revert "Skip ingresshost check for gateway (#544)" This reverts commit 2f42186. * Revert "Kubernetes Gateway API Support (#540)" This reverts commit 4057ce0. * bump
1 parent f449243 commit 869f4fb

File tree

14 files changed

+490
-893
lines changed

14 files changed

+490
-893
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=v0.0.491
1+
VERSION=v0.0.492
22

33
OUT_DIR=dist
44
YEAR?=$(shell date +"%Y")

cmd/commands/common.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,27 @@ func getValueFromUserInput(label, defaultValue string, validate promptui.Validat
260260
return prompt.Run()
261261
}
262262

263+
func getIngressClassFromUserSelect(ingressClassNames []string) (string, error) {
264+
templates := &promptui.SelectTemplates{
265+
Selected: "{{ . | yellow }} ",
266+
}
267+
268+
labelStr := fmt.Sprintf("%vSelect ingressClass%v", CYAN, COLOR_RESET)
269+
270+
prompt := promptui.Select{
271+
Label: labelStr,
272+
Items: ingressClassNames,
273+
Templates: templates,
274+
}
275+
276+
_, result, err := prompt.Run()
277+
if err != nil {
278+
return "", err
279+
}
280+
281+
return result, nil
282+
}
283+
263284
// ensureGitRuntimeToken gets the runtime token from the user (if !silent), and verifys it with he provider (if available)
264285
func ensureGitRuntimeToken(cmd *cobra.Command, gitProvider cfgit.Provider, cloneOpts *apgit.CloneOptions) error {
265286
ctx := cmd.Context()

cmd/commands/git-source.go

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"github.com/codefresh-io/cli-v2/pkg/util"
2929
apu "github.com/codefresh-io/cli-v2/pkg/util/aputil"
3030
eventsutil "github.com/codefresh-io/cli-v2/pkg/util/events"
31-
routingutil "github.com/codefresh-io/cli-v2/pkg/util/routing"
31+
ingressutil "github.com/codefresh-io/cli-v2/pkg/util/ingress"
3232
wfutil "github.com/codefresh-io/cli-v2/pkg/util/workflow"
3333

3434
"github.com/Masterminds/semver/v3"
@@ -50,6 +50,7 @@ import (
5050
"github.com/juju/ansiterm"
5151
"github.com/spf13/cobra"
5252
corev1 "k8s.io/api/core/v1"
53+
netv1 "k8s.io/api/networking/v1"
5354
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5455
"k8s.io/apimachinery/pkg/util/intstr"
5556
)
@@ -66,12 +67,9 @@ type (
6667
HostName string
6768
IngressHost string
6869
IngressClass string
69-
IngressController routingutil.RoutingController
70-
GatewayName string
71-
GatewayNamespace string
70+
IngressController ingressutil.IngressController
7271
Flow string
7372
GitProvider cfgit.Provider
74-
useGatewayAPI bool
7573
}
7674

7775
GitSourceDeleteOptions struct {
@@ -104,10 +102,7 @@ type (
104102
hostName string
105103
ingressHost string
106104
ingressClass string
107-
ingressController routingutil.RoutingController
108-
gatewayName string
109-
gatewayNamespace string
110-
useGatewayAPI bool
105+
ingressController ingressutil.IngressController
111106
}
112107

113108
dirConfig struct {
@@ -616,9 +611,6 @@ func createDemoResources(ctx context.Context, opts *GitSourceCreateOptions, gsRe
616611
ingressHost: opts.IngressHost,
617612
ingressClass: opts.IngressClass,
618613
ingressController: opts.IngressController,
619-
gatewayName: opts.GatewayName,
620-
gatewayNamespace: opts.GatewayNamespace,
621-
useGatewayAPI: opts.useGatewayAPI,
622614
})
623615
if err != nil {
624616
return fmt.Errorf("failed to create github example pipeline. Error: %w", err)
@@ -754,17 +746,9 @@ func createDemoCalendarTrigger() sensorsv1alpha1.Trigger {
754746
func createDemoGitPipeline(opts *gitSourceGitDemoPipelineOptions) error {
755747
if !store.Get().SkipIngress {
756748
// Create an ingress that will manage external access to the git eventsource service
757-
routeOpts := routingutil.CreateRouteOpts{
758-
RuntimeName: opts.runtimeName,
759-
IngressClass: opts.ingressClass,
760-
Hostname: opts.hostName,
761-
IngressController: opts.ingressController,
762-
GatewayName: opts.gatewayName,
763-
GatewayNamespace: opts.gatewayNamespace,
764-
}
765-
routeName, route := routingutil.CreateDemoPipelinesRoute(&routeOpts, opts.useGatewayAPI)
766-
routeFilePath := fmt.Sprintf("%s.%s.yaml", store.Get().DemoPipelinesIngressObjectName, routeName)
767-
if err := writeObjectToYaml(opts.gsFs, routeFilePath, &route, cleanUpFieldsIngress); err != nil {
749+
ingress := createDemoPipelinesIngress(opts.ingressClass, opts.hostName, opts.ingressController, opts.runtimeName)
750+
ingressFilePath := store.Get().DemoPipelinesIngressFileName
751+
if err := writeObjectToYaml(opts.gsFs, ingressFilePath, &ingress, cleanUpFieldsIngress); err != nil {
768752
return fmt.Errorf("failed to write yaml of demo pipeline ingress. Error: %w", err)
769753
}
770754
}
@@ -839,6 +823,26 @@ func createDemoBitbucketServerPipeline(opts *gitSourceGitDemoPipelineOptions) er
839823
return nil
840824
}
841825

826+
func createDemoPipelinesIngress(ingressClass string, hostName string, ingressController ingressutil.IngressController, runtimeName string) *netv1.Ingress {
827+
ingressOptions := ingressutil.CreateIngressOptions{
828+
Name: store.Get().DemoPipelinesIngressObjectName,
829+
IngressClassName: ingressClass,
830+
Host: hostName,
831+
Paths: []ingressutil.IngressPath{
832+
{
833+
Path: util.GenerateIngressPathForDemoGitEventSource(runtimeName),
834+
ServiceName: store.Get().DemoGitEventSourceObjectName + "-eventsource-svc",
835+
ServicePort: store.Get().DemoGitEventSourceServicePort,
836+
PathType: netv1.PathTypePrefix,
837+
},
838+
}}
839+
840+
ingress := ingressutil.CreateIngress(&ingressOptions)
841+
ingressController.Decorate(ingress)
842+
843+
return ingress
844+
}
845+
842846
func createDemoGithubEventSource(repoURL string, ingressHost string, runtimeName string, gitProvider cfgit.Provider) *eventsourcev1alpha1.EventSource {
843847
name := store.Get().DemoGitEventSourceObjectName
844848
es := createDemoEventSource(name)
@@ -1252,8 +1256,8 @@ func getBitbucketServerRepoFromGitURL(url string) eventsourcev1alpha1.BitbucketS
12521256
}
12531257
}
12541258

1255-
func cleanUpFieldsIngress(resource *interface{}) (map[string]interface{}, error) {
1256-
crd, err := util.StructToMap(resource)
1259+
func cleanUpFieldsIngress(ingress **netv1.Ingress) (map[string]interface{}, error) {
1260+
crd, err := util.StructToMap(ingress)
12571261
if err != nil {
12581262
return nil, err
12591263
}

0 commit comments

Comments
 (0)