Skip to content
This repository was archived by the owner on Mar 10, 2023. It is now read-only.

Commit e3cc266

Browse files
Waterdripsalexellis
authored andcommitted
Remove of-client-secret as env var from edge-auth
Edge-auth now only uses the mounted secret to read the of-client-secret for Oauth2. This is to reduce complexity in the chart and deployments. Signed-off-by: Alistair Hey <[email protected]>
1 parent 52a081a commit e3cc266

File tree

8 files changed

+5
-18
lines changed

8 files changed

+5
-18
lines changed

chart/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ to install OpenFaaS Cloud clusters.
77

88
This is mainly for configuration documentation for developers wishing to use this chart in `ofc-bootstrap`.
99

10-
1110
## Configuration
1211

1312
| Parameter | Description | Default|
@@ -20,10 +19,9 @@ This is mainly for configuration documentation for developers wishing to use thi
2019
| `edgeAuth.replicas` | `Number of replicas of edge-auth to run` | `1` |
2120
| `edgeAuth.enableOauth2` | `If OAuth2 is enabled in the installation` | `true` |
2221
| `edgeAuth.oauthProvider` | `The OAuth provider, github or gitlab` | `github` |
23-
| `edgeAuth.oauthProviderBaseURL` | `The OAuth2 base URL, required if using gitlab as OAuth2 provider` | `` |
22+
| `edgeAuth.oauthProviderBaseURL` | `The OAuth2 base URL, required if using gitlab as OAuth2 provider` | `""` |
2423
| `edgeAuth.clientId` | `The client ID provided by your OAuth provider` | `""` |
2524
| `edgeAuth.writeDebug` | `If Debug logging is enabled in edge-auth` | `false` |
26-
| `edgeAuth.clientSecret` | `The client secret provided by your OAuth2 provider` | `""` |
2725
| `edgeRouter.image` | `The container image for the OpenFaaS Cloud edge-router` | `openfaas/edge-router:0.7.4` |
2826
| `tls.enabled` | `If we are using TLS, certificated provided by LEtsEncrypt` | `true` |
2927
| `tls.email` | `The email for the LetsEncrypt TLS certificates. Required if TLS is enabled` | `[email protected]` |
@@ -36,7 +34,6 @@ This is mainly for configuration documentation for developers wishing to use thi
3634
| `tls.clouddns.projectID` | `If using Clouddns set this to your project ID` | `` |
3735
| `ingress.class` | `The ingress class used for ingress. Set to traefik if using traefik for ingress for example` | `nginx` |
3836
| `ingress.maxConnections` | `The max connections allowed for OpenFaaS Cloud Functions` | `` |
39-
| `ingress.requestsPerMinute` | `The max number of connections for ingress when using nginx for ingress class` | `20` |
4037
| `ingesss.requestsPerMinute` | `The max requests per minute when using nginx for the inress class` | `600` |
4138
| `customers.url` | `The public URL to a customers file, it should be unformatted with 1 username per line` | `""` |
4239
| `customers.customersSecret` | `If set to ture we use a secret for our customers list rather than a public URL` | `false` |

chart/openfaas-cloud/templates/ofc-core/edge-auth-dep.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ spec:
7070
- name: customers_path
7171
value: "/var/secrets/of-customers/of-customers"
7272
{{- end }}
73-
- name: client_secret
74-
value: {{ required "A valid .Values.edgeAuth.clientSecret entry required!" .Values.edgeAuth.clientSecret | quote }}
7573
- name: client_id
7674
value: {{ required "A valid .Values.edgeAuth.clientId entry required!" .Values.edgeAuth.clientId | quote }}
7775
- name: oauth_provider_base_url

chart/openfaas-cloud/values.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ edgeAuth:
2020
## clientId is generated by your Oauth App, and needs to be set to connect correctly
2121
clientId: ""
2222
writeDebug: false
23-
## clientSecret is the value from your OAuth application
24-
clientSecret: ""
2523

2624
edgeRouter:
2725
image: openfaas/edge-router:0.7.4

chart/test/core_edge_auth_dep_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ func makeContainerEnv(customersSecret, secureCookie bool) []Environment {
143143
if customersSecret {
144144
environ = append(environ, Environment{Name: "customers_path", Value: "/var/secrets/of-customers/of-customers"})
145145
}
146-
environ = append(environ, Environment{Name: "client_secret", Value: "client-secret"})
147146
environ = append(environ, Environment{Name: "client_id", Value: "client-id"})
148147
environ = append(environ, Environment{Name: "oauth_provider_base_url", Value: ""})
149148
environ = append(environ, Environment{Name: "oauth_provider", Value: "github"})

edge-auth/handlers/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ type Config struct {
88
OAuthProvider string
99
OAuthProviderBaseURL string
1010
ClientID string
11-
ClientSecret string
12-
OAuthClientSecretPath string // OAuthClientSecretPath when given overrides the ClientSecret env-var
11+
OAuthClientSecretPath string
1312
ExternalRedirectDomain string
1413
Scope string
1514
CookieRootDomain string

edge-auth/handlers/oauth2.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,16 @@ func MakeOAuth2Handler(config *Config) func(http.ResponseWriter, *http.Request)
3333
log.Fatalf("unable to parse private key: %s", keyErr.Error())
3434
}
3535

36-
clientSecret := config.ClientSecret
36+
var clientSecret string
3737

3838
if len(config.OAuthClientSecretPath) > 0 {
3939
clientSecretBytes, err := ioutil.ReadFile(config.OAuthClientSecretPath)
4040
if err != nil {
4141
log.Fatalf("OAuthClientSecretPath, unable to read path: %s, error: %s", config.OAuthClientSecretPath, err.Error())
4242
}
4343
clientSecret = strings.TrimSpace(string(clientSecretBytes))
44+
} else {
45+
log.Fatalf("OauthClientSecretPath should be set to load the secret")
4446
}
4547

4648
return func(w http.ResponseWriter, r *http.Request) {

edge-auth/main.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ func main() {
5252
clientID = val
5353
}
5454

55-
if val, exists := os.LookupEnv("client_secret"); exists {
56-
clientSecret = val
57-
}
58-
5955
if val, exists := os.LookupEnv("external_redirect_domain"); exists {
6056
externalRedirectDomain = val
6157
}

yaml/core/edge-auth-dep.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ spec:
5353
- name: customers_path
5454
value: "/var/secrets/of-customers/of-customers"
5555
# Update for your configuration:
56-
- name: client_secret # this can also be provided via a secret named of-client-secret
57-
value: ""
5856
- name: client_id
5957
value: ""
6058
- name: oauth_provider_base_url

0 commit comments

Comments
 (0)