Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
9443bf0f
Commit
9443bf0f
authored
Jun 07, 2016
by
nikhiljindal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding secrets for kubernetes clusters as well
parent
b4da4697
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
10 deletions
+30
-10
util.sh
cluster/gce/util.sh
+11
-0
common.sh
federation/cluster/common.sh
+19
-10
No files found.
cluster/gce/util.sh
View file @
9443bf0f
...
@@ -896,7 +896,18 @@ function check-cluster() {
...
@@ -896,7 +896,18 @@ function check-cluster() {
export
CONTEXT
=
"
${
PROJECT
}
_
${
INSTANCE_PREFIX
}
"
export
CONTEXT
=
"
${
PROJECT
}
_
${
INSTANCE_PREFIX
}
"
(
(
umask
077
umask
077
# Update the user's kubeconfig to include credentials for this apiserver.
create-kubeconfig
create-kubeconfig
if
[[
"
${
FEDERATION
:-}
"
==
"true"
]]
;
then
# Create a kubeconfig with credentials for this apiserver. We will later use
# this kubeconfig to create a secret which the federation control plane can
# use to talk to this apiserver.
KUBECONFIG_DIR
=
$(
dirname
${
KUBECONFIG
:-
$DEFAULT_KUBECONFIG
})
KUBECONFIG
=
"
${
KUBECONFIG_DIR
}
/federation/kubernetes-apiserver/
${
CONTEXT
}
/kubeconfig"
\
create-kubeconfig
fi
)
)
# ensures KUBECONFIG is set
# ensures KUBECONFIG is set
...
...
federation/cluster/common.sh
View file @
9443bf0f
...
@@ -111,20 +111,26 @@ function create-federated-api-objects {
...
@@ -111,20 +111,26 @@ function create-federated-api-objects {
$template
"
${
manifests_root
}
/federation-apiserver-"
{
deployment,secrets
}
".yaml"
|
$host_kubectl
create
-f
-
$template
"
${
manifests_root
}
/federation-apiserver-"
{
deployment,secrets
}
".yaml"
|
$host_kubectl
create
-f
-
$template
"
${
manifests_root
}
/federation-controller-manager-deployment.yaml"
|
$host_kubectl
create
-f
-
$template
"
${
manifests_root
}
/federation-controller-manager-deployment.yaml"
|
$host_kubectl
create
-f
-
# Create a kubeconfig with credentails for federation-apiserver and create a
# Create a kubeconfig with credentails for federation-apiserver. We will
# secret for it.
# then use this kubeconfig to create a secret which the federation
# controller manager can use to talk to the federation-apiserver.
# Create kubeconfig. Note that the file name should be "kubeconfig"
# Note that the file name should be "kubeconfig" so that the secret key gets the same name.
# so that the secret key gets the same name.
KUBECONFIG_DIR
=
$(
dirname
${
KUBECONFIG
:-
$DEFAULT_KUBECONFIG
})
kube::util::ensure-temp-dir
CONTEXT
=
federated-cluster
\
CONTEXT
=
federated-cluster
\
KUBE_BEARER_TOKEN
=
"
$FEDERATION_API_TOKEN
"
\
KUBE_BEARER_TOKEN
=
"
$FEDERATION_API_TOKEN
"
\
KUBECONFIG
=
"
${
KUBE
_TEMP
}
/federation/federation-apiserver/kubeconfig"
\
KUBECONFIG
=
"
${
KUBE
CONFIG_DIR
}
/federation/federation-apiserver/kubeconfig"
\
create-kubeconfig
create-kubeconfig
# Create
the secret
# Create
secret with federation-apiserver's kubeconfig
$host_kubectl
create secret generic federation-apiserver-secret
--from-file
=
"
${
KUBE
_TEMP
}
/federation/federation-apiserver/kubeconfig"
--namespace
=
"
${
FEDERATION_NAMESPACE
}
"
$host_kubectl
create secret generic federation-apiserver-secret
--from-file
=
"
${
KUBE
CONFIG_DIR
}
/federation/federation-apiserver/kubeconfig"
--namespace
=
"
${
FEDERATION_NAMESPACE
}
"
# Create secrets with all the kubernetes-apiserver's kubeconfigs.
for
dir
in
${
KUBECONFIG_DIR
}
/federation/kubernetes-apiserver/
*
;
do
# We create a secret with the same name as the directory name (which is
# same as cluster name in kubeconfig)
name
=
$(
basename
$dir
)
$host_kubectl
create secret generic
${
name
}
--from-file
=
"
${
dir
}
/kubeconfig"
--namespace
=
"
${
FEDERATION_NAMESPACE
}
"
done
# Update the users kubeconfig to include federation-apiserver credentials.
# Update the users kubeconfig to include federation-apiserver credentials.
CONTEXT
=
federated-cluster
\
CONTEXT
=
federated-cluster
\
...
@@ -225,5 +231,8 @@ function push-federated-images {
...
@@ -225,5 +231,8 @@ function push-federated-images {
done
done
}
}
function
cleanup-federated-api-objects
{
function
cleanup-federated-api-objects
{
$host_kubectl
delete pods,svc,rc,deployment,secret
-lapp
=
federated-cluster
# Delete all resources with the federated-cluster label.
$host_kubectl
delete pods,svc,rc,deployment,secret
-lapp
=
federated-cluster
# Delete all resources in FEDERATION_NAMESPACE.
$host_kubectl
delete pods,svc,rc,deployment,secret
--namespace
=
${
FEDERATION_NAMESPACE
}
--all
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment