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

Reuse strategic merge patches for multiple targets #638

Closed
hyww opened this issue Dec 17, 2018 · 2 comments
Closed

Reuse strategic merge patches for multiple targets #638

hyww opened this issue Dec 17, 2018 · 2 comments

Comments

@hyww
Copy link
Contributor

hyww commented Dec 17, 2018

It seems that we cannot reuse strategic merge patches for multiple targets since targets are defined inside each patch.

I've come up with an idea that maybe we can put strategic merge patches in List and reuse duplicated part of patches using anchor/reference of YAML.

#637 is my implementation and below is an example to apply hostAliases patch to multiple Deployments

apiVersion: v1
kind: List
items:
- apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: deployment-a
  spec: &hostAliases
    template:
      spec:
        hostAliases:
        - hostnames:
          - a.example.com
          ip: 1.1.1.1
        - hostnames:
          - b.example.com
          ip: 8.8.8.8
- apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: deployment-b
  spec: *hostAliases

If this seems to be a correct method to deal with the problem, I might be able to work on this further and provide tests, documentations, examples, etc.

@Liujingfang1
Copy link
Contributor

This is another issue for List, which is to load resources from a List #581

@Liujingfang1
Copy link
Contributor

fixed by #637

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

No branches or pull requests

2 participants