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

[GEP-26] Workload Identity support #855

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

dimityrmirchev
Copy link
Member

@dimityrmirchev dimityrmirchev commented Oct 1, 2024

How to categorize this PR?

/area security ipcei
/kind enhancement
/platform gcp
/label ipcei/workload-identity

What this PR does / why we need it:
This PR adds support for workload identity. A few of the main points of this PR:

  • A mutator to configure the cloudprovider secret.
  • A mutator to inject the needed configuration in the Terraformer pod.
  • MCM container and pod are enhanced with needed configs in order to support this scenario.

Which issue(s) this PR fixes:
Part of gardener/gardener#9586

Special notes for your reviewer:
/cc @vpnachev

In order to develop/review this PR one would need a running Gardener Discovery Server + established trust from GCP account to Gardener's workload identity. This can be achieved using the proposed changes in the following PR: gardener/gardener#10520

The PR also depends on gardener/machine-controller-manager-provider-gcp#130 being reviewed and released.

I will keep this as draft until MCM PR is merged and documentation is added to the PR, but feel free to review/test.

Release note:

The extension now supports `Shoot`s using `WorkloadIdentity`s instead of cloud provider credentials.

@gardener-robot gardener-robot added kind/api-change API change with impact on API users needs/second-opinion Needs second review by someone else area/ipcei IPCEI (Important Project of Common European Interest) area/security Security related kind/enhancement Enhancement, improvement, extension platform/gcp Google cloud platform/infrastructure labels Oct 1, 2024
@gardener-robot
Copy link

@dimityrmirchev Label ipcei/workload-identity does not exist.

@gardener-robot gardener-robot added needs/review Needs review size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py) labels Oct 1, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Oct 1, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 1, 2024
@gardener-robot
Copy link

@dimityrmirchev Label ipcei/workload-identity does not exist.

@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 1, 2024
@gardener-robot
Copy link

@dimityrmirchev Label ipcei/workload-identity does not exist.

@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 3, 2024
@gardener-robot gardener-robot added the needs/rebase Needs git rebase label Oct 4, 2024
@gardener-robot
Copy link

@dimityrmirchev You need rebase this pull request with latest master branch. Please check.

@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Oct 10, 2024
Copy link
Member

@vpnachev vpnachev left a comment

Choose a reason for hiding this comment

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

Some preliminary findings, I will need to take a second look (do not know if the change can be split into several PRs to ease the review).

},
Target: extensionswebhook.TargetSeed,
ObjectSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{"provider.shoot.gardener.cloud/gcp": "true"},
Copy link
Member

Choose a reason for hiding this comment

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

I do not think the label is set on Workloadidentities, is it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Ok, but that is valid only for workload identities referenced by credentials binding, otherwise it is not labeled, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

We discussed with @vpnachev and will replace the LabelSelector. Please see #855 (comment)

}
}

// Validate checks whether the given new secret contains a valid GCP service account.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Validate checks whether the given new secret contains a valid GCP service account.
// Validate checks whether the given new workloadidentity contains a valid GCP configuration.

return fmt.Errorf("wrong object type %T for old object", oldObj)
}

if workloadIdentity.Spec.TargetSystem.ProviderConfig == nil {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if workloadIdentity.Spec.TargetSystem.ProviderConfig == nil {
if oldWorkloadIdentity.Spec.TargetSystem.ProviderConfig == nil {

But is this check necessary? If it was allowed providerConfig=nil, then there must be a migration path which seems to be forbidden here.

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right. We can skip the check

"k8s.io/apimachinery/pkg/runtime"
)

// +genclient
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// +genclient

This is not a real API resource, hence a client is not needed.

@vpnachev
Copy link
Member

On a second look, apart from the comments above, looks good to me.

@dimityrmirchev
Copy link
Member Author

Once #866 is merged this PR can be moved to "Ready" state.

@dimityrmirchev
Copy link
Member Author

This PR will also need #869 merged so we can use the GardenSecurityProviderType function introduced in g/g v1.104.0.

@dimityrmirchev dimityrmirchev marked this pull request as ready for review October 22, 2024 09:44
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Jan 15, 2025
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Jan 15, 2025
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Jan 15, 2025
@dimityrmirchev
Copy link
Member Author

I tested this PR after rebasing over the latest changes. The PR is ready for final review.

ping @kon-angelo

@dimityrmirchev
Copy link
Member Author

After an offline talk with @vpnachev we decided to explore the possibility of using SubjectTokenSupplier which might replace the internal http server.

@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Jan 17, 2025
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Jan 17, 2025
@gardener-robot-ci-3 gardener-robot-ci-3 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Jan 17, 2025
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Jan 17, 2025
@gardener-robot-ci-3 gardener-robot-ci-3 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Jan 17, 2025
@dimityrmirchev
Copy link
Member Author

After an offline talk with @vpnachev we decided to explore the possibility of using SubjectTokenSupplier which might replace the internal http server.

I updated the implementation to not rely on a local http server to retrieve the credentials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ipcei IPCEI (Important Project of Common European Interest) area/security Security related kind/api-change API change with impact on API users kind/enhancement Enhancement, improvement, extension needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) needs/rebase Needs git rebase needs/second-opinion Needs second review by someone else platform/gcp Google cloud platform/infrastructure size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants