Fix "unknown apiVersion: kind.sigs.k8s.io/v1alpha3" (#76)

* Fix "unknown apiVersion: kind.sigs.k8s.io/v1alpha3"

*Motivation*

The api version `kind.sigs.k8s.io/v1alpha3` is not available anymore for kind clusters.
So all the CI actions are broken now. This PR fix the issue.

Additionally it adds a helm chart lint job to lint the chart changes.

* Trigger CI when kind cluster build script is changed
This commit is contained in:
Sijie Guo 2020-11-11 11:48:42 -07:00 committed by GitHub
parent fb4c44f449
commit 669af788ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 61 additions and 21 deletions

View File

@ -23,7 +23,7 @@ set -o errexit
set -o nounset
set -o pipefail
DEFAULT_IMAGE=quay.io/helmpack/chart-testing:v2.4.0
DEFAULT_IMAGE=quay.io/helmpack/chart-testing:v3.0.0
show_help() {
cat << EOF
@ -65,12 +65,9 @@ main() {
# charts changed.
echo "::set-output name=changed::true"
if [[ "$command" == "lint" ]] || [[ "$command" == "list-changed" ]]; then
helm_init
# All other ct commands require a cluster to be created in a previous step.
else
if [[ "$command" != "lint" ]] && [[ "$command" != "list-changed" ]]; then
configure_kube
install_tiller
fi
run_ct
@ -151,21 +148,6 @@ configure_kube() {
docker cp "$kubeconfig" ct:/root/.kube/config
}
install_tiller() {
echo 'Installing Tiller...'
docker_exec sh -c 'kubectl create serviceaccount tiller --namespace kube-system --save-config --dry-run \
--output=yaml | kubectl apply -f -'
docker_exec sh -c 'kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin \
--serviceaccount=kube-system:tiller --save-config --dry-run --output=yaml | kubectl apply -f -'
docker_exec helm init --service-account tiller --upgrade --wait
echo
}
helm_init() {
docker_exec helm init --client-only
echo
}
run_ct() {
echo "Running 'ct $command'..."
docker_exec ct "$command"

48
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,48 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#
name: Precommit - Helm Chart Lint
on:
pull_request:
branches:
- '*'
paths:
- 'charts/pulsar/**'
- '.ci/ct.sh'
jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Check if this pull request only changes documentation
id: docs
uses: apache/pulsar-test-infra/diff-only@master
with:
args: site2 .asf.yaml ct.yaml
- name: Lint chart
id: lint
uses: helm/chart-testing-action@v1.0.0
with:
command: lint

View File

@ -24,6 +24,7 @@ on:
- '*'
paths:
- 'charts/pulsar/**'
- 'hack/kind-cluster-build.sh'
jobs:
lint-test:
runs-on: ubuntu-latest

View File

@ -24,6 +24,7 @@ on:
- '*'
paths:
- 'charts/pulsar/**'
- 'hack/kind-cluster-build.sh'
jobs:
lint-test:
runs-on: ubuntu-latest

View File

@ -24,6 +24,7 @@ on:
- '*'
paths:
- 'charts/pulsar/**'
- 'hack/kind-cluster-build.sh'
jobs:
lint-test:
runs-on: ubuntu-latest

View File

@ -24,6 +24,7 @@ on:
- '*'
paths:
- 'charts/pulsar/**'
- 'hack/kind-cluster-build.sh'
jobs:
lint-test:
runs-on: ubuntu-latest

View File

@ -24,6 +24,7 @@ on:
- '*'
paths:
- 'charts/pulsar/**'
- 'hack/kind-cluster-build.sh'
jobs:
lint-test:
runs-on: ubuntu-latest

View File

@ -24,6 +24,7 @@ on:
- '*'
paths:
- 'charts/pulsar/**'
- 'hack/kind-cluster-build.sh'
jobs:
lint-test:
runs-on: ubuntu-latest

View File

@ -24,6 +24,7 @@ on:
- '*'
paths:
- 'charts/pulsar/**'
- 'hack/kind-cluster-build.sh'
jobs:
lint-test:
runs-on: ubuntu-latest

View File

@ -24,6 +24,7 @@ on:
- '*'
paths:
- 'charts/pulsar/**'
- 'hack/kind-cluster-build.sh'
jobs:
lint-test:
runs-on: ubuntu-latest

View File

@ -24,6 +24,7 @@ on:
- '*'
paths:
- 'charts/pulsar/**'
- 'hack/kind-cluster-build.sh'
jobs:
lint-test:
runs-on: ubuntu-latest

View File

@ -24,6 +24,7 @@ on:
- '*'
paths:
- 'charts/pulsar/**'
- 'hack/kind-cluster-build.sh'
jobs:
lint-test:
runs-on: ubuntu-latest

View File

@ -117,7 +117,7 @@ configFile=${workDir}/kind-config.yaml
cat <<EOF > ${configFile}
kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraPortMappings: