c034b0060e
Till now, for installing kuryr-kubernetes and one of the crucial service - kubernetes, there has been used manual method for installing it in specified version. Over time it became a burden to follow requirements and constraints, therefore decision has been made to use recommended way of installing Kubernetes - kubeadm. In this patch devstack installation of the kuryr-kubernetes and its dependences has been heavily reworked. Other than that, OpenShift related functions has been removed, since they were all outdated and non-working for the long time. Change-Id: Ife21874c0a71ba07723094c0f880aabcf5825b77
57 lines
3.6 KiB
Bash
Executable File
57 lines
3.6 KiB
Bash
Executable File
#!/bin/bash -x
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
# implied.
|
|
#
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
# This script takes bits from devstack-gate/functions/cleanup_host in a
|
|
# more generic approach, so we don't need to actually run devstack on the node
|
|
# to cleanup an host.
|
|
|
|
# Kubernetes resources
|
|
# TODO(dulek): It might be good to split that into Ansible tasks once it's
|
|
# stable. Until then script is easier to debug and test.
|
|
K8S_LOG_DIR=${DEVSTACK_BASE_DIR}/logs/kubernetes
|
|
mkdir -p ${K8S_LOG_DIR}
|
|
mkdir ${HOME}/.kube
|
|
sudo cp /opt/stack/.kube/config ${HOME}/.kube/
|
|
sudo chown ${USER}:${USER} ${HOME}/.kube/config
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config get pods -o yaml --all-namespaces >> ${K8S_LOG_DIR}/pods.txt
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config get svc -o yaml --all-namespaces >> ${K8S_LOG_DIR}/services.txt
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config get cm -o yaml --all-namespaces >> ${K8S_LOG_DIR}/configmaps.txt
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config get deploy -o yaml --all-namespaces >> ${K8S_LOG_DIR}/deployments.txt
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config get ds -o yaml --all-namespaces >> ${K8S_LOG_DIR}/daemonsets.txt
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config get nodes -o yaml --all-namespaces >> ${K8S_LOG_DIR}/nodes.txt
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config get ingress -o yaml --all-namespaces >> ${K8S_LOG_DIR}/ingress.txt
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config get namespaces -o yaml >> ${K8S_LOG_DIR}/namespaces.txt
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config get kuryrnets -o yaml --all-namespaces >> ${K8S_LOG_DIR}/kuryrnets_crds.txt
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config get kuryrnetworks -o yaml --all-namespaces >> ${K8S_LOG_DIR}/kuryrnetworks_crds.txt
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config get endpoints -o yaml --all-namespaces >> ${K8S_LOG_DIR}/endpoints.txt
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config get kuryrnetpolicy -o yaml --all-namespaces >> ${K8S_LOG_DIR}/kuryrnetpolicy_crds.txt
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config get kuryrport -o yaml --all-namespaces >> ${K8S_LOG_DIR}/kuryrport_crds.txt
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config get kuryrnetworkpolicy -o yaml --all-namespaces >> ${K8S_LOG_DIR}/kuryrnetworkpolicy_crds.txt
|
|
# Kubernetes pods logs
|
|
mkdir -p ${K8S_LOG_DIR}/pod_logs
|
|
while read -r line
|
|
do
|
|
name=$(echo ${line} | cut -f1 -d " ")
|
|
namespace=$(echo ${line} | cut -f2 -d " ")
|
|
containers=`/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config -n ${namespace} get pods ${name} -o jsonpath="{.spec.containers[*].name} {.spec.initContainers[*].name}"`
|
|
for container in ${containers}
|
|
do
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config logs -n ${namespace} -c ${container} ${name} >> ${K8S_LOG_DIR}/pod_logs/${namespace}-${name}-${container}.txt
|
|
/usr/bin/kubectl --kubeconfig=${HOME}/.kube/config logs -n ${namespace} -p -c ${container} ${name} >> ${K8S_LOG_DIR}/pod_logs/${namespace}-${name}-${container}-prev.txt
|
|
done
|
|
done < <(/usr/bin/kubectl get pods -o=custom-columns=NAME:.metadata.name,NAMESPACE:.metadata.namespace --all-namespaces | tail -n +2)
|
|
|
|
sudo chown -R zuul:zuul ${K8S_LOG_DIR}
|