Skip to content

fix: create release namespace under strict RBAC, --no-create-namespace flag - #662

Merged
dmmordvi merged 6 commits into
mainfrom
fix/release-ns-creation-with-strict-rbac
Jul 20, 2026
Merged

fix: create release namespace under strict RBAC, --no-create-namespace flag#662
dmmordvi merged 6 commits into
mainfrom
fix/release-ns-creation-with-strict-rbac

Conversation

@dmmordvi

@dmmordvi dmmordvi commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review in cubic

@dmmordvi dmmordvi changed the title fix: adopt ns creation to strict RBAC without access to get/list namespaces fix: adopt release namespace creation to strict RBAC without access to get/list namespaces Jul 17, 2026
… permission

Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
@dmmordvi
dmmordvi force-pushed the fix/release-ns-creation-with-strict-rbac branch from ac08366 to 7ef3170 Compare July 17, 2026 10:29
@dmmordvi dmmordvi changed the title fix: adopt release namespace creation to strict RBAC without access to get/list namespaces fix: create release namespace under strict RBAC without namespace get permission Jul 17, 2026
dmmordvi added 2 commits July 17, 2026 13:37
Make createReleaseNamespace accept the kube.ClientFactorier interface so
the release-namespace probe flow can be unit-tested with a recording fake,
and add ai-tagged tests covering the full decision matrix: configmap probe
success, configmap 403/404 falling back to namespace dry-run and real
create, both probes 403/404 aggregating into the approved error, and
non-403/404 errors (configmap probe, namespace probe, real create)
propagating.

Also reword the non-403/404 configmap probe error to reference the
synchronization configmap instead of the release lock, since the probe is
a generic namespace-access check and is not tied to release locking.

Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
@dmmordvi
dmmordvi requested a review from ilya-lesikov July 17, 2026 14:02
dmmordvi added 2 commits July 17, 2026 17:22
Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
@dmmordvi dmmordvi changed the title fix: create release namespace under strict RBAC without namespace get permission fix: create release namespace under strict RBAC, --no-create-namespace flag Jul 20, 2026
Comment thread pkg/action/release_install.go Outdated
"apiVersion": "v1",
"kind": "ConfigMap",
"metadata": map[string]interface{}{
"name": "werf-synchronization",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is there a constant? If not, create please in common package

Comment thread pkg/action/release_install.go Outdated
DryRun: true,
}); nsApplyErr != nil {
if errors.IsForbidden(nsApplyErr) || errors.IsNotFound(nsApplyErr) {
return fmt.Errorf("can't apply ConfigMap for locking, and can't apply release namespace (in case ConfigMap apply error caused by non-existent namespace):\n\n * %w\n * %w", cmApplyErr, nsApplyErr)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we have Multierror somewhere for this, try it

Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
@dmmordvi
dmmordvi merged commit 3d389ef into main Jul 20, 2026
8 checks passed
@dmmordvi
dmmordvi deleted the fix/release-ns-creation-with-strict-rbac branch July 20, 2026 13:16
alexey-igrychev added a commit that referenced this pull request Jul 28, 2026
* feat: add --lookup-resources flag for offline lookup in render/lint commands (#657)

Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
(cherry picked from commit a984242)

* fix: create release namespace under strict RBAC, `--no-create-namespace` flag (#662)

Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
(cherry picked from commit 3d389ef)

---------

Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
Co-authored-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
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.

2 participants