func (c *initSidecar) getResources() corev1.ResourceRequirements {
	return c.Spec.PodPolicy.ExtraResources
}
getResources get the container resources.
package container
import (
	"fmt"
	"strconv"
	corev1 "k8s.io/api/core/v1"
	"github.com/radondb/radondb-mysql-kubernetes/mysqlcluster"
	"github.com/radondb/radondb-mysql-kubernetes/utils"
)
type initSidecar struct {
	*mysqlcluster.MysqlCluster
	name string
}
func (c *initSidecar) getName() string {
	return c.name
}
func (c *initSidecar) getImage() string {
	return c.Spec.PodPolicy.SidecarImage
}
func (c *initSidecar) getCommand() []string {
	return []string{"sidecar", "init"}
}
func (c *initSidecar) getEnvVars() []corev1.EnvVar {
	sctName := c.GetNameForResource(utils.Secret)
	sctNamebackup := c.Spec.BackupSecretName
	envs := []corev1.EnvVar{
		{
			Name:  "CONTAINER_TYPE",
			Value: utils.ContainerInitSidecarName,
		},
		{
			Name: "POD_HOSTNAME",
			ValueFrom: &corev1.EnvVarSource{
				FieldRef: &corev1.ObjectFieldSelector{
					APIVersion: "v1",
					FieldPath:  "metadata.name",
				},
			},
		},
		{
			Name:  "NAMESPACE",
			Value: c.Namespace,
		},
		{
			Name:  "SERVICE_NAME",
			Value: c.GetNameForResource(utils.HeadlessSVC),
		},
		{
			Name:  "STATEFULSET_NAME",
			Value: c.GetNameForResource(utils.StatefulSet),
		},
		{
			Name:  "REPLICAS",
			Value: fmt.Sprintf("%d", *c.Spec.Replicas),
		},
		{
			Name:  "ADMIT_DEFEAT_HEARBEAT_COUNT",
			Value: strconv.Itoa(int(*c.Spec.XenonOpts.AdmitDefeatHearbeatCount)),
		},
		{
			Name:  "ELECTION_TIMEOUT",
			Value: strconv.Itoa(int(*c.Spec.XenonOpts.ElectionTimeout)),
		},
		{
			Name:  "MYSQL_VERSION",
			Value: c.GetMySQLVersion(),
		},
		{
			Name:  "RESTORE_FROM",
			Value: c.Spec.RestoreFrom,
		},
		getEnvVarFromSecret(sctName, "MYSQL_ROOT_PASSWORD", "root-password", false),
		getEnvVarFromSecret(sctName, "INTERNAL_ROOT_PASSWORD", "internal-root-password", true),
		getEnvVarFromSecret(sctName, "MYSQL_DATABASE", "mysql-database", true),
		getEnvVarFromSecret(sctName, "MYSQL_USER", "mysql-user", true),
		getEnvVarFromSecret(sctName, "MYSQL_PASSWORD", "mysql-password", true),
		getEnvVarFromSecret(sctName, "MYSQL_REPL_USER", "replication-user", true),
		getEnvVarFromSecret(sctName, "MYSQL_REPL_PASSWORD", "replication-password", true),
		getEnvVarFromSecret(sctName, "METRICS_USER", "metrics-user", true),
		getEnvVarFromSecret(sctName, "METRICS_PASSWORD", "metrics-password", true),
		getEnvVarFromSecret(sctName, "OPERATOR_USER", "operator-user", true),
		getEnvVarFromSecret(sctName, "OPERATOR_PASSWORD", "operator-password", true),
		getEnvVarFromSecret(sctName, "BACKUP_USER", "backup-user", true),
		getEnvVarFromSecret(sctName, "BACKUP_PASSWORD", "backup-password", true),
	}
	if len(c.Spec.BackupSecretName) != 0 {
		envs = append(envs,
			getEnvVarFromSecret(sctNamebackup, "S3_ENDPOINT", "s3-endpoint", false),
			getEnvVarFromSecret(sctNamebackup, "S3_ACCESSKEY", "s3-access-key", true),
			getEnvVarFromSecret(sctNamebackup, "S3_SECRETKEY", "s3-secret-key", true),
			getEnvVarFromSecret(sctNamebackup, "S3_BUCKET", "s3-bucket", true),
		)
	}
	if c.Spec.MysqlOpts.InitTokuDB {
		envs = append(envs, corev1.EnvVar{
			Name:  "INIT_TOKUDB",
			Value: "1",
		})
	}
	return envs
}
func (c *initSidecar) getLifecycle() *corev1.Lifecycle {
	return nil
}