Skip to content

Commit 0928633

Browse files
committed
feat: let pod use default config
1 parent 794b8f9 commit 0928633

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pkg/controller/webhook/mutating.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func podWebhook(ctx context.Context, req *webhook.AdmissionRequest, client clien
106106
return webhook.Denied("can not use pod annotation and podNetworking at same time")
107107
}
108108

109-
if types.PodUseENI(pod) {
109+
if types.PodUseENI(pod) || controlplane.GetConfig().IPAMType == types.IPAMTypeCRD {
110110
networks, err := controlplane.ParsePodNetworksFromAnnotation(pod)
111111
if err != nil {
112112
return webhook.Denied(fmt.Sprintf("unable parse annotation field %s", types.PodNetworks))
@@ -129,6 +129,7 @@ func podWebhook(ctx context.Context, req *webhook.AdmissionRequest, client clien
129129
return webhook.Errored(1, err)
130130
}
131131
pod.Annotations[types.PodNetworks] = string(pnaBytes)
132+
pod.Annotations[types.PodENI] = "true"
132133
memberCount = 1
133134
} else {
134135
for _, n := range networks.PodNetworks {

types/controlplane/config_default.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ type Config struct {
6262
CustomStatefulWorkloadKinds []string `json:"customStatefulWorkloadKinds"`
6363

6464
BackoffOverride map[string]wait.Backoff `json:"backoffOverride,omitempty"`
65+
IPAMType string `json:"ipamType"`
6566

6667
Credential
6768
}

0 commit comments

Comments
 (0)