Skip to content

Commit e291534

Browse files
authored
Optionally skip predefined roles (#18)
1 parent f58a7d5 commit e291534

3 files changed

Lines changed: 23 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## 0.11.1
4+
5+
- Key changes:
6+
- Added an option to skip the file with predefined roles through setting `ACL_PATH` to an empty value. This might be useful in environments that fully rely on Assumed Roles (=autoconfiguration).
7+
38
## 0.11.0
49

510
- Key changes:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Docker images are published on [ghcr.io/weisdd/lfgw](https://github.com/weisdd/l
6060
| | `SET_PROXY_HEADERS` | `false` | Whether to set proxy headers (`X-Forwarded-For`, `X-Forwarded-Proto`, `X-Forwarded-Host`). |
6161
| | | | |
6262
| **OIDC** | | | |
63-
| | `ACL_PATH` | `./acl.yaml` | Path to a file with ACL definitions (OIDC role to namespace bindings). |
63+
| | `ACL_PATH` | `./acl.yaml` | Path to a file with ACL definitions (OIDC role to namespace bindings). Skipped if `ACL_PATH` is empty (might be useful when autoconfiguration is enabled through `ASSUMED_ROLES=true`). |
6464
| | `OIDC_REALM_URL` | | OIDC Realm URL, e.g. `https://auth.microk8s.localhost/auth/realms/cicd` |
6565
| | `OIDC_CLIENT_ID` | | OIDC Client ID (1*) |
6666

cmd/lfgw/main.go

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,25 @@ func main() {
9797
Msg("Assumed roles mode is off")
9898
}
9999

100-
app.ACLMap, err = app.loadACL()
101-
if err != nil {
102-
app.logger.Fatal().Caller().
103-
Err(err).Msgf("Failed to load ACL")
104-
}
100+
if app.ACLPath != "" {
101+
app.ACLMap, err = app.loadACL()
102+
if err != nil {
103+
app.logger.Fatal().Caller().
104+
Err(err).Msgf("Failed to load ACL")
105+
}
106+
107+
for role, acl := range app.ACLMap {
108+
app.logger.Info().Caller().
109+
Msgf("Loaded role definition for %s: %q (converted to %s)", role, acl.RawACL, acl.LabelFilter.AppendString(nil))
110+
}
111+
} else {
112+
if !app.AssumedRoles {
113+
app.logger.Fatal().Caller().
114+
Msgf("The app cannot run without at least one source of configuration (Non-empty ACL_PATH and/or ASSUMED_ROLES set to true)")
115+
}
105116

106-
for role, acl := range app.ACLMap {
107117
app.logger.Info().Caller().
108-
Msgf("Loaded role definition for %s: %q (converted to %s)", role, acl.RawACL, acl.LabelFilter.AppendString(nil))
118+
Msgf("ACL_PATH is empty, thus predefined roles are not loaded")
109119
}
110120

111121
app.logger.Info().Caller().

0 commit comments

Comments
 (0)