Skip to content

Conversation

Fedosin
Copy link
Contributor

@Fedosin Fedosin commented Jun 25, 2023

What this PR does / why we need it:

Now users have to manually set provider version, which is not convenient as it requires additional github searching. This PR allows to omit it, and the latest version will be substituted automatically. This behavior is similar to what is done in clusterctl, where version is optional.

Additionally this PR adds e2e tests for air-gapped environments.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 25, 2023
@k8s-ci-robot k8s-ci-robot requested a review from JoelSpeed June 25, 2023 16:59
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jun 25, 2023
var err error

// Create repository either from provided URL or from a config map.
if p.provider.GetSpec().FetchConfig != nil && p.provider.GetSpec().FetchConfig.Selector != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we optimize it and initialize the repo only once? It gets created in the later phases too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, I slightly rewrote the original PR, so it is more optimized now.

@Fedosin
Copy link
Contributor Author

Fedosin commented Jun 27, 2023

/hold

@alexander-demicev agree, we can optimise this code a little. I'll propose another update for this PR soon

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 27, 2023
@Fedosin
Copy link
Contributor Author

Fedosin commented Jul 1, 2023

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 1, 2023
@Fedosin Fedosin force-pushed the latest_version branch 3 times, most recently from 2faa5a1 to d81e26f Compare July 1, 2023 16:01
@Fedosin
Copy link
Contributor Author

Fedosin commented Jul 1, 2023

/retest

@Fedosin Fedosin force-pushed the latest_version branch 3 times, most recently from 04a3cf9 to 57264d7 Compare July 1, 2023 18:13
@Fedosin
Copy link
Contributor Author

Fedosin commented Jul 1, 2023

/retest

@Fedosin
Copy link
Contributor Author

Fedosin commented Jul 1, 2023

/retest

spec.Version = repo.DefaultVersion()

// Add version to the provider spec.
p.provider.SetSpec(spec)
Copy link
Contributor

Choose a reason for hiding this comment

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

why provider spec is set twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason spec is set twice is because it accommodates two distinct workflows:

  • When downloading manifests from GitHub/GitLab.
  • When working with config maps containing manifests.

For the first workflow, the version is set during the manifest download process when a fetch URL is used. In the case of config maps, the version setting occurs in the load phase. Regardless of the workflow, the spec update is executed only once.

Copy link
Member

@furkatgofurov7 furkatgofurov7 left a comment

Choose a reason for hiding this comment

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

What happens in case, CAPI tags v1.5.x as latest while CAPZ did not yet uplift to latest of CAPI and has latest tagged version compatible only with CAPI v1.4.x?


configMaps := []corev1.ConfigMap{}

for _, fileName := range []string{"core-cluster-api-v1.4.2.yaml", "core-cluster-api-v1.4.3.yaml"} {
Copy link
Member

Choose a reason for hiding this comment

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

perhaps this the only way to do it in air gapped env (manually updating/adding huge manifests as CAPI releasing new versions), but I do not have a better suggestion either how we could improve it..

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, this is the only way. For clusterctl you have to create local repositories, for operator you can download manifests from github and make a configmap from file.

@alexander-demicev
Copy link
Contributor

@furkatgofurov7 I guess the issue here is similar to when using clusterctl, you have to specify version in case you want to be sure that dependencies are aligned

@furkatgofurov7
Copy link
Member

@furkatgofurov7 I guess the issue here is similar to when using clusterctl, you have to specify version in case you want to be sure that dependencies are aligned

That is true and I guess it is fine to follow the same behaviour here

Copy link
Contributor

@alexander-demicev alexander-demicev left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexander-demicev

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

The pull request process is described 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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 7, 2023
Copy link
Member

@furkatgofurov7 furkatgofurov7 left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 7, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 63a6154b1aab26d415d72dfa1308d997718ed432

@furkatgofurov7
Copy link
Member

/hold
to address #180 (comment)

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 7, 2023
@Fedosin
Copy link
Contributor Author

Fedosin commented Jul 9, 2023

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 9, 2023
@k8s-ci-robot k8s-ci-robot merged commit e1a5c7b into kubernetes-sigs:main Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants