Skip to content

better clusterIP filtering logic, add default services#61

Open
memory wants to merge 3 commits intopieterlange:masterfrom
memory:master
Open

better clusterIP filtering logic, add default services#61
memory wants to merge 3 commits intopieterlange:masterfrom
memory:master

Conversation

@memory
Copy link

@memory memory commented Sep 19, 2019

  • pull the inline python one-liner out into a separate script so
    that we can:

  • apply better logic around filtering out service.spec.clusterIP:
    if the value is "None" that's a headless service
    and not preserving the value will result in the creation of
    a NON-headless service, which is likely to be extremely wrong.

  • set explicit_start=True in the call to pyyaml.safe_dump() so
    that backup files can be safely concatenated together

  • add serviceaccount to the list of default resources

  • update the README with the current defaults

  • add EXTRA_ env vars for the resource lists so that they can be appended to as well as overwritten

- pull the inline python one-liner out into a separate script so
  that we can:

- apply better logic around filtering out service.spec.clusterIP:
  if the value is "None" that's a [headless service](https://kubernetes.io/docs/concepts/services-networking/service/#headless-services)
  and _not_ preserving the value will result in the creation of
  a NON-headless service, which is likely to be extremely wrong.

- set `explicit_start=True` in the call to pyyaml.safe_dump() so
  that backup files can be safely concatenated together

- add a few more default resource types to back up:
    - [backendconfigs](https://cloud.google.com/kubernetes-engine/docs/concepts/backendconfig)
    - [serviceaccount](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/)
@memory
Copy link
Author

memory commented Sep 19, 2019

n.b. I spent a little bit of time trying to figure out if there was a straightforward way of doing a conditional key deletion in JQ's query language and did not make much progress, but I won't claim that it's not possible.

@pieterlange
Copy link
Owner

Excellent, good catch on the headless services! This script was written before those existed..

Could you remove backendconfigs from the default resources though? Its not portable.

@memory
Copy link
Author

memory commented Sep 19, 2019

Fair enough about the backendconfig, and this reminded me that I wanted to also make it a little easier to simply append to the resource list rather than overwrite it.

- remove backendconfig from default resource set; it's a gke-only
  thing presently

- add "EXTRA" env vars for the resource list variables so that
  they can be appended to as well as overwritten.
@memory
Copy link
Author

memory commented Sep 23, 2019

@pieterlange comments addressed, look good?

@pieterlange
Copy link
Owner

Sorry for the delay. Looks good, but i'm gonna try to catch this logic in jq instead so we don't deviate too much from the "this is just a shellscript project" concept. Will merge after i've done that.

@memory
Copy link
Author

memory commented Nov 11, 2019

Ping? :)

@memory
Copy link
Author

memory commented May 18, 2020

Poke -- did you have any luck trying to port this logic into jq?

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