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

set GANESHA_VERSION from Dockerfile #122

Closed
wants to merge 7 commits into from

Conversation

revant
Copy link

@revant revant commented Mar 6, 2023

Proposed fix for #115

This will publish image on ghcr.io instead of registry.k8s.io.

I was able to build and publish image here https://github.com/revant/nfs-ganesha-server-and-external-provisioner/actions/runs/4340538329/jobs/7579174476 and it was published successfully on ghcr.

At this moment the registry credentials are configured for ghcr.

To use registry.k8s.io I can change the tags for the docker build steps, It will not work without authentication.

Additional references to image in the repo will also need to change.

Are there any ENV vars that I can already use for registry.k8s.io?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: revant
Once this PR has been reviewed and has the lgtm label, please assign jsafrane for approval. For more information see the Kubernetes Code Review Process.

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

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested review from kvaps and wongma7 March 6, 2023 08:50
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Mar 6, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot
Copy link
Contributor

Welcome @revant!

It looks like this is your first PR to kubernetes-sigs/nfs-ganesha-server-and-external-provisioner 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/nfs-ganesha-server-and-external-provisioner has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Mar 6, 2023
@revant
Copy link
Author

revant commented Mar 6, 2023

@kvaps

I can change the references to images in following files?

12 results - 9 files
charts/nfs-server-provisioner/README.md:
  60: | `image.repository`             | The image repository to pull from                                                                               | `k8s.gcr.io/sig-storage/nfs-provisioner:v4.0.8`         |

charts/nfs-server-provisioner/values.yaml:
  10:   repository: k8s.gcr.io/sig-storage/nfs-provisioner

deploy/kubernetes/deployment.yaml:
  66:           image: k8s.gcr.io/sig-storage/nfs-provisioner:v4.0.8

deploy/kubernetes/pod.yaml:
  14:       image: k8s.gcr.io/sig-storage/nfs-provisioner:v4.0.8

deploy/kubernetes/statefulset.yaml:
  66:           image: k8s.gcr.io/sig-storage/nfs-provisioner:v4.0.8

docs/deployment.md:
   32: $ docker pull k8s.gcr.io/sig-storage/nfs-provisioner:v4.0.8
   90: k8s.gcr.io/sig-storage/nfs-provisioner:v4.0.8 \
   98: k8s.gcr.io/sig-storage/nfs-provisioner:v4.0.8 \
  113: k8s.gcr.io/sig-storage/nfs-provisioner:v4.0.8 \

test/e2e/testing-manifests/deployment.yaml:
  66:           image: k8s.gcr.io/sig-storage/nfs-provisioner:v4.0.8

test/e2e/testing-manifests/pod.yaml:
  14:       image: k8s.gcr.io/sig-storage/nfs-provisioner:v4.0.8

test/e2e/testing-manifests/statefulset.yaml:
  66:           image: k8s.gcr.io/sig-storage/nfs-provisioner:v4.0.8

What about authentication for registry.k8s.io? Any idea what changes to be done for that?

Edit: found this https://github.com/kubernetes/registry.k8s.io#registryk8sio -> https://github.com/kubernetes/k8s.io/tree/main/k8s.gcr.io#managing-kubernetes-container-registries, Trying to understand it.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 6, 2023
.github/workflows/docker-build.yml Outdated Show resolved Hide resolved
.github/workflows/docker-build.yml Outdated Show resolved Hide resolved
@kvaps
Copy link
Member

kvaps commented Mar 7, 2023

Thanks for proposed changes, I'd like to know is there any opportunity to push images into registry.k8s.io. Unfortunately I have not much time for elaborating this, so I asked a question in #sig-storage

ref https://kubernetes.slack.com/archives/C09QZFCE5/p1678188485825369

FYI

@revant
Copy link
Author

revant commented Mar 7, 2023

My understanding after reading the links.

It seems all the other yamls in that repo are using gcr.io, I don't know if ghcr.io can be used as staging.

In case gcr needs to be used there is a documentation here: https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md, It says we need a cloudbuild.yaml in this repo and a cookie-cutter prow job config placed there.

@kvaps
Copy link
Member

kvaps commented Mar 7, 2023

Hey. Yeah, I requested changes in upstream for creating google group and staging repo:
kubernetes/k8s.io#4881 (comment)

However non of active maintainers are not member of kubernetes-org, I requested to add myself:
kubernetes/org#4079

@kvaps
Copy link
Member

kvaps commented Mar 7, 2023

Okay it seems we have a staging repo:

gcr.io/k8s-staging-sig-storage/nfs-provisioner

Now we need to configure automatic push into it

https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md

@revant
Copy link
Author

revant commented Mar 8, 2023

There is already a cloudbuild.yaml and it seems to run ./.cloudbuild.sh. It seems to be a boilerplate.

I'm trying to figure out how I can verify execution of steps from cloudbuild.yaml.

I was able to verify github actions on my github fork.

@revant
Copy link
Author

revant commented Mar 8, 2023

I guess the ./.cloudbuild.sh works. I tried it locally. It builds the image locally, the push part doesn't work due to auth

cd nfs-ganesha-server-and-external-provisioner
docker run --rm -it -v ${PWD}:/workspace -v /var/run/docker.sock:/var/run/docker.sock --entrypoint=bash gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20211118-2f2d816b90
# In container
cd /workspace
export PULL_BASE_REF=master
export REGISTRY_NAME=gcr.io/k8s-staging-sig-storage
./.cloudbuild.sh

###

 > exporting to image:
------
error: failed to solve: failed to push gcr.io/k8s-staging-sig-storage/nfs-provisioner:amd64-linux-canary: error getting credentials - err: exit status 1, out: `You do not currently have an active account selected. See https://cloud.google.com/sdk/docs/authorizing for more information.`
+ docker buildx rm multiarchimage-buildertest
make: *** [release-tools/build.make:149: push-multiarch-nfs-provisioner] Error 1

I think it should work as expected for builds at least. I've to figure out about tags. It tags as amd64-linux-canary instead it should be GANESHA_VERSION

Edit:

build.make:

# A release image "vX.Y.Z" gets built if there is a tag of that format for the current commit.
# --abbrev=0 suppresses long format, only showing the closest tag.
IMAGE_TAGS+=$(shell tagged="$$(git describe --tags --match='v*' --abbrev=0)"; if [ "$$tagged" ] && [ "$$(git rev-list -n1 HEAD)" = "$$(git rev-list -n1 $$tagged)" ]; then echo $$tagged; fi)

It should pick up the tag from git repo.

@revant
Copy link
Author

revant commented Mar 8, 2023

In that case the only useful change that the PR does is use a step for Set ganesha version and use env.GANESHA_VERSION instead of tag.

compile nfs-provisioner and build final image happens on cloudbuild. I'll revert the steps.

@k8s-ci-robot k8s-ci-robot removed the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 8, 2023
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 8, 2023
@revant revant changed the title Build base image + nfs-provisioner set GANESHA_VERSION from Dockerfile Mar 8, 2023
@revant
Copy link
Author

revant commented Mar 12, 2023

Why does the build process uses github actions for base image and cloud build for final image?

Shouldn't it be completely done on cloudbuild?

What if new version tag for base image is in build process (takes around 2hrs) and cloudbuild tries to build final image based on new version tag and doesn't find the image on ghcr.io yet? Or this scenario will not happen?

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 10, 2023
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jul 10, 2023
@revant revant closed this Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants