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

Remove key field from provider.Manifest in the k8s plugin #5446

Merged
merged 6 commits into from
Dec 25, 2024

Conversation

Warashi
Copy link
Contributor

@Warashi Warashi commented Dec 24, 2024

What this PR does:

  • remove key field from provider.Manifest of k8s plugin, and make it in Key() method
  • add test to ensure application config's namespace is used when applying the manifests
  • refactor the tests to reduce duplicated codes

Why we need it:

  • To reduce modification after the creation of the Manifest instance

Which issue(s) this PR fixes:

Part of #4980

Does this PR introduce a user-facing change?: No

  • How are users affected by this change:
  • Is this breaking change:
  • How to migrate (if breaking change):

Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Comment on lines +202 to +208
// decode and override the autoCreateNamespace and namespace
spec, err := config.DecodeYAML[*kubeConfigPkg.KubernetesApplicationSpec](cfg)
require.NoError(t, err)
spec.Spec.Input.AutoCreateNamespace = true
spec.Spec.Input.Namespace = "test-namespace"
cfg, err = yaml.Marshal(spec)
require.NoError(t, err)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

override example config to ensure these fields are used when applying the resources

require.NoError(t, err)
assert.Equal(t, model.StageStatus_STAGE_SUCCESS.String(), resp.GetStatus().String())

deployment, err := dynamicClient.Resource(schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "deployments"}).Namespace("test-namespace").Get(context.Background(), "simple", metav1.GetOptions{})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

check the resource in the namespace test-namespace

Copy link

codecov bot commented Dec 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 26.24%. Comparing base (437d26f) to head (1c96054).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5446      +/-   ##
==========================================
+ Coverage   26.23%   26.24%   +0.01%     
==========================================
  Files         452      452              
  Lines       48872    48859      -13     
==========================================
+ Hits        12823    12825       +2     
+ Misses      35024    35010      -14     
+ Partials     1025     1024       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Warashi Warashi marked this pull request as ready for review December 24, 2024 06:26
ffjlabo
ffjlabo previously approved these changes Dec 25, 2024
Copy link
Member

@ffjlabo ffjlabo left a comment

Choose a reason for hiding this comment

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

👍

@Warashi
Copy link
Contributor Author

Warashi commented Dec 25, 2024

I applied #5450 changes to this PR.

@ffjlabo Sorry, please re-review this PR.

@Warashi Warashi enabled auto-merge (squash) December 25, 2024 01:41
@Warashi Warashi merged commit 336d96d into master Dec 25, 2024
18 checks passed
@Warashi Warashi deleted the k8s-plugin-dynamically-calc-resource-key branch December 25, 2024 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants