|
19 | 19 | set -e |
20 | 20 |
|
21 | 21 | if [ $# -lt 6 ]; then |
22 | | - echo "Invalid input. Valid usage: ./create-kubernetes-binaries-iso.sh OUTPUT_PATH KUBERNETES_VERSION CNI_VERSION CRICTL_VERSION WEAVENET_NETWORK_YAML_CONFIG DASHBOARD_YAML_CONFIG BUILD_NAME [ARCH] [ETCD_VERSION]" |
23 | | - echo "eg: ./create-kubernetes-binaries-iso.sh ./ 1.11.4 0.7.1 1.11.1 https://github.com/weaveworks/weave/releases/download/latest_release/weave-daemonset-k8s-1.11.yaml https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.0/src/deploy/recommended/kubernetes-dashboard.yaml setup-v1.11.4 amd64" |
| 22 | + echo "Invalid input. Valid usage: ./create-kubernetes-binaries-iso.sh OUTPUT_PATH KUBERNETES_VERSION CNI_VERSION CRICTL_VERSION WEAVENET_NETWORK_YAML_CONFIG HEADLAMP_DASHBOARD_VERSION BUILD_NAME [ARCH] [ETCD_VERSION]" |
| 23 | + echo "eg: ./create-kubernetes-binaries-iso.sh ./ 1.11.4 0.7.1 1.11.1 https://github.com/weaveworks/weave/releases/download/latest_release/weave-daemonset-k8s-1.11.yaml 0.40.1 setup-v1.11.4 amd64" |
24 | 24 | exit 1 |
25 | 25 | fi |
26 | 26 |
|
@@ -96,10 +96,60 @@ echo "Downloading network config ${NETWORK_CONFIG_URL}" |
96 | 96 | network_conf_file="${working_dir}/network.yaml" |
97 | 97 | curl -sSL ${NETWORK_CONFIG_URL} -o ${network_conf_file} |
98 | 98 |
|
99 | | -DASHBORAD_CONFIG_URL="${6}" |
100 | | -echo "Downloading dashboard config ${DASHBORAD_CONFIG_URL}" |
101 | | -dashboard_conf_file="${working_dir}/dashboard.yaml" |
102 | | -curl -sSL ${DASHBORAD_CONFIG_URL} -o ${dashboard_conf_file} |
| 99 | +HEADLAMP_DASHBOARD_VERSION="${6}" |
| 100 | +HEADLAMP_DASHBOARD_URL="https://raw.githubusercontent.com/kubernetes-sigs/headlamp/v${HEADLAMP_DASHBOARD_VERSION}/kubernetes-headlamp.yaml" |
| 101 | +echo "Downloading Headlamp manifest from ${HEADLAMP_DASHBOARD_URL}" |
| 102 | +headlamp_conf_file="${working_dir}/headlamp.yaml" |
| 103 | +curl -sSL ${HEADLAMP_DASHBOARD_URL} -o ${headlamp_conf_file} |
| 104 | + |
| 105 | +# Patch the Headlamp manifest to add missing components |
| 106 | +echo "Patching Headlamp manifest with missing ServiceAccount and ClusterRoleBinding..." |
| 107 | + |
| 108 | +if ! grep -q "kind: ServiceAccount" ${headlamp_conf_file}; then |
| 109 | + echo "Adding missing ServiceAccount to Headlamp manifest" |
| 110 | + cat > ${headlamp_conf_file}.tmp << 'EOF' |
| 111 | +--- |
| 112 | +# ServiceAccount for Headlamp (added by CloudStack) |
| 113 | +kind: ServiceAccount |
| 114 | +apiVersion: v1 |
| 115 | +metadata: |
| 116 | + name: headlamp-admin |
| 117 | + namespace: kube-system |
| 118 | +--- |
| 119 | +# ClusterRoleBinding to grant cluster-admin permissions to Headlamp (added by CloudStack) |
| 120 | +kind: ClusterRoleBinding |
| 121 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 122 | +metadata: |
| 123 | + name: headlamp-admin |
| 124 | +roleRef: |
| 125 | + apiGroup: rbac.authorization.k8s.io |
| 126 | + kind: ClusterRole |
| 127 | + name: cluster-admin |
| 128 | +subjects: |
| 129 | + - kind: ServiceAccount |
| 130 | + name: headlamp-admin |
| 131 | + namespace: kube-system |
| 132 | +--- |
| 133 | +EOF |
| 134 | + cat ${headlamp_conf_file} >> ${headlamp_conf_file}.tmp |
| 135 | + mv ${headlamp_conf_file}.tmp ${headlamp_conf_file} |
| 136 | +fi |
| 137 | + |
| 138 | +if grep -q "kind: Deployment" ${headlamp_conf_file} && ! grep -q "serviceAccountName:" ${headlamp_conf_file}; then |
| 139 | + echo "Adding serviceAccountName to Headlamp Deployment" |
| 140 | + awk '/kind: Deployment/,0 { |
| 141 | + if (/^ spec:$/ && !found) { |
| 142 | + print |
| 143 | + print " serviceAccountName: headlamp-admin" |
| 144 | + found=1 |
| 145 | + next |
| 146 | + } |
| 147 | + } |
| 148 | + {print}' ${headlamp_conf_file} > ${headlamp_conf_file}.tmp |
| 149 | + mv ${headlamp_conf_file}.tmp ${headlamp_conf_file} |
| 150 | +fi |
| 151 | + |
| 152 | +echo "Headlamp manifest patched successfully" |
103 | 153 |
|
104 | 154 | # TODO : Change the url once merged |
105 | 155 | AUTOSCALER_URL="https://raw.githubusercontent.com/kubernetes/autoscaler/master/cluster-autoscaler/cloudprovider/cloudstack/examples/cluster-autoscaler-standard.yaml" |
@@ -135,7 +185,7 @@ mkdir -p "${working_dir}/docker" |
135 | 185 | output=`${k8s_dir}/kubeadm config images list --kubernetes-version=${RELEASE}` |
136 | 186 |
|
137 | 187 | # Don't forget about the yaml images ! |
138 | | -for i in ${network_conf_file} ${dashboard_conf_file} |
| 188 | +for i in ${network_conf_file} ${headlamp_conf_file} |
139 | 189 | do |
140 | 190 | images=`grep "image:" $i | cut -d ':' -f2- | tr -d ' ' | tr -d "'"` |
141 | 191 | output=`printf "%s\n" ${output} ${images}` |
|
0 commit comments