-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rollouts: scripts and dev guide for running with kind (#3888)
- Loading branch information
1 parent
879298b
commit 0a89c06
Showing
8 changed files
with
273 additions
and
14 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
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,36 @@ | ||
#! /usr/bin/env bash | ||
# Copyright 2023 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. | ||
|
||
mkdir -p ~/.kube | ||
KUBECONFIG=~/.kube/admin-cluster | ||
|
||
# create kind cluster | ||
kind delete cluster --name=rollouts-management-cluster --kubeconfig $KUBECONFIG | ||
kind create cluster --name=rollouts-management-cluster --kubeconfig $KUBECONFIG | ||
|
||
# install crds | ||
KUBECONFIG=$KUBECONFIG make install | ||
KUBECONFIG=$KUBECONFIG kubectl apply -f ./manifests/crds/containercluster.yaml | ||
|
||
# build and set image | ||
IMG=$IMG make docker-build | ||
kind load docker-image $IMG --name=rollouts-management-cluster | ||
(cd config/manager && $KUSTOMIZE edit set image controller=$IMG) | ||
|
||
# deploy | ||
$KUSTOMIZE build ./config/default | sed --expression='s/imagePullPolicy: Always/imagePullPolicy: IfNotPresent/g' | KUBECONFIG=$KUBECONFIG kubectl apply -f - | ||
|
||
# wait for controller to be ready | ||
KUBECONFIG=$KUBECONFIG kubectl rollout status deployment rollouts-controller-manager --namespace rollouts-system |
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,62 @@ | ||
#! /usr/bin/env bash | ||
# Copyright 2023 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. | ||
|
||
KUBECONFIG=/tmp/kubeconfig.yaml | ||
KIND_CONFIG=/tmp/kind-cluster.yaml | ||
MGMTKUBECONFIG=~/.kube/admin-cluster | ||
|
||
DEFAULT_NAME=rollouts-target | ||
DEFAULT_NAMESPACE=kind-clusters | ||
|
||
# TODO: fetch the latest version of config sync instead of hardcoding it here | ||
DEFAULT_CS_VERSION="v1.14.2" | ||
|
||
# set default values | ||
if [ -z "$NAME" ] | ||
then | ||
NAME=$DEFAULT_NAME | ||
fi | ||
|
||
if [ -z "$NAMESPACE" ] | ||
then | ||
NAMESPACE=$DEFAULT_NAMESPACE | ||
fi | ||
|
||
if [ -z "$CS_VERSION" ] | ||
then | ||
CS_VERSION=$DEFAULT_CS_VERSION | ||
fi | ||
|
||
# create the kind cluster and store the kubeconfig | ||
cat <<EOF > $KIND_CONFIG | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
networking: | ||
apiServerAddress: "$(hostname -I | awk '{print $1}')" | ||
EOF | ||
|
||
kind create cluster --config $KIND_CONFIG --kubeconfig $KUBECONFIG --name $NAME | ||
kind get kubeconfig --name $NAME > $KUBECONFIG | ||
|
||
# create the kind-clusters namespace and put the ConfigMap in it | ||
KUBECONFIG=$MGMTKUBECONFIG kubectl create namespace $NAMESPACE | ||
KUBECONFIG=$MGMTKUBECONFIG kubectl create configmap $NAME -n $NAMESPACE --from-file=kubeconfig.yaml=$KUBECONFIG | ||
KUBECONFIG=$MGMTKUBECONFIG kubectl label configmap $NAME -n $NAMESPACE location=example | ||
|
||
mkdir -p ~/.kube | ||
cp $KUBECONFIG ~/.kube/$NAME | ||
|
||
# install config sync | ||
KUBECONFIG=~/.kube/$NAME kubectl apply -f "https://github.com/GoogleContainerTools/kpt-config-sync/releases/download/${CS_VERSION}/config-sync-manifest.yaml" |