Skip to content

Commit

Permalink
add system-default-registry setting (#132)
Browse files Browse the repository at this point in the history
Signed-off-by: nasusoba <[email protected]>

fix conversion

Co-authored-by: qi liang <[email protected]>
  • Loading branch information
nasusoba and qi liang authored Jun 17, 2024
1 parent 1fad6b8 commit 661bbbe
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bootstrap/api/v1beta1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func (c *KThreesConfig) ConvertTo(dstRaw ctrlconversion.Hub) error {
dst.Spec.ServerConfig.CloudProviderName = restored.Spec.ServerConfig.CloudProviderName
dst.Spec.ServerConfig.DeprecatedDisableExternalCloudProvider = restored.Spec.ServerConfig.DeprecatedDisableExternalCloudProvider
dst.Spec.ServerConfig.DisableCloudController = restored.Spec.ServerConfig.DisableCloudController
dst.Spec.ServerConfig.SystemDefaultRegistry = restored.Spec.ServerConfig.SystemDefaultRegistry
return nil
}

Expand Down Expand Up @@ -94,6 +95,7 @@ func (r *KThreesConfigTemplate) ConvertTo(dstRaw ctrlconversion.Hub) error {
dst.Spec.Template.Spec.ServerConfig.CloudProviderName = restored.Spec.Template.Spec.ServerConfig.CloudProviderName
dst.Spec.Template.Spec.ServerConfig.DeprecatedDisableExternalCloudProvider = restored.Spec.Template.Spec.ServerConfig.DeprecatedDisableExternalCloudProvider
dst.Spec.Template.Spec.ServerConfig.DisableCloudController = restored.Spec.Template.Spec.ServerConfig.DisableCloudController
dst.Spec.Template.Spec.ServerConfig.SystemDefaultRegistry = restored.Spec.Template.Spec.ServerConfig.SystemDefaultRegistry
return nil
}

Expand Down
1 change: 1 addition & 0 deletions bootstrap/api/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions bootstrap/api/v1beta2/kthreesconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ type KThreesServerConfig struct {
// CloudProviderName defines the --cloud-provider= kubelet extra arg. (default: "external")
// +optional
CloudProviderName *string `json:"cloudProviderName,omitempty"`

// SystemDefaultRegistry defines private registry to be used for all system images
// +optional
SystemDefaultRegistry string `json:"systemDefaultRegistry,omitempty"`
}

type KThreesAgentConfig struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,10 @@ spec:
description: 'ServiceCidr Network CIDR to use for services IPs
(default: "10.43.0.0/16")'
type: string
systemDefaultRegistry:
description: SystemDefaultRegistry defines private registry to
be used for all system images
type: string
tlsSan:
description: TLSSan Add additional hostname or IP as a Subject
Alternative Name in the TLS cert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,10 @@ spec:
description: 'ServiceCidr Network CIDR to use for services
IPs (default: "10.43.0.0/16")'
type: string
systemDefaultRegistry:
description: SystemDefaultRegistry defines private registry
to be used for all system images
type: string
tlsSan:
description: TLSSan Add additional hostname or IP as a
Subject Alternative Name in the TLS cert
Expand Down
1 change: 1 addition & 0 deletions controlplane/api/v1beta1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func (in *KThreesControlPlane) ConvertTo(dstRaw ctrlconversion.Hub) error {
dst.Spec.KThreesConfigSpec.ServerConfig.CloudProviderName = restored.Spec.KThreesConfigSpec.ServerConfig.CloudProviderName
dst.Spec.KThreesConfigSpec.ServerConfig.DeprecatedDisableExternalCloudProvider = restored.Spec.KThreesConfigSpec.ServerConfig.DeprecatedDisableExternalCloudProvider
dst.Spec.KThreesConfigSpec.ServerConfig.DisableCloudController = restored.Spec.KThreesConfigSpec.ServerConfig.DisableCloudController
dst.Spec.KThreesConfigSpec.ServerConfig.SystemDefaultRegistry = restored.Spec.KThreesConfigSpec.ServerConfig.SystemDefaultRegistry
dst.Spec.MachineTemplate.NodeVolumeDetachTimeout = restored.Spec.MachineTemplate.NodeVolumeDetachTimeout
dst.Spec.MachineTemplate.NodeDeletionTimeout = restored.Spec.MachineTemplate.NodeDeletionTimeout
dst.Status.Version = restored.Status.Version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,10 @@ spec:
description: 'ServiceCidr Network CIDR to use for services
IPs (default: "10.43.0.0/16")'
type: string
systemDefaultRegistry:
description: SystemDefaultRegistry defines private registry
to be used for all system images
type: string
tlsSan:
description: TLSSan Add additional hostname or IP as a Subject
Alternative Name in the TLS cert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ spec:
description: 'ServiceCidr Network CIDR to use for
services IPs (default: "10.43.0.0/16")'
type: string
systemDefaultRegistry:
description: SystemDefaultRegistry defines private
registry to be used for all system images
type: string
tlsSan:
description: TLSSan Add additional hostname or IP
as a Subject Alternative Name in the TLS cert
Expand Down
3 changes: 3 additions & 0 deletions pkg/k3s/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type K3sServerConfig struct {
ClusterDomain string `json:"cluster-domain,omitempty"`
DisableComponents []string `json:"disable,omitempty"`
ClusterInit bool `json:"cluster-init,omitempty"`
SystemDefaultRegistry string `json:"system-default-registry,omitempty"`
K3sAgentConfig `json:",inline"`
}

Expand Down Expand Up @@ -57,6 +58,7 @@ func GenerateInitControlPlaneConfig(controlPlaneEndpoint string, token string, s
ClusterDNS: serverConfig.ClusterDNS,
ClusterDomain: serverConfig.ClusterDomain,
DisableComponents: serverConfig.DisableComponents,
SystemDefaultRegistry: serverConfig.SystemDefaultRegistry,
}

k3sServerConfig.K3sAgentConfig = K3sAgentConfig{
Expand Down Expand Up @@ -89,6 +91,7 @@ func GenerateJoinControlPlaneConfig(serverURL string, token string, controlplane
ClusterDNS: serverConfig.ClusterDNS,
ClusterDomain: serverConfig.ClusterDomain,
DisableComponents: serverConfig.DisableComponents,
SystemDefaultRegistry: serverConfig.SystemDefaultRegistry,
}

k3sServerConfig.K3sAgentConfig = K3sAgentConfig{
Expand Down

0 comments on commit 661bbbe

Please sign in to comment.