Skip to content

support extension on Garden resource#280

Open
hown3d wants to merge 25 commits into
mainfrom
garden-extension
Open

support extension on Garden resource#280
hown3d wants to merge 25 commits into
mainfrom
garden-extension

Conversation

@hown3d
Copy link
Copy Markdown
Member

@hown3d hown3d commented May 5, 2026

What this PR does / why we need it:
Allows to use the ACL extension to restrict access to the virtual garden API server

Which issue(s) this PR fixes:
Fixes gardener/hackathon#47

Special notes for your reviewer:

Copy link
Copy Markdown
Member

@timebertt timebertt left a comment

Choose a reason for hiding this comment

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

Partial review together with @MichaelEischer @mstueer @hammadzf

Comment thread charts/gardener-extension-acl/templates/deployment.yaml Outdated
Comment thread charts/gardener-extension-acl/templates/deployment.yaml Outdated
Comment thread pkg/helper/seed.go Outdated
Comment thread pkg/helper/seed.go Outdated
- get
- list
- watch
{{- end }}
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.

Please double-check if we need all of the remaining permissions in the garden case.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think having a seperate roles that clearly define which permissions are granted for the extensions is easier to read. I will refactor this.

Comment thread pkg/controller/add.go Outdated
var gardenCluster cluster.Cluster
if kFile := os.Getenv("GARDEN_KUBECONFIG"); kFile != "" {
var err error
gardenCluster, err = setupGardenCluster(mgr, kFile)
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.

This should happen in app.go not in the controller package

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I agree, but there where would I put the cluster to pass it through to the predicate?
The controllers are registered via controllerSwitches which expects the AddToManger(ctx, mgr) signature.

Binding to AddOptions could be an option, but this seems a bit weird. WDYT?

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 suggest passing a new cluster.Cluster param to ControllerSwitches, then you can wrap the actual AddToManager(ctx, mgr, cluster) call in a func(context.Context, manager.Manager)

Copy link
Copy Markdown
Member Author

@hown3d hown3d May 27, 2026

Choose a reason for hiding this comment

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

This does not work well because the controller switches are registered before the manager is setup and I would like to setup the cluster next to the manager.

Comment thread pkg/controller/actuator.go Outdated
Comment thread pkg/controller/actuator.go Outdated
Comment thread pkg/controller/actuator.go Outdated
Comment thread pkg/controller/allowedcidrs/errors.go
@hown3d hown3d force-pushed the garden-extension branch 7 times, most recently from cac3025 to 0e64847 Compare May 29, 2026 09:23
@hown3d
Copy link
Copy Markdown
Member Author

hown3d commented May 29, 2026

Sorry for all the force pushes, it was quite exhausting to rebase this to main.

@hown3d hown3d marked this pull request as ready for review May 29, 2026 09:24
@hown3d hown3d requested a review from a team as a code owner May 29, 2026 09:24
hown3d added 12 commits June 2, 2026 11:41
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
hown3d added 13 commits June 2, 2026 11:41
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
@hown3d hown3d force-pushed the garden-extension branch from 0e64847 to fe2b7ed Compare June 2, 2026 09:42
if err := a.client.List(ctx, gardens); err != nil {
return nil, err
}
if len(gardens.Items) == 0 {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

maybe add a check if > 1 gardens are found (which should never happen i think)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is not supported by gardener operator and will be denied by the operator webhooks.
I don't think we need to check that

log,
ex.GetNamespace(),
extSpec,
cluster,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

since cluster is nil (line 149 ff.) if hasClassGarden() == false:

wouldn't it be better to have a function createFiltersGarden() without the cluster variable, and rename createFilters() to createFiltersShoot() ?'

and then do something like if hasGardenClass(ex) { createFiltersGarden() } else { createFiltersShoot() }?

return a.createManagedResource(ctx, namespace, mrName, "seed", renderer, ChartNameSeed, namespace, values.AsMap(), nil, charts.Seed)
}

type values struct {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can we have

Suggested change
type values struct {
type envoyFilterSpecValues struct {

or helmChartValues or similar, to make the name clearer?

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.

Add support for virtual Garden to ACL Extension

3 participants