@@ -180,8 +180,8 @@ func NewRuntimeInstallCommand() *cobra.Command {
180
180
}
181
181
182
182
finalParameters = map [string ]string {
183
- "Runtime name" : runtimeName ,
184
- "Repository URL" : insCloneOpts .Repo ,
183
+ "Runtime name" : runtimeName ,
184
+ "Repository URL" : insCloneOpts .Repo ,
185
185
"Installing sample resources" : strconv .FormatBool (sampleInstall ),
186
186
}
187
187
@@ -420,6 +420,10 @@ func installComponents(ctx context.Context, opts *RuntimeInstallOptions, rt *run
420
420
}
421
421
}
422
422
423
+ if err = configureAppProxy (ctx , opts , rt ); err != nil {
424
+ return fmt .Errorf ("failed to patch App-Proxy ingress: %w" , err )
425
+ }
426
+
423
427
if err = createCodefreshArgoAgentReporter (ctx , opts .InsCloneOpts , opts , rt ); err != nil {
424
428
return fmt .Errorf ("failed to create argocd-agent-reporter: %w" , err )
425
429
}
@@ -925,7 +929,7 @@ func createWorkflowsIngress(ctx context.Context, cloneOpts *git.CloneOptions, rt
925
929
926
930
overlaysDir := fs .Join (apstore .Default .AppsDir , "workflows" , apstore .Default .OverlaysDir , rt .Name )
927
931
ingress := ingressutil .CreateIngress (& ingressutil.CreateIngressOptions {
928
- Name : rt .Name + store .Get ().IngressName ,
932
+ Name : rt .Name + store .Get ().WorkflowsIngressName ,
929
933
Namespace : rt .Namespace ,
930
934
Annotations : map [string ]string {
931
935
"kubernetes.io/ingress.class" : "nginx" ,
@@ -934,7 +938,7 @@ func createWorkflowsIngress(ctx context.Context, cloneOpts *git.CloneOptions, rt
934
938
},
935
939
Paths : []ingressutil.IngressPath {
936
940
{
937
- Path : fmt .Sprintf ("/%s(/|$)(.*)" , store .Get ().IngressPath ),
941
+ Path : fmt .Sprintf ("/%s(/|$)(.*)" , store .Get ().WorkflowsIngressPath ),
938
942
PathType : netv1 .PathTypePrefix ,
939
943
ServiceName : store .Get ().ArgoWFServiceName ,
940
944
ServicePort : store .Get ().ArgoWFServicePort ,
@@ -945,7 +949,7 @@ func createWorkflowsIngress(ctx context.Context, cloneOpts *git.CloneOptions, rt
945
949
return err
946
950
}
947
951
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 {
949
953
return err
950
954
}
951
955
@@ -977,6 +981,64 @@ func createWorkflowsIngress(ctx context.Context, cloneOpts *git.CloneOptions, rt
977
981
return apu .PushWithMessage (ctx , r , "Created Workflows Ingress" )
978
982
}
979
983
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
+
980
1042
func createEventsReporter (ctx context.Context , cloneOpts * git.CloneOptions , opts * RuntimeInstallOptions , rt * runtime.Runtime ) error {
981
1043
runtimeTokenSecret , err := getRuntimeTokenSecret (opts .RuntimeName , opts .RuntimeToken )
982
1044
if err != nil {
0 commit comments