remove variable changes
This commit is contained in:
parent
13f492ae43
commit
9a83199ffe
|
|
@ -152,7 +152,7 @@ type LoadBalancerConfiguration struct {
|
|||
// AWSGCPConfiguration defines the configuration for AWS
|
||||
// TODO complete Google Cloud Platform (GCP) configuration
|
||||
type AWSGCPConfiguration struct {
|
||||
WALS3Bucket string `json:"wal_s3_bucket,omitempty"`
|
||||
WALES3Bucket string `json:"wal_s3_bucket,omitempty"`
|
||||
AWSRegion string `json:"aws_region,omitempty"`
|
||||
WALGSBucket string `json:"wal_gs_bucket,omitempty"`
|
||||
GCPCredentials string `json:"gcp_credentials,omitempty"`
|
||||
|
|
|
|||
|
|
@ -1052,8 +1052,8 @@ func (c *Cluster) generateSpiloPodEnvVars(
|
|||
|
||||
// global variables derived from operator configuration
|
||||
opConfigEnvVars := make([]v1.EnvVar, 0)
|
||||
if c.OpConfig.WALS3Bucket != "" {
|
||||
opConfigEnvVars = append(opConfigEnvVars, v1.EnvVar{Name: "WAL_S3_BUCKET", Value: c.OpConfig.WALS3Bucket})
|
||||
if c.OpConfig.WALES3Bucket != "" {
|
||||
opConfigEnvVars = append(opConfigEnvVars, v1.EnvVar{Name: "WAL_S3_BUCKET", Value: c.OpConfig.WALES3Bucket})
|
||||
opConfigEnvVars = append(opConfigEnvVars, v1.EnvVar{Name: "WAL_BUCKET_SCOPE_SUFFIX", Value: getBucketScopeSuffix(string(uid))})
|
||||
opConfigEnvVars = append(opConfigEnvVars, v1.EnvVar{Name: "WAL_BUCKET_SCOPE_PREFIX", Value: ""})
|
||||
}
|
||||
|
|
@ -2118,9 +2118,9 @@ func (c *Cluster) generateCloneEnvironment(description *acidv1.CloneDescription)
|
|||
if description.S3WalPath == "" {
|
||||
c.logger.Info("no S3 WAL path defined - taking value from global config", description.S3WalPath)
|
||||
|
||||
if c.OpConfig.WALS3Bucket != "" {
|
||||
c.logger.Debugf("found WALS3Bucket %s - will set CLONE_WAL_S3_BUCKET", c.OpConfig.WALS3Bucket)
|
||||
result = append(result, v1.EnvVar{Name: "CLONE_WAL_S3_BUCKET", Value: c.OpConfig.WALS3Bucket})
|
||||
if c.OpConfig.WALES3Bucket != "" {
|
||||
c.logger.Debugf("found WALES3Bucket %s - will set CLONE_WAL_S3_BUCKET", c.OpConfig.WALES3Bucket)
|
||||
result = append(result, v1.EnvVar{Name: "CLONE_WAL_S3_BUCKET", Value: c.OpConfig.WALES3Bucket})
|
||||
} else if c.OpConfig.WALGSBucket != "" {
|
||||
c.logger.Debugf("found WALGSBucket %s - will set CLONE_WAL_GS_BUCKET", c.OpConfig.WALGSBucket)
|
||||
result = append(result, v1.EnvVar{Name: "CLONE_WAL_GS_BUCKET", Value: c.OpConfig.WALGSBucket})
|
||||
|
|
@ -2139,21 +2139,19 @@ func (c *Cluster) generateCloneEnvironment(description *acidv1.CloneDescription)
|
|||
} else {
|
||||
c.logger.Debugf("use S3WalPath %s from the manifest", description.S3WalPath)
|
||||
|
||||
// add if
|
||||
result = append(result, v1.EnvVar{
|
||||
Name: "CLONE_WALG_S3_PREFIX",
|
||||
Name: "CLONE_WALE_S3_PREFIX",
|
||||
Value: description.S3WalPath,
|
||||
})
|
||||
}
|
||||
|
||||
// if else wal-g
|
||||
result = append(result, v1.EnvVar{Name: "CLONE_METHOD", Value: "CLONE_WITH_WALG"})
|
||||
result = append(result, v1.EnvVar{Name: "CLONE_METHOD", Value: "CLONE_WITH_WALE"})
|
||||
result = append(result, v1.EnvVar{Name: "CLONE_TARGET_TIME", Value: description.EndTimestamp})
|
||||
result = append(result, v1.EnvVar{Name: "CLONE_WAL_BUCKET_SCOPE_PREFIX", Value: ""})
|
||||
|
||||
if description.S3Endpoint != "" {
|
||||
result = append(result, v1.EnvVar{Name: "CLONE_AWS_ENDPOINT", Value: description.S3Endpoint})
|
||||
result = append(result, v1.EnvVar{Name: "CLONE_WALG_S3_ENDPOINT", Value: description.S3Endpoint})
|
||||
result = append(result, v1.EnvVar{Name: "CLONE_WALE_S3_ENDPOINT", Value: description.S3Endpoint})
|
||||
}
|
||||
|
||||
if description.S3AccessKeyId != "" {
|
||||
|
|
@ -2197,12 +2195,12 @@ func (c *Cluster) generateStandbyEnvironment(description *acidv1.StandbyDescript
|
|||
c.logger.Info("standby cluster streaming from WAL location")
|
||||
if description.S3WalPath != "" {
|
||||
result = append(result, v1.EnvVar{
|
||||
Name: "STANDBY_WALG_S3_PREFIX",
|
||||
Name: "STANDBY_WALE_S3_PREFIX",
|
||||
Value: description.S3WalPath,
|
||||
})
|
||||
} else if description.GSWalPath != "" {
|
||||
result = append(result, v1.EnvVar{
|
||||
Name: "STANDBY_WALG_GS_PREFIX",
|
||||
Name: "STANDBY_WALE_GS_PREFIX",
|
||||
Value: description.GSWalPath,
|
||||
})
|
||||
} else {
|
||||
|
|
@ -2211,7 +2209,7 @@ func (c *Cluster) generateStandbyEnvironment(description *acidv1.StandbyDescript
|
|||
}
|
||||
|
||||
// if use wal-g
|
||||
result = append(result, v1.EnvVar{Name: "STANDBY_METHOD", Value: "STANDBY_WITH_WALG"})
|
||||
result = append(result, v1.EnvVar{Name: "STANDBY_METHOD", Value: "STANDBY_WITH_WALE"})
|
||||
result = append(result, v1.EnvVar{Name: "STANDBY_WAL_BUCKET_SCOPE_PREFIX", Value: ""})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -665,7 +665,7 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
|||
expectedCloneEnvSpec := []ExpectedValue{
|
||||
{
|
||||
envIndex: 16,
|
||||
envVarConstant: "CLONE_WALG_S3_PREFIX",
|
||||
envVarConstant: "CLONE_WALE_S3_PREFIX",
|
||||
envVarValue: "s3://another-bucket",
|
||||
},
|
||||
{
|
||||
|
|
@ -687,7 +687,7 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
|||
},
|
||||
{
|
||||
envIndex: 17,
|
||||
envVarConstant: "CLONE_WALG_S3_PREFIX",
|
||||
envVarConstant: "CLONE_WALE_S3_PREFIX",
|
||||
envVarValue: "s3://another-bucket",
|
||||
},
|
||||
{
|
||||
|
|
@ -730,7 +730,7 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
|||
expectedStandbyEnvSecret := []ExpectedValue{
|
||||
{
|
||||
envIndex: 15,
|
||||
envVarConstant: "STANDBY_WALG_GS_PREFIX",
|
||||
envVarConstant: "STANDBY_WALE_GS_PREFIX",
|
||||
envVarValue: "gs://some/path/",
|
||||
},
|
||||
{
|
||||
|
|
@ -767,7 +767,7 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
|||
{
|
||||
subTest: "will set WAL_S3_BUCKET env",
|
||||
opConfig: config.Config{
|
||||
WALS3Bucket: "global-s3-bucket",
|
||||
WALES3Bucket: "global-s3-bucket",
|
||||
},
|
||||
cloneDescription: &acidv1.CloneDescription{},
|
||||
standbyDescription: &acidv1.StandbyDescription{},
|
||||
|
|
@ -815,7 +815,7 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
|||
Name: testPodEnvironmentConfigMapName,
|
||||
},
|
||||
},
|
||||
WALS3Bucket: "global-s3-bucket",
|
||||
WALES3Bucket: "global-s3-bucket",
|
||||
},
|
||||
cloneDescription: &acidv1.CloneDescription{},
|
||||
standbyDescription: &acidv1.StandbyDescription{},
|
||||
|
|
@ -903,7 +903,7 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
|||
Name: testPodEnvironmentConfigMapName,
|
||||
},
|
||||
},
|
||||
WALS3Bucket: "global-s3-bucket",
|
||||
WALES3Bucket: "global-s3-bucket",
|
||||
},
|
||||
cloneDescription: &acidv1.CloneDescription{
|
||||
ClusterName: "test-cluster",
|
||||
|
|
@ -923,7 +923,7 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
|||
Name: testPodEnvironmentConfigMapName,
|
||||
},
|
||||
},
|
||||
WALS3Bucket: "global-s3-bucket",
|
||||
WALES3Bucket: "global-s3-bucket",
|
||||
},
|
||||
cloneDescription: &acidv1.CloneDescription{
|
||||
ClusterName: "test-cluster",
|
||||
|
|
@ -953,7 +953,7 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
|||
Name: testPodEnvironmentConfigMapName,
|
||||
},
|
||||
},
|
||||
WALS3Bucket: "global-s3-bucket",
|
||||
WALES3Bucket: "global-s3-bucket",
|
||||
},
|
||||
cloneDescription: &acidv1.CloneDescription{
|
||||
ClusterName: "test-cluster",
|
||||
|
|
@ -971,7 +971,7 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
|||
ResourceCheckInterval: time.Duration(testResourceCheckInterval),
|
||||
ResourceCheckTimeout: time.Duration(testResourceCheckTimeout),
|
||||
},
|
||||
WALS3Bucket: "global-s3-bucket",
|
||||
WALES3Bucket: "global-s3-bucket",
|
||||
},
|
||||
cloneDescription: &acidv1.CloneDescription{
|
||||
ClusterName: "test-cluster",
|
||||
|
|
@ -989,7 +989,7 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
|||
ResourceCheckInterval: time.Duration(testResourceCheckInterval),
|
||||
ResourceCheckTimeout: time.Duration(testResourceCheckTimeout),
|
||||
},
|
||||
WALS3Bucket: "global-s3-bucket",
|
||||
WALES3Bucket: "global-s3-bucket",
|
||||
},
|
||||
cloneDescription: &acidv1.CloneDescription{},
|
||||
standbyDescription: &acidv1.StandbyDescription{
|
||||
|
|
@ -1177,7 +1177,7 @@ func TestCloneEnv(t *testing.T) {
|
|||
EndTimestamp: "somewhen",
|
||||
},
|
||||
env: v1.EnvVar{
|
||||
Name: "CLONE_WALG_S3_PREFIX",
|
||||
Name: "CLONE_WALE_S3_PREFIX",
|
||||
Value: "s3://some/path/",
|
||||
},
|
||||
envPos: 1,
|
||||
|
|
@ -1213,7 +1213,7 @@ func TestCloneEnv(t *testing.T) {
|
|||
var cluster = New(
|
||||
Config{
|
||||
OpConfig: config.Config{
|
||||
WALS3Bucket: "wal-bucket",
|
||||
WALES3Bucket: "wal-bucket",
|
||||
ProtectedRoles: []string{"admin"},
|
||||
Auth: config.Auth{
|
||||
SuperUsername: superUserName,
|
||||
|
|
@ -1325,7 +1325,7 @@ func TestStandbyEnv(t *testing.T) {
|
|||
S3WalPath: "s3://some/path/",
|
||||
},
|
||||
env: v1.EnvVar{
|
||||
Name: "STANDBY_WALG_S3_PREFIX",
|
||||
Name: "STANDBY_WALE_S3_PREFIX",
|
||||
Value: "s3://some/path/",
|
||||
},
|
||||
envPos: 0,
|
||||
|
|
@ -1339,7 +1339,7 @@ func TestStandbyEnv(t *testing.T) {
|
|||
},
|
||||
env: v1.EnvVar{
|
||||
Name: "STANDBY_METHOD",
|
||||
Value: "STANDBY_WITH_WALG",
|
||||
Value: "STANDBY_WITH_WALE",
|
||||
},
|
||||
envPos: 1,
|
||||
envLen: 3,
|
||||
|
|
|
|||
|
|
@ -741,7 +741,7 @@ func TestSyncStandbyClusterConfiguration(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
|
||||
// check that pods do not have a STANDBY_* environment variable
|
||||
assert.NotContains(t, sts.Spec.Template.Spec.Containers[0].Env, v1.EnvVar{Name: "STANDBY_METHOD", Value: "STANDBY_WITH_WALG"})
|
||||
assert.NotContains(t, sts.Spec.Template.Spec.Containers[0].Env, v1.EnvVar{Name: "STANDBY_METHOD", Value: "STANDBY_WITH_WALE"})
|
||||
|
||||
// add standby section
|
||||
cluster.Spec.StandbyCluster = &acidv1.StandbyDescription{
|
||||
|
|
@ -751,13 +751,13 @@ func TestSyncStandbyClusterConfiguration(t *testing.T) {
|
|||
updatedSts := cluster.Statefulset
|
||||
|
||||
// check that pods do not have a STANDBY_* environment variable
|
||||
assert.Contains(t, updatedSts.Spec.Template.Spec.Containers[0].Env, v1.EnvVar{Name: "STANDBY_METHOD", Value: "STANDBY_WITH_WALG"})
|
||||
assert.Contains(t, updatedSts.Spec.Template.Spec.Containers[0].Env, v1.EnvVar{Name: "STANDBY_METHOD", Value: "STANDBY_WITH_WALE"})
|
||||
|
||||
// this should update the Patroni config
|
||||
err = cluster.syncStandbyClusterConfiguration()
|
||||
assert.NoError(t, err)
|
||||
|
||||
configJson = `{"standby_cluster":{"create_replica_methods":["bootstrap_standby_with_g","basebackup_fast_xlog"],"restore_command":"envdir \"/run/etc/wal-g.d/env-standby\" /scripts/restore_command.sh \"%f\" \"%p\""}, "ttl": 20}`
|
||||
configJson = `{"standby_cluster":{"create_replica_methods":["bootstrap_standby_with_walg","basebackup_fast_xlog"],"restore_command":"envdir \"/run/etc/wal-g.d/env-standby\" /scripts/restore_command.sh \"%f\" \"%p\""}, "ttl": 20}`
|
||||
r = io.NopCloser(bytes.NewReader([]byte(configJson)))
|
||||
response = http.Response{
|
||||
StatusCode: 200,
|
||||
|
|
@ -774,7 +774,7 @@ func TestSyncStandbyClusterConfiguration(t *testing.T) {
|
|||
/*
|
||||
defaultStandbyParameters := map[string]interface{}{
|
||||
"create_replica_methods": []string{"bootstrap_standby_with_walg", "basebackup_fast_xlog"},
|
||||
"restore_command": "envdir \"/run/etc/wal-g.d/env-standby\" /scripts/restore_command.sh \"%f\" \"%p\"",
|
||||
"restore_command": "envdir \"/run/etc/wal-e.d/env-standby\" /scripts/restore_command.sh \"%f\" \"%p\"",
|
||||
}
|
||||
assert.True(t, reflect.DeepEqual(defaultStandbyParameters, standbyCluster))
|
||||
*/
|
||||
|
|
@ -784,7 +784,7 @@ func TestSyncStandbyClusterConfiguration(t *testing.T) {
|
|||
updatedSts2 := cluster.Statefulset
|
||||
|
||||
// check that pods do not have a STANDBY_* environment variable
|
||||
assert.NotContains(t, updatedSts2.Spec.Template.Spec.Containers[0].Env, v1.EnvVar{Name: "STANDBY_METHOD", Value: "STANDBY_WITH_WALG"})
|
||||
assert.NotContains(t, updatedSts2.Spec.Template.Spec.Containers[0].Env, v1.EnvVar{Name: "STANDBY_METHOD", Value: "STANDBY_WITH_WALE"})
|
||||
|
||||
// this should update the Patroni config again
|
||||
err = cluster.syncStandbyClusterConfiguration()
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ func (c *Controller) importConfigurationFromCRD(fromCRD *acidv1.OperatorConfigur
|
|||
result.ExternalTrafficPolicy = util.Coalesce(fromCRD.LoadBalancer.ExternalTrafficPolicy, "Cluster")
|
||||
|
||||
// AWS or GCP config
|
||||
result.WALS3Bucket = fromCRD.AWSGCP.WALS3Bucket
|
||||
result.WALES3Bucket = fromCRD.AWSGCP.WALES3Bucket
|
||||
result.AWSRegion = fromCRD.AWSGCP.AWSRegion
|
||||
result.LogS3Bucket = fromCRD.AWSGCP.LogS3Bucket
|
||||
result.KubeIAMRole = fromCRD.AWSGCP.KubeIAMRole
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ type Config struct {
|
|||
MasterPodMoveTimeout time.Duration `name:"master_pod_move_timeout" default:"20m"`
|
||||
DbHostedZone string `name:"db_hosted_zone" default:"db.example.com"`
|
||||
AWSRegion string `name:"aws_region" default:"eu-central-1"`
|
||||
WALS3Bucket string `name:"wal_s3_bucket"`
|
||||
WALES3Bucket string `name:"wal_s3_bucket"`
|
||||
LogS3Bucket string `name:"log_s3_bucket"`
|
||||
KubeIAMRole string `name:"kube_iam_role"`
|
||||
WALGSBucket string `name:"wal_gs_bucket"`
|
||||
|
|
|
|||
Loading…
Reference in New Issue