Skip to content

Commit

Permalink
verify pod on chart testing (#286)
Browse files Browse the repository at this point in the history
* verify pod on chart testing

* fix cves
  • Loading branch information
freeznet authored Feb 18, 2025
1 parent e8bbb33 commit 51b9363
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 31 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/chart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,31 @@ jobs:
run: ct install --debug --config ct.yaml --print-config --charts ${{ needs.lint-test.outputs.chart_name }}
if: ${{ needs.lint-test.outputs.changed == 'true' }}

- name: Verify Pod Status
if: ${{ needs.lint-test.outputs.changed == 'true' }}
run: |
echo "Waiting for pods to be ready..."
kubectl wait --for=condition=Ready pods --all -n chart-testing --timeout=300s
echo "Checking pod status..."
if [[ $(kubectl get pods -n chart-testing -o jsonpath='{.items[*].status.phase}' | tr ' ' '\n' | grep -v "Running" | wc -l) -ne 0 ]]; then
echo "Some pods are not running:"
kubectl get pods -n chart-testing
kubectl describe pods -n chart-testing
exit 1
fi
echo "Checking for pod restarts..."
if [[ $(kubectl get pods -n chart-testing -o jsonpath='{.items[*].status.containerStatuses[*].restartCount}' | tr ' ' '\n' | grep -v "^0$" | wc -l) -ne 0 ]]; then
echo "Some pods have restarted:"
kubectl get pods -n chart-testing
kubectl describe pods -n chart-testing
exit 1
fi
echo "All pods are running properly!"
kubectl get pods -n chart-testing
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 10
Expand Down Expand Up @@ -198,6 +223,31 @@ jobs:
run: ct install --debug --config ct.yaml --print-config --charts ${{ needs.lint-test.outputs.chart_name }}
if: ${{ needs.lint-test.outputs.changed == 'true' }}

- name: Verify Pod Status
if: ${{ needs.lint-test.outputs.changed == 'true' }}
run: |
echo "Waiting for pods to be ready..."
kubectl wait --for=condition=Ready pods --all -n chart-testing --timeout=300s
echo "Checking pod status..."
if [[ $(kubectl get pods -n chart-testing -o jsonpath='{.items[*].status.phase}' | tr ' ' '\n' | grep -v "Running" | wc -l) -ne 0 ]]; then
echo "Some pods are not running:"
kubectl get pods -n chart-testing
kubectl describe pods -n chart-testing
exit 1
fi
echo "Checking for pod restarts..."
if [[ $(kubectl get pods -n chart-testing -o jsonpath='{.items[*].status.containerStatuses[*].restartCount}' | tr ' ' '\n' | grep -v "^0$" | wc -l) -ne 0 ]]; then
echo "Some pods have restarted:"
kubectl get pods -n chart-testing
kubectl describe pods -n chart-testing
exit 1
fi
echo "All pods are running properly!"
kubectl get pods -n chart-testing
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 10
Expand Down Expand Up @@ -248,6 +298,31 @@ jobs:
run: ct install --debug --config ct.yaml --print-config --charts ${{ needs.lint-test.outputs.chart_name }}
if: ${{ needs.lint-test.outputs.changed == 'true' }}

- name: Verify Pod Status
if: ${{ needs.lint-test.outputs.changed == 'true' }}
run: |
echo "Waiting for pods to be ready..."
kubectl wait --for=condition=Ready pods --all -n chart-testing --timeout=300s
echo "Checking pod status..."
if [[ $(kubectl get pods -n chart-testing -o jsonpath='{.items[*].status.phase}' | tr ' ' '\n' | grep -v "Running" | wc -l) -ne 0 ]]; then
echo "Some pods are not running:"
kubectl get pods -n chart-testing
kubectl describe pods -n chart-testing
exit 1
fi
echo "Checking for pod restarts..."
if [[ $(kubectl get pods -n chart-testing -o jsonpath='{.items[*].status.containerStatuses[*].restartCount}' | tr ' ' '\n' | grep -v "^0$" | wc -l) -ne 0 ]]; then
echo "Some pods have restarted:"
kubectl get pods -n chart-testing
kubectl describe pods -n chart-testing
exit 1
fi
echo "All pods are running properly!"
kubectl get pods -n chart-testing
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 10
Expand Down Expand Up @@ -298,6 +373,31 @@ jobs:
run: ct install --debug --config ct.yaml --print-config --charts ${{ needs.lint-test.outputs.chart_name }}
if: ${{ needs.lint-test.outputs.changed == 'true' }}

- name: Verify Pod Status
if: ${{ needs.lint-test.outputs.changed == 'true' }}
run: |
echo "Waiting for pods to be ready..."
kubectl wait --for=condition=Ready pods --all -n chart-testing --timeout=300s
echo "Checking pod status..."
if [[ $(kubectl get pods -n chart-testing -o jsonpath='{.items[*].status.phase}' | tr ' ' '\n' | grep -v "Running" | wc -l) -ne 0 ]]; then
echo "Some pods are not running:"
kubectl get pods -n chart-testing
kubectl describe pods -n chart-testing
exit 1
fi
echo "Checking for pod restarts..."
if [[ $(kubectl get pods -n chart-testing -o jsonpath='{.items[*].status.containerStatuses[*].restartCount}' | tr ' ' '\n' | grep -v "^0$" | wc -l) -ne 0 ]]; then
echo "Some pods have restarted:"
kubectl get pods -n chart-testing
kubectl describe pods -n chart-testing
exit 1
fi
echo "All pods are running properly!"
kubectl get pods -n chart-testing
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 10
Expand Down
5 changes: 5 additions & 0 deletions ct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ target-branch: main
charts:
- charts/pulsar-resources-operator

# 添加固定的命名配置
namespace: chart-testing
release-label: app.kubernetes.io/instance
release-name: pulsar-resources-operator

# Additional commands to run per chart.
# Commands will be executed in the same order as provided in the list and will
# be rendered with go template before being executed.
Expand Down
19 changes: 9 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ require (
)

require (
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/iam v1.1.1 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
Expand Down Expand Up @@ -86,7 +84,7 @@ require (
go.etcd.io/etcd/api/v3 v3.5.9 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
go.etcd.io/etcd/client/v3 v3.5.9 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.35.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 // indirect
Expand All @@ -98,7 +96,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
golang.org/x/net v0.32.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
Expand Down Expand Up @@ -129,18 +127,19 @@ replace (
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace => github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.19.1
github.com/streamnative/kube-instrumentation => github.com/streamnative/kube-instrumentation v0.3.2
go.opentelemetry.io/contrib/detectors/gcp => go.opentelemetry.io/contrib/detectors/gcp v1.19.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc => go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp => go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0
go.opentelemetry.io/contrib/propagators/aws => go.opentelemetry.io/contrib/propagators/aws v1.19.0
go.opentelemetry.io/otel => go.opentelemetry.io/otel v1.19.0
go.opentelemetry.io/otel => go.opentelemetry.io/otel v1.21.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace => go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0
go.opentelemetry.io/otel/exporters/stdout => go.opentelemetry.io/otel/exporters/stdout v0.19.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace => go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0
go.opentelemetry.io/otel/metric => go.opentelemetry.io/otel/metric v1.19.0
go.opentelemetry.io/otel/sdk => go.opentelemetry.io/otel/sdk v1.19.0
go.opentelemetry.io/otel/sdk/metric => go.opentelemetry.io/otel/sdk/metric v1.19.0
go.opentelemetry.io/otel/sdk/trace => go.opentelemetry.io/otel/sdk/trace v1.19.0
go.opentelemetry.io/otel/trace => go.opentelemetry.io/otel/trace v1.19.0
go.opentelemetry.io/otel/metric => go.opentelemetry.io/otel/metric v1.21.0
go.opentelemetry.io/otel/sdk => go.opentelemetry.io/otel/sdk v1.21.0
go.opentelemetry.io/otel/sdk/metric => go.opentelemetry.io/otel/sdk/metric v1.21.0
go.opentelemetry.io/otel/sdk/trace => go.opentelemetry.io/otel/sdk/trace v1.21.0
go.opentelemetry.io/otel/trace => go.opentelemetry.io/otel/trace v1.21.0
)

// Pulsar Operator
Expand Down
29 changes: 15 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY=
cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc=
cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k=
cloud.google.com/go/iam v1.1.1 h1:lW7fzj15aVIXYHREOqjRBV9PsH0Z6u8Y46a1YGvQP4Y=
Expand Down Expand Up @@ -70,8 +71,8 @@ github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA
github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU=
github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU=
github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/envoyproxy/protoc-gen-validate v0.10.1 h1:c0g45+xCJhdgFGw7a5QAfdS4byAbud7miNWJ1WwEVf8=
github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss=
github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA=
github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE=
github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ2tG6yudJd8LBksgI=
github.com/evanphx/json-patch v5.7.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg=
Expand Down Expand Up @@ -338,22 +339,22 @@ go.etcd.io/etcd/server/v3 v3.5.9 h1:vomEmmxeztLtS5OEH7d0hBAg4cjVIu9wXuNzUZx2ZA0=
go.etcd.io/etcd/server/v3 v3.5.9/go.mod h1:GgI1fQClQCFIzuVjlvdbMxNbnISt90gdfYyqiAIt65g=
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.35.0 h1:xFSRQBbXF6VvYRf2lqMJXxoB72XI1K/azav8TekHHSw=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.35.0/go.mod h1:h8TWwRAhQpOd0aM5nYsRD8+flnkj+526GEIVlarH7eY=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 h1:PzIubN4/sjByhDRHLviCjJuweBXWFZWhghjg7cS28+M=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 h1:KfYpVmrjI7JuToy5k8XV3nkapjWx48k4E4JOtVstzQI=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0/go.mod h1:SeQhzAEccGVZVEy7aH87Nh0km+utSpo1pTv6eMMop48=
go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs=
go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY=
go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc=
go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 h1:Mne5On7VWdx7omSrSSZvM4Kw7cS7NQkOOmLcgscI51U=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0/go.mod h1:IPtUMKL4O3tH5y+iXVyAXqpAwMuzC1IrxVS81rummfE=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 h1:3d+S281UTjM+AbF31XSOYn1qXn3BgIdWl8HNEpx08Jk=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0/go.mod h1:0+KuTDyKL4gjKCF75pHOX4wuzYDUZYfAQdSu43o+Z2I=
go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE=
go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8=
go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o=
go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A=
go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg=
go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo=
go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4=
go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM=
go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8=
go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E=
go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc=
go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ=
go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94=
go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A=
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca h1:VdD38733bfYv5tUZwEIskMM93VanwNIi5bIKnDrJdEY=
Expand Down Expand Up @@ -384,8 +385,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI=
golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
Loading

0 comments on commit 51b9363

Please sign in to comment.