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

Support code generation via kube_codegen.sh when the repository path is outside the package name #165

Closed
mimowo opened this issue Nov 6, 2023 · 5 comments

Comments

@mimowo
Copy link

mimowo commented Nov 6, 2023

In particular, the script only works when the kueue repository is cloned into the "sigs.k8s.io" folder, so that it matches its package name prefix : sigs.k8s.io/kueue.
See more details here: kubernetes-sigs/kueue#1151 (comment)
It was also reported as a complication for jobset: kubernetes-sigs/jobset#305

@sportshead
Copy link

Workaround for multi-level packages (e.g. github.com/sportshead/codegen-demo instead of just sigs.k8s.io/kueue:

# TODO: remove the workaround when the issue is solved in code-generator
# (https://github.com/kubernetes/code-generator/issues/165).
# kube_codegen.sh expects this layout:
# .
# └── github.com
#     └── sportshead
#         └── codegen-demo
# We can use soft links in order to fake this layout, such that
# ./github.com/sportshead/codegen-demo resolves to ././../codegen-demo, or ./.
ln -s . github.com
ln -s .. sportshead
trap "rm github.com && rm sportshead" EXIT

tmshort added a commit to tmshort/operator-lifecycle-manager that referenced this issue Jan 12, 2024
Hack `scripts/update_codegen.sh` script to continue to generate code using
the deprecated scripts. The deprecated scripts now call into each other,
and unfortunately, `go mod vendor` doesn't keep permission bits around.
So, we need to update the execute permissions on a vendored script.

The new `kube_codegen.sh` doesn't work when the repository path is
outside the package name, see:
kubernetes/code-generator#165

The workaround is to create symlinked directories to fool `kube_codegen.sh`
into thinking the path is correct. But first we'd have to start using the
new script.

Once `kube_codegen.sh` is fixed, we should migrate to it (which is a
non-trivial task).

Signed-off-by: Todd Short <todd.short@me.com>
tmshort added a commit to tmshort/operator-lifecycle-manager that referenced this issue Jan 12, 2024
Hack `scripts/update_codegen.sh` script to continue to generate code using
the deprecated scripts. The deprecated scripts now call into each other,
and unfortunately, `go mod vendor` doesn't keep permission bits around.
So, we need to update the execute permissions on a vendored script.

The new `kube_codegen.sh` doesn't work when the repository path is
outside the package name, see:
kubernetes/code-generator#165

The workaround is to create symlinked directories to fool `kube_codegen.sh`
into thinking the path is correct. But first we'd have to start using the
new script.

Once `kube_codegen.sh` is fixed, we should migrate to it (which is a
non-trivial task).

Signed-off-by: Todd Short <todd.short@me.com>
tmshort added a commit to tmshort/operator-lifecycle-manager that referenced this issue Jan 15, 2024
Hack `scripts/update_codegen.sh` script to continue to generate code using
the deprecated scripts. The deprecated scripts now call into each other,
and unfortunately, `go mod vendor` doesn't keep permission bits around.
So, we need to update the execute permissions on a vendored script.

The new `kube_codegen.sh` doesn't work when the repository path is
outside the package name, see:
kubernetes/code-generator#165

The workaround is to create symlinked directories to fool `kube_codegen.sh`
into thinking the path is correct. But first we'd have to start using the
new script.

Once `kube_codegen.sh` is fixed, we should migrate to it (which is a
non-trivial task).

Signed-off-by: Todd Short <todd.short@me.com>
github-merge-queue bot pushed a commit to operator-framework/operator-lifecycle-manager that referenced this issue Jan 15, 2024
* Update k8s to v0.28.5

This also updates to the latest operator-framework api and operator-registry
kind is still at v0.20.0 (k8s 1.27.3) as it's the latest version

Signed-off-by: Todd Short <todd.short@me.com>

* Update code for k8s v0.28.5 compatibility

Fix unit-tests as well

Signed-off-by: Todd Short <todd.short@me.com>

* Update codegen

Hack `scripts/update_codegen.sh` script to continue to generate code using
the deprecated scripts. The deprecated scripts now call into each other,
and unfortunately, `go mod vendor` doesn't keep permission bits around.
So, we need to update the execute permissions on a vendored script.

The new `kube_codegen.sh` doesn't work when the repository path is
outside the package name, see:
kubernetes/code-generator#165

The workaround is to create symlinked directories to fool `kube_codegen.sh`
into thinking the path is correct. But first we'd have to start using the
new script.

Once `kube_codegen.sh` is fixed, we should migrate to it (which is a
non-trivial task).

Signed-off-by: Todd Short <todd.short@me.com>

---------

Signed-off-by: Todd Short <todd.short@me.com>
github-merge-queue bot pushed a commit to operator-framework/operator-lifecycle-manager that referenced this issue Jan 15, 2024
* Update k8s to v0.28.5

This also updates to the latest operator-framework api and operator-registry
kind is still at v0.20.0 (k8s 1.27.3) as it's the latest version

Signed-off-by: Todd Short <todd.short@me.com>

* Update code for k8s v0.28.5 compatibility

Fix unit-tests as well

Signed-off-by: Todd Short <todd.short@me.com>

* Update codegen

Hack `scripts/update_codegen.sh` script to continue to generate code using
the deprecated scripts. The deprecated scripts now call into each other,
and unfortunately, `go mod vendor` doesn't keep permission bits around.
So, we need to update the execute permissions on a vendored script.

The new `kube_codegen.sh` doesn't work when the repository path is
outside the package name, see:
kubernetes/code-generator#165

The workaround is to create symlinked directories to fool `kube_codegen.sh`
into thinking the path is correct. But first we'd have to start using the
new script.

Once `kube_codegen.sh` is fixed, we should migrate to it (which is a
non-trivial task).

Signed-off-by: Todd Short <todd.short@me.com>

---------

Signed-off-by: Todd Short <todd.short@me.com>
github-merge-queue bot pushed a commit to operator-framework/operator-lifecycle-manager that referenced this issue Jan 15, 2024
* Update k8s to v0.28.5

This also updates to the latest operator-framework api and operator-registry
kind is still at v0.20.0 (k8s 1.27.3) as it's the latest version

Signed-off-by: Todd Short <todd.short@me.com>

* Update code for k8s v0.28.5 compatibility

Fix unit-tests as well

Signed-off-by: Todd Short <todd.short@me.com>

* Update codegen

Hack `scripts/update_codegen.sh` script to continue to generate code using
the deprecated scripts. The deprecated scripts now call into each other,
and unfortunately, `go mod vendor` doesn't keep permission bits around.
So, we need to update the execute permissions on a vendored script.

The new `kube_codegen.sh` doesn't work when the repository path is
outside the package name, see:
kubernetes/code-generator#165

The workaround is to create symlinked directories to fool `kube_codegen.sh`
into thinking the path is correct. But first we'd have to start using the
new script.

Once `kube_codegen.sh` is fixed, we should migrate to it (which is a
non-trivial task).

Signed-off-by: Todd Short <todd.short@me.com>

---------

Signed-off-by: Todd Short <todd.short@me.com>
tmshort added a commit to tmshort/operator-framework-olm that referenced this issue Jan 16, 2024
* Update k8s to v0.28.5

This also updates to the latest operator-framework api and operator-registry
kind is still at v0.20.0 (k8s 1.27.3) as it's the latest version

Signed-off-by: Todd Short <todd.short@me.com>

* Update code for k8s v0.28.5 compatibility

Fix unit-tests as well

Signed-off-by: Todd Short <todd.short@me.com>

* Update codegen

Hack `scripts/update_codegen.sh` script to continue to generate code using
the deprecated scripts. The deprecated scripts now call into each other,
and unfortunately, `go mod vendor` doesn't keep permission bits around.
So, we need to update the execute permissions on a vendored script.

The new `kube_codegen.sh` doesn't work when the repository path is
outside the package name, see:
kubernetes/code-generator#165

The workaround is to create symlinked directories to fool `kube_codegen.sh`
into thinking the path is correct. But first we'd have to start using the
new script.

Once `kube_codegen.sh` is fixed, we should migrate to it (which is a
non-trivial task).

Signed-off-by: Todd Short <todd.short@me.com>
Upstream-repository: operator-lifecycle-manager
Upstream-commit: 134cceeb21059dbcbcef68e95c623dc83fede4fe
@thockin
Copy link
Member

thockin commented Mar 12, 2024

All the PATH and GOPATH stuff should be resolved now!

/close

@k8s-ci-robot
Copy link

@thockin: Closing this issue.

In response to this:

All the PATH and GOPATH stuff should be resolved now!

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@caozhuozi
Copy link

All the PATH and GOPATH stuff should be resolved now!

/close

Hi, @thockin from which tag the issue is solved? Could you share any commit related to the fix?

@thockin
Copy link
Member

thockin commented Mar 17, 2024

I thought it was fixed in v0.30.0-beta.0 but there are other issues with go.mod - it MIGHT work for you, else it should be fixed in beta.1 - let me know if not?

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

No branches or pull requests

5 participants