Skip to content

Commit

Permalink
chore: update controller-runtime to 0.17
Browse files Browse the repository at this point in the history
Signed-off-by: Rory Z <[email protected]>
  • Loading branch information
Rory-Z committed Apr 9, 2024
1 parent a761bf3 commit e010fed
Show file tree
Hide file tree
Showing 49 changed files with 3,811 additions and 1,388 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-reloader-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
build-reloader-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Get reloader image version
id: version
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: minikube start
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Update helm
run: |
helm repo add emqx https://repos.emqx.io/charts
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/cts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
echo "KUBECONFIG=/etc/rancher/k3s/k3s.yaml" >> $GITHUB_ENV
- if: matrix.kubernetes-env == 'minikube'
run: minikube start --kubernetes-version="${{ matrix.kubernetes-version }}"
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21'
- name: install kubebuilder
run: |
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
Expand All @@ -58,7 +58,7 @@ jobs:
build-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v2
- uses: docker/setup-qemu-action@v2
with:
Expand Down Expand Up @@ -124,10 +124,10 @@ jobs:
echo "KUBECONFIG=/etc/rancher/k3s/k3s.yaml" >> $GITHUB_ENV
- if: matrix.kubernetes-env == 'minikube'
run: minikube start --kubernetes-version="${{ matrix.kubernetes-version }}"
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21'
- name: Deploy operator
timeout-minutes: 5
uses: ./.github/actions/deploy-operator
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ jobs:
--namespace cert-manager \
--create-namespace \
--set installCRDs=true
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- uses: actions/checkout@v3
go-version: '1.21'
- name: Build image
env:
IMG: "emqx/emqx-operator-controller:${{ github.sha }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gitlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout source code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install gitlint
run: |
sudo apt-get update
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
helm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Get tag
id: get_tag
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check helm
run: |
version=$(grep -E "^version" deploy/charts/emqx-operator/Chart.yaml | grep -oE "[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc)\.[0-9])?")
Expand Down
47 changes: 25 additions & 22 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ jobs:
e2e: ${{ steps.e2e.outputs.e2e }}

steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- uses: golangci/golangci-lint-action@v3
go-version: '1.21'
- uses: golangci/golangci-lint-action@v4
with:
## TODO: https://github.com/golangci/golangci-lint-action/issues/759
version: v1.52.2
##https://github.com/golangci/golangci-lint-action/issues/807
skip-pkg-cache: true
args: --timeout=5m
- run: go install github.com/google/go-licenses@latest
- run: $(go env GOPATH)/bin/go-licenses check . --disallowed_types forbidden,restricted,unknown
Expand Down Expand Up @@ -77,10 +77,10 @@ jobs:

steps:
- run: minikube start
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21'
- run: go install github.com/onsi/ginkgo/v2/ginkgo@latest
- name: Install Telepresence
env:
Expand All @@ -91,30 +91,32 @@ jobs:
- run: telepresence helm install
- run: telepresence connect
- name: Run e2e test cases
id: e2e_test
env:
FILE: ${{ matrix.file }}
run: |
echo "Run e2e test cases: $FILE"
filename="$(basename $FILE)"
filename="${filename%.*}"
$(go env GOPATH)/bin/ginkgo -v --cover -covermode=atomic -coverpkg=./... -coverprofile=${filename}.out --focus-file=${filename} $(dirname $FILE)
- uses: actions/upload-artifact@v3
echo "filename=${filename}" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v4
with:
name: coverprofile
name: coverprofile-${{ steps.e2e_test.outputs.filename }}
path: |
*.out
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21'
- run: make test
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: coverprofile
name: coverprofile-unit-test
path: |
*.out
Expand All @@ -124,19 +126,20 @@ jobs:
- e2e-test
- unit-test
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: coverprofile
pattern: coverprofile-*
- name: Get cover files
id: files
run: |
files="$(find -maxdepth 1 -name '*.out' -exec readlink -f '{}' ';' | tr '\n' ',' | sed 's/,$//g')"
files="$(find . -type f -name '*.out' -exec readlink -f '{}' ';' | tr '\n' ',' | sed 's/,$//g')"
echo "files=$files" >> $GITHUB_OUTPUT
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
with:
files: ${{ steps.files.outputs.files }} # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
- uses: geekyeggo/delete-artifact@v2
token: ${{ secrets.CODECOV_TOKEN }} # required
- uses: geekyeggo/delete-artifact@v5
with:
name: coverprofile
name: coverprofile-*
8 changes: 4 additions & 4 deletions .github/workflows/upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ jobs:
--namespace cert-manager \
--create-namespace \
--set installCRDs=true
- uses: actions/setup-go@v3
with:
go-version: '1.20'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Get pre stable version
## Just get the last stable version, ignore the pre-release version
run: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.20.3 as builder
FROM golang:1.21 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
22 changes: 11 additions & 11 deletions apis/apps/v1beta3/emqxbroker_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)

var v1bete3EmqxBroker = &EmqxBroker{
Expand All @@ -40,7 +40,7 @@ var v1bete3EmqxBroker = &EmqxBroker{
},
},
Spec: EmqxBrokerSpec{
Replicas: pointer.Int32(3),
Replicas: ptr.To(int32(3)),
Env: []corev1.EnvVar{
{
Name: "foo",
Expand Down Expand Up @@ -77,7 +77,7 @@ var v1bete3EmqxBroker = &EmqxBroker{
},
},
Persistent: corev1.PersistentVolumeClaimSpec{
StorageClassName: pointer.String("foo"),
StorageClassName: ptr.To("foo"),
},
InitContainers: []corev1.Container{
{
Expand All @@ -97,9 +97,9 @@ var v1bete3EmqxBroker = &EmqxBroker{
ACL: []string{"allow, all."},
ImagePullPolicy: corev1.PullIfNotPresent,
SecurityContext: &corev1.PodSecurityContext{
RunAsUser: pointer.Int64(1000),
RunAsGroup: pointer.Int64(1000),
FSGroup: pointer.Int64(1000),
RunAsUser: ptr.To(int64(1000)),
RunAsGroup: ptr.To(int64(1000)),
FSGroup: ptr.To(int64(1000)),
FSGroupChangePolicy: &[]corev1.PodFSGroupChangePolicy{corev1.FSGroupChangeAlways}[0],
},
ExtraVolumes: []corev1.Volume{
Expand Down Expand Up @@ -202,10 +202,10 @@ var v1beta4EmqxBroker = &v1beta4.EmqxBroker{
},
},
Spec: v1beta4.EmqxBrokerSpec{
Replicas: pointer.Int32(3),
Replicas: ptr.To(int32(3)),
Persistent: &corev1.PersistentVolumeClaimTemplate{
Spec: corev1.PersistentVolumeClaimSpec{
StorageClassName: pointer.String("foo"),
StorageClassName: ptr.To("foo"),
},
},
Template: v1beta4.EmqxTemplate{
Expand Down Expand Up @@ -333,9 +333,9 @@ var v1beta4EmqxBroker = &v1beta4.EmqxBroker{
},
},
PodSecurityContext: &corev1.PodSecurityContext{
RunAsUser: pointer.Int64(1000),
RunAsGroup: pointer.Int64(1000),
FSGroup: pointer.Int64(1000),
RunAsUser: ptr.To(int64(1000)),
RunAsGroup: ptr.To(int64(1000)),
FSGroup: ptr.To(int64(1000)),
FSGroupChangePolicy: &[]corev1.PodFSGroupChangePolicy{corev1.FSGroupChangeAlways}[0],
},
},
Expand Down
22 changes: 11 additions & 11 deletions apis/apps/v1beta3/emqxenterprise_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)

var v1bete3EmqxEnterprise = &EmqxEnterprise{
Expand All @@ -40,7 +40,7 @@ var v1bete3EmqxEnterprise = &EmqxEnterprise{
},
},
Spec: EmqxEnterpriseSpec{
Replicas: pointer.Int32(3),
Replicas: ptr.To(int32(3)),
Env: []corev1.EnvVar{
{
Name: "foo",
Expand Down Expand Up @@ -77,7 +77,7 @@ var v1bete3EmqxEnterprise = &EmqxEnterprise{
},
},
Persistent: corev1.PersistentVolumeClaimSpec{
StorageClassName: pointer.String("foo"),
StorageClassName: ptr.To("foo"),
},
InitContainers: []corev1.Container{
{
Expand All @@ -100,9 +100,9 @@ var v1bete3EmqxEnterprise = &EmqxEnterprise{
ACL: []string{"allow, all."},
ImagePullPolicy: corev1.PullIfNotPresent,
SecurityContext: &corev1.PodSecurityContext{
RunAsUser: pointer.Int64(1000),
RunAsGroup: pointer.Int64(1000),
FSGroup: pointer.Int64(1000),
RunAsUser: ptr.To(int64(1000)),
RunAsGroup: ptr.To(int64(1000)),
FSGroup: ptr.To(int64(1000)),
FSGroupChangePolicy: &[]corev1.PodFSGroupChangePolicy{corev1.FSGroupChangeAlways}[0],
},
ExtraVolumes: []corev1.Volume{
Expand Down Expand Up @@ -205,13 +205,13 @@ var v1beta4EmqxEnterprise = &v1beta4.EmqxEnterprise{
},
},
Spec: v1beta4.EmqxEnterpriseSpec{
Replicas: pointer.Int32(3),
Replicas: ptr.To(int32(3)),
License: v1beta4.EmqxLicense{
SecretName: "fake-license-secret",
},
Persistent: &corev1.PersistentVolumeClaimTemplate{
Spec: corev1.PersistentVolumeClaimSpec{
StorageClassName: pointer.String("foo"),
StorageClassName: ptr.To("foo"),
},
},
Template: v1beta4.EmqxTemplate{
Expand Down Expand Up @@ -339,9 +339,9 @@ var v1beta4EmqxEnterprise = &v1beta4.EmqxEnterprise{
},
},
PodSecurityContext: &corev1.PodSecurityContext{
RunAsUser: pointer.Int64(1000),
RunAsGroup: pointer.Int64(1000),
FSGroup: pointer.Int64(1000),
RunAsUser: ptr.To(int64(1000)),
RunAsGroup: ptr.To(int64(1000)),
FSGroup: ptr.To(int64(1000)),
FSGroupChangePolicy: &[]corev1.PodFSGroupChangePolicy{corev1.FSGroupChangeAlways}[0],
},
},
Expand Down
Loading

0 comments on commit e010fed

Please sign in to comment.