-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Add multi-repo support for Config Sync (#872)
* Add multi-repo support for Config Sync * Run make build * increase wait time for configsync api * Update modules/k8s-operator-crd-support/main.tf Co-authored-by: Bharath KKB <[email protected]> * Enhance wait_for_configsync_api step Co-authored-by: Morgante Pell <[email protected]> Co-authored-by: Bharath KKB <[email protected]> Co-authored-by: Morgante Pell <[email protected]>
- Loading branch information
1 parent
7531f90
commit 23da103
Showing
12 changed files
with
231 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: configsync.gke.io/v1beta1 | ||
kind: RootSync | ||
metadata: | ||
name: root-sync | ||
namespace: config-management-system | ||
spec: | ||
${source_format_node} | ||
git: | ||
repo: ${sync_repo} | ||
auth: ${secret_type} | ||
${policy_dir_node} | ||
${sync_branch_node} | ||
${sync_revision_node} | ||
${secret_ref_node} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: configsync.gke.io/v1beta1 | ||
kind: RootSync | ||
metadata: | ||
name: root-sync | ||
namespace: config-management-system | ||
spec: | ||
${source_format_node} | ||
git: | ||
repo: ${sync_repo} | ||
auth: ${secret_type} | ||
${policy_dir_node} | ||
${sync_branch_node} | ||
${sync_revision_node} | ||
${secret_ref_node} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
modules/k8s-operator-crd-support/scripts/wait_for_configsync.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2018 Google LLC | ||
# | ||
# 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. | ||
|
||
is_configsync_ready() { | ||
# Check if config-management-system namespace exists | ||
kubectl --context "$1" get namespace config-management-system &> /dev/null | ||
export exit_code=$? | ||
while [ ! " ${exit_code} " -eq 0 ] | ||
do | ||
sleep 5 | ||
echo -e "Waiting for namespace config-mangement-system in cluster $1 to be created..." | ||
kubectl --context "$1" get namespace config-management-system &> /dev/null | ||
export exit_code=$? | ||
done | ||
echo -e "Namespace config-management-system in cluster $1 created." | ||
|
||
# Once namespace is created, check if config-managment pods are ready | ||
kubectl --context "$1" -n config-management-system wait --timeout 60s --for=condition=Ready pod --all &> /dev/null | ||
export exit_code=$? | ||
|
||
while [ ! " ${exit_code} " -eq 0 ] | ||
do | ||
sleep 5 | ||
echo -e "Waiting for config-management pods in cluster $1 to become ready..." | ||
kubectl --context "$1" -n config-management-system wait --timeout 60s --for=condition=Ready pod --all &> /dev/null | ||
export exit_code=$? | ||
done | ||
|
||
echo -e "Config-management pods in cluster $1 are ready." | ||
return | ||
} | ||
|
||
if [ "$#" -lt 3 ]; then | ||
>&2 echo "Not all expected arguments set." | ||
exit 1 | ||
fi | ||
|
||
PROJECT_ID=$1 | ||
CLUSTER_NAME=$2 | ||
CLUSTER_LOCATION=$3 | ||
USE_EXISTING_CONTEXT=$4 | ||
|
||
# Check if we need to use the current context | ||
if [ -z ${USE_EXISTING_CONTEXT+x} ]; then | ||
# GKE Cluster. Use the GKE cluster context | ||
is_configsync_ready gke_"${PROJECT_ID}"_"${CLUSTER_LOCATION}"_"${CLUSTER_NAME}" | ||
else | ||
echo "USE_EXISTING_CONTEXT variable is set. Using current context to wait for deployment to be ready." | ||
# Get the current context. This can be used for non GKE Clusters | ||
CURRENT_CONTEXT=$(kubectl config current-context) | ||
is_configsync_ready "${CURRENT_CONTEXT}" | ||
fi |
Oops, something went wrong.