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

feat: add service account impersonation support for controllers #59

Merged
merged 1 commit into from
Oct 23, 2024

Conversation

a-hilaly
Copy link
Member

@a-hilaly a-hilaly commented Oct 23, 2024

Add support for per namespace service account impersonation in controllers.
This enables running controller operations with different service account
permissions based on namespace configuration.

Key changes:

  • Add ServiceAccounts field to ResourceGroupSpec for mapping namespaces
    to service accounts
  • Implement dynamic client creation with service account impersonation
  • Add metrics for tracking impersonation success/failures and latency
  • Support default service account fallback using "*" key

e.g usage:

apiVersion: x.symphony.k8s.aws/v1alpha1
kind: ResourceGroup
metadata:
  name: deploymentservice.x.symphony.k8s.aws
spec:
  # NOTE: this is just an initial implementation, we'll probably
  # review and redesign this.
  serviceAccounts:
    production: prod-sa
    staging: staging-sa
    "*": fallback-sa

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ack-prow ack-prow bot requested review from michaelhtm and TiberiuGC October 23, 2024 07:15
@ack-prow ack-prow bot added the approved label Oct 23, 2024
@a-hilaly a-hilaly force-pushed the a-hilaly/impersonation branch from 89eec39 to 8a0d10e Compare October 23, 2024 07:17
Add support for per namespace service account impersonation in controllers.
This enables running controller operations with different service account
permissions based on namespace configuration.

Key changes:
- Add `ServiceAccounts` field to `ResourceGroupSpec` for mapping namespaces
  to service accounts
- Implement dynamic client creation with service account impersonation
- Add metrics for tracking impersonation `success`/`failures` and `latency`
- Support default service account fallback using `"*"` key
@a-hilaly a-hilaly force-pushed the a-hilaly/impersonation branch from 8a0d10e to 8d151ae Compare October 23, 2024 07:21
Copy link
Contributor

@michaelhtm michaelhtm left a comment

Choose a reason for hiding this comment

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

/lgtm

@ack-prow ack-prow bot added the lgtm label Oct 23, 2024
Copy link

ack-prow bot commented Oct 23, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: a-hilaly, michaelhtm

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [a-hilaly,michaelhtm]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-prow ack-prow bot merged commit c49c3e4 into main Oct 23, 2024
4 checks passed
@a-hilaly a-hilaly deleted the a-hilaly/impersonation branch October 24, 2024 03:56
a-hilaly added a commit that referenced this pull request Nov 12, 2024
Add support for per namespace service account impersonation in controllers.
This enables running controller operations with different service account
permissions based on namespace configuration.

Key changes:
- Add `ServiceAccounts` field to `ResourceGroupSpec` for mapping namespaces
  to service accounts
- Implement dynamic client creation with service account impersonation
- Add metrics for tracking impersonation `success`/`failures` and `latency`
- Support default service account fallback using `"*"` key

e.g usage:
```yaml
apiVersion: x.symphony.k8s.aws/v1alpha1
kind: ResourceGroup
metadata:
  name: deploymentservice.x.symphony.k8s.aws
spec:
  # NOTE: this is just an initial implementation, we'll probably
  # review and redesign this.
  serviceAccounts:
    production: prod-sa
    staging: staging-sa
    "*": fallback-sa
```

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
a-hilaly added a commit that referenced this pull request Nov 12, 2024
Add support for per namespace service account impersonation in controllers.
This enables running controller operations with different service account
permissions based on namespace configuration.

Key changes:
- Add `ServiceAccounts` field to `ResourceGroupSpec` for mapping namespaces
  to service accounts
- Implement dynamic client creation with service account impersonation
- Add metrics for tracking impersonation `success`/`failures` and `latency`
- Support default service account fallback using `"*"` key

e.g usage:
```yaml
apiVersion: x.symphony.k8s.aws/v1alpha1
kind: ResourceGroup
metadata:
  name: deploymentservice.x.symphony.k8s.aws
spec:
  # NOTE: this is just an initial implementation, we'll probably
  # review and redesign this.
  serviceAccounts:
    production: prod-sa
    staging: staging-sa
    "*": fallback-sa
```

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
a-hilaly added a commit that referenced this pull request Nov 12, 2024
Add support for per namespace service account impersonation in controllers.
This enables running controller operations with different service account
permissions based on namespace configuration.

Key changes:
- Add `ServiceAccounts` field to `ResourceGroupSpec` for mapping namespaces
  to service accounts
- Implement dynamic client creation with service account impersonation
- Add metrics for tracking impersonation `success`/`failures` and `latency`
- Support default service account fallback using `"*"` key

e.g usage:
```yaml
apiVersion: x.symphony.k8s.aws/v1alpha1
kind: ResourceGroup
metadata:
  name: deploymentservice.x.symphony.k8s.aws
spec:
  # NOTE: this is just an initial implementation, we'll probably
  # review and redesign this.
  serviceAccounts:
    production: prod-sa
    staging: staging-sa
    "*": fallback-sa
```

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants