Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dodokek committed Oct 19, 2024
1 parent c8ad6b4 commit e52dc98
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 193 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/docker-push.yml

This file was deleted.

287 changes: 130 additions & 157 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,167 +1,140 @@
name: Test
on: push
on: [push]

jobs:
build:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: lint
uses: golangci/golangci-lint-action@v2
with:
args: --timeout 2m

controllers_testing:
name: controllers_testing
runs-on: ubuntu-latest
needs: lint
env:
KIND_CLUSTER_NAME: kind-cluster

strategy:
matrix:
kubernetes-version: [v1.23.4, v1.31.1]

steps:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Create Docker config with auth
run: |
mkdir -p ~/.docker
echo '${{ secrets.DOCKER_AUTH_CONFIG }}' > ~/.docker/config.json
echo "End"
- name: Push docker
run: |
docker build -t docker-picodata.binary.picodata.io/tarantool-operator:0.1.0 .
docker --config ~/.docker/ push docker-picodata.binary.picodata.io/tarantool-operator:0.1.0
- name: Delete docker auth config
run: rm -rf ~/.docker/config.json # Clean up Docker auth credentials


# lint:
# name: lint
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2

# - name: lint
# uses: golangci/golangci-lint-action@v2
# with:
# args: --timeout 2m

# controllers_testing:
# name: controllers_testing
# runs-on: ubuntu-latest
# needs: lint
# env:
# KIND_CLUSTER_NAME: kind-cluster

# strategy:
# matrix:
# kubernetes-version: [v1.23.4, v1.31.1]

# steps:
# - uses: actions/checkout@v3

# - name: Set up Go 1.18
# uses: actions/setup-go@v3
# with:
# go-version: 1.18
# id: go

# - name: Set up Kind Cluster
# uses: helm/[email protected]
# with:
# node_image: kindest/node:${{ matrix.kubernetes-version }}
# cluster_name: ${{ env.KIND_CLUSTER_NAME }}

# - name: Test
# run: make gotest

# e2e_testing:
# name: e2e_testing
# runs-on: ubuntu-latest
# needs: lint
# env:
# KIND_CLUSTER_NAME: kind-cluster
# OPERATOR_NAMESPACE: tarantool-operator
# APP_NAMESPACE: tarantool-app
# OPERATOR_IMAGE_REPO: tarantool-operator
# OPERATOR_IMAGE_TAG: 0.0.0

# strategy:
# fail-fast: false
# matrix:
# kubernetes-version: [v1.23.4, v1.31.1]

# steps:
# - uses: actions/checkout@v1

# - name: Set up helm
# uses: azure/setup-helm@v1
# with:
# version: v3.15.4

# - name: Set up Kind Cluster
# uses: helm/[email protected]
# with:
# node_image: kindest/node:${{ matrix.kubernetes-version }}
# cluster_name: ${{ env.KIND_CLUSTER_NAME }}

# - name: Prepare Tarantool operator Docker image
# run: |
# make docker-build REPO=${{ env.OPERATOR_IMAGE_REPO }} VERSION=${{ env.OPERATOR_IMAGE_TAG }}
# kind load docker-image ${{ env.OPERATOR_IMAGE_REPO }}:${{ env.OPERATOR_IMAGE_TAG }} \
# --name ${{ env.KIND_CLUSTER_NAME }}

# - name: Install Tarantool Operator in Kind
# run: |
# # Set the default namespace
# kubectl config set-context --current --namespace=${{ env.OPERATOR_NAMESPACE }}

# helm install -n ${{ env.OPERATOR_NAMESPACE }} operator helm-charts/tarantool-operator \
# --create-namespace \
# --set image.repository=${{ env.OPERATOR_IMAGE_REPO }} \
# --set image.tag=${{ env.OPERATOR_IMAGE_TAG }}

# - name: Waiting for Operator Deployment availability
# run: kubectl wait deployment/controller-manager --for=condition=available --timeout=60s || true

# - name: Сhecking the number of available replicas
# run: |
# available_num=$(kubectl get deployments/controller-manager -o=jsonpath="{.status.availableReplicas}")
# desired_num=$(kubectl get deployments/controller-manager -o=jsonpath="{.status.replicas}")

# if [[ $available_num -ne $desired_num ]]; then
# kubectl describe deployments/controller-manager
# echo 'ERROR: invalid number of available replicas...' >&2; exit 1
# fi

# - name: Install Tarantool Cartridge app in Kind
# run: |
# # Set the default namespace
# kubectl config set-context --current --namespace=${{ env.APP_NAMESPACE }}

# helm install -n ${{ env.APP_NAMESPACE }} --create-namespace \
# -f test/helpers/ci/cluster_values.yaml \
# crtg \
# helm-charts/tarantool-cartridge

# - name: Waiting for routers Pods availability
# run: for i in {1..60}; do kubectl wait -n ${{ env.APP_NAMESPACE }} --for=condition=ready pod --timeout=180s -l tarantool.io/role=router && break || sleep 1; done

# - name: Сhecking the number of ready router replicas
# run : |
# desired_routers_num=1
# ready_routers_num=$(kubectl get statefulsets/crtg-router-0 -o=jsonpath="{.status.readyReplicas}")

# if [[ $ready_routers_num -ne $desired_routers_num ]]; then
# kubectl describe statefulsets/crtg-router-0
# kubectl describe pod -l tarantool.io/role=router
# echo 'ERROR: invalid number of ready routers...' >&2; exit 1
# fi

# - name: Waiting for storages availability
# run: kubectl wait --for=condition=ready pod --timeout=180s -l tarantool.io/role=storage || true

# - name: Сhecking the number of ready storage replicas
# run: |
# desired_storage_num=1
# ready_storage_num=$(kubectl get statefulsets/crtg-storage-0 -o=jsonpath="{.status.readyReplicas}")

# if [[ $ready_storage_num -ne $desired_storage_num ]]; then
# kubectl describe statefulsets/crtg-storage-0
# kubectl describe pod -l tarantool.io/role=storage
# echo 'ERROR: invalid number of ready storages...' >&2; exit 1
# fi
- uses: actions/checkout@v3

- name: Set up Go 1.18
uses: actions/setup-go@v3
with:
go-version: 1.18
id: go

- name: Set up Kind Cluster
uses: helm/[email protected]
with:
node_image: kindest/node:${{ matrix.kubernetes-version }}
cluster_name: ${{ env.KIND_CLUSTER_NAME }}

- name: Test
run: make gotest

e2e_testing:
name: e2e_testing
runs-on: ubuntu-latest
needs: lint
env:
KIND_CLUSTER_NAME: kind-cluster
OPERATOR_NAMESPACE: tarantool-operator
APP_NAMESPACE: tarantool-app
OPERATOR_IMAGE_REPO: tarantool-operator
OPERATOR_IMAGE_TAG: 0.0.0

strategy:
fail-fast: false
matrix:
kubernetes-version: [v1.23.4, v1.31.1]

steps:
- uses: actions/checkout@v1

- name: Set up helm
uses: azure/setup-helm@v1
with:
version: v3.15.4

- name: Set up Kind Cluster
uses: helm/[email protected]
with:
node_image: kindest/node:${{ matrix.kubernetes-version }}
cluster_name: ${{ env.KIND_CLUSTER_NAME }}

- name: Prepare Tarantool operator Docker image
run: |
make docker-build REPO=${{ env.OPERATOR_IMAGE_REPO }} VERSION=${{ env.OPERATOR_IMAGE_TAG }}
kind load docker-image ${{ env.OPERATOR_IMAGE_REPO }}:${{ env.OPERATOR_IMAGE_TAG }} \
--name ${{ env.KIND_CLUSTER_NAME }}
- name: Install Tarantool Operator in Kind
run: |
# Set the default namespace
kubectl config set-context --current --namespace=${{ env.OPERATOR_NAMESPACE }}
helm install -n ${{ env.OPERATOR_NAMESPACE }} operator helm-charts/tarantool-operator \
--create-namespace \
--set image.repository=${{ env.OPERATOR_IMAGE_REPO }} \
--set image.tag=${{ env.OPERATOR_IMAGE_TAG }}
- name: Waiting for Operator Deployment availability
run: kubectl wait deployment/controller-manager --for=condition=available --timeout=60s || true

- name: Сhecking the number of available replicas
run: |
available_num=$(kubectl get deployments/controller-manager -o=jsonpath="{.status.availableReplicas}")
desired_num=$(kubectl get deployments/controller-manager -o=jsonpath="{.status.replicas}")
if [[ $available_num -ne $desired_num ]]; then
kubectl describe deployments/controller-manager
echo 'ERROR: invalid number of available replicas...' >&2; exit 1
fi
- name: Install Tarantool Cartridge app in Kind
run: |
# Set the default namespace
kubectl config set-context --current --namespace=${{ env.APP_NAMESPACE }}
helm install -n ${{ env.APP_NAMESPACE }} --create-namespace \
-f test/helpers/ci/cluster_values.yaml \
crtg \
helm-charts/tarantool-cartridge
- name: Waiting for routers Pods availability
run: for i in {1..60}; do kubectl wait -n ${{ env.APP_NAMESPACE }} --for=condition=ready pod --timeout=180s -l tarantool.io/role=router && break || sleep 1; done

- name: Сhecking the number of ready router replicas
run : |
desired_routers_num=1
ready_routers_num=$(kubectl get statefulsets/crtg-router-0 -o=jsonpath="{.status.readyReplicas}")
if [[ $ready_routers_num -ne $desired_routers_num ]]; then
kubectl describe statefulsets/crtg-router-0
kubectl describe pod -l tarantool.io/role=router
echo 'ERROR: invalid number of ready routers...' >&2; exit 1
fi
- name: Waiting for storages availability
run: kubectl wait --for=condition=ready pod --timeout=180s -l tarantool.io/role=storage || true

- name: Сhecking the number of ready storage replicas
run: |
desired_storage_num=1
ready_storage_num=$(kubectl get statefulsets/crtg-storage-0 -o=jsonpath="{.status.readyReplicas}")
if [[ $ready_storage_num -ne $desired_storage_num ]]; then
kubectl describe statefulsets/crtg-storage-0
kubectl describe pod -l tarantool.io/role=storage
echo 'ERROR: invalid number of ready storages...' >&2; exit 1
fi
2 changes: 1 addition & 1 deletion controllers/cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
}
}
}
reqLogger.Info("ep := &corev1.Endpoints{}")

// ensure Cluster leader elected
ep := &corev1.Endpoints{}
if err := r.Get(context.TODO(), types.NamespacedName{Namespace: cluster.GetNamespace(), Name: cluster.GetName()}, ep); err != nil {
Expand Down

0 comments on commit e52dc98

Please sign in to comment.