Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of Fix autopilot scenario failures into release/1.13.x #21031

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions enos/enos-scenario-autopilot.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ scenario "autopilot" {
}

variables {
vault_instances = step.create_vault_cluster_targets.hosts
vault_instances = step.create_vault_cluster.target_hosts
vault_install_dir = local.vault_install_dir
vault_root_token = step.create_vault_cluster.root_token
}
Expand All @@ -200,7 +200,7 @@ scenario "autopilot" {
variables {
leader_public_ip = step.get_vault_cluster_ips.leader_public_ip
leader_private_ip = step.get_vault_cluster_ips.leader_private_ip
vault_instances = step.create_vault_cluster_targets.hosts
vault_instances = step.create_vault_cluster.target_hosts
vault_install_dir = local.vault_install_dir
vault_root_token = step.create_vault_cluster.root_token
}
Expand Down Expand Up @@ -266,6 +266,7 @@ scenario "autopilot" {
storage_node_prefix = "upgrade_node"
target_hosts = step.create_vault_cluster_upgrade_targets.hosts
unseal_method = matrix.seal
enable_file_audit_device = var.vault_enable_file_audit_device
}
}

Expand All @@ -283,7 +284,7 @@ scenario "autopilot" {

variables {
vault_install_dir = local.vault_install_dir
vault_instances = step.create_vault_cluster_upgrade_targets.hosts
vault_instances = step.upgrade_vault_cluster_with_autopilot.target_hosts
}
}

Expand All @@ -300,7 +301,7 @@ scenario "autopilot" {

variables {
vault_install_dir = local.vault_install_dir
vault_instances = step.create_vault_cluster_upgrade_targets.hosts
vault_instances = step.upgrade_vault_cluster_with_autopilot.target_hosts
vault_root_token = step.upgrade_vault_cluster_with_autopilot.root_token
}
}
Expand All @@ -321,7 +322,7 @@ scenario "autopilot" {
vault_autopilot_upgrade_version = matrix.artifact_source == "local" ? step.get_local_metadata.version : var.vault_product_version
vault_autopilot_upgrade_status = "await-server-removal"
vault_install_dir = local.vault_install_dir
vault_instances = step.create_vault_cluster_upgrade_targets.hosts
vault_instances = step.create_vault_cluster_upgrade_targets.target_hosts
vault_root_token = step.upgrade_vault_cluster_with_autopilot.root_token
}
}
Expand All @@ -340,11 +341,11 @@ scenario "autopilot" {
}

variables {
vault_instances = step.create_vault_cluster_targets.hosts
vault_instances = step.create_vault_cluster.target_hosts
vault_install_dir = local.vault_install_dir
vault_root_token = step.create_vault_cluster.root_token
node_public_ip = step.get_vault_cluster_ips.leader_public_ip
added_vault_instances = step.create_vault_cluster_targets.hosts
added_vault_instances = step.upgrade_vault_cluster_with_autopilot.target_hosts
}
}

Expand Down Expand Up @@ -383,7 +384,7 @@ scenario "autopilot" {

variables {
operator_instance = step.get_updated_vault_cluster_ips.leader_public_ip
remove_vault_instances = step.create_vault_cluster_targets.hosts
remove_vault_instances = step.create_vault_cluster.target_hosts
vault_install_dir = local.vault_install_dir
vault_instance_count = 3
vault_root_token = step.create_vault_cluster.root_token
Expand All @@ -402,7 +403,7 @@ scenario "autopilot" {
}

variables {
old_vault_instances = step.create_vault_cluster_targets.hosts
old_vault_instances = step.create_vault_cluster.target_hosts
vault_instance_count = 3
}
}
Expand All @@ -424,7 +425,7 @@ scenario "autopilot" {
vault_autopilot_upgrade_version = matrix.artifact_source == "local" ? step.get_local_metadata.version : var.vault_product_version
vault_autopilot_upgrade_status = "idle"
vault_install_dir = local.vault_install_dir
vault_instances = step.create_vault_cluster_upgrade_targets.hosts
vault_instances = step.upgrade_vault_cluster_with_autopilot.target_hosts
vault_root_token = step.create_vault_cluster.root_token
}
}
Expand All @@ -445,7 +446,7 @@ scenario "autopilot" {

variables {
vault_install_dir = local.vault_install_dir
vault_instances = step.create_vault_cluster_upgrade_targets.hosts
vault_instances = step.upgrade_vault_cluster_with_autopilot.target_hosts
vault_root_token = step.create_vault_cluster.root_token
}
}
Expand Down
2 changes: 1 addition & 1 deletion enos/modules/vault_cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ locals {
path = "vault"
})
]
audit_device_file_path = "/var/log/vault_audit.log"
audit_device_file_path = "/var/log/vault/vault_audit.log"
vault_service_user = "vault"
enable_audit_device = var.enable_file_audit_device && var.initialize_cluster
}
Expand Down
26 changes: 24 additions & 2 deletions enos/modules/vault_cluster/scripts/create_audit_log_dir.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
#!/bin/env sh
#!/usr/bin/env bash

set -eux

LOG_DIR=$(dirname "$LOG_FILE_PATH")

function retry {
local retries=$1
shift
local count=0

until "$@"; do
exit=$?
wait=10
count=$((count + 1))

if [ "$count" -lt "$retries" ]; then
sleep "$wait"
else
return "$exit"
fi
done

return 0
}

retry 7 id -a "$SERVICE_USER"

sudo mkdir -p "$LOG_DIR"
sudo chown "$SERVICE_USER":"$SERVICE_USER" "$LOG_DIR"
sudo chown -R "$SERVICE_USER":"$SERVICE_USER" "$LOG_DIR"