Skip to content

Commit

Permalink
Update Makefile.d/kind.mk
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Kosuke Morimoto <[email protected]>
  • Loading branch information
kmrmt and coderabbitai[bot] committed Dec 25, 2024
1 parent bde000e commit 9ab90c2
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 45 deletions.
4 changes: 4 additions & 0 deletions .github/actions/e2e-deploy-vald-readreplica/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@ runs:
run: |
make k8s/vald-readreplica/deploy HELM_VALUES=${VALUES} HELM_EXTRA_OPTIONS="${HELM_EXTRA_OPTIONS}"
stern vald-lb-gateway &
stern vald-agent-readreplica &
sleep 3
kubectl get pods
kubectl wait --for=condition=ready pod -l ${WAIT_FOR_SELECTOR} --timeout=600s
podname=`kubectl get pods --selector=${WAIT_FOR_SELECTOR} | tail -1 | awk '{print $1}'`
echo "POD_NAME=${podname}" >> $GITHUB_OUTPUT
env:
Expand Down
3 changes: 0 additions & 3 deletions .github/actions/e2e-deploy-vald/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,8 @@ runs:
if: ${{ inputs.use_local_charts == 'true' }}
run: |
make k8s/vald/deploy HELM_VALUES=${VALUES} HELM_EXTRA_OPTIONS="${HELM_EXTRA_OPTIONS}"
sleep 3
kubectl get pods
kubectl wait --for=condition=Ready pod -l ${WAIT_FOR_SELECTOR} --timeout=${WAIT_FOR_TIMEOUT}
kubectl get pods
Expand Down
2 changes: 1 addition & 1 deletion .github/helm/values/values-readreplica.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

defaults:
logging:
level: info
level: debug
networkPolicy:
enabled: true
gateway:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,6 @@ jobs:
- name: Deploy Vald Read Replica
id: deploy_vald_readreplica
uses: ./.github/actions/e2e-deploy-vald-readreplica
with:
helm_extra_options: ${{ steps.setup_e2e.outputs.HELM_EXTRA_OPTIONS }}
values: .github/helm/values/values-readreplica.yaml
- name: Deploy Vald
id: deploy_vald
uses: ./.github/actions/e2e-deploy-vald
with:
helm_extra_options: ${{ steps.setup_e2e.outputs.HELM_EXTRA_OPTIONS }}
values: .github/helm/values/values-readreplica.yaml
Expand Down
6 changes: 0 additions & 6 deletions Makefile.d/e2e.mk
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,9 @@ e2e/actions/run/readreplica: \
sleep 2
kubectl wait -n kube-system --for=condition=Ready pod -l app.kubernetes.io/name=metrics-server --timeout=$(E2E_WAIT_FOR_START_TIMEOUT)
kubectl wait -n kube-system --for=condition=ContainersReady pod -l app.kubernetes.io/name=metrics-server --timeout=$(E2E_WAIT_FOR_START_TIMEOUT)
sleep 3
$(MAKE) k8s/vald-readreplica/deploy \
HELM_VALUES=$(ROOTDIR)/.github/helm/values/values-readreplica.yaml
sleep 3
$(MAKE) k8s/vald/deploy \
HELM_VALUES=$(ROOTDIR)/.github/helm/values/values-readreplica.yaml
sleep 20
kubectl wait --for=condition=Ready pod -l "app=$(AGENT_IMAGE)" --timeout=$(E2E_WAIT_FOR_START_TIMEOUT)
kubectl wait --for=condition=ContainersReady pod -l "app=$(AGENT_IMAGE)" --timeout=$(E2E_WAIT_FOR_START_TIMEOUT)
kubectl wait --for=condition=Ready pod -l "app=$(LB_GATEWAY_IMAGE)" --timeout=$(E2E_WAIT_FOR_START_TIMEOUT)
kubectl wait --for=condition=ContainersReady pod -l "app=$(LB_GATEWAY_IMAGE)" --timeout=$(E2E_WAIT_FOR_START_TIMEOUT)
kubectl get pods
Expand Down
49 changes: 25 additions & 24 deletions Makefile.d/k8s.mk
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ k8s/manifest/readreplica/update: \
mv $(TEMP_DIR)/vald-readreplica/templates $(ROOTDIR)/k8s/readreplica
rm -rf $(TEMP_DIR)

.PHONY: k8s/vald/deploy
## deploy vald sample cluster to k8s
k8s/vald/deploy:
.PHONY: k8s/vald/manifests
## generate vald manifest
k8s/vald/manifests:
helm template \
--values $(HELM_VALUES) \
--set defaults.image.tag=$(VERSION) \
Expand All @@ -131,6 +131,10 @@ k8s/vald/deploy:
--include-crds \
--output-dir $(TEMP_DIR) \
charts/vald

.PHONY: k8s/vald/deploy
## deploy vald sample cluster to k8s
k8s/vald/deploy: k8s/vald/manifests
@echo "Permitting error because there's some cases nothing to apply"
kubectl apply -f $(TEMP_DIR)/vald/templates/manager/index || true
kubectl apply -f $(TEMP_DIR)/vald/templates/agent || true
Expand All @@ -146,26 +150,13 @@ k8s/vald/deploy:
kubectl apply -f $(TEMP_DIR)/vald/templates/index/job/save || true
kubectl apply -f $(TEMP_DIR)/vald/templates/index/job/readreplica/rotate || true
kubectl apply -f $(TEMP_DIR)/vald/templates/index/operator || true
rm -rf $(TEMP_DIR)
kubectl get pods -o jsonpath="{.items[*].spec.containers[*].image}" | tr " " "\n"

@echo "manifest files location: $(TEMP_DIR)"

.PHONY: k8s/vald/delete
## delete vald sample cluster from k8s
k8s/vald/delete:
helm template \
--values $(HELM_VALUES) \
--set defaults.image.tag=$(VERSION) \
--set agent.image.repository=$(CRORG)/$(AGENT_NGT_IMAGE) \
--set agent.sidecar.image.repository=$(CRORG)/$(AGENT_SIDECAR_IMAGE) \
--set discoverer.image.repository=$(CRORG)/$(DISCOVERER_IMAGE) \
--set gateway.filter.image.repository=$(CRORG)/$(FILTER_GATEWAY_IMAGE) \
--set gateway.lb.image.repository=$(CRORG)/$(LB_GATEWAY_IMAGE) \
--set gateway.mirror.image.repository=$(CRORG)/$(MIRROR_GATEWAY_IMAGE) \
--set manager.index.image.repository=$(CRORG)/$(MANAGER_INDEX_IMAGE) \
--set manager.index.operator.image.repository=$(CRORG)/$(INDEX_OPERATOR_IMAGE) \
--include-crds \
--output-dir $(TEMP_DIR) \
charts/vald
k8s/vald/delete: k8s/vald/manifests
kubectl delete -f $(TEMP_DIR)/vald/templates/gateway/mirror || true
kubectl delete -f $(TEMP_DIR)/vald/templates/index/operator || true
kubectl delete -f $(TEMP_DIR)/vald/templates/index/job/readreplica/rotate || true
Expand All @@ -182,7 +173,6 @@ k8s/vald/delete:
kubectl delete -f $(TEMP_DIR)/vald/templates/agent/ngt || true
kubectl delete -f $(TEMP_DIR)/vald/templates/agent || true
kubectl delete -f $(TEMP_DIR)/vald/crds || true
rm -rf $(TEMP_DIR)

.PHONY: k8s/multi/vald/deploy
## deploy multiple vald sample clusters to k8s
Expand Down Expand Up @@ -246,7 +236,7 @@ k8s/vald-helm-operator/delete:

.PHONY: k8s/vald-readreplica/deploy
## deploy vald-readreplica to k8s
k8s/vald-readreplica/deploy:
k8s/vald-readreplica/deploy: k8s/vald/deploy
helm template \
--values $(HELM_VALUES) \
--set defaults.image.tag=$(VERSION) \
Expand All @@ -261,15 +251,26 @@ k8s/vald-readreplica/deploy:
$(HELM_EXTRA_OPTIONS) \
--output-dir $(TEMP_DIR) \
charts/vald-readreplica
kubectl delete -f $(TEMP_DIR)/vald/templates/gateway || true
kubectl delete -f $(TEMP_DIR)/vald/templates/gateway/lb || true
kubectl get pods
kubectl wait --for=delete pod -l app=vald-lb-gateway --timeout=600s

kubectl apply -f $(TEMP_DIR)/vald-readreplica/templates
sleep 5

# kubectl get pods
# kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=vald-readreplica --timeout=600s
kubectl get pods
kubectl wait --for=condition=ready pod -l app=vald-agent --timeout=600s
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=vald-readreplica --timeout=600s

kubectl apply -f $(TEMP_DIR)/vald/templates/gateway || true
kubectl apply -f $(TEMP_DIR)/vald/templates/gateway/lb || true

kubectl get pods

.PHONY: k8s/vald-readreplica/delete
## delete vald-helm-operator from k8s
k8s/vald-readreplica/delete:
k8s/vald-readreplica/delete: k8s/vald/delete
helm template \
--values $(HELM_VALUES) \
--set defaults.image.tag=$(VERSION) \
Expand Down
4 changes: 2 additions & 2 deletions Makefile.d/kind.mk
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ kind/vs/start: \
&& curl -fsSL https://github.com/kubernetes-csi/csi-driver-host-path/archive/refs/tags/v1.15.0.tar.gz | tar zxf - -C $(TEMP_DIR)/csi-driver-hostpath --strip-components 1 \
&& cd $(TEMP_DIR)/csi-driver-hostpath \
&& deploy/kubernetes-latest/deploy.sh \
&& kubectl apply -f ./examples/csi-storageclass.yaml \
&& kubectl apply -f ././examples/csi-pvc.yaml \
&& kubectl apply -f examples/csi-storageclass.yaml \
&& kubectl apply -f examples/csi-pvc.yaml \
&& rm -rf $(TEMP_DIR)/csi-driver-hostpath

@make k8s/metrics/metrics-server/deploy
Expand Down
5 changes: 2 additions & 3 deletions Makefile.d/minikube.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ $(BINDIR)/minikube:
# Start minikube with CSI Driver and Volume Snapshots support
# Only use this for development related to Volume Snapshots. Usually k3d is faster.
.PHONY: minikube/start
minikube/start: \
$(BINDIR)/docker
minikube start --driver=docker --force --alsologtostderr -v=1
minikube/start:
minikube start
minikube addons enable volumesnapshots
minikube addons enable csi-hostpath-driver
minikube addons disable storage-provisioner
Expand Down
4 changes: 4 additions & 0 deletions charts/vald/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,10 @@ initContainers
{{- $agentReadinessPort := default $.Values.defaults.server_config.healths.readiness.port $.Values.agent.server_config.healths.readiness.port }}
{{- $agentReadinessPath := default $.Values.defaults.server_config.healths.readiness.readinessProbe.httpGet.path .readinessPath }}
until [ "$(wget --server-response --spider --quiet http://{{ $.Values.agent.name }}.{{ $.namespace }}.svc.cluster.local:{{ $agentReadinessPort }}{{ $agentReadinessPath }} 2>&1 | awk 'NR==1{print $2}')" == "200" ]; do
{{- else if eq .target "agent-readreplica" }}
{{- $agentReadReplicaReadinessPort := default $.Values.defaults.server_config.healths.readiness.port $.Values.agent.server_config.healths.readiness.port }}
{{- $agentReadReplicaReadinessPath := default $.Values.defaults.server_config.healths.readiness.readinessProbe.httpGet.path .readinessPath }}
until [ "$(wget --server-response --spider --quiet http://{{ $.Values.agent.readreplica.name }}-0.{{ $.namespace }}.svc.cluster.local:{{ $agentReadReplicaReadinessPort }}{{ $agentReadReplicaReadinessPath }} 2>&1 | awk 'NR==1{print $2}')" == "200" ]; do
{{- else if eq .target "gateway-lb" }}
{{- $lbGatewayReadinessPort := default $.Values.defaults.server_config.healths.readiness.port $.Values.gateway.lb.server_config.healths.readiness.port }}
{{- $lbGatewayReadinessPath := default $.Values.defaults.server_config.healths.readiness.readinessProbe.httpGet.path .readinessPath }}
Expand Down

0 comments on commit 9ab90c2

Please sign in to comment.