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

Image syncer #2438

Merged
merged 6 commits into from
Jun 9, 2020
Merged

Image syncer #2438

merged 6 commits into from
Jun 9, 2020

Conversation

adamwalach
Copy link
Contributor

@adamwalach adamwalach commented Jun 8, 2020

Description

Changes proposed in this pull request:

  • ...
  • ...
  • ...

Related issue(s)
#2426

Interesting comment about how digests and IDs are computed: distribution/distribution#1662 (comment)

@adamwalach
Copy link
Contributor Author

adamwalach commented Jun 8, 2020

Definition:

targetRepoPrefix:  "eu.gcr.io/sap-kyma-prow/external/"
images:
- source: "quay.io/prometheus/prometheus:v2.17.1"
- source: "grafana/grafana:7.0.1"
- source: "grafana/lok-error-i:v1.3.0"

Output:

INFO[0000] Source image: quay.io/prometheus/prometheus:v2.17.1
INFO[0002] Source ID: sha256:358a0d2395fe711bb8258e8fb4b2d7865c0a9a6463969bcd1452ee8869ea6653
INFO[0002] Source repo digest: sha256:0d05276441fc3ec287025db43190873fd0088d1b16a45a0012a59f4cbd6e5be9
INFO[0002] Target image: eu.gcr.io/sap-kyma-prow/external/quay.io/prometheus/prometheus:v2.17.1
INFO[0003] Target ID: sha256:358a0d2395fe711bb8258e8fb4b2d7865c0a9a6463969bcd1452ee8869ea6653
INFO[0003] Target repo digest: sha256:0ec13a50dfa65ec1cf8583ef640271e14392534f1d2c21f758eb0e0e441f7540
INFO[0003] Source and target IDs are the same, nothing to do
INFO[0003] ------------------------
INFO[0003] Source image: grafana/grafana:7.0.1
INFO[0006] Source ID: sha256:465c4af545b156014b9a7ca526d5e3577f1b0d5c4a37344ea1d25b0bed89bce4
INFO[0006] Source repo digest: sha256:eb5abc53bed20198052d4ac0e01a8fd3bfe0c80d8e9eb9d021fbc10f93a25514
INFO[0006] Target image: eu.gcr.io/sap-kyma-prow/external/grafana/grafana:7.0.1
INFO[0007] Target image does not exist
INFO[0007] Dry-run mode - tagging and pushing skipped
INFO[0007] ------------------------
INFO[0007] Source image: grafana/lok-error-i:v1.3.0
FATA[0009] image pull failed: Error response from daemon: pull access denied for grafana/lok-error-i, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
exit status 1

@adamwalach
Copy link
Contributor Author

adamwalach commented Jun 8, 2020

We thought about possibility of using https://github.com/kubernetes-sigs/k8s-container-image-promoter instead of creating our own solution.
Unfortunately image-promoter is limited only to Google Container Registry (GCR) - it uses server-side operations that are not supported by other registries like quay.io or Docker Hub.

}
log.Info("Image re-tagged")
log.Info("Pushing to target repo")
if reader, err := cli.ImagePush(ctx, target, types.ImagePushOptions{RegistryAuth: authString}); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

For logging in and tracking errors if the login credentials are wrong can we use for example RegistryLogin method of Docker Client? If the credentials are wrong it returns unauthorizedError when the authorisation fails.

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 point, I will test this method against malformed json file

return base64.URLEncoding.EncodeToString(encodedJSON), nil
}

func getImageIdAndRepoDigest(ctx context.Context, cli *client.Client, authString, image string) (string, string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The authString does not seem to be used in the function. Will it have a purpose in a future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested registries where it was used, but since we don't have a situation like that I will remove that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Ressetkk
Ressetkk previously approved these changes Jun 9, 2020
@adamwalach adamwalach merged commit fb98a37 into kyma-project:master Jun 9, 2020
@kyma-bot
Copy link
Contributor

kyma-bot commented Jun 9, 2020

@adamwalach: Updated the job-config configmap in namespace default at cluster default using the following files:

  • key image-syncer.yaml using file prow/jobs/test-infra/image-syncer.yaml

In response to this:

Description

Changes proposed in this pull request:

  • ...
  • ...
  • ...

Related issue(s)
#2426

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.

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.

3 participants