You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cluster-autoscaler/FAQ.md
+40-1Lines changed: 40 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -912,4 +912,43 @@ We are aware that this process is tedious and we will work to improve it.
912
912
913
913
### How can I update CA dependencies (particularly k8s.io/kubernetes)?
914
914
915
-
TODO - update needed after k8s migrated to go modules
915
+
Cluster Autoscaler imports a huge chunk of internal k8s code as it calls out to scheduler implementation.
916
+
Therefore we want to keep set of libraries used in CA as close to one used by k8s, to avoid
917
+
unexpected problems coming from version incompatibilities.
918
+
919
+
Cluster Autoscaler depends on `go modules` mechanism for dependency management, but do not use it directly
920
+
during build process. `go.mod` file is just used to generate the `vendor` directory and further compilation
921
+
is run against set of libraries stored in `vendor`. `vendor` directory can be regenerated using [`update-vendor.sh`](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/hack/update-vendor.sh) script.
922
+
The `update-vendor.sh` script is responsible for autogenerating `go.mod` file used by Cluster Autoscaler. The base
923
+
of the file is `go.mod` file coming from [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) repository.
924
+
On top of that script adds modifications as defined
925
+
locally in [`go.mod-extra`](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/go.mod-extra) file.
926
+
927
+
Note: It is important that one should **never manually edit** `go.mod` file as it is regenerated
928
+
on each `update-vendor.sh` call. Any extra libraries or version overrides should be put in `go.mod-extra` file (syntax of the file
929
+
is same as syntax of `go.mod` file).
930
+
931
+
Finally `vendor` directry is materialized and validation tests are run.
932
+
933
+
If everything completes correctly a commit with updated `vendor` directory is created automatically. The pull-request with changed vendor
934
+
must be sent out manually. The PR should include the auto-generated commit as well as commits containing any manual changes/fixes that need to
935
+
go together.
936
+
937
+
Execution of `update-vendor.sh` can be parametrized using command line argumets:
938
+
- `-f`- kubernetes/kubernetes fork to use. On `master` it defaults to `[email protected]:kubernetes/kubernetes.git`
939
+
- `-r`- revision in kubernetes/kubernetes which should be used to get base `go.mod` file
940
+
- `-d`- specifies script workdir; useful to speed up execution if script needs to be run multiple times, because updating vendor resulted in some compilation errors on Cluster-Autoscaler side which need to be fixed
- `update-vendor.sh`is called directly in shell (no docker is used) therefore its operation may differ from environment to environment.
949
+
- It is important that go version, which isn in use in the shell in which `update-vendor.sh` is called, matches the `go <version>` directive specified in `go.mod` file
950
+
in `kubernetes/kubernetes` revision against which revendoring is done.
951
+
- `update-vendor.sh`automatically runs unit tests as part of verification process. If one needs to suppress that, it can be done by overriding `VERIFY_COMMAND` variable (`VERIFY_COMMAND=true ./hack/update-vendor.sh ...`)
952
+
- If one wants to only add new libraries to `go.mod-extra`, but not change the base `go.mod`, `-r` should be used with kubernetes/kubernets revision, which was used last time `update-vendor.sh` was called. One can determine that revision by looking at `git log` in Cluster Autoscaler repository. Following command will do the trick `git log | grep "Updating vendor against"`.
0 commit comments