Skip to content

Commit

Permalink
feat: improve hostNetwork mode of NodePool by adding NodeAffinity to …
Browse files Browse the repository at this point in the history
…pods with specified annotation (openyurtio#1935) (openyurtio#1959)
  • Loading branch information
huangchenzhao authored Mar 13, 2024
1 parent e33a217 commit 273e8df
Show file tree
Hide file tree
Showing 11 changed files with 490 additions and 706 deletions.
20 changes: 20 additions & 0 deletions charts/yurt-manager/templates/yurt-manager-auto-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,26 @@ webhooks:
resources:
- platformadmins
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: yurt-manager-webhook-service
namespace: {{ .Release.Namespace }}
path: /mutate-core-openyurt-io-v1-pod
failurePolicy: Ignore
name: mutate.core.v1.pod.openyurt.io
rules:
- apiGroups:
- ""
apiVersions:
- v1
operations:
- CREATE
resources:
- pods
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/apps/well_known_labels_annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ const (
NodePoolHostNetworkLabel = "nodepool.openyurt.io/hostnetwork"
NodePoolChangedEvent = "NodePoolChanged"
)

// Pod related labels and annotations
const (
// AnnotationExcludeHostNetworkPool indicates the pod don't want to be scheduled to nodes in hostNetwork mode NodePool
AnnotationExcludeHostNetworkPool = "apps.openyurt.io/exclude-host-network-pool"
)
18 changes: 6 additions & 12 deletions pkg/yurthub/filter/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ const (
// in order to make NodePort will not be listened by kube-proxy component in specified NodePool.
NodePortIsolationFilterName = "nodeportisolation"

// HostNetworkPropagationFilterName filter is used to set pod.spec.HostNetwork to true when the
// hostNetwork field(nodePool.spec.HostNetwork) is true. this is equivalent to the nodepool
// propagating the hostNetwork configuration to the pods running in it.
HostNetworkPropagationFilterName = "hostnetworkpropagation"

// SkipDiscardServiceAnnotation is annotation used by LB service.
// If end users want to use specified LB service at the edge side,
// End users should add annotation["openyurt.io/skip-discard"]="true" for LB service.
Expand All @@ -55,15 +50,14 @@ const (

var (
// DisabledInCloudMode contains the filters that should be disabled when yurthub is working in cloud mode.
DisabledInCloudMode = []string{DiscardCloudServiceFilterName, HostNetworkPropagationFilterName}
DisabledInCloudMode = []string{DiscardCloudServiceFilterName}

// SupportedComponentsForFilter is used for specifying which components are supported by filters as default setting.
SupportedComponentsForFilter = map[string]string{
MasterServiceFilterName: "kubelet",
DiscardCloudServiceFilterName: "kube-proxy",
ServiceTopologyFilterName: "kube-proxy, coredns, nginx-ingress-controller",
InClusterConfigFilterName: "kubelet",
NodePortIsolationFilterName: "kube-proxy",
HostNetworkPropagationFilterName: "kubelet",
MasterServiceFilterName: "kubelet",
DiscardCloudServiceFilterName: "kube-proxy",
ServiceTopologyFilterName: "kube-proxy, coredns, nginx-ingress-controller",
InClusterConfigFilterName: "kubelet",
NodePortIsolationFilterName: "kube-proxy",
}
)
160 changes: 0 additions & 160 deletions pkg/yurthub/filter/hostnetworkpropagation/filter.go

This file was deleted.

Loading

0 comments on commit 273e8df

Please sign in to comment.