Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: tiansuo114 <[email protected]>
  • Loading branch information
tiansuo114 committed Sep 24, 2024
1 parent 5f9b5e4 commit 63b56e4
Showing 1 changed file with 84 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,146 +224,146 @@ With these flag, we will:
Based on my classification of dozens of flags in the current `karmadactl init` command, I have designed the following data structure:

```go
// InitConfiguration holds the configuration for initializing a Kubernetes cluster.
type InitConfiguration struct {
metav1.TypeMeta json:",inline"
metav1.TypeMeta `json:",inline"`
// GeneralConfig contains the common configuration at initialization.
GeneralConfig GeneralConfig yaml:"general"
// GeneralConfig contains the common configuration at initialization.
GeneralConfig GeneralConfig `yaml:"generalConfig"`
// CertificateConfig contains configurations related to certificates.
CertificateConfig CertificateConfig yaml:"certificate"
// CertificateConfig contains configurations related to certificates.
CertificateConfig CertificateConfig `yaml:"certificateConfig"`
// EtcdConfig contains configuration for etcd.
EtcdConfig EtcdConfig yaml:"etcd"
// EtcdConfig contains configuration for etcd.
EtcdConfig EtcdConfig `yaml:"etcdConfig"`
// KarmadaControlPlaneConfig contains control plane configurations.
KarmadaControlPlaneConfig KarmadaControlPlaneConfig yaml:"karmadaControlPlane"
// KarmadaControlPlaneConfig contains control plane configurations.
KarmadaControlPlaneConfig KarmadaControlPlaneConfig `yaml:"karmadaControlPlaneConfig"`
// ImageConfig contains image-related configurations.
ImageConfig ImageConfig `yaml:"imageConfig"`
}
// GeneralConfig contains general configuration parameters.
type GeneralConfig struct {
Namespace string yaml:"namespace"
KubeConfigPath string yaml:"kubeConfigPath"
KubeImageTag string yaml:"kubeImageTag"
KubeContextName string yaml:"context"
KubeStorageClassesName string yaml:"storageClassesName"
PrivateImageRegistry string yaml:"privateImageRegistry"
WaitComponentReadyTimeout int yaml:"waitComponentReadyTimeout"
Port int yaml:"port"
StorageClassesName string yaml:"storageClassesName"
// ImageConfig contains image-related configurations.
ImageConfig ImageConfig yaml:"image"
}
// ImageConfig contains configuration for images used in the cluster.
type ImageConfig struct {
KubeImageTag string yaml:"kubeImageTag"
KubeImageRegistry string yaml:"kubeImageRegistry"
KubeImageMirrorCountry string yaml:"kubeImageMirrorCountry"
ImagePullPolicy string yaml:"imagePullPolicy"
ImagePullSecrets []string yaml:"imagePullSecrets"
Namespace string `yaml:"namespace"`
KubeConfigPath string `yaml:"kubeConfigPath"`
KubeImageTag string `yaml:"kubeImageTag"`
Context string `yaml:"context"`
PrivateImageRegistry string `yaml:"privateImageRegistry"`
WaitComponentReadyTimeout int `yaml:"waitComponentReadyTimeout"`
StorageClassesName string `yaml:"storageClassesName"`
}
// CertificateConfig contains certificate-related configuration.
type CertificateConfig struct {
ExternalDNS []string yaml:"externalDNS"
ExternalIP []string yaml:"externalIP"
ValidityPeriod string yaml:"validityPeriod"
CaCertFile string yaml:"caCertFile"
CaCertKeyFile string yaml:"caCertKeyFile"
ExtraArgs []Arg yaml:"extraArgs"
ExternalDNS []string `yaml:"externalDNS"`
ExternalIP []string `yaml:"externalIP"`
ValidityPeriod string `yaml:"validityPeriod"`
CaCertFile string `yaml:"caCertFile"`
CaCertKeyFile string `yaml:"caCertKeyFile"`
ExtraArgs []Arg `yaml:"extraArgs"`
}
// EtcdConfig contains etcd configuration parameters.
type EtcdConfig struct {
Local *LocalEtcd json:"local,omitempty"
External *ExternalEtcd json:"external,omitempty"
Local *LocalEtcd `json:"local,omitempty"`
External *ExternalEtcd `json:"external,omitempty"`
}
// LocalEtcd contains configuration for a local etcd instance.
type LocalEtcd struct {
Image string yaml:"image"
InitImage string yaml:"initImage"
DataDir string yaml:"dataDir"
PVCSize string yaml:"pvcSize"
NodeSelectorLabels map[string]string yaml:"nodeSelectorLabels"
StorageMode string yaml:"storageMode"
Replicas int32 yaml:"replicas"
ExtraArgs []Arg yaml:"extraArgs"
Image string `yaml:"image"`
InitImage string `yaml:"initImage"`
DataDir string `yaml:"dataDir"`
PVCSize string `yaml:"pvcSize"`
NodeSelectorLabels map[string]string `yaml:"nodeSelectorLabels"`
StorageMode string `yaml:"storageMode"`
Replicas int32 `yaml:"replicas"`
ExtraArgs []Arg `yaml:"extraArgs"`
}
// ExternalEtcd contains configuration for connecting to an external etcd cluster.
type ExternalEtcd struct {
CAPath string yaml:"caPath"
CertPath string yaml:"certPath"
KeyPath string yaml:"keyPath"
Servers string yaml:"servers"
Prefix string yaml:"prefix"
ExtraArgs []Arg yaml:"extraArgs"
ExternalCAPath string `yaml:"externalCAPath"`
ExternalCertPath string `yaml:"externalCertPath"`
ExternalKeyPath string `yaml:"externalKeyPath"`
ExternalServers string `yaml:"externalServers"`
ExternalPrefix string `yaml:"externalPrefix"`
ExtraArgs []Arg `yaml:"extraArgs"`
}
// KarmadaControlPlaneConfig contains configuration for the control plane components.
type KarmadaControlPlaneConfig struct {
APIServer APIServerConfig yaml:"apiServer"
ControllerManager ControllerManagerConfig yaml:"controllerManager"
Scheduler SchedulerConfig yaml:"scheduler"
Webhook WebhookConfig yaml:"webhook"
AggregatedAPIServerConfig AggregatedAPIServerConfig yaml:"aggregatedAPIServerConfig"
KubeControllerManagerConfig KubeControllerManagerConfig yaml:"kubeControllerManagerConfig"
DataPath string yaml:"dataPath"
PkiPath string yaml:"pkiPath"
CRDs string yaml:"crds"
HostClusterDomain string yaml:"hostClusterDomain"
APIServer APIServerConfig `yaml:"apiServer"`
ControllerManager ControllerManagerConfig `yaml:"controllerManager"`
Scheduler SchedulerConfig `yaml:"scheduler"`
Webhook WebhookConfig `yaml:"webhook"`
AggregatedAPIServerConfig AggregatedAPIServerConfig `yaml:"aggregatedAPIServerConfig"`
KubeControllerManagerConfig KubeControllerManagerConfig `yaml:"kubeControllerManagerConfig"`
DataPath string `yaml:"dataPath"`
PkiPath string `yaml:"pkiPath"`
CRDs string `yaml:"crds"`
HostClusterDomain string `yaml:"hostClusterDomain"`
}
// APIServerConfig contains configuration for the API server.
type APIServerConfig struct {
Image string yaml:"image"
AdvertiseAddress string yaml:"advertiseAddress"
Replicas int32 yaml:"replicas"
NodePort int32 yaml:"nodePort"
ExtraArgs []Arg yaml:"extraArgs"
Image string `yaml:"image"`
AdvertiseAddress string `yaml:"advertiseAddress"`
Replicas int32 `yaml:"replicas"`
NodePort int32 `yaml:"nodePort"`
ExtraArgs []Arg `yaml:"extraArgs"`
}
// ControllerManagerConfig contains configuration for the controller manager.
type ControllerManagerConfig struct {
Image string yaml:"image"
Replicas int32 yaml:"replicas"
ExtraArgs []Arg yaml:"extraArgs"
Image string `yaml:"image"`
Replicas int32 `yaml:"replicas"`
ExtraArgs []Arg `yaml:"extraArgs"`
}
// SchedulerConfig contains configuration for the scheduler.
type SchedulerConfig struct {
Image string yaml:"image"
Replicas int32 yaml:"replicas"
ExtraArgs []Arg yaml:"extraArgs"
Image string `yaml:"image"`
Replicas int32 `yaml:"replicas"`
ExtraArgs []Arg `yaml:"extraArgs"`
}
// WebhookConfig contains configuration for the webhook.
type WebhookConfig struct {
Image string yaml:"image"
Replicas int32 yaml:"replicas"
ExtraArgs []Arg yaml:"extraArgs"
Image string `yaml:"image"`
Replicas int32 `yaml:"replicas"`
ExtraArgs []Arg `yaml:"extraArgs"`
}
// AggregatedAPIServerConfig contains configuration for the aggregated API server.
type AggregatedAPIServerConfig struct {
Image string yaml:"image"
Replicas int32 yaml:"replicas"
ExtraArgs []Arg yaml:"extraArgs"
Image string `yaml:"image"`
Replicas int32 `yaml:"replicas"`
ExtraArgs []Arg `yaml:"extraArgs"`
}
// KubeControllerManagerConfig contains configuration for the kube-controller-manager.
type KubeControllerManagerConfig struct {
Image string yaml:"image"
Replicas int32 yaml:"replicas"
ExtraArgs []Arg yaml:"extraArgs"
Image string `yaml:"image"`
Replicas int32 `yaml:"replicas"`
ExtraArgs []Arg `yaml:"extraArgs"`
}
// ImageConfig contains configuration for images used in the cluster.
type ImageConfig struct {
KubeImageTag string `yaml:"kubeImageTag"`
KubeImageRegistry string `yaml:"kubeImageRegistry"`
KubeImageMirrorCountry string `yaml:"kubeImageMirrorCountry"`
ImagePullPolicy string `yaml:"imagePullPolicy"`
ImagePullSecrets []string `yaml:"imagePullSecrets"`
}
// Arg represents a name-value pair argument.
type Arg struct {
Name string yaml:"name"
Value string yaml:"value"
Name string `yaml:"name"`
Value string `yaml:"value"`
}
```
Expand Down

0 comments on commit 63b56e4

Please sign in to comment.