-
Notifications
You must be signed in to change notification settings - Fork 250
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
Improve secret copy + kubeconfig permissions #481
Improve secret copy + kubeconfig permissions #481
Conversation
f01e774
to
c61f24f
Compare
818d261
to
f6d7bdc
Compare
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.
One necessary change I think is needed and a couple other considerations.
@@ -29,7 +29,7 @@ if [ "$(ls ${SECRETS_MOUNT_DIR} 3>/dev/null)" ]; | |||
then | |||
echo "Installing any TLS assets from ${SECRETS_MOUNT_DIR}" | |||
mkdir -p /host/etc/cni/net.d/calico-tls | |||
cp ${SECRETS_MOUNT_DIR}/* /host/etc/cni/net.d/calico-tls/ | |||
cp -p ${SECRETS_MOUNT_DIR}/* /host/etc/cni/net.d/calico-tls/ |
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.
I think we should have this change done on line 180 also.
k8s-install/scripts/install-cni.sh
Outdated
cat > /host/etc/cni/net.d/calico-kubeconfig <<EOF | ||
# Kubeconfig file for Calico CNI plugin. | ||
apiVersion: v1 | ||
kind: Config | ||
clusters: | ||
- name: local | ||
cluster: | ||
server: https://${KUBERNETES_SERVICE_HOST:-}:${KUBERNETES_SERVICE_PORT:-} |
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.
If those are not set I think this will result in server: https://:
, should we have defaults for them?
Do we need to have https
be configurable, would someone ever use http
?
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.
I don't know if we can put a reasonable default here. It's all a bit awkward, but those envs really should be set whenever we're running as a k8s pod (but not say, mesos).
+1 on adding http/https configuration.
k8s-install/scripts/install-cni.sh
Outdated
@@ -119,7 +127,6 @@ current-context: calico-context | |||
EOF | |||
|
|||
# Insert any of the supported "auto" parameters. | |||
SERVICEACCOUNT_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) |
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.
The replacement below of SERVICEACCOUNT_TOKEN could be removed once it is removed from the CNI config, are we waiting until that is done to allow an easier transition. I think that makes sense, just making sure it has been considered.
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.
Yeah, I think we should wait a while. We should probably leave it there for compat purposes indefinitely. We can document it as deprecated if we want though.
@tmjd thanks for the review, I've pushed some changes, LMK what you think. |
7403eba
to
1889dc3
Compare
Description
A few improvements to our install CNI script:
-p
to retain permissions (See https://github.com/projectcalico/cni-plugin/issues/459)calico-kubeconfig
mode to0600
by defaultTodos
Release Note