Skip to content

Commit

Permalink
Merge pull request #452 from simplysoft/fix/rke2-server-config-cidrs
Browse files Browse the repository at this point in the history
Pass multiple CIDRs to RKE2 server config
  • Loading branch information
furkatgofurov7 authored Oct 24, 2024
2 parents 28586d2 + 7fd28be commit f1892ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/rke2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package rke2
import (
"context"
"fmt"
"strings"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -197,13 +198,13 @@ func newRKE2ServerConfig(opts ServerConfigOpts) (*ServerConfig, []bootstrapv1.Fi
if opts.Cluster.Spec.ClusterNetwork != nil &&
opts.Cluster.Spec.ClusterNetwork.Pods != nil &&
len(opts.Cluster.Spec.ClusterNetwork.Pods.CIDRBlocks) > 0 {
rke2ServerConfig.ClusterCIDR = opts.Cluster.Spec.ClusterNetwork.Pods.CIDRBlocks[0]
rke2ServerConfig.ClusterCIDR = strings.Join(opts.Cluster.Spec.ClusterNetwork.Pods.CIDRBlocks, ",")
}

if opts.Cluster.Spec.ClusterNetwork != nil &&
opts.Cluster.Spec.ClusterNetwork.Services != nil &&
len(opts.Cluster.Spec.ClusterNetwork.Services.CIDRBlocks) > 0 {
rke2ServerConfig.ServiceCIDR = opts.Cluster.Spec.ClusterNetwork.Services.CIDRBlocks[0]
rke2ServerConfig.ServiceCIDR = strings.Join(opts.Cluster.Spec.ClusterNetwork.Services.CIDRBlocks, ",")
}

rke2ServerConfig.BindAddress = opts.ServerConfig.BindAddress
Expand Down

0 comments on commit f1892ab

Please sign in to comment.