Skip to content

Commit d293916

Browse files
authored
App proxy ingress (#194)
* get all app-proxy env vars from cm * added CORS * set relevant cm values for app-proxy * move crb of app-proxy to a new resource * update to use app-proxy:v0.0.16
1 parent 4a35c3b commit d293916

File tree

10 files changed

+106
-67
lines changed

10 files changed

+106
-67
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.181
1+
VERSION=v0.0.182
22

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

cmd/commands/runtime.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,11 +358,11 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
358358

359359
log.G(ctx).WithField("version", rt.Spec.Version).Infof("Installing runtime '%s'", opts.RuntimeName)
360360
err = apcmd.RunRepoBootstrap(ctx, &apcmd.RepoBootstrapOptions{
361-
AppSpecifier: rt.Spec.FullSpecifier(),
361+
AppSpecifier: rt.Spec.FullSpecifier(),
362362
Namespace: opts.RuntimeName,
363363
KubeFactory: opts.KubeFactory,
364364
CloneOptions: opts.InsCloneOpts,
365-
Insecure: opts.Insecure,
365+
Insecure: opts.Insecure,
366366
KubeContextName: opts.kubeContext,
367367
ArgoCDLabels: map[string]string{
368368
store.Get().LabelKeyCFType: store.Get().CFComponentType,
@@ -1085,12 +1085,10 @@ func configureAppProxy(ctx context.Context, opts *RuntimeInstallOptions, rt *run
10851085
}
10861086

10871087
literalResources := []string{
1088-
fmt.Sprintf("cfHost=%s", cfConfig.GetCurrentContext().URL),
10891088
"argoWorkflowsInsecure=true",
1090-
}
1091-
1092-
if cfConfig.GetCurrentContext().IsProduction() {
1093-
literalResources = append(literalResources, "env=production")
1089+
fmt.Sprintf("cfHost=%s", cfConfig.GetCurrentContext().URL),
1090+
fmt.Sprintf("cors=%s", cfConfig.GetCurrentContext().URL),
1091+
"env=production",
10941092
}
10951093

10961094
// configure codefresh host
@@ -1110,7 +1108,7 @@ func configureAppProxy(ctx context.Context, opts *RuntimeInstallOptions, rt *run
11101108
Namespace: rt.Namespace,
11111109
Paths: []ingressutil.IngressPath{
11121110
{
1113-
Path: fmt.Sprintf("/%s/", store.Get().AppProxyIngressPath),
1111+
Path: fmt.Sprintf("/%s", store.Get().AppProxyIngressPath),
11141112
PathType: netv1.PathTypeImplementationSpecific,
11151113
ServiceName: store.Get().AppProxyServiceName,
11161114
ServicePort: store.Get().AppProxyServicePort,

docs/releases/release_notes.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
### Installed Applications:
22

3-
- Argo CD [v2.1.5](https://github.com/codefresh-io/argo-cd/releases/tag/v2.1.3)
4-
- Argo CD ApplicationSet Controller [v0.2.0](https://github.com/argoproj-labs/applicationset/releases/tag/v0.2.0)
5-
- Argo Events [v1.5.5](https://github.com/argoproj/argo-events/releases/tag/v1.4.0)
6-
- Argo Rollouts [v1.1.0](https://github.com/argoproj/argo-rollouts/releases/tag/v1.1.0)
7-
- Argo Workflows [v3.2.4](https://github.com/argoproj/argo-workflows/releases/tag/v3.1.8)
3+
- Argo CD [v2.1.5](https://github.com/codefresh-io/argo-cd/releases/tag/v2.1.3)
4+
- Argo CD ApplicationSet Controller [v0.2.0](https://github.com/argoproj-labs/applicationset/releases/tag/v0.2.0)
5+
- Argo Events [v1.5.5](https://github.com/argoproj/argo-events/releases/tag/v1.4.0)
6+
- Argo Rollouts [v1.1.0](https://github.com/argoproj/argo-rollouts/releases/tag/v1.1.0)
7+
- Argo Workflows [v3.2.4](https://github.com/argoproj/argo-workflows/releases/tag/v3.1.8)
88

99
### Using brew:
1010

@@ -23,7 +23,7 @@ cf version
2323

2424
```bash
2525
# download and extract the binary
26-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.181/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.182/cf-linux-amd64.tar.gz | tar zx
2727

2828
# move the binary to your $PATH
2929
mv ./cf-linux-amd64 /usr/local/bin/cf
@@ -36,7 +36,7 @@ cf version
3636

3737
```bash
3838
# download and extract the binary
39-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.181/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.182/cf-darwin-amd64.tar.gz | tar zx
4040

4141
# move the binary to your $PATH
4242
mv ./cf-darwin-amd64 /usr/local/bin/cf

manifests/app-proxy/app-proxy.cm.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@ apiVersion: v1
22
kind: ConfigMap
33
metadata:
44
name: cap-app-proxy-cm
5-
data:
6-
apiPrefix: "/app-proxy"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: cap-app-proxy-binding
5+
roleRef:
6+
apiGroup: rbac.authorization.k8s.io
7+
kind: ClusterRole
8+
name: argo-server-cluster-role
9+
subjects:
10+
- kind: ServiceAccount
11+
name: cap-app-proxy
12+
namespace: default

manifests/app-proxy/app-proxy.deploy.yaml

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,41 +17,87 @@ spec:
1717
serviceAccountName: cap-app-proxy
1818
containers:
1919
- env:
20-
- name: API_PATH_PREFIX
20+
- name: ARGO_WORKFLOWS_INSECURE
21+
valueFrom:
22+
configMapKeyRef:
23+
name: cap-app-proxy-cm
24+
key: argoWorkflowsInsecure
25+
optional: true
26+
- name: ARGO_WORKFLOWS_URL
2127
valueFrom:
2228
configMapKeyRef:
2329
name: cap-app-proxy-cm
24-
key: apiPrefix
30+
key: argoWorkflowsUrl
2531
optional: true
2632
- name: CF_HOST
2733
valueFrom:
2834
configMapKeyRef:
2935
name: cap-app-proxy-cm
3036
key: cfHost
3137
optional: true
38+
- name: CORS
39+
valueFrom:
40+
configMapKeyRef:
41+
name: cap-app-proxy-cm
42+
key: cors
43+
optional: true
3244
- name: ENV
3345
valueFrom:
3446
configMapKeyRef:
3547
name: cap-app-proxy-cm
3648
key: env
3749
optional: true
38-
- name: ARGO_WORKFLOWS_INSECURE
50+
- name: GRAPHQL_DEBUG
3951
valueFrom:
4052
configMapKeyRef:
4153
name: cap-app-proxy-cm
42-
key: argoWorkflowsInsecure
54+
key: graphqlDebug
4355
optional: true
44-
- name: RUNTIME_TOKEN
56+
- name: GRAPHQL_PLAYGROUND
4557
valueFrom:
46-
secretKeyRef:
47-
name: codefresh-token
48-
key: token
58+
configMapKeyRef:
59+
name: cap-app-proxy-cm
60+
key: graphqlPlayground
61+
optional: true
4962
- name: NAMESPACE
5063
valueFrom:
5164
fieldRef:
5265
fieldPath: metadata.namespace
5366
- name: PORT
54-
value: "80"
67+
valueFrom:
68+
configMapKeyRef:
69+
name: cap-app-proxy-cm
70+
key: port
71+
optional: true
72+
- name: REPOS_DIR
73+
valueFrom:
74+
configMapKeyRef:
75+
name: cap-app-proxy-cm
76+
key: reposDir
77+
optional: true
78+
- name: RUNTIME_NAME
79+
valueFrom:
80+
configMapKeyRef:
81+
name: cap-app-proxy-cm
82+
key: runtimeName
83+
optional: true
84+
- name: RUNTIME_TOKEN
85+
valueFrom:
86+
secretKeyRef:
87+
name: codefresh-token
88+
key: token
89+
- name: STORE_BACKEND
90+
valueFrom:
91+
configMapKeyRef:
92+
name: cap-app-proxy-cm
93+
key: storeBackend
94+
optional: true
95+
- name: STRIP_PREFIX
96+
valueFrom:
97+
configMapKeyRef:
98+
name: cap-app-proxy-cm
99+
key: stripPrefix
100+
optional: true
55101
image: quay.io/codefresh/cap-app-proxy
56102
imagePullPolicy: Always
57103
name: cap-app-proxy

manifests/app-proxy/kustomization.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ kind: Kustomization
33
images:
44
- name: quay.io/codefresh/cap-app-proxy
55
newName: quay.io/codefresh/cap-app-proxy
6-
newTag: v0.0.14
6+
newTag: v0.0.16
77
resources:
88
- app-proxy.deploy.yaml
99
- app-proxy.svc.yaml
1010
- app-proxy.sa.yaml
1111
- app-proxy.rb.yaml
12+
- app-proxy.crb.yaml
1213
- app-proxy.role.yaml
1314
- app-proxy.cm.yaml

manifests/argo-workflows/kustomization.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@ patches:
1313
- op: replace
1414
path: /subjects/0/namespace
1515
value: default
16-
# add to the app-proxy service account the required permissions
17-
# to manipulate workflows
18-
- target:
19-
group: rbac.authorization.k8s.io
20-
version: v1
21-
kind: ClusterRoleBinding
22-
name: argo-server-binding
23-
patch: |-
24-
- op: add
25-
path: /subjects/1
26-
value: { "kind": "ServiceAccount", "name": "cap-app-proxy", "namespace": "default" }
2716
2817
- target:
2918
group: apps

manifests/runtime.yaml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
apiVersion: codefresh.io/v1alpha1
22
kind: Runtime
33
metadata:
4-
name: "{{ name }}"
5-
namespace: "{{ namespace }}"
4+
name: '{{ name }}'
5+
namespace: '{{ namespace }}'
66
spec:
7-
defVersion: 1.0.0
8-
version: 0.0.181
9-
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
10-
components:
11-
- name: events
12-
type: kustomize
13-
url: github.com/codefresh-io/cli-v2/manifests/argo-events
14-
wait: true
15-
- name: rollouts
16-
type: kustomize
17-
url: github.com/codefresh-io/cli-v2/manifests/argo-rollouts
18-
- name: workflows
19-
type: kustomize
20-
url: github.com/codefresh-io/cli-v2/manifests/argo-workflows
21-
- name: argocd-agent
22-
type: kustomize
23-
url: github.com/codefresh-io/cli-v2/manifests/argo-agent
24-
- name: app-proxy
25-
type: kustomize
26-
url: github.com/codefresh-io/cli-v2/manifests/app-proxy
7+
defVersion: 1.0.0
8+
version: 0.0.182
9+
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
10+
components:
11+
- name: events
12+
type: kustomize
13+
url: github.com/codefresh-io/cli-v2/manifests/argo-events
14+
wait: true
15+
- name: rollouts
16+
type: kustomize
17+
url: github.com/codefresh-io/cli-v2/manifests/argo-rollouts
18+
- name: workflows
19+
type: kustomize
20+
url: github.com/codefresh-io/cli-v2/manifests/argo-workflows
21+
- name: argocd-agent
22+
type: kustomize
23+
url: github.com/codefresh-io/cli-v2/manifests/argo-agent
24+
- name: app-proxy
25+
type: kustomize
26+
url: github.com/codefresh-io/cli-v2/manifests/app-proxy

pkg/config/config.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import (
4949
"github.com/spf13/viper"
5050

5151
"github.com/codefresh-io/cli-v2/pkg/log"
52-
"github.com/codefresh-io/cli-v2/pkg/store"
5352
"github.com/codefresh-io/cli-v2/pkg/util"
5453
"github.com/codefresh-io/go-sdk/pkg/codefresh"
5554
)
@@ -95,10 +94,6 @@ type AuthContext struct {
9594
DefaultRuntime string `mapstructure:"defaultRuntime" json:"defaultRuntime"`
9695
}
9796

98-
func (ac *AuthContext) IsProduction() bool {
99-
return ac.URL == store.Get().DefaultAPI
100-
}
101-
10297
func AddFlags(f *pflag.FlagSet) *Config {
10398
conf := &Config{path: defaultPath}
10499

@@ -243,7 +238,7 @@ func (c *Config) clientForContext(ctx *AuthContext) codefresh.Codefresh {
243238
}
244239

245240
return newCodefresh(&codefresh.ClientOptions{
246-
Host: ctx.URL,
241+
Host: ctx.URL,
247242
Auth: codefresh.AuthOptions{
248243
Token: ctx.Token,
249244
},

0 commit comments

Comments
 (0)