Skip to content

Commit

Permalink
Fix Cilium NS creation in case of unstable KAPI
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Schmid <[email protected]>
  • Loading branch information
PhilipSchmid committed Oct 3, 2023
1 parent 23c92b4 commit 3ffabde
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_cilium_helm_chart"></a> [cilium\_helm\_chart](#input\_cilium\_helm\_chart) | The name of the Helm chart to use to install Cilium. It is assumed that the Helm repository containing this chart has been added beforehand (e.g. using 'helm repo add'). | `string` | `"cilium/cilium"` | no |
| <a name="input_cilium_helm_extra_args"></a> [cilium\_helm\_extra\_args](#input\_cilium\_helm\_extra\_args) | Extra arguments to be passed to the 'helm upgrade --install' command that installs Cilium. | `string` | `""` | no |
| <a name="input_cilium_helm_release_name"></a> [cilium\_helm\_release\_name](#input\_cilium\_helm\_release\_name) | The name of the Helm release to use for Cilium. | `string` | `"cilium"` | no |
| <a name="input_cilium_helm_values_file_path"></a> [cilium\_helm\_values\_file\_path](#input\_cilium\_helm\_values\_file\_path) | The path to the file containing the values to use when installing Cilium. | `string` | n/a | yes |
| <a name="input_cilium_helm_values_override_file_path"></a> [cilium\_helm\_values\_override\_file\_path](#input\_cilium\_helm\_values\_override\_file\_path) | The path to the file containing the values to use when installing Cilium. These values will override the ones in 'cilium\_helm\_values\_file\_path'. | `string` | n/a | yes |
| <a name="input_cilium_helm_version"></a> [cilium\_helm\_version](#input\_cilium\_helm\_version) | The version of the Cilium Helm chart to install. | `string` | n/a | yes |
| <a name="input_cilium_namespace"></a> [cilium\_namespace](#input\_cilium\_namespace) | The namespace in which to install Cilium. | `string` | `"kube-system"` | no |
| <a name="input_deploy_etcd_cluster"></a> [deploy\_etcd\_cluster](#input\_deploy\_etcd\_cluster) | Whether to deploy an 'etcd' cluster suitable for usage as the Cilium key-value store (HIGHLY EXPERIMENTAL). | `bool` | `false` | no |
Expand Down
22 changes: 18 additions & 4 deletions scripts/provisioner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,25 @@ do
fi
done

# Wait for Kubernetes API to stabilize
KAPI_REACHABILITY_COUNT=1
set +e
until kubectl get --raw='/readyz?verbose'
do
if [[ ${KAPI_REACHABILITY_COUNT} -gt 180 ]];
then
echo "Failed to connect to the Kubernetes API or the Kubernetes API doesn't report an healthy state."
exit 1
else
KAPI_REACHABILITY_COUNT=$((KAPI_REACHABILITY_COUNT+1))
sleep 1
fi
done
set -e
sleep 10

# Create the target namespace if it does not exist.
if ! kubectl get ns "${CILIUM_NAMESPACE}";
then
kubectl create ns "${CILIUM_NAMESPACE}"
fi
kubectl create namespace "${CILIUM_NAMESPACE}" --dry-run=client -o yaml | kubectl apply -f -

# Upsert or delete the IPsec secret to be used for transparent encryption.
IPSEC_ENABLED=""
Expand Down

0 comments on commit 3ffabde

Please sign in to comment.