Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api/vmauth: introduce unauthorizedUserAccess field at spec #1186

Merged
merged 5 commits into from
Dec 12, 2024
Merged

Conversation

f41gh7
Copy link
Collaborator

@f41gh7 f41gh7 commented Dec 11, 2024

Previously for unauthorized_user config section of vmauth. Operator used two configuration fields: unauthorizedAccessConfig and inlined fields from VMUserOptions. This behaviour doesn't aligh with configuration file supported
by vmauth. It also incorrectly exposed fields from VMUserOptions at spec.
Which could mislead users, since spec.default_urls could be treated as global config option for vmauth, but in fact, it can only be used at unauthorized_user section.

This commit replaces both fields with the new field unauthorizedUserAccess.
It combines both config options - url_map and VMUserOptions. Replaced fields marked as deprecated and will be removed at v1.0 operator API release.

Also VMauth now properly validates unauthorized_user related configuration and returns proper error to the user, instead of crashing vmauth container in runtime.

Related issues:

Previously for unauthorized_user config section of vmauth.
Operator used two configuration fields: `unauthorizedAccessConfig` and inlined fields
from `VMUserOptions`. This behaviour doesn't aligh with configuration file supported
 by vmauth. It also incorrectly exposed fields from `VMUserOptions` at `spec`.
Which could mislead users, since `spec.default_urls` could be treated as global
config option for vmauth, but in fact, it can only be used at `unauthorized_user` section.

 This commit replaces both fields with the new field `unauthorizedUserAccess`.
It combines both config options - `url_map` and `VMUserOptions`. Replaced fields
marked as deprecated and will be removed at `v1.0` operator API release.

Also `VMauth` now properly validates `unauthorized_user` related configuration and returns
proper error to the user, instead of crashing `vmauth` container in runtime.

Related issues:
- #1168
- #1169

Signed-off-by: f41gh7 <[email protected]>
api/operator/v1beta1/vmauth_types.go Outdated Show resolved Hide resolved
@@ -59,6 +62,24 @@ func (r *VMAuth) sanityCheck() error {
r.Spec.ExternalConfig.SecretRef.Name, r.Spec.ExternalConfig.SecretRef.Key)
}
}

if len(r.Spec.UnauthorizedAccessConfig) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can also add a check for not having both UnauthorizedAccessConfig and UnauthorizedUserAccess specified.

api/operator/v1beta1/vmauth_types.go Outdated Show resolved Hide resolved
return nil
}

// UnauthorizedAccessConfigURLMap defines
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// UnauthorizedAccessConfigURLMap defines
// UnauthorizedAccessConfigURLMap defines unauthorized_user section configuration for vmauth

@f41gh7 f41gh7 merged commit 76a1c94 into master Dec 12, 2024
2 checks passed
@f41gh7 f41gh7 deleted the gh-1169 branch December 12, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants