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

distributed: major refactoring, use common templates #1520

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AndrewChubatiuk
Copy link
Contributor

@AndrewChubatiuk AndrewChubatiuk commented Sep 20, 2024

  • added default common.<component>.spec, which is merged with all *.<component>.spec, e.g: common.vmagent.spec is merged with availabilityZones[1].vmagent.spec
  • vmauthIngestGlobal was changed to write.global.vmauth
  • vmauthQueryGlobal was changed to read.global.vmauth
  • availabilityZones[*].allowIngest was changed to availabilityZones[*].write.allow
  • availabilityZones[*].allowRead was changed to availabilityZones[*].read.allow
  • availabilityZones[*].nodeSelector was moved to availabilityZones[*].common.spec.nodeSelector
  • availabilityZones[*].extraAffinity was moved to availabilityZones[*].common.spec.affinity
  • availabilityZones[*].topologySpreadConstraints was moved to availabilityZones[*].common.spec.topologySpreadConstraints
  • availabilityZones[*].vmauthIngest was moved to availabilityZones[*].write.vmauth
  • availabilityZones[*].vmauthQueryPerZone was moved to availabilityZones[*].read.perZone.vmauth
  • availabilityZones[*].vmauthCrossAZQuery was moved to availabilityZones[*].read.crossZone.vmauth

Comment on lines +3 to +4
- `vmauthIngestGlobal` was changed to `write.global.vmauth`
- `vmauthQueryGlobal` was changed to `read.global.vmauth`
Copy link
Contributor

Choose a reason for hiding this comment

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

How about moving them into .global as global.vmauthIngest and global.vmauthQuery?
Since there shouldn't be other fields under write.global or global.write.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

global section in helm is special one, it's shared across all charts in release

{{- $mergedSettings := merge (default (default dict) $zone.vmagent.spec.remoteWriteSettings) (dict "useMultiTenantMode" true) }}
remoteWriteSettings: {{ toYaml $mergedSettings | nindent 4 }}
{{- end }}
{{- $spec := mergeOverwrite (deepCopy ($zone.common).spec) (deepCopy ($zone.vmagent).spec) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{- $spec := mergeOverwrite (deepCopy ($zone.common).spec) (deepCopy ($zone.vmagent).spec) }}
{{- $spec := mergeOverwrite (deepCopy $.Values.common.vmagent.spec) (deepCopy ($zone.common).spec) (deepCopy ($zone.vmagent).spec) }}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

applied these changes

-
# -- Availability zone name
name: zone-eu-1
common:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think components shouldn't share other spec except nodeSelector/affinitytopologySpreadConstraints, which could lead to misuse and it's better to not lead to that way.
How about changing this as a plain commonSpec instead of having common.spec?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

common.spec allows having then common.annotations and common.labels

# Available parameters can be found [here](https://docs.victoriametrics.com/operator/api/index.html#vmagentspec)
spec:
remoteWriteSettings:
useMultiTenantMode: true
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to not set useMultiTenantMode=true by default, since it degrades vmagent performance.

Copy link
Contributor Author

@AndrewChubatiuk AndrewChubatiuk Sep 24, 2024

Choose a reason for hiding this comment

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

updated this

vminsert:
serviceSpec:
spec:
clusterIP: None
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason for this setting?

Copy link
Contributor Author

@AndrewChubatiuk AndrewChubatiuk Sep 24, 2024

Choose a reason for hiding this comment

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

It was hardcoded in templates, looks like it's needed to provide to vmauth pod ips and move balancing to vmauth

{{- $urls = append $urls (include "vm.url" $ctx)}}
{{- end }}
{{- end }}
url_prefix: {{ toYaml $urls | nindent 4 }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
url_prefix: {{ toYaml $urls | nindent 4 }}
{{- if $urls }}
url_prefix: {{ toYaml $urls | nindent 4 }}
{{- end }}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i would rather fail if there're no urls defined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added failing helm template if no urls defined for vmauth

whenUnsatisfiable: ScheduleAnyway
write:
# -- Allow data ingestion to this zone
allow: true
Copy link
Contributor

Choose a reason for hiding this comment

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

How about unifying them to enable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

enable is for resource creation and allow is for traffic routing

{{- $zones := (dict) -}}
{{- $commonClusterSpec := ((($Values.common).vmcluster).spec) | default dict -}}
{{- range $idx, $rolloutZone := $Values.availabilityZones -}}
{{- $commonSpec := $rolloutZone.spec | default dict -}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Wdyt about moving $zone.spec.nodeSelector and the rest of common fields to $zone.common level?
That would make it easier to understand from user's PoV as having a spec in property path implies that there is some specification for this resource, while that it not the case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is a typo, it is actually $zone.common.spec, fixed it

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