Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE-479] [operator] refine operator's build system #491

Merged
merged 10 commits into from
Jan 29, 2023

Conversation

advancedxy
Copy link
Contributor

@advancedxy advancedxy commented Jan 16, 2023

What changes were proposed in this pull request?

  1. image name defaults to rss-$module when no registry is specifed
  2. upgrade envtest to 1.24.1 to support Apple M1 chips
  3. modify Dockerfile to replace base image from alpine to debian slim
  4. remove gorequest dep
  5. modify go.mod and related changes to upgrade go version to 1.17
  6. add new changes in auto-generated code(by go 1.17 and above)

Why are the changes needed?

to address #479.

Does this PR introduce any user-facing change?

No

How was this patch tested?

No need

@advancedxy
Copy link
Contributor Author

@wangao1236 please take a look when you have time.

@zuston
Copy link
Member

zuston commented Jan 16, 2023

I have a question about this, when I built the rss image from the master branch, the image version is release.0.4.0.316.g01d37beb
image

This makes me confused.

@advancedxy
Copy link
Contributor Author

I have a question about this, when I built the rss image from the master branch, the image version is release.0.4.0.316.g01d37beb image

This makes me confused.

Me too. I'm not sure why this version format is used. Maybe @wangao1236 could give us some hint.

@wangao1236
Copy link
Collaborator

I have a question about this, when I built the rss image from the master branch, the image version is release.0.4.0.316.g01d37beb image
This makes me confused.

Me too. I'm not sure why this version format is used. Maybe @wangao1236 could give us some hint.

This is just a way of differentiating versions. You can customize the version name by setting value of "IMAGE_VERSION". Maybe we can define a new way to differentiate versions. Do you have any suggestions?

@codecov-commenter
Copy link

codecov-commenter commented Jan 17, 2023

Codecov Report

Merging #491 (7bb48f9) into master (0a6605b) will increase coverage by 0.04%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##             master     #491      +/-   ##
============================================
+ Coverage     59.73%   59.78%   +0.04%     
- Complexity     1764     1770       +6     
============================================
  Files           205      205              
  Lines         11527    11531       +4     
  Branches       1033     1033              
============================================
+ Hits           6886     6894       +8     
+ Misses         4234     4232       -2     
+ Partials        407      405       -2     
Impacted Files Coverage Δ
...org/apache/uniffle/server/ShuffleFlushManager.java 84.37% <0.00%> (+0.33%) ⬆️
...he/uniffle/server/storage/LocalStorageManager.java 87.00% <0.00%> (+1.12%) ⬆️
...pache/hadoop/mapreduce/task/reduce/RssFetcher.java 92.30% <0.00%> (+1.53%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more


MODULES ?= webhook controller

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.22.1
ENVTEST_K8S_VERSION = 1.24.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can update it in go.mod as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which lib should I update the version? k8s.io/api v0.22.2 -> what version?

I'm not quite family with envtest...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually my question is why update envtest?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the names of individual fields in k8s v1.24 have been changed, and I recommend a separate PR to change the k8s version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually my question is why update envtest?

To quote:upgrade envtest to 1.24.1 to support Apple M1 chips. envtest v1.22.x doesn't support M1 chip, not publish related arm archives. So, you cannot test the controller on M1.

The operator's required k8s in go.mod doesn't change, and still goes to 1.22 (k8s.io/api v0.22.x). And RSS's operator doesn't seem to use too much advanced features.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed earlier, why upgrade envtest to 1.24 when you don't need to upgrade k8s to 1.24?
cc @advancedxy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed earlier, why upgrade envtest to 1.24 when you don't need to upgrade k8s to 1.24? cc @advancedxy

Yeah, as discussed earlier. Envtest is upgraded to 1.24 to support Apple M1's chips as 1.22 doesn't work for M1 chip.

The operator itself doesn't need to upgrade to 1.24 and it shouldn't since many K8S clusters are in old versions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed earlier, why upgrade envtest to 1.24 when you don't need to upgrade k8s to 1.24? cc @advancedxy

Yeah, as discussed earlier. Envtest is upgraded to 1.24 to support Apple M1's chips as 1.22 doesn't work for M1 chip.

The operator itself doesn't need to upgrade to 1.24 and it shouldn't since many K8S clusters are in old versions.

Ok, I get it.

@@ -1,3 +1,4 @@
//go:build !ignore_autogenerated
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is due to locally dev machine's go version is 1.17 or higher(such as 1.19).

I will create a followup pr to upgrade the go version to 1.17.

WORKDIR /
COPY --from=builder /workspace/${MODULE} .

CMD ["${MODULE}"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, this is wrong:

  1. the ARG MODULE is not defined in the second stage. the module might be empty or undefined.
  2. MODULE is only available in build time. You cannot start the container by default since the MODULE env is not defined in the container.

cc @wangao1236

@advancedxy
Copy link
Contributor Author

@zuston could you also help review this pr.

@zuston
Copy link
Member

zuston commented Jan 17, 2023

@zuston could you also help review this pr.

OK. I will take a look tomorrow, but to be honest, I don’t have much golang experience.

@advancedxy advancedxy changed the title [operator] better build system support [ISSUE-479] [operator] better build system support Jan 19, 2023
@kaijchen
Copy link
Contributor

Rerun CI to see if #512 can be fixed.

@advancedxy advancedxy changed the title [ISSUE-479] [operator] better build system support [ISSUE-479] [operator] refine operator's build system Jan 29, 2023
@advancedxy
Copy link
Contributor Author

@wangao1236 @kaijchen please take a look at this. I would like this to be merged today as there are other changes based on this.

Copy link
Contributor

@kaijchen kaijchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a glance of the changes, mostly looks good.
I'm not familiar with the build-operator.sh and the Makefile part.

deploy/kubernetes/operator/hack/Dockerfile Show resolved Hide resolved
@advancedxy
Copy link
Contributor Author

ping @wangao1236 @kaijchen


MODULES ?= webhook controller

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.22.1
ENVTEST_K8S_VERSION = 1.24.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed earlier, why upgrade envtest to 1.24 when you don't need to upgrade k8s to 1.24? cc @advancedxy

Yeah, as discussed earlier. Envtest is upgraded to 1.24 to support Apple M1's chips as 1.22 doesn't work for M1 chip.

The operator itself doesn't need to upgrade to 1.24 and it shouldn't since many K8S clusters are in old versions.

Ok, I get it.

Copy link
Contributor

@kaijchen kaijchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @advancedxy for the improvement.

@kaijchen kaijchen merged commit e1be8d6 into apache:master Jan 29, 2023

CMD ["${MODULE}"]
ENV OPERATOR_BIN=/${MODULE}
ENTRYPOINT "/${OPERATOR_BIN}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest using exec mode in dockerfile. For example, ENTRYPOINT ["${OPERATOR_BIN}"].
Ref: https://emmer.dev/blog/docker-shell-vs.-exec-form/
However, this does not affect normal running.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion. Let's raise a follow up pr to quick address it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants