func (c *Controlplane) propagateCommon(co *Common) {
	if co == nil {
		co = &Common{}
	}
	if c.Common == nil {
		c.Common = &Common{}
	}
	co.Image = util.PickString(co.Image, c.Common.Image)
	var pkiCA types.Certificate
	if c.PKI != nil && c.PKI.Kubernetes != nil && c.PKI.Kubernetes.CA != nil {
		pkiCA = c.PKI.Kubernetes.CA.X509Certificate
	}
	var frontProxyCA types.Certificate
	if c.PKI != nil && c.PKI.Kubernetes != nil && c.PKI.Kubernetes.FrontProxyCA != nil {
		frontProxyCA = c.PKI.Kubernetes.FrontProxyCA.X509Certificate
	}
	co.KubernetesCACertificate = co.KubernetesCACertificate.Pick(c.Common.KubernetesCACertificate, pkiCA)
	co.FrontProxyCACertificate = co.FrontProxyCACertificate.Pick(c.Common.FrontProxyCACertificate, frontProxyCA)
}
propagateCommon merges given common configuration with values stored in Controlplane.
Values in given common configuration has priority over ones from the Controlplane.
package controlplane
import (
	"fmt"
	"sigs.k8s.io/yaml"
	"github.com/flexkube/libflexkube/internal/util"
	"github.com/flexkube/libflexkube/pkg/container"
	"github.com/flexkube/libflexkube/pkg/defaults"
	"github.com/flexkube/libflexkube/pkg/host"
	"github.com/flexkube/libflexkube/pkg/host/transport/ssh"
	"github.com/flexkube/libflexkube/pkg/kubernetes/client"
	"github.com/flexkube/libflexkube/pkg/pki"
	"github.com/flexkube/libflexkube/pkg/types"
)
type Common struct {
	Image string `json:"image,omitempty"`
	KubernetesCACertificate types.Certificate `json:"kubernetesCACertificate,omitempty"`
	FrontProxyCACertificate types.Certificate `json:"frontProxyCACertificate,omitempty"`
}
type Controlplane struct {
	Common *Common `json:"common,omitempty"`
	SSH *ssh.Config `json:"ssh,omitempty"`
	APIServerAddress string `json:"apiServerAddress,omitempty"`
	APIServerPort int `json:"apiServerPort,omitempty"`
	KubeAPIServer KubeAPIServer `json:"kubeAPIServer,omitempty"`
	KubeControllerManager KubeControllerManager `json:"kubeControllerManager,omitempty"`
	KubeScheduler KubeScheduler `json:"kubeScheduler,omitempty"`
	Destroy bool `json:"destroy,omitempty"`
	PKI *pki.PKI `json:"pki,omitempty"`
	State *container.ContainersState `json:"state,omitempty"`
}
type controlplane struct {
	containers container.ContainersInterface
}
func (c *Controlplane) propagateKubeconfig(d *client.Config) {
	pkiCA := types.Certificate("")
	if c.PKI != nil && c.PKI.Kubernetes != nil && c.PKI.Kubernetes.CA != nil {
		pkiCA = c.PKI.Kubernetes.CA.X509Certificate
	}
	d.CACertificate = d.CACertificate.Pick(c.Common.KubernetesCACertificate, pkiCA)
	if c.APIServerAddress != "" && c.APIServerPort != 0 {
		d.Server = util.PickString(d.Server, fmt.Sprintf("%s:%d", c.APIServerAddress, c.APIServerPort))
	}
}
func (c *Controlplane) propagateHost(h *host.Host) *host.Host {
	if h == nil {
		h = &host.Host{}
	}
	nh := host.BuildConfig(*h, host.Host{
		SSHConfig: c.SSH,
	})
	return &nh
}