kubesphere / s2ioperator

Operator for Source to image
Apache License 2.0
47 stars 31 forks source link

Upgrade controller-manager from 0.4.0 to 0.7.1 #163

Closed JohnNiang closed 3 years ago

JohnNiang commented 3 years ago

What this PR dose?

References:

Why we need it?

Because coming KubeSphere 3.2.0 cliams to support Kubernetes 1.22.x at most, please see also https://github.com/kubesphere/kubekey/pull/634, but the dependencies of this project are too old to support Kubernetes 1.22.x, event if we change extension API from v1beta1 to v1, please see alos https://github.com/kubesphere-sigs/ks-devops-helm-chart/pull/29.

When we try to create a S2iBuilder like below:

apiVersion: devops.kubesphere.io/v1alpha1
kind: S2iBuilder
metadata:
  labels:
    controller-tools.k8s.io: '1.0'
    s2i-type.kubesphere.io: s2i
  annotations:
    languageType: java
    kubesphere.io/repoUrl: ''
    kubesphere.io/creator: admin
  name: my-halo-latest-xj2
  namespace: default
spec:
  config:
    replicas: 0
    export: true
    outputBuildResult: true
    builderPullPolicy: if-not-present
    revisionId: master
    tag: latest
    contextDir: "/"
    builderImage: kubesphere/tomcat85-java11-centos7:v3.2.0
    buildVolumes:
    - s2i_java_cache:/tmp/artifacts
    runtimeArtifacts:
    - source: "/deployments"
    runtimeImage: kubesphere/tomcat85-java11-runtime:v3.2.0
    type: java
    pushAuthentication:
      secretRef:
        name: dockerhub
    imageName: my-halo
    sourceUrl: https://github.com/halo-dev/halo

The following error will appear:

 {"level":"error","ts":1635809362.3882542,"logger":"controller-runtime.webhook.webhooks","msg":"unable to decode the request","webhook":"/mutate-devops-kubesphere-io-v1alpha1-s2ibuilder","error":"no kind \"AdmissionReview\" is registered for version \"admission.k8s.io/v1\" in scheme \"pkg/runtime/scheme.go:101\"","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/go/pkg/mod/github.com/go-logr/zapr@v0.1.1/zapr.go:128\nsigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).ServeHTTP\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.4.0/pkg/webhook/admission/http.go:79\nsigs.k8s.io/controller-runtime/pkg/webhook.instrumentedHook.func1\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.4.0/pkg/webhook/server.go:117\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:1995\nnet/http.(*ServeMux).ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2375\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2774\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1878"}

Special notes for reviewers

Main changes are in commit https://github.com/kubesphere/s2ioperator/commit/46514f95878700edca6b5f7458d0cfac1384e47e.

Docker image for test:

My manual test result:

image

/kind enhancement

ks-ci-bot commented 3 years ago

@JohnNiang: The label(s) kind/enhancement cannot be applied, because the repository doesn't have them.

In response to [this](https://github.com/kubesphere/s2ioperator/pull/163): >### What this PR dose? > >- Remove vendor folder and refine go.mod; > - Upgrade [controller-manager](https://github.com/kubernetes-sigs/controller-runtime) from 0.4.0 to 0.7.1; > - Upgrade go from 1.12 to 1.16. >- Refine Makefile to make some commands consistent; >- Refine codes due to break changes since controller-manager 0.7.1; >- Regenerate clients, openapi and CRDs. > >References: >- https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.7.0 >- https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.7.1 > >### Why we need it? > >Because coming KubeSphere 3.2.0 cliams to support Kubernetes 1.22.x at most, please see also https://github.com/kubesphere/kubekey/pull/634, but the dependencies of this project are too old to support Kubernetes 1.22.x, event if we change extension API from v1beta1 to v1, please see alos https://github.com/kubesphere-sigs/ks-devops-helm-chart/pull/29. > >When we try to create a S2iBuilder like below: > >```yaml >apiVersion: devops.kubesphere.io/v1alpha1 >kind: S2iBuilder >metadata: > labels: > controller-tools.k8s.io: '1.0' > s2i-type.kubesphere.io: s2i > annotations: > languageType: java > kubesphere.io/repoUrl: '' > kubesphere.io/creator: admin > name: my-halo-latest-xj2 > namespace: default >spec: > config: > replicas: 0 > export: true > outputBuildResult: true > builderPullPolicy: if-not-present > revisionId: master > tag: latest > contextDir: "/" > builderImage: kubesphere/tomcat85-java11-centos7:v3.2.0 > buildVolumes: > - s2i_java_cache:/tmp/artifacts > runtimeArtifacts: > - source: "/deployments" > runtimeImage: kubesphere/tomcat85-java11-runtime:v3.2.0 > type: java > pushAuthentication: > secretRef: > name: dockerhub > imageName: my-halo > sourceUrl: https://github.com/halo-dev/halo >``` > >The following error will appear: > >```go > {"level":"error","ts":1635809362.3882542,"logger":"controller-runtime.webhook.webhooks","msg":"unable to decode the request","webhook":"/mutate-devops-kubesphere-io-v1alpha1-s2ibuilder","error":"no kind \"AdmissionReview\" is registered for version \"admission.k8s.io/v1\" in scheme \"pkg/runtime/scheme.go:101\"","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/go/pkg/mod/github.com/go-logr/zapr@v0.1.1/zapr.go:128\nsigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).ServeHTTP\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.4.0/pkg/webhook/admission/http.go:79\nsigs.k8s.io/controller-runtime/pkg/webhook.instrumentedHook.func1\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.4.0/pkg/webhook/server.go:117\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:1995\nnet/http.(*ServeMux).ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2375\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2774\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1878"} >``` > >### Special notes for reviewers > >Main changes are in commit https://github.com/kubesphere/s2ioperator/commit/46514f95878700edca6b5f7458d0cfac1384e47e. > >/kind enhancement Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
zryfish commented 3 years ago

/lgtm

zryfish commented 3 years ago

/lgtm /approve

ks-ci-bot commented 3 years ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: JohnNiang, zryfish To complete the pull request process, please assign shaowenchen after the PR has been reviewed. You can assign the PR to them by writing /assign @shaowenchen in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/kubesphere/s2ioperator/blob/master/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment