@@ -180,8 +180,8 @@ func NewRuntimeInstallCommand() *cobra.Command {
180180 }
181181
182182 finalParameters = map [string ]string {
183- "Runtime name" : runtimeName ,
184- "Repository URL" : insCloneOpts .Repo ,
183+ "Runtime name" : runtimeName ,
184+ "Repository URL" : insCloneOpts .Repo ,
185185 "Installing sample resources" : strconv .FormatBool (sampleInstall ),
186186 }
187187
@@ -420,6 +420,10 @@ func installComponents(ctx context.Context, opts *RuntimeInstallOptions, rt *run
420420 }
421421 }
422422
423+ if err = configureAppProxy (ctx , opts , rt ); err != nil {
424+ return fmt .Errorf ("failed to patch App-Proxy ingress: %w" , err )
425+ }
426+
423427 if err = createCodefreshArgoAgentReporter (ctx , opts .InsCloneOpts , opts , rt ); err != nil {
424428 return fmt .Errorf ("failed to create argocd-agent-reporter: %w" , err )
425429 }
@@ -925,7 +929,7 @@ func createWorkflowsIngress(ctx context.Context, cloneOpts *git.CloneOptions, rt
925929
926930 overlaysDir := fs .Join (apstore .Default .AppsDir , "workflows" , apstore .Default .OverlaysDir , rt .Name )
927931 ingress := ingressutil .CreateIngress (& ingressutil.CreateIngressOptions {
928- Name : rt .Name + store .Get ().IngressName ,
932+ Name : rt .Name + store .Get ().WorkflowsIngressName ,
929933 Namespace : rt .Namespace ,
930934 Annotations : map [string ]string {
931935 "kubernetes.io/ingress.class" : "nginx" ,
@@ -934,7 +938,7 @@ func createWorkflowsIngress(ctx context.Context, cloneOpts *git.CloneOptions, rt
934938 },
935939 Paths : []ingressutil.IngressPath {
936940 {
937- Path : fmt .Sprintf ("/%s(/|$)(.*)" , store .Get ().IngressPath ),
941+ Path : fmt .Sprintf ("/%s(/|$)(.*)" , store .Get ().WorkflowsIngressPath ),
938942 PathType : netv1 .PathTypePrefix ,
939943 ServiceName : store .Get ().ArgoWFServiceName ,
940944 ServicePort : store .Get ().ArgoWFServicePort ,
@@ -945,7 +949,7 @@ func createWorkflowsIngress(ctx context.Context, cloneOpts *git.CloneOptions, rt
945949 return err
946950 }
947951
948- if err = billyUtils .WriteFile (fs , fs .Join (overlaysDir , "ingress-patch.json" ), ingressPatch , 0666 ); err != nil {
952+ if err = billyUtils .WriteFile (fs , fs .Join (overlaysDir , "ingress-patch.json" ), workflowsIngressPatch , 0666 ); err != nil {
949953 return err
950954 }
951955
@@ -977,6 +981,64 @@ func createWorkflowsIngress(ctx context.Context, cloneOpts *git.CloneOptions, rt
977981 return apu .PushWithMessage (ctx , r , "Created Workflows Ingress" )
978982}
979983
984+ func configureAppProxy (ctx context.Context , opts * RuntimeInstallOptions , rt * runtime.Runtime ) error {
985+ r , fs , err := opts .InsCloneOpts .GetRepo (ctx )
986+ if err != nil {
987+ return err
988+ }
989+
990+ overlaysDir := fs .Join (apstore .Default .AppsDir , "app-proxy" , apstore .Default .OverlaysDir , rt .Name )
991+
992+ kust , err := kustutil .ReadKustomization (fs , overlaysDir )
993+ if err != nil {
994+ return err
995+ }
996+
997+ // configure codefresh host
998+ kust .ConfigMapGenerator = append (kust .ConfigMapGenerator , kusttypes.ConfigMapArgs {
999+ GeneratorArgs : kusttypes.GeneratorArgs {
1000+ Name : store .Get ().AppProxyServiceName + "-cm" ,
1001+ Behavior : "merge" ,
1002+ KvPairSources : kusttypes.KvPairSources {
1003+ LiteralSources : []string {fmt .Sprintf ("cfHost=%s" , cfConfig .GetCurrentContext ().URL )},
1004+ },
1005+ },
1006+ })
1007+
1008+ if opts .IngressHost != "" {
1009+ ingress := ingressutil .CreateIngress (& ingressutil.CreateIngressOptions {
1010+ Name : rt .Name + store .Get ().AppProxyIngressName ,
1011+ Namespace : rt .Namespace ,
1012+ Annotations : map [string ]string {
1013+ "kubernetes.io/ingress.class" : "nginx" ,
1014+ "nginx.ingress.kubernetes.io/rewrite-target" : "/$2" ,
1015+ "nginx.ingress.kubernetes.io/backend-protocol" : "http" ,
1016+ },
1017+ Paths : []ingressutil.IngressPath {
1018+ {
1019+ Path : fmt .Sprintf ("/%s(/|$)(.*)" , store .Get ().AppProxyIngressPath ),
1020+ PathType : netv1 .PathTypePrefix ,
1021+ ServiceName : store .Get ().AppProxyServiceName ,
1022+ ServicePort : store .Get ().AppProxyServicePort ,
1023+ },
1024+ },
1025+ })
1026+ if err = fs .WriteYamls (fs .Join (overlaysDir , "ingress.yaml" ), ingress ); err != nil {
1027+ return err
1028+ }
1029+
1030+ kust .Resources = append (kust .Resources , "ingress.yaml" )
1031+ }
1032+
1033+ if err = kustutil .WriteKustomization (fs , kust , overlaysDir ); err != nil {
1034+ return err
1035+ }
1036+
1037+ log .G (ctx ).Info ("Pushing App-Proxy ingress manifests" )
1038+
1039+ return apu .PushWithMessage (ctx , r , "Created App-Proxy Ingress" )
1040+ }
1041+
9801042func createEventsReporter (ctx context.Context , cloneOpts * git.CloneOptions , opts * RuntimeInstallOptions , rt * runtime.Runtime ) error {
9811043 runtimeTokenSecret , err := getRuntimeTokenSecret (opts .RuntimeName , opts .RuntimeToken )
9821044 if err != nil {
0 commit comments