-
Notifications
You must be signed in to change notification settings - Fork 40k
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
adding service account to libvirt #17848
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,8 @@ source "$ROOT/${KUBE_CONFIG_FILE:-"config-default.sh"}" | |
source "$KUBE_ROOT/cluster/common.sh" | ||
|
||
export LIBVIRT_DEFAULT_URI=qemu:///system | ||
|
||
export SERVICE_ACCOUNT_LOOKUP=${SERVICE_ACCOUNT_LOOKUP:-false} | ||
export ADMISSION_CONTROL=${ADMISSION_CONTROL:-NamespaceLifecycle,LimitRanger,ServiceAccount,ResourceQuota} | ||
readonly POOL=kubernetes | ||
readonly POOL_PATH="$(cd $ROOT && pwd)/libvirt_storage_pool" | ||
|
||
|
@@ -51,6 +52,19 @@ function detect-nodes { | |
KUBE_NODE_IP_ADDRESSES=("${NODE_IPS[@]}") | ||
} | ||
|
||
function set_service_accounts { | ||
SERVICE_ACCOUNT_KEY=${SERVICE_ACCOUNT_KEY:-"/tmp/kube-serviceaccount.key"} | ||
# Generate ServiceAccount key if needed | ||
if [[ ! -f "${SERVICE_ACCOUNT_KEY}" ]]; then | ||
mkdir -p "$(dirname ${SERVICE_ACCOUNT_KEY})" | ||
openssl genrsa -out "${SERVICE_ACCOUNT_KEY}" 2048 2>/dev/null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will openssl be available under normal circumstances? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
fi | ||
|
||
mkdir -p "$POOL_PATH/kubernetes/certs" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not familiar enough with this install to know if this path is reasonable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In It is the most efficient way to push things to the VMs. I’m fine with that. |
||
cp "${SERVICE_ACCOUNT_KEY}" "$POOL_PATH/kubernetes/certs" | ||
} | ||
|
||
|
||
# Verify prereqs on host machine | ||
function verify-prereqs { | ||
if ! which virsh >/dev/null; then | ||
|
@@ -185,6 +199,7 @@ function kube-up { | |
detect-nodes | ||
load-or-gen-kube-bearertoken | ||
initialize-pool keep_base_image | ||
set_service_accounts | ||
initialize-network | ||
|
||
readonly ssh_keys="$(cat ~/.ssh/id_*.pub | sed 's/^/ - /')" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will /tmp be writeable under normal circumstances?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This env is local dev environment. /tmp in general is writable (as in local cluster)