Skip to content

Commit

Permalink
feat: add sync.toHost.pods.runtimeClassName
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianKramm committed Jan 20, 2025
1 parent 646c6b0 commit e543d6d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3245,6 +3245,10 @@
"type": "boolean",
"description": "UseSecretsForSATokens will use secrets to save the generated service account tokens by virtual cluster instead of using a\npod annotation."
},
"runtimeClassName": {
"type": "string",
"description": "RuntimeClassName is the runtime class to set for synced pods."
},
"rewriteHosts": {
"$ref": "#/$defs/SyncRewriteHosts",
"description": "RewriteHosts is a special option needed to rewrite statefulset containers to allow the correct FQDN. virtual cluster will add\na small container to each stateful set pod that will initially rewrite the /etc/hosts file to match the FQDN expected by\nthe virtual cluster."
Expand Down
2 changes: 2 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ sync:
# UseSecretsForSATokens will use secrets to save the generated service account tokens by virtual cluster instead of using a
# pod annotation.
useSecretsForSATokens: false
# RuntimeClassName is the runtime class to set for synced pods.
runtimeClassName: ""
# RewriteHosts is a special option needed to rewrite statefulset containers to allow the correct FQDN. virtual cluster will add
# a small container to each stateful set pod that will initially rewrite the /etc/hosts file to match the FQDN expected by
# the virtual cluster.
Expand Down
3 changes: 3 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,9 @@ type SyncPods struct {
// pod annotation.
UseSecretsForSATokens bool `json:"useSecretsForSATokens,omitempty"`

// RuntimeClassName is the runtime class to set for synced pods.
RuntimeClassName string `json:"runtimeClassName,omitempty"`

// RewriteHosts is a special option needed to rewrite statefulset containers to allow the correct FQDN. virtual cluster will add
// a small container to each stateful set pod that will initially rewrite the /etc/hosts file to match the FQDN expected by
// the virtual cluster.
Expand Down
1 change: 1 addition & 0 deletions config/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sync:
translateImage: {}
enforceTolerations: []
useSecretsForSATokens: false
runtimeClassName: ""
rewriteHosts:
enabled: true
initContainer:
Expand Down
5 changes: 5 additions & 0 deletions pkg/controllers/resources/pods/translate/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ func (t *translator) Translate(ctx *synccontext.SyncContext, vPod *corev1.Pod, s
return nil, err
}

// add runtime class name
if ctx.Config.Sync.ToHost.Pods.RuntimeClassName != "" {
pPod.Spec.RuntimeClassName = &ctx.Config.Sync.ToHost.Pods.RuntimeClassName
}

// translate topology spread constraints
if t.enableScheduler {
pPod.Spec.TopologySpreadConstraints = nil
Expand Down

0 comments on commit e543d6d

Please sign in to comment.