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

feat: support for loading images in the K3s module #1622

Merged
merged 12 commits into from
Sep 21, 2023

Conversation

pablochacin
Copy link
Contributor

What does this PR do?

Adds a function to k3s module for loading images into the k3s cluster.
It also adds helper functions for manipulating images to the docker provider, to facilitate testing.

Why is it important?

When testing images generated locally (for example, in a CI/CD workflow), it would be convenient not to have to push them to a repository in order to make them available to the k3s test container. Instead, the test should be able tp upload the images to the test container.

Related issues

@pablochacin pablochacin requested a review from a team as a code owner September 17, 2023 16:20
@netlify
Copy link

netlify bot commented Sep 17, 2023

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 31f6a9a
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/650c0fa53854f50008de1bb3
😎 Deploy Preview https://deploy-preview-1622--testcontainers-go.netlify.app/modules/k3s
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@pablochacin pablochacin changed the title K3s load images WIP: K3s load images Sep 17, 2023
Copy link
Collaborator

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

I added just two minor comments, although the one regarding the new PullImage method would need your attention.

Other than that, this PR LGTM, thank you very much for your work here 👏

docker.go Outdated Show resolved Hide resolved
modules/k3s/k3s.go Outdated Show resolved Hide resolved
@mdelapenya mdelapenya self-assigned this Sep 18, 2023
@mdelapenya mdelapenya added the enhancement New feature or request label Sep 18, 2023
@pablochacin pablochacin changed the title WIP: K3s load images K3s load images Sep 18, 2023
@pablochacin
Copy link
Contributor Author

I added some documentation.
Also, rebased the PR because there were conflicts with main.
From my side, I think the PR is "complete".
Waiting for your comments.

mdelapenya
mdelapenya previously approved these changes Sep 18, 2023
Copy link
Collaborator

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

LGTM, added a few comments, all minor.

Thank you so much for your contribution including testable examples in his to load the images into the cluster. Very helpful!

modules/k3s/k3s.go Outdated Show resolved Hide resolved
modules/k3s/k3s_image_test.go Outdated Show resolved Hide resolved
modules/k3s/k3s_image_test.go Outdated Show resolved Hide resolved
modules/k3s/k3s.go Outdated Show resolved Hide resolved
pablochacin and others added 6 commits September 19, 2023 14:02
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Co-authored-by: Manuel de la Peña <social.mdelapenya@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
modules/k3s/k3s.go Outdated Show resolved Hide resolved
Co-authored-by: Manuel de la Peña <social.mdelapenya@gmail.com>
@mdelapenya
Copy link
Collaborator

Lint failed: I think you can run make lint from the root dir 🤔

Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
modules/k3s/k3s.go Outdated Show resolved Hide resolved
modules/k3s/k3s_image_test.go Outdated Show resolved Hide resolved
modules/k3s/k3s_image_test.go Show resolved Hide resolved
modules/k3s/k3s_image_test.go Outdated Show resolved Hide resolved
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
@pablochacin
Copy link
Contributor Author

Following a conversation with @mdelapenya The LoadImages method now receives a list of images and takes the responsibility of saving them in a .tar and loading them into the cluster.

As a result of these simplifications, the LoadImages runnable example is no longer needed. The test_k3s_images.go file now has regular go tests.

docs/modules/k3s.md Outdated Show resolved Hide resolved
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Copy link
Collaborator

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for your time contributing to testcontainers-go! 👏

@mdelapenya mdelapenya changed the title K3s load images feat: support for loading images in the K3s module Sep 21, 2023
@mdelapenya mdelapenya merged commit 7daf178 into testcontainers:main Sep 21, 2023
103 checks passed
mdelapenya added a commit that referenced this pull request Sep 25, 2023
…util/v3-3.23.8

* main:
  chore(deps): bump github.com/IBM/sarama in /modules/kafka (#1637)
  chore(deps): bump github.com/ClickHouse/clickhouse-go/v2 (#1625)
  chore(deps): bump github.com/elastic/go-elasticsearch/v8 (#1641)
  chore(deps): bump github.com/tidwall/gjson from 1.16.0 to 1.17.0 in /modules/couchbase and /modules/vault (#1684)
  chore(deps): bump mkdocs from 1.5.2 to 1.5.3 (#1662)
  chore(deps): bump github.com/nats-io/nats.go in /modules/nats (#1657)
  chore(deps): bump k8s.io/apimachinery from 0.28.1 to 0.28.2 and k8s.io/client-go from 0.28.1 to 0.28.2 in /modules/k3s (#1683)
  chore(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.18.39 to 1.18.42 and github.com/aws/aws-sdk-go from 1.45.3 to 1.45.15 and github.com/aws/aws-sdk-go-v2/service/s3 from 1.38.5 to 1.39.0 in /modules/localstack (#1680)
  chore(deps): bump github.com/twmb/franz-go/pkg/kadm from 1.9.0 to 1.9.1 and github.com/twmb/franz-go from 1.14.4 to 1.15.0 in /modules/redpanda (#1682)
  chore(deps): bump cloud.google.com/go/datastore from 1.13.0 to 1.14.0 and google.golang.org/grpc from 1.58.1 to 1.58.2 and cloud.google.com/go/spanner from 1.47.0 to 1.49.0 in /modules/gcloud (#1681)
  feat: add GCloud module (#1670)
  make ryuk timeouts configurable via properties file (#1668)
  chore(deps): bump mkdocs-material from 8.2.7 to 9.3.2 (#1649)
  chore(deps): bump google.golang.org/grpc from 1.57.0 to 1.58.1 and google.golang.org/api from 0.138.0 to 0.142.0 in /examples (#1667)
  feat: support for loading images in the K3s module (#1622)
mdelapenya added a commit that referenced this pull request Sep 26, 2023
….com/docker/compose/v2-2.22.0

* main:
  chore(deps): bump golang.org/x/text to v0.15.0 (#1687)
  chore(deps): bump github.com/shirou/gopsutil/v3 from 3.23.7 to 3.23.8 (#1651)
  Wait for k3s node to sync (#1685)
  chore(deps): bump github.com/IBM/sarama in /modules/kafka (#1637)
  chore(deps): bump github.com/ClickHouse/clickhouse-go/v2 (#1625)
  chore(deps): bump github.com/elastic/go-elasticsearch/v8 (#1641)
  chore(deps): bump github.com/tidwall/gjson from 1.16.0 to 1.17.0 in /modules/couchbase and /modules/vault (#1684)
  chore(deps): bump mkdocs from 1.5.2 to 1.5.3 (#1662)
  chore(deps): bump github.com/nats-io/nats.go in /modules/nats (#1657)
  chore(deps): bump k8s.io/apimachinery from 0.28.1 to 0.28.2 and k8s.io/client-go from 0.28.1 to 0.28.2 in /modules/k3s (#1683)
  chore(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.18.39 to 1.18.42 and github.com/aws/aws-sdk-go from 1.45.3 to 1.45.15 and github.com/aws/aws-sdk-go-v2/service/s3 from 1.38.5 to 1.39.0 in /modules/localstack (#1680)
  chore(deps): bump github.com/twmb/franz-go/pkg/kadm from 1.9.0 to 1.9.1 and github.com/twmb/franz-go from 1.14.4 to 1.15.0 in /modules/redpanda (#1682)
  chore(deps): bump cloud.google.com/go/datastore from 1.13.0 to 1.14.0 and google.golang.org/grpc from 1.58.1 to 1.58.2 and cloud.google.com/go/spanner from 1.47.0 to 1.49.0 in /modules/gcloud (#1681)
  feat: add GCloud module (#1670)
  make ryuk timeouts configurable via properties file (#1668)
  chore(deps): bump mkdocs-material from 8.2.7 to 9.3.2 (#1649)
  chore(deps): bump google.golang.org/grpc from 1.57.0 to 1.58.1 and google.golang.org/api from 0.138.0 to 0.142.0 in /examples (#1667)
  feat: support for loading images in the K3s module (#1622)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: load images in k3s container
3 participants