Skip to content

Commit

Permalink
support --configfile for kubenest
Browse files Browse the repository at this point in the history
Signed-off-by: duanmengkk <[email protected]>
  • Loading branch information
duanmengkk committed Jul 2, 2024
1 parent 2af26a6 commit f628306
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions cmd/kubenest/operator/app/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func NewVirtualClusterOperatorCommand(ctx context.Context) *cobra.Command {
}

func runCommand(ctx context.Context, opts *options.Options) error {
ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithCancel(ctx)
defer cancel()

kc, err := SetupConfig(opts)
Expand All @@ -74,7 +74,7 @@ func runCommand(ctx context.Context, opts *options.Options) error {
func SetupConfig(opts *options.Options) (*config.Config, error) {
c := &config.Config{}

koc := v1alpha1.KubeNestConfiguration{}
var koc v1alpha1.KubeNestConfiguration
if len(opts.ConfigFile) != 0 {
ko, err := loadConfig(opts.ConfigFile)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubenest/controller/kosmos/kosmos_join_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/base64"
"fmt"
restclient "k8s.io/client-go/rest"
"os"
"reflect"
"sync"
Expand All @@ -15,6 +14,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes"
restclient "k8s.io/client-go/rest"
"k8s.io/client-go/tools/record"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down
30 changes: 15 additions & 15 deletions pkg/kubenest/controlplane/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,21 @@ func installEtcd(client clientset.Interface, name, namespace string, kubeNestCon
ETCDStorageClass, ETCDStorageSize string
IPV6First bool
}{
StatefulSetName: fmt.Sprintf("%s-%s", name, "etcd"),
Namespace: namespace,
ImageRepository: imageRepository,
Version: imageVersion,
EtcdClientService: fmt.Sprintf("%s-%s", name, "etcd-client"),
CertsSecretName: fmt.Sprintf("%s-%s", name, "etcd-cert"),
EtcdPeerServiceName: fmt.Sprintf("%s-%s", name, "etcd"),
EtcdDataVolumeName: constants.EtcdDataVolumeName,
InitialCluster: strings.Join(initialClusters, ","),
EtcdCipherSuites: strings.Join(flag.PreferredTLSCipherNames(), ","),
Replicas: constants.EtcdReplicas,
EtcdListenClientPort: constants.EtcdListenClientPort,
EtcdListenPeerPort: constants.EtcdListenPeerPort,
ETCDStorageClass: kubeNestConfiguration.KubeInKubeConfig.ETCDStorageClass,
ETCDStorageSize: resourceQuantity.String(),
StatefulSetName: fmt.Sprintf("%s-%s", name, "etcd"),
Namespace: namespace,
ImageRepository: imageRepository,
Version: imageVersion,
EtcdClientService: fmt.Sprintf("%s-%s", name, "etcd-client"),
CertsSecretName: fmt.Sprintf("%s-%s", name, "etcd-cert"),
EtcdPeerServiceName: fmt.Sprintf("%s-%s", name, "etcd"),
EtcdDataVolumeName: constants.EtcdDataVolumeName,
InitialCluster: strings.Join(initialClusters, ","),
EtcdCipherSuites: strings.Join(flag.PreferredTLSCipherNames(), ","),
Replicas: constants.EtcdReplicas,
EtcdListenClientPort: constants.EtcdListenClientPort,
EtcdListenPeerPort: constants.EtcdListenPeerPort,
ETCDStorageClass: kubeNestConfiguration.KubeInKubeConfig.ETCDStorageClass,
ETCDStorageSize: resourceQuantity.String(),
VirtualControllerLabel: vclabel,
IPV6First: IPV6FirstFlag,
})
Expand Down

0 comments on commit f628306

Please sign in to comment.