spiffe / spiffe/spire-controller-manager
Resolve "ultimate owner" of pod
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 77
- Forks
- 69
- Avg merge
- 11d 11h
- Merged PRs (30d)
- 6
Description
Background
The default SVID template is
spiffe://{{ .TrustDomain }}/ns/{{ .PodMeta.Namespace }}/sa/{{ .PodSpec.ServiceAccountName }}
where the assumption is that the service account name is descriptive of what deployment this is.
Problems
The above have the following problems
- By default pods are assigned the
defaultservice account for that namespace - Service accounts are namespaced resources. So deployment
foocan highjack the service account forbar.
The above can be mitigated by a policy framework like OPA gatekeeper or kyverno.
Proposal
Add "UltimateOwner" to the SVID template.
It is then the responsibility the controller manager to walk the owner reference to resolve the ultimate owner.
As this is costly, then it should only be done when necessary.
With ultimate owner it means
- Pod -> ReplicaSet -> Deployment
- Pod -> ReplicaSet -> Argo Rollout
- Pod -> StatefulSet
- Pod -> DaemonSet
It is important how the owner walk is terminated.
Here is two options
- Walk the chain until it encounters a controller managed resource
- Walk the chain until we encounter an owner that is (Deployment, Rollout, StatefulSet, DaemonSet)
The downside of $1 is that resources deployed as CRD eg. ElasticCluster might have multiple Deployments.
Then all of these are granted the same SVID.
The downside of $2 is that an explicit heuristic should be written in the controller.
Alternatively, a list of resources that terminates the walk.
Runtime considerations
This will require a dynamic lookup of the ultimate owner.
§1 will add informer caches on all resources in the chain.
§2 will add informer caches on ReplicaSet.
On a large cluster this will require significant memory.
RBAC
§1 will need list, get, watch on the above:
- ReplicaSet
- Deployment
- Rollout
- StatefulSet
- DaemonSet
§2 will need it on ReplicaSet.
Draft
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposal and the linked draft comparison to understand the intended UltimateOwner changes. Work through the two owner-walk termination options, including informer-cache and RBAC implications. Done means the project has an agreed design for resolving ultimate owners and incorporating that result into the SVID template.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- devops, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100