Skip to content

Commit

Permalink
feat: support forward requests to leader hub for sharing pool scope m…
Browse files Browse the repository at this point in the history
…etadata in nodepool.

Signed-off-by: rambohe-ch <[email protected]>
  • Loading branch information
rambohe-ch committed Feb 19, 2025
1 parent 6676fa3 commit c86a55a
Show file tree
Hide file tree
Showing 40 changed files with 1,051 additions and 246 deletions.
1 change: 1 addition & 0 deletions charts/yurthub/templates/yurthub-cfg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ metadata:
name: yurt-hub-cfg
namespace: {{ .Release.Namespace }}
labels:
openyurt.io/configmap-name: yurt-hub-cfg
{{- include "yurthub.labels" . | nindent 4 }}
data:
cache_agents: {{ .Values.cacheAgents | quote }}
Expand Down
1 change: 1 addition & 0 deletions charts/yurthub/templates/yurthub-cloud-yurtstaticset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ spec:
- --bind-address={{ .Values.yurthubBindingAddr }}
- --server-addr={{ .Values.kubernetesServerAddr }}
- --node-name=$(NODE_NAME)
- --nodepool-name={{ .Values.nodePoolName }}
- --bootstrap-file={{ .Values.bootstrapFile }}
- --working-mode=cloud
- --namespace={{ .Release.Namespace }}
Expand Down
1 change: 1 addition & 0 deletions charts/yurthub/templates/yurthub-yurtstaticset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ spec:
- --bind-address={{ .Values.yurthubBindingAddr }}
- --server-addr={{ .Values.kubernetesServerAddr }}
- --node-name=$(NODE_NAME)
- --nodepool-name={{ .Values.nodePoolName }}
- --bootstrap-file={{ .Values.bootstrapFile }}
- --working-mode=edge
- --namespace={{ .Release.Namespace }}
Expand Down
1 change: 1 addition & 0 deletions charts/yurthub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ yurthubBindingAddr: 127.0.0.1
kubernetesServerAddr: https://127.0.0.1:6443
bootstrapFile: "/var/lib/yurthub/bootstrap-hub.conf"
organizations: ""
nodePoolName: ""

image:
registry: openyurt
Expand Down
54 changes: 34 additions & 20 deletions cmd/yurthub/app/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/wait"
apiserver "k8s.io/apiserver/pkg/server"
"k8s.io/apiserver/pkg/server/dynamiccertificates"
Expand All @@ -37,7 +38,6 @@ import (
"k8s.io/client-go/informers"
coreinformers "k8s.io/client-go/informers/core/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/klog/v2"
Expand All @@ -55,9 +55,8 @@ import (
"github.com/openyurtio/openyurt/pkg/yurthub/filter/manager"
"github.com/openyurtio/openyurt/pkg/yurthub/kubernetes/meta"
"github.com/openyurtio/openyurt/pkg/yurthub/kubernetes/serializer"
"github.com/openyurtio/openyurt/pkg/yurthub/multiplexer"
"github.com/openyurtio/openyurt/pkg/yurthub/multiplexer/storage"
"github.com/openyurtio/openyurt/pkg/yurthub/network"
"github.com/openyurtio/openyurt/pkg/yurthub/proxy/remote"
"github.com/openyurtio/openyurt/pkg/yurthub/tenant"
"github.com/openyurtio/openyurt/pkg/yurthub/transport"
"github.com/openyurtio/openyurt/pkg/yurthub/util"
Expand Down Expand Up @@ -90,11 +89,15 @@ type YurtHubConfiguration struct {
YurtHubProxyServerServing *apiserver.DeprecatedInsecureServingInfo
YurtHubDummyProxyServerServing *apiserver.DeprecatedInsecureServingInfo
YurtHubSecureProxyServerServing *apiserver.SecureServingInfo
YurtHubMultiplexerServerServing *apiserver.SecureServingInfo
DiskCachePath string
RequestMultiplexerManager *multiplexer.MultiplexerManager
ConfigManager *configuration.Manager
TenantManager tenant.Interface
TransportAndDirectClientManager transport.Interface
LoadBalancerForLeaderHub remote.LoadBalancer
PoolScopeResources []schema.GroupVersionResource
PortForMultiplexer int
NodePoolName string
}

// Complete converts *options.YurtHubOptions to *YurtHubConfiguration
Expand All @@ -116,7 +119,9 @@ func Complete(options *options.YurtHubOptions, stopCh <-chan struct{}) (*YurtHub

// list/watch endpoints from host cluster in order to resolve tenant cluster address.
newEndpointsInformer := func(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return coreinformers.NewFilteredEndpointsInformer(client, "kube-public", resyncPeriod, nil, nil)
informer := coreinformers.NewFilteredEndpointsInformer(client, "kube-public", resyncPeriod, nil, nil)
informer.SetTransform(pkgutil.TransformStripManagedFields())
return informer

Check warning on line 124 in cmd/yurthub/app/config/config.go

View check run for this annotation

Codecov / codecov/patch

cmd/yurthub/app/config/config.go#L122-L124

Added lines #L122 - L124 were not covered by tests
}
sharedFactory.InformerFor(&corev1.Endpoints{}, newEndpointsInformer)
cfg.SharedFactory = sharedFactory
Expand All @@ -128,6 +133,9 @@ func Complete(options *options.YurtHubOptions, stopCh <-chan struct{}) (*YurtHub
cfg.RemoteServers = us
cfg.LBMode = options.LBMode
tenantNamespce := util.ParseTenantNsFromOrgs(options.YurtHubCertOrganizations)
cfg.PoolScopeResources = options.PoolScopeResources
cfg.PortForMultiplexer = options.PortForMultiplexer
cfg.NodePoolName = options.NodePoolName

// prepare some basic configurations as following:
// - serializer manager: used for managing serializer for encoding or decoding response from kube-apiserver.
Expand All @@ -145,7 +153,7 @@ func Complete(options *options.YurtHubOptions, stopCh <-chan struct{}) (*YurtHub
if err != nil {
return nil, err
}
registerInformers(sharedFactory, options.YurtHubNamespace, options.NodeName, (cfg.WorkingMode == util.WorkingModeCloud), tenantNamespce)
registerInformers(sharedFactory, options.YurtHubNamespace, options.NodePoolName, options.NodeName, (cfg.WorkingMode == util.WorkingModeCloud), tenantNamespce)

certMgr, err := certificatemgr.NewYurtHubCertManager(options, us)
if err != nil {
Expand Down Expand Up @@ -191,7 +199,6 @@ func Complete(options *options.YurtHubOptions, stopCh <-chan struct{}) (*YurtHub

cfg.ConfigManager = configManager
cfg.FilterFinder = filterFinder
cfg.RequestMultiplexerManager = newRequestMultiplexerManager(options, restMapperManager)

if options.EnableDummyIf {
klog.V(2).Infof("create dummy network interface %s(%s)", options.HubAgentDummyIfName, options.HubAgentDummyIfIP)
Expand Down Expand Up @@ -284,15 +291,17 @@ func createClientAndSharedInformerFactories(serverAddr, nodePoolName string) (ku
func registerInformers(
informerFactory informers.SharedInformerFactory,
namespace string,
poolName string,
nodeName string,
enablePodInformer bool,
tenantNs string) {

// configmap informer is used for list/watching yurt-hub-cfg configmap which includes configurations about cache agents and filters.
// and is used by approver in filter and cache manager on cloud and edge working mode.
// configmap informer is used for list/watching yurt-hub-cfg configmap and leader-hub-{poolName} configmap.
// yurt-hub-cfg configmap includes configurations about cache agents and filters which are needed by approver in filter and cache manager on cloud and edge working mode.
// leader-hub-{nodePoolName} configmap includes leader election configurations which are used by multiplexer manager.
newConfigmapInformer := func(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
tweakListOptions := func(options *metav1.ListOptions) {
options.FieldSelector = fields.Set{"metadata.name": util.YurthubConfigMapName}.String()
options.LabelSelector = fmt.Sprintf("openyurt.io/configmap-name in (%s, %s)", util.YurthubConfigMapName, "leader-hub-"+poolName)

Check warning on line 304 in cmd/yurthub/app/config/config.go

View check run for this annotation

Codecov / codecov/patch

cmd/yurthub/app/config/config.go#L304

Added line #L304 was not covered by tests
}
informer := coreinformers.NewFilteredConfigMapInformer(client, namespace, resyncPeriod, nil, tweakListOptions)
informer.SetTransform(pkgutil.TransformStripManagedFields())
Expand Down Expand Up @@ -385,17 +394,22 @@ func prepareServerServing(options *options.YurtHubOptions, certMgr certificate.Y
cfg.YurtHubSecureProxyServerServing.ClientCA = caBundleProvider
cfg.YurtHubSecureProxyServerServing.DisableHTTP2 = true

return nil
}

func newRequestMultiplexerManager(options *options.YurtHubOptions, restMapperManager *meta.RESTMapperManager) *multiplexer.MultiplexerManager {
config := &rest.Config{
Host: fmt.Sprintf("http://%s:%d", options.YurtHubProxyHost, options.YurtHubProxyPort),
UserAgent: util.MultiplexerProxyClientUserAgentPrefix + options.NodeName,
if err := (&apiserveroptions.SecureServingOptions{
BindAddress: net.ParseIP(options.NodeIP),
BindPort: options.PortForMultiplexer,
BindNetwork: "tcp",
ServerCert: apiserveroptions.GeneratableKeyCert{
CertKey: apiserveroptions.CertKey{
CertFile: serverCertPath,
KeyFile: serverCertPath,
},
},
}).ApplyTo(&cfg.YurtHubMultiplexerServerServing); err != nil {
return err

Check warning on line 408 in cmd/yurthub/app/config/config.go

View check run for this annotation

Codecov / codecov/patch

cmd/yurthub/app/config/config.go#L408

Added line #L408 was not covered by tests
}
storageProvider := storage.NewStorageProvider(config)

return multiplexer.NewRequestMultiplexerManager(storageProvider, restMapperManager, options.PoolScopeResources)
cfg.YurtHubMultiplexerServerServing.ClientCA = caBundleProvider
cfg.YurtHubMultiplexerServerServing.DisableHTTP2 = true
return nil
}

func ReadinessCheck(cfg *YurtHubConfiguration) error {
Expand Down
1 change: 1 addition & 0 deletions cmd/yurthub/app/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func TestComplete(t *testing.T) {
options.NodeName = "foo"
options.EnableDummyIf = false
options.HubAgentDummyIfIP = "169.254.2.1"
options.NodeIP = "127.0.0.1"
cfg, err := Complete(options, nil)
if err != nil {
t.Errorf("expect no err, but got %v", err)
Expand Down
20 changes: 20 additions & 0 deletions cmd/yurthub/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ limitations under the License.
package options

import (
"errors"
"fmt"
"net"
"path/filepath"
"time"

"github.com/spf13/pflag"
"k8s.io/apimachinery/pkg/runtime/schema"
apinet "k8s.io/apimachinery/pkg/util/net"
"k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
utilnet "k8s.io/utils/net"
Expand Down Expand Up @@ -83,6 +85,8 @@ type YurtHubOptions struct {
ClientForTest kubernetes.Interface
EnablePoolServiceTopology bool
PoolScopeResources PoolScopeMetadatas
PortForMultiplexer int
NodeIP string
}

// NewYurtHubOptions creates a new YurtHubOptions with a default config.
Expand All @@ -93,6 +97,7 @@ func NewYurtHubOptions() *YurtHubOptions {
YurtHubProxyPort: util.YurtHubProxyPort,
YurtHubPort: util.YurtHubPort,
YurtHubProxySecurePort: util.YurtHubProxySecurePort,
PortForMultiplexer: util.YurtHubMultiplexerPort,
YurtHubNamespace: util.YurtHubNamespace,
GCFrequency: 120,
YurtHubCertOrganizations: make([]string, 0),
Expand Down Expand Up @@ -167,6 +172,19 @@ func (options *YurtHubOptions) Validate() error {
if len(options.CACertHashes) == 0 && !options.UnsafeSkipCAVerification {
return fmt.Errorf("set --discovery-token-unsafe-skip-ca-verification flag as true or pass CACertHashes to continue")
}

if len(options.NodePoolName) == 0 {
return errors.New("node-pool-name is empty")

Check warning on line 177 in cmd/yurthub/app/options/options.go

View check run for this annotation

Codecov / codecov/patch

cmd/yurthub/app/options/options.go#L177

Added line #L177 was not covered by tests
}

if len(options.NodeIP) == 0 {
ipAddr, err := apinet.ResolveBindAddress(nil)
if err != nil {
return fmt.Errorf("couldn't get the node ip, %v", err)

Check warning on line 183 in cmd/yurthub/app/options/options.go

View check run for this annotation

Codecov / codecov/patch

cmd/yurthub/app/options/options.go#L183

Added line #L183 was not covered by tests
}
options.NodeIP = ipAddr.String()
klog.Infof("node ip is configured as %s", options.NodeIP)
}
}

return nil
Expand All @@ -179,11 +197,13 @@ func (o *YurtHubOptions) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&o.YurtHubProxyHost, "bind-proxy-address", o.YurtHubProxyHost, "the IP address of YurtHub Proxy Server")
fs.IntVar(&o.YurtHubProxyPort, "proxy-port", o.YurtHubProxyPort, "the port on which to proxy HTTP requests to kube-apiserver")
fs.IntVar(&o.YurtHubProxySecurePort, "proxy-secure-port", o.YurtHubProxySecurePort, "the port on which to proxy HTTPS requests to kube-apiserver")
fs.IntVar(&o.PortForMultiplexer, "multiplexer-port", o.PortForMultiplexer, "the port on which to proxy HTTPS requests to multiplexer in yurthub")
fs.StringVar(&o.YurtHubNamespace, "namespace", o.YurtHubNamespace, "the namespace of YurtHub Server")
fs.StringVar(&o.ServerAddr, "server-addr", o.ServerAddr, "the address of Kubernetes kube-apiserver, the format is: \"server1,server2,...\"; when yurthub is in local mode, server-addr represents the service address of apiservers, the format is: \"ip:port\".")
fs.StringSliceVar(&o.YurtHubCertOrganizations, "hub-cert-organizations", o.YurtHubCertOrganizations, "Organizations that will be added into hub's apiserver client certificate, the format is: certOrg1,certOrg2,...")
fs.IntVar(&o.GCFrequency, "gc-frequency", o.GCFrequency, "the frequency to gc cache in storage(unit: minute).")
fs.StringVar(&o.NodeName, "node-name", o.NodeName, "the name of node that runs hub agent")
fs.StringVar(&o.NodeIP, "node-ip", o.NodeIP, "the same IP address of the node which used by kubelet. if unset, node's default IPv4 address will be used.")
fs.StringVar(&o.LBMode, "lb-mode", o.LBMode, "the mode of load balancer to connect remote servers(round-robin, priority)")
fs.IntVar(&o.HeartbeatFailedRetry, "heartbeat-failed-retry", o.HeartbeatFailedRetry, "number of heartbeat request retry after having failed.")
fs.IntVar(&o.HeartbeatHealthyThreshold, "heartbeat-healthy-threshold", o.HeartbeatHealthyThreshold, "minimum consecutive successes for the heartbeat to be considered healthy after having failed.")
Expand Down
8 changes: 6 additions & 2 deletions cmd/yurthub/app/options/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func TestNewYurtHubOptions(t *testing.T) {
YurtHubProxyPort: util.YurtHubProxyPort,
YurtHubPort: util.YurtHubPort,
YurtHubProxySecurePort: util.YurtHubProxySecurePort,
PortForMultiplexer: util.YurtHubMultiplexerPort,
YurtHubNamespace: util.YurtHubNamespace,
GCFrequency: 120,
YurtHubCertOrganizations: make([]string, 0),
Expand Down Expand Up @@ -179,10 +180,11 @@ func TestValidate(t *testing.T) {
LBMode: "rr",
WorkingMode: "cloud",
UnsafeSkipCAVerification: true,
NodePoolName: "foo",
},
isErr: false,
},
"normal options with ipv4": {
"normal options with ipv6": {
options: &YurtHubOptions{
NodeName: "foo",
ServerAddr: "1.2.3.4:56",
Expand All @@ -191,10 +193,11 @@ func TestValidate(t *testing.T) {
WorkingMode: "cloud",
UnsafeSkipCAVerification: true,
HubAgentDummyIfIP: "fd00::2:1",
NodePoolName: "foo",
},
isErr: false,
},
"normal options with ipv6": {
"normal options with ipv4": {
options: &YurtHubOptions{
NodeName: "foo",
ServerAddr: "1.2.3.4:56",
Expand All @@ -203,6 +206,7 @@ func TestValidate(t *testing.T) {
WorkingMode: "cloud",
UnsafeSkipCAVerification: true,
HubAgentDummyIfIP: "169.254.2.1",
NodePoolName: "foo",
},
isErr: false,
},
Expand Down
33 changes: 33 additions & 0 deletions cmd/yurthub/app/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ package app
import (
"context"
"fmt"
"net/url"
"time"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"k8s.io/client-go/rest"
"k8s.io/component-base/cli/globalflag"
"k8s.io/klog/v2"

Expand All @@ -32,10 +35,15 @@ import (
"github.com/openyurtio/openyurt/pkg/yurthub/gc"
"github.com/openyurtio/openyurt/pkg/yurthub/healthchecker"
"github.com/openyurtio/openyurt/pkg/yurthub/healthchecker/cloudapiserver"
"github.com/openyurtio/openyurt/pkg/yurthub/healthchecker/leaderhub"
"github.com/openyurtio/openyurt/pkg/yurthub/locallb"
"github.com/openyurtio/openyurt/pkg/yurthub/multiplexer"
"github.com/openyurtio/openyurt/pkg/yurthub/multiplexer/storage"
"github.com/openyurtio/openyurt/pkg/yurthub/proxy"
"github.com/openyurtio/openyurt/pkg/yurthub/proxy/remote"
"github.com/openyurtio/openyurt/pkg/yurthub/server"
"github.com/openyurtio/openyurt/pkg/yurthub/storage/disk"
"github.com/openyurtio/openyurt/pkg/yurthub/transport"
"github.com/openyurtio/openyurt/pkg/yurthub/util"
)

Expand Down Expand Up @@ -137,6 +145,18 @@ func Run(ctx context.Context, cfg *config.YurtHubConfiguration) error {
trace++
}

// no leader hub servers for transport manager at startup time.
// and don't filter response of request for pool scope metadata from leader hub.
transportManagerForLeaderHub, err := transport.NewTransportAndClientManager([]*url.URL{}, 2, cfg.CertManager, ctx.Done())
if err != nil {
return fmt.Errorf("could not new transport manager for leader hub, %w", err)

Check warning on line 152 in cmd/yurthub/app/start.go

View check run for this annotation

Codecov / codecov/patch

cmd/yurthub/app/start.go#L150-L152

Added lines #L150 - L152 were not covered by tests
}
healthCheckerForLeaderHub := leaderhub.NewLeaderHubHealthChecker(20*time.Second, nil, ctx.Done())
loadBalancerForLeaderHub := remote.NewLoadBalancer("round-robin", []*url.URL{}, cacheManager, transportManagerForLeaderHub, healthCheckerForLeaderHub, nil, ctx.Done())

Check warning on line 155 in cmd/yurthub/app/start.go

View check run for this annotation

Codecov / codecov/patch

cmd/yurthub/app/start.go#L154-L155

Added lines #L154 - L155 were not covered by tests

cfg.LoadBalancerForLeaderHub = loadBalancerForLeaderHub
requestMultiplexerManager := newRequestMultiplexerManager(cfg, healthCheckerForLeaderHub)

Check warning on line 158 in cmd/yurthub/app/start.go

View check run for this annotation

Codecov / codecov/patch

cmd/yurthub/app/start.go#L157-L158

Added lines #L157 - L158 were not covered by tests

if cfg.NetworkMgr != nil {
klog.Infof("%d. start network manager for ensuing dummy interface", trace)
cfg.NetworkMgr.Run(ctx.Done())
Expand All @@ -153,6 +173,7 @@ func Run(ctx context.Context, cfg *config.YurtHubConfiguration) error {
cfg,
cacheManager,
cloudHealthChecker,
requestMultiplexerManager,

Check warning on line 176 in cmd/yurthub/app/start.go

View check run for this annotation

Codecov / codecov/patch

cmd/yurthub/app/start.go#L176

Added line #L176 was not covered by tests
ctx.Done())
if err != nil {
return fmt.Errorf("could not create reverse proxy handler, %w", err)
Expand All @@ -170,3 +191,15 @@ func Run(ctx context.Context, cfg *config.YurtHubConfiguration) error {
klog.Info("hub agent exited")
return nil
}

func newRequestMultiplexerManager(cfg *config.YurtHubConfiguration, healthCheckerForLeaderHub healthchecker.Interface) *multiplexer.MultiplexerManager {
insecureHubProxyAddress := cfg.YurtHubProxyServerServing.Listener.Addr().String()
klog.Infof("hub insecure proxy address: %s", insecureHubProxyAddress)
config := &rest.Config{
Host: fmt.Sprintf("http://%s", insecureHubProxyAddress),
UserAgent: util.MultiplexerProxyClientUserAgentPrefix + cfg.NodeName,

Check warning on line 200 in cmd/yurthub/app/start.go

View check run for this annotation

Codecov / codecov/patch

cmd/yurthub/app/start.go#L195-L200

Added lines #L195 - L200 were not covered by tests
}
storageProvider := storage.NewStorageProvider(config)

Check warning on line 202 in cmd/yurthub/app/start.go

View check run for this annotation

Codecov / codecov/patch

cmd/yurthub/app/start.go#L202

Added line #L202 was not covered by tests

return multiplexer.NewRequestMultiplexerManager(cfg, storageProvider, healthCheckerForLeaderHub)

Check warning on line 204 in cmd/yurthub/app/start.go

View check run for this annotation

Codecov / codecov/patch

cmd/yurthub/app/start.go#L204

Added line #L204 was not covered by tests
}
6 changes: 5 additions & 1 deletion pkg/node-servant/components/yurthub.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ const (
type yurtHubOperator struct {
apiServerAddr string
joinToken string
nodePoolName string
yurthubHealthCheckTimeout time.Duration
}

// NewYurthubOperator new yurtHubOperator struct
func NewYurthubOperator(apiServerAddr string, joinToken string, yurthubHealthCheckTimeout time.Duration) *yurtHubOperator {
func NewYurthubOperator(apiServerAddr string, joinToken, nodePoolName string, yurthubHealthCheckTimeout time.Duration) *yurtHubOperator {

Check warning on line 59 in pkg/node-servant/components/yurthub.go

View check run for this annotation

Codecov / codecov/patch

pkg/node-servant/components/yurthub.go#L59

Added line #L59 was not covered by tests
return &yurtHubOperator{
apiServerAddr: apiServerAddr,
joinToken: joinToken,
nodePoolName: nodePoolName,

Check warning on line 63 in pkg/node-servant/components/yurthub.go

View check run for this annotation

Codecov / codecov/patch

pkg/node-servant/components/yurthub.go#L63

Added line #L63 was not covered by tests
yurthubHealthCheckTimeout: yurthubHealthCheckTimeout,
}
}
Expand Down Expand Up @@ -91,6 +93,8 @@ func (op *yurtHubOperator) Install() error {
}
klog.Infof("yurt-hub.yaml apiServerAddr: %+v", op.apiServerAddr)
yssYurtHub := strings.ReplaceAll(string(content), "KUBERNETES_SERVER_ADDRESS", op.apiServerAddr)
klog.Infof("yurt-hub.yaml nodePoolName: %s", op.nodePoolName)
yssYurtHub = strings.ReplaceAll(string(yssYurtHub), "NODE_POOL_NAME", op.nodePoolName)

Check warning on line 97 in pkg/node-servant/components/yurthub.go

View check run for this annotation

Codecov / codecov/patch

pkg/node-servant/components/yurthub.go#L96-L97

Added lines #L96 - L97 were not covered by tests
if err = os.WriteFile(getYurthubYaml(podManifestPath), []byte(yssYurtHub), fileMode); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/node-servant/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ spec:
- /bin/sh
- -c
args:
- "/usr/local/bin/entry.sh convert {{if .yurthub_healthcheck_timeout}}--yurthub-healthcheck-timeout={{.yurthub_healthcheck_timeout}} {{end}}--join-token={{.joinToken}}"
- "/usr/local/bin/entry.sh convert {{if .yurthub_healthcheck_timeout}}--yurthub-healthcheck-timeout={{.yurthub_healthcheck_timeout}} {{end}}--join-token={{.joinToken}} --nodepool-name={{.nodePoolName}}"
securityContext:
privileged: true
volumeMounts:
Expand Down
Loading

0 comments on commit c86a55a

Please sign in to comment.