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

Feature/add dns as helm chart #324

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

klinch0
Copy link
Contributor

@klinch0 klinch0 commented Aug 31, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a .helmignore file to streamline Helm packaging by excluding unnecessary files.
    • Added a Chart.yaml for CoreDNS, providing essential metadata for deployment in Kubernetes.
    • Implemented a new HelmRelease configuration for managing CoreDNS deployment.
    • Defined a JSON schema for DNS forwarding parameters, enhancing configuration validation.
    • Added forward_params to allow custom DNS server settings in CoreDNS.
    • Introduced disabledDNSAddon parameter to control the CoreDNS addon state in Kubernetes.
    • Added comprehensive values.yaml file for extensive customization of CoreDNS deployment.
    • Implemented a ServiceMonitor for Prometheus integration to enhance observability of CoreDNS.
  • Bug Fixes

    • Updated the Helm chart version from 0.9.0 to 0.10.0 to reflect recent improvements.
  • Chores

    • Enhanced configurability of Kubernetes templates with conditional logic for DNS addon inclusion.

@klinch0 klinch0 requested a review from kvaps as a code owner August 31, 2024 08:46
Copy link

coderabbitai bot commented Aug 31, 2024

Walkthrough

The changes introduce a new Helm chart for the CoreDNS application, encompassing configuration files such as .helmignore, Chart.yaml, values.yaml, and a JSON schema for validation. Additionally, updates were made to the existing Kubernetes application chart and templates, including parameters to control the state of the CoreDNS addon. These modifications improve the configuration and management of CoreDNS within a Kubernetes environment.

Changes

File Path Change Summary
packages/apps/coredns/.helmignore New file specifying patterns for files to be ignored by Helm when packaging the application.
packages/apps/coredns/Chart.yaml New Helm chart configuration file with metadata for the CoreDNS service.
packages/apps/coredns/templates/coredns.yaml New HelmRelease configuration for deploying CoreDNS, detailing server configurations and plugins.
packages/apps/coredns/values.schema.json New JSON schema defining structured configuration parameters for DNS forwarding.
packages/apps/coredns/values.yaml New file defining common parameters, specifically for DNS forwarding configuration.
packages/apps/kubernetes/Chart.yaml Updated version number from 0.9.0 to 0.10.0.
packages/apps/kubernetes/templates/cluster.yaml Added conditional logic to include coreDNS configuration based on disabledDNSAddon.
packages/apps/kubernetes/values.schema.json New property disabledDNSAddon added to control the state of the CoreDNS addon.
packages/apps/kubernetes/values.yaml New parameter disabledDNSAddon added to manage the CoreDNS addon state.
packages/system/coredns/Chart.yaml New file defining essential metadata for the cozy-coredns package.
packages/system/coredns/Makefile New Makefile establishing a build and update process for the CoreDNS application.
packages/system/coredns/charts/coredns/.helmignore New file specifying patterns for files to be ignored during package builds.
packages/system/coredns/charts/coredns/Chart.yaml New file specifying metadata and configuration for deploying CoreDNS.
packages/system/coredns/charts/coredns/README.md New documentation file outlining installation and configuration options for CoreDNS.
packages/system/coredns/charts/coredns/templates/NOTES.txt New file providing deployment and accessibility information for CoreDNS.
packages/system/coredns/charts/coredns/templates/_helpers.tpl New file with template functions for generating Kubernetes resource names and labels.
packages/system/coredns/charts/coredns/templates/clusterrole-autoscaler.yaml New ClusterRole configuration for the CoreDNS autoscaler.
packages/system/coredns/charts/coredns/templates/clusterrole.yaml New ClusterRole configuration for CoreDNS deployment management.
packages/system/coredns/charts/coredns/templates/clusterrolebinding-autoscaler.yaml New ClusterRoleBinding configuration for the autoscaler.
packages/system/coredns/charts/coredns/templates/clusterrolebinding.yaml New ClusterRoleBinding configuration for CoreDNS deployment.
packages/system/coredns/charts/coredns/templates/configmap-autoscaler.yaml New ConfigMap template for the autoscaler configuration.
packages/system/coredns/charts/coredns/templates/configmap.yaml New ConfigMap defining CoreDNS configuration settings.
packages/system/coredns/charts/coredns/templates/deployment-autoscaler.yaml New deployment configuration for the CoreDNS autoscaler.
packages/system/coredns/charts/coredns/templates/deployment.yaml New deployment configuration for CoreDNS instances.
packages/system/coredns/charts/coredns/templates/hpa.yaml New template for configuring a Horizontal Pod Autoscaler for CoreDNS.
packages/system/coredns/charts/coredns/templates/poddisruptionbudget.yaml New Pod Disruption Budget configuration for CoreDNS.
packages/system/coredns/charts/coredns/templates/podsecuritypolicy.yaml New PodSecurityPolicy configuration for CoreDNS deployment security.
packages/system/coredns/charts/coredns/templates/service-metrics.yaml New Service resource for metrics collection in CoreDNS.
packages/system/coredns/charts/coredns/templates/service.yaml New Service configuration for CoreDNS.
packages/system/coredns/charts/coredns/templates/serviceaccount-autoscaler.yaml New ServiceAccount definition for the autoscaler.
packages/system/coredns/charts/coredns/templates/serviceaccount.yaml New ServiceAccount template for CoreDNS deployment.
packages/system/coredns/charts/coredns/templates/servicemonitor.yaml New ServiceMonitor resource for Prometheus monitoring integration.
packages/system/coredns/charts/coredns/values.yaml New file defining default configuration values for CoreDNS deployment.
packages/system/coredns/values.yaml New file defining resource management settings for CoreDNS.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Helm
    participant Kubernetes

    User->>Helm: Deploy CoreDNS
    Helm->>Kubernetes: Install CoreDNS Chart
    Kubernetes->>Helm: Acknowledge Installation
    Helm->>User: Deployment Successful
Loading

🐰 In the meadow, I hop with glee,
New charts and values, oh what a spree!
CoreDNS dances, with plugins so bright,
Forwarding queries, day and night.
With options to tweak, and settings to play,
Hooray for the changes, hip-hip-hooray! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b8e33d1 and 1f9dbe3.

Files ignored due to path filters (1)
  • packages/apps/coredns/logos/coredns.svg is excluded by !**/*.svg
Files selected for processing (9)
  • packages/apps/coredns/.helmignore (1 hunks)
  • packages/apps/coredns/Chart.yaml (1 hunks)
  • packages/apps/coredns/templates/coredns.yaml (1 hunks)
  • packages/apps/coredns/values.schema.json (1 hunks)
  • packages/apps/coredns/values.yaml (1 hunks)
  • packages/apps/kubernetes/Chart.yaml (1 hunks)
  • packages/apps/kubernetes/templates/cluster.yaml (1 hunks)
  • packages/apps/kubernetes/values.schema.json (2 hunks)
  • packages/apps/kubernetes/values.yaml (1 hunks)
Files skipped from review due to trivial changes (4)
  • packages/apps/coredns/.helmignore
  • packages/apps/coredns/Chart.yaml
  • packages/apps/coredns/values.yaml
  • packages/apps/kubernetes/Chart.yaml
Additional context used
yamllint
packages/apps/coredns/templates/coredns.yaml

[error] 4-4: syntax error: expected , but found ''

(syntax)

Additional comments not posted (4)
packages/apps/coredns/values.schema.json (1)

1-15: Well-defined JSON schema for Helm values.

The JSON schema is well-structured and follows the standard format. It correctly defines the properties for forward_params with appropriate types, defaults, and examples. This will help ensure that the Helm values are validated effectively when used.

packages/apps/kubernetes/values.yaml (1)

6-12: New parameter disabledDNSAddon added effectively.

The addition of the disabledDNSAddon parameter is a good enhancement, allowing users to control the state of the CoreDNS addon directly from the values file. The default setting of false is appropriate, ensuring that CoreDNS is enabled by default, which aligns with typical Kubernetes deployments.

packages/apps/kubernetes/values.schema.json (1)

25-29: Well-defined new property for DNS addon control.

The addition of the disabledDNSAddon property is well-implemented with a clear type, description, and default value. This change enhances the configurability of the DNS management within the Kubernetes application.

packages/apps/kubernetes/templates/cluster.yaml (1)

90-94: Conditional logic for CoreDNS configuration is well-placed.

The addition of the conditional block to check the disabledDNSAddon value before including the coreDNS configuration is a smart enhancement. It allows for more flexible deployment scenarios based on user-defined values.

Consider verifying this conditional logic through deployment tests to ensure it functions as intended under various configurations.

Verification successful

Conditional logic for CoreDNS configuration is correctly implemented.

The disabledDNSAddon parameter is well-documented and correctly used in the cluster.yaml template to control the inclusion of the coreDNS configuration. However, consider performing manual tests to verify its behavior under different configurations, as there are no automated tests found for this logic.

  • values.yaml: Defines disabledDNSAddon with a default value of false.
  • values.schema.json: Describes disabledDNSAddon as a boolean parameter.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the conditional logic in the cluster template.

# Test: Deploy the template with different `disabledDNSAddon` values and check the resulting configuration.
echo "Deploy the template with 'disabledDNSAddon' set to true and false, then verify the 'coreDNS' section presence accordingly."

Length of output: 266


Script:

#!/bin/bash
# Search for the usage of `disabledDNSAddon` in the repository to understand its context.
rg 'disabledDNSAddon' -A 3

# Check for any documentation or test files related to this feature.
fd -e md -e yaml -e yml | xargs rg 'disabledDNSAddon'

Length of output: 1492

Comment on lines 1 to 42
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ .Release.Name }}-system
spec:
chart:
spec:
chart: cozy-coredns
reconcileStrategy: Revision
sourceRef:
kind: HelmRepository
name: cozystack-system
namespace: cozy-system
version: '{{ .Chart.AppVersion }}'
interval: 1m0s
timeout: 5m0s
values:
servers:
- zones:
- zone: .
port: 53
plugins:
- name: errors
- name: health
configBlock: |-
lameduck 5s
- name: ready
- name: kubernetes
parameters: cluster.local in-addr.arpa ip6.arpa
configBlock: |-
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
- name: prometheus
parameters: 0.0.0.0:9153
- name: forward
parameters: {{ .Values.forward_parametr | default ". /etc/resolv.conf" }}
- name: cache
parameters: 30
- name: loop
- name: reload
- name: loadbalance
Copy link

Choose a reason for hiding this comment

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

Syntax error needs correction.

There is a syntax error reported by yamllint at line 4, which could potentially break the Helm deployment. Please ensure that the template is valid YAML. The rest of the template is well-structured and covers the necessary configurations for deploying CoreDNS effectively.

Suggested fix for the syntax error:

-  name: {{ .Release.Name }}-system
+  name: "{{ .Release.Name }}-system"
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ .Release.Name }}-system
spec:
chart:
spec:
chart: cozy-coredns
reconcileStrategy: Revision
sourceRef:
kind: HelmRepository
name: cozystack-system
namespace: cozy-system
version: '{{ .Chart.AppVersion }}'
interval: 1m0s
timeout: 5m0s
values:
servers:
- zones:
- zone: .
port: 53
plugins:
- name: errors
- name: health
configBlock: |-
lameduck 5s
- name: ready
- name: kubernetes
parameters: cluster.local in-addr.arpa ip6.arpa
configBlock: |-
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
- name: prometheus
parameters: 0.0.0.0:9153
- name: forward
parameters: {{ .Values.forward_parametr | default ". /etc/resolv.conf" }}
- name: cache
parameters: 30
- name: loop
- name: reload
- name: loadbalance
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: "{{ .Release.Name }}-system"
spec:
chart:
spec:
chart: cozy-coredns
reconcileStrategy: Revision
sourceRef:
kind: HelmRepository
name: cozystack-system
namespace: cozy-system
version: '{{ .Chart.AppVersion }}'
interval: 1m0s
timeout: 5m0s
values:
servers:
- zones:
- zone: .
port: 53
plugins:
- name: errors
- name: health
configBlock: |-
lameduck 5s
- name: ready
- name: kubernetes
parameters: cluster.local in-addr.arpa ip6.arpa
configBlock: |-
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
- name: prometheus
parameters: 0.0.0.0:9153
- name: forward
parameters: {{ .Values.forward_parametr | default ". /etc/resolv.conf" }}
- name: cache
parameters: 30
- name: loop
- name: reload
- name: loadbalance
Tools
yamllint

[error] 4-4: syntax error: expected , but found ''

(syntax)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1f9dbe3 and e6b05c6.

Files selected for processing (1)
  • packages/apps/coredns/templates/coredns.yaml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/apps/coredns/templates/coredns.yaml

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (1)
packages/system/coredns/charts/coredns/README.md (1)

12-19: Review detailed deployment scenarios.

The documentation outlines various deployment scenarios for CoreDNS, including as a cluster DNS service, an external DNS service, and for Kubernetes federation. This section is informative and covers a broad range of use cases.

  • Typographical Issue: There is a repeated word "using" in line 17. This should be corrected to improve readability.
  • Spelling Issue: The term "sub case" in line 18 should be "subcase" as it is normally spelled as one word.

Consider correcting the typographical and spelling issues for improved clarity:

- using using
+ using
- sub case
+ subcase
Tools
LanguageTool

[duplication] ~17-~17: Possible typo: you repeated a word
Context: ...e can be exposed outside the cluster by using using either the NodePort or LoadBalancer typ...

(ENGLISH_WORD_REPEAT_RULE)


[misspelling] ~18-~18: This word is normally spelled as one.
Context: ...er for kubernetes federation. This is a sub case of 'external dns service' which uses et...

(EN_COMPOUNDS_SUB_CASE)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e6b05c6 and 97e1dfb.

Files selected for processing (26)
  • packages/apps/kubernetes/Chart.yaml (1 hunks)
  • packages/system/coredns/Chart.yaml (1 hunks)
  • packages/system/coredns/Makefile (1 hunks)
  • packages/system/coredns/charts/coredns/.helmignore (1 hunks)
  • packages/system/coredns/charts/coredns/Chart.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/README.md (1 hunks)
  • packages/system/coredns/charts/coredns/templates/NOTES.txt (1 hunks)
  • packages/system/coredns/charts/coredns/templates/_helpers.tpl (1 hunks)
  • packages/system/coredns/charts/coredns/templates/clusterrole-autoscaler.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/clusterrole.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/clusterrolebinding-autoscaler.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/clusterrolebinding.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/configmap-autoscaler.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/configmap.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/deployment-autoscaler.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/deployment.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/hpa.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/poddisruptionbudget.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/podsecuritypolicy.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/service-metrics.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/service.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/serviceaccount-autoscaler.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/serviceaccount.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/templates/servicemonitor.yaml (1 hunks)
  • packages/system/coredns/charts/coredns/values.yaml (1 hunks)
  • packages/system/coredns/values.yaml (1 hunks)
Files skipped from review due to trivial changes (3)
  • packages/system/coredns/Chart.yaml
  • packages/system/coredns/charts/coredns/.helmignore
  • packages/system/coredns/values.yaml
Additional context used
yamllint
packages/system/coredns/charts/coredns/templates/clusterrolebinding.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/serviceaccount-autoscaler.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/clusterrolebinding-autoscaler.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/clusterrole.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/serviceaccount.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/poddisruptionbudget.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/clusterrole-autoscaler.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/hpa.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/configmap.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/podsecuritypolicy.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/configmap-autoscaler.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)


[warning] 9-9: wrong indentation: expected 2 but found 4

(indentation)


[warning] 10-10: wrong indentation: expected 2 but found 4

(indentation)


[warning] 11-11: wrong indentation: expected 2 but found 4

(indentation)

packages/system/coredns/charts/coredns/templates/service-metrics.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/servicemonitor.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/service.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/deployment-autoscaler.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/deployment.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

LanguageTool
packages/system/coredns/charts/coredns/templates/NOTES.txt

[uncategorized] ~7-~7: Loose punctuation mark.
Context: ...rvices {{ template "coredns.fullname" . }}) export NODE_IP=$(kubectl get nodes ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~12-~12: Loose punctuation mark.
Context: ...svc -w {{ template "coredns.fullname" . }}' export SERVICE_IP=$(kubectl get ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~17-~17: Loose punctuation mark.
Context: ...} "{{ template "coredns.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.l...

(UNLIKELY_OPENING_PUNCTUATION)

packages/system/coredns/charts/coredns/README.md

[duplication] ~17-~17: Possible typo: you repeated a word
Context: ...e can be exposed outside the cluster by using using either the NodePort or LoadBalancer typ...

(ENGLISH_WORD_REPEAT_RULE)


[misspelling] ~18-~18: This word is normally spelled as one.
Context: ...er for kubernetes federation. This is a sub case of 'external dns service' which uses et...

(EN_COMPOUNDS_SUB_CASE)


[typographical] ~136-~136: After the expression ‘for example’ a comma is usually used.
Context: ...ns to add to autoscaler config map. For example to stop CI renaming them ...

(COMMA_FOR_EXAMPLE)


[uncategorized] ~145-~145: A comma may be missing after the conjunctive/linking adverb ‘Otherwise’.
Context: ...oyment if deployment.enabled is true. Otherwise the name of an existing deployment for ...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)

Markdownlint
packages/system/coredns/charts/coredns/README.md

8-8: null
Dollar signs used before commands without showing output

(MD014, commands-show-output)


9-9: null
Dollar signs used before commands without showing output

(MD014, commands-show-output)


29-29: null
Dollar signs used before commands without showing output

(MD014, commands-show-output)


30-30: null
Dollar signs used before commands without showing output

(MD014, commands-show-output)


42-42: null
Dollar signs used before commands without showing output

(MD014, commands-show-output)


163-163: null
Dollar signs used before commands without showing output

(MD014, commands-show-output)


5-5: Punctuation: ';'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


202-202: null
Bare URL used

(MD034, no-bare-urls)


204-204: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


223-223: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


233-233: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


248-248: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


106-106: Expected: 3; Actual: 2; Too few cells, row will be missing data
Table column count

(MD056, table-column-count)

Additional comments not posted (39)
packages/system/coredns/Makefile (2)

1-2: Environment Variables Declared Correctly

The environment variables NAME and NAMESPACE are declared correctly and follow good practices for maintainability and reusability.


7-11: Makefile update Target Well-Defined

The update target in the Makefile is well-defined and uses appropriate Helm commands to manage the CoreDNS chart. The sequence of commands ensures that the charts directory is cleaned before pulling the new chart, which is a good practice.

packages/system/coredns/charts/coredns/templates/clusterrolebinding.yaml (1)

1-15: ClusterRoleBinding Template Correctly Defined

The Kubernetes ClusterRoleBinding template is correctly defined using Helm templating syntax. It conditionally creates a ClusterRoleBinding if both deployment and RBAC are enabled, which is a good practice for conditional resource creation in Kubernetes.

The syntax error flagged by yamllint appears to be a false positive related to the Helm templating syntax, which is correctly used here.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/Chart.yaml (1)

1-24: Helm Chart Metadata Appropriately Defined

The Chart.yaml file for the CoreDNS Helm chart is appropriately defined with comprehensive metadata. It includes versioning, descriptions, maintainers, and other relevant information, which are crucial for managing the Helm chart effectively. The use of annotations to document changes is a good practice for traceability and version management.

packages/system/coredns/charts/coredns/templates/serviceaccount-autoscaler.yaml (1)

1-22: Review of Helm Template Syntax and Kubernetes Resource Definitions

The Helm template for creating a ServiceAccount is well-structured and follows best practices for conditional resource creation in Helm charts. The use of template functions like coredns.fullname and dynamic settings for labels and annotations is correctly implemented.

  • Syntax and Logic: The Helm templating syntax, including the use of if conditions and with blocks, is correctly used to make the creation of resources configurable based on values provided in values.yaml.
  • Kubernetes Resource Definitions: The Kubernetes resource definitions for ServiceAccount and imagePullSecrets are correctly structured.
  • Static Analysis Tool Error: The reported syntax error by yamllint is a false positive, typical when linting tools encounter Helm templating syntax. This can be safely ignored in this context.

Overall, the file meets the requirements for introducing a DNS feature as a Helm chart, specifically for managing a service account with autoscaling capabilities.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/clusterrolebinding-autoscaler.yaml (1)

1-23: Review of ClusterRoleBinding Definition and Helm Templating

The Helm template for the ClusterRoleBinding associated with the autoscaler component of CoreDNS is correctly structured. The file uses Helm templating effectively to manage Kubernetes resource definitions dynamically based on configuration values.

  • Kubernetes Resource Definitions: The ClusterRoleBinding is correctly defined with appropriate roleRef and subjects to link the service account to the necessary permissions.
  • Helm Templating: The use of dynamic values and conditional blocks ensures that the resource is only created when necessary, adhering to the configurations specified in values.yaml.
  • Static Analysis Tool Error: The syntax error reported by yamllint is a false positive due to its inability to correctly parse Helm templating syntax. This error can be ignored.

This file is well-prepared to support the new DNS feature as a Helm chart by managing permissions for the autoscaler component effectively.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/clusterrole.yaml (1)

1-36: Review of ClusterRole Definition and Helm Templating

The Helm template for the ClusterRole necessary for the CoreDNS deployment is well-constructed. It correctly specifies the necessary permissions for the DNS service to function within a Kubernetes environment.

  • RBAC Permissions: The permissions for endpoints, services, pods, namespaces, and endpointslices are appropriately defined. The use of apiGroups and verbs aligns with Kubernetes RBAC best practices.
  • Conditional Security Features: The inclusion of permissions for podsecuritypolicies based on the Helm value rbac.pspEnable is a prudent approach to managing optional security features.
  • Helm Templating: The dynamic creation of the ClusterRole based on deployment settings ensures that resources are managed according to the specified configurations.
  • Static Analysis Tool Error: The syntax error reported by yamllint is a false positive, typical of its handling of Helm templating syntax. This error can be disregarded.

This file effectively supports the new DNS feature as a Helm chart by defining necessary permissions for the CoreDNS deployment.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/serviceaccount.yaml (1)

1-23: Review of the ServiceAccount Helm Template

The Helm template for creating a ServiceAccount is well-structured and follows best practices for conditional rendering based on values provided in values.yaml. The use of {{- to control whitespace is correctly applied, and the conditions for creating annotations and image pull secrets are clear and logical.

However, ensure that the serviceAccount.create and deployment.enabled flags are well-documented in the values.yaml to avoid confusion about when the ServiceAccount will be created.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/poddisruptionbudget.yaml (1)

1-26: Review of the PodDisruptionBudget Helm Template

The Helm template for creating a PodDisruptionBudget is well-structured and follows best practices for conditional rendering based on values provided in values.yaml. The use of {{- to control whitespace is correctly applied, and the conditions for creating custom labels and annotations are clear and logical.

However, ensure that the podDisruptionBudget and deployment.enabled flags are well-documented in the values.yaml to avoid confusion about when the PodDisruptionBudget will be created.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/clusterrole-autoscaler.yaml (1)

1-30: Review of the ClusterRole Autoscaler Helm Template

The Helm template for creating a ClusterRole for autoscaling is well-structured and follows best practices for conditional rendering based on values provided in values.yaml. The use of {{- to control whitespace is correctly applied, and the conditions for creating custom labels and annotations are clear and logical.

The comment regarding the removal of the configmaps rule once a specific issue is resolved is a good practice for future maintainability. Ensure that this issue is tracked in your project's issue tracking system to not forget about this temporary workaround.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/hpa.yaml (1)

1-33: Review of the new HPA configuration file for CoreDNS Helm chart.

This file introduces a new Horizontal Pod Autoscaler (HPA) configuration for CoreDNS, using Helm templating to dynamically generate the appropriate settings based on deployment conditions. The file is well-structured and follows best practices for Helm chart templates, including:

  • Conditional checks for enabling HPA and ensuring no conflict with another autoscaler.
  • Compatibility checks for Kubernetes API versions to use the correct HPA API.
  • Dynamic labeling and annotations using Helm functions and pipelines.

The static analysis tool flagged a syntax error at the beginning of the file, which is a common false positive when dealing with Helm templating syntax in YAML files. This is not an actual syntax error in the context of Helm charts.

Overall, the file is correctly implemented and adheres to best practices for Kubernetes Helm charts.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/apps/kubernetes/Chart.yaml (1)

19-19: Version number update in Helm chart metadata.

The version number of the Helm chart has been updated from 0.9.0 to 0.10.0. This change is consistent with Semantic Versioning practices, indicating enhancements or significant changes to the chart. The file is well-documented, and the version update is appropriately reflected.

This change is approved as it follows best practices for version management in Helm charts.

packages/system/coredns/charts/coredns/templates/configmap.yaml (1)

1-37: Review of the new ConfigMap configuration file for CoreDNS Helm chart.

This file introduces a new ConfigMap configuration for CoreDNS, using Helm templating to dynamically generate the appropriate settings based on deployment conditions. The file is well-structured and follows best practices for Helm chart templates, including:

  • Conditional checks for enabling or skipping the ConfigMap based on deployment settings.
  • Dynamic labeling and annotations using Helm functions and pipelines.
  • Flexible configuration for CoreDNS through templated values, allowing customization of the Corefile and other settings.

The static analysis tool flagged a syntax error at the beginning of the file, which is a common false positive when dealing with Helm templating syntax in YAML files. This is not an actual syntax error in the context of Helm charts.

Overall, the file is correctly implemented and adheres to best practices for Kubernetes Helm charts.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/podsecuritypolicy.yaml (1)

1-47: Approve the PodSecurityPolicy configuration.

The Helm templating is correctly used to conditionally apply configurations and check for API versions, ensuring compatibility across different Kubernetes versions. The security settings are aligned with best practices for securing pods.

Regarding the static analysis error on line 1, it is a common issue with Helm templates and can be safely ignored as a false positive.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/NOTES.txt (1)

1-30: Approve the NOTES.txt content.

The Helm templating is correctly used to provide user-friendly instructions for accessing CoreDNS based on the service type. The content is clear and effectively communicates how to access the service under different configurations.

Regarding the static analysis punctuation issues, they are common with Helm templates and can be safely ignored as false positives.

Tools
LanguageTool

[uncategorized] ~7-~7: Loose punctuation mark.
Context: ...rvices {{ template "coredns.fullname" . }}) export NODE_IP=$(kubectl get nodes ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~12-~12: Loose punctuation mark.
Context: ...svc -w {{ template "coredns.fullname" . }}' export SERVICE_IP=$(kubectl get ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~17-~17: Loose punctuation mark.
Context: ...} "{{ template "coredns.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.l...

(UNLIKELY_OPENING_PUNCTUATION)

packages/system/coredns/charts/coredns/templates/service-metrics.yaml (1)

1-39: Template and Kubernetes resource definitions look correct.

The Helm template uses conditional logic to configure the Kubernetes Service resource based on values provided in the Helm chart. The use of template functions and conditional blocks for labels and annotations is correctly implemented.

Regarding the syntax error flagged by yamllint at line 1, this is a common false positive when linting Helm templates, as the Helm syntax {{- is not recognized by standard YAML linters.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/servicemonitor.yaml (1)

1-40: Template and Kubernetes resource definitions look correct.

The Helm template uses conditional logic to configure the ServiceMonitor resource based on values provided in the Helm chart. The use of template functions and conditional blocks for labels, annotations, and selectors is correctly implemented.

Regarding the syntax error flagged by yamllint at line 1, this is a common false positive when linting Helm templates, as the Helm syntax {{- is not recognized by standard YAML linters.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/service.yaml (1)

1-55: Template and Kubernetes resource definitions look correct.

The Helm template uses conditional logic to configure the Kubernetes Service resource based on values provided in the Helm chart. The use of template functions and conditional blocks for labels, annotations, and selectors is correctly implemented.

Regarding the syntax error flagged by yamllint at line 1, this is a common false positive when linting Helm templates, as the Helm syntax {{- is not recognized by standard YAML linters.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

packages/system/coredns/charts/coredns/templates/deployment-autoscaler.yaml (3)

1-8: Conditional Logic and Metadata Configuration: Approved

The conditional logic correctly enables the autoscaler only when HPA is not enabled, preventing conflicts between autoscaling mechanisms. The dynamic naming and namespace assignment are correctly implemented using Helm templating functions.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)


8-15: Label and Annotation Handling: Approved

The dynamic generation of labels and annotations using Helm templating functions like nindent and toYaml is correctly implemented. This approach provides flexibility and maintains readability and maintainability of the Helm chart.


45-97: Pod Specification: Comprehensive and Flexible

The pod specification is well-structured, covering service accounts, priority classes, affinity, tolerations, node selectors, and image pull secrets. Each feature is conditionally applied, enhancing the deployment's adaptability to different environments.

Suggestion: Verify Image Repository and Tag
Ensure that the image repository and tag specified in .Values.autoscaler.image.repository and .Values.autoscaler.image.tag are valid and accessible.

Run the following script to verify the image repository and tag:

packages/system/coredns/charts/coredns/templates/deployment.yaml (3)

1-9: Conditional Logic and Metadata Configuration: Approved

The conditional logic correctly enables the deployment based on the .Values.deployment.enabled configuration. The metadata configuration, including dynamic naming and version labeling, is correctly implemented using Helm templating functions.

Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)


8-41: Label, Annotation, and Selector Handling: Approved

The dynamic generation of labels, annotations, and selectors using Helm templating functions like nindent and toYaml is correctly implemented. This approach provides flexibility and maintains readability and maintainability of the Helm chart.


61-160: Pod and Container Specification: Comprehensive and Flexible

The pod and container specification is well-structured, covering security contexts, termination policies, service accounts, priority classes, DNS policies, affinity, tolerations, node selectors, image pull secrets, and container settings. Each feature is conditionally applied, enhancing the deployment's adaptability to different environments.

Suggestion: Verify Image Repository and Tag
Ensure that the image repository and tag specified in .Values.image.repository and .Values.image.tag are valid and accessible.

Run the following script to verify the image repository and tag:

packages/system/coredns/charts/coredns/templates/_helpers.tpl (2)

1-39: Helper Definitions for Names and Labels: Approved

The helper definitions for names and labels are correctly implemented using Helm templating functions like default, trunc, and trimSuffix. This approach ensures compliance with Kubernetes naming specifications and provides flexibility in configuration.


66-215: Port Configuration Helpers: Robust and Well-Designed

The port configuration helpers are implemented using complex Helm templating logic, which dynamically generates accurate port settings based on server definitions and supported protocols. This implementation ensures that ports are correctly configured for both TCP and UDP, meeting the deployment's specific requirements.

packages/system/coredns/charts/coredns/values.yaml (9)

5-17: Review default image configuration.

The default image configuration is well-defined with placeholders for the image tag and options for image pull secrets. This setup follows best practices by allowing flexibility in image source and versioning while ensuring the image is pulled only if not present.

  • Security Consideration: The use of pullSecrets is optional but crucial for private registries. Ensure secrets are created securely in the Kubernetes environment.
  • Best Practice: It's recommended to specify a default tag aligned with a stable version rather than leaving it empty to ensure predictable deployments.

18-27: Validate resource limits and requests.

The resource limits and requests are set conservatively to 100m for CPU and 128Mi for memory both in limits and requests. This configuration is suitable for ensuring that CoreDNS does not consume excessive resources on a node, which is particularly important in multi-tenant environments or clusters with limited resources.

  • Performance Consideration: Adjust these values based on the cluster size and load expectations. Monitoring actual usage and adjusting these values can help in optimizing resource utilization.
  • Best Practice: It's a good practice to define both limits and requests to avoid resource starvation and ensure QoS for the pod.

28-31: Check rolling update strategy.

The rolling update configuration with maxUnavailable: 1 and maxSurge: 25% is a standard practice for ensuring high availability during updates. This setup helps in minimizing downtime and ensuring that at least a portion of the CoreDNS service remains available during the rolling update.

  • High Availability: This configuration is crucial for DNS services which are critical for cluster operation. Ensuring that updates do not take down all instances simultaneously is vital.
  • Best Practice: Validate these settings in a staging environment to ensure they meet the uptime requirements of your specific Kubernetes cluster setup.

32-33: Set appropriate termination grace period.

The terminationGracePeriodSeconds is set to 30 seconds, which is generally sufficient for DNS servers like CoreDNS to gracefully shutdown. This setting helps in handling ongoing DNS queries and ensures that the pod shutdown does not disrupt service.

  • Graceful Shutdown: It's important for DNS services to handle ongoing requests before shutdown to maintain reliability and reduce DNS lookup failures.
  • Best Practice: Depending on the load, this value might need adjustment. Observing the shutdown behavior under load can provide insights for potential adjustments.

37-51: Review Prometheus integration settings.

The configuration for Prometheus integration is disabled by default (enabled: false), which is a safe default to prevent unintended exposure of metrics. However, for clusters where monitoring is crucial, enabling this and configuring proper annotations and selectors is necessary.

  • Monitoring and Observability: Enabling Prometheus metrics can significantly aid in monitoring the health and performance of CoreDNS.
  • Security Consideration: Ensure that access to the metrics endpoints is secured and restricted to prevent unauthorized access.

67-81: Evaluate RBAC and security settings.

RBAC is enabled by default (create: true), which is essential for enforcing least privilege access controls in Kubernetes. The option to enable PodSecurityPolicy (pspEnable: false) is provided but disabled by default, which might need reconsideration in highly regulated environments.

  • Security Best Practices: Enabling PodSecurityPolicy can provide an additional layer of security by restricting pod capabilities based on security policies.
  • Configuration Flexibility: The chart provides flexibility to configure these settings based on the security posture and requirements of the deployment environment.

83-98: Inspect security context and capabilities.

The security context is configured to add the NET_BIND_SERVICE capability, allowing CoreDNS to bind to well-known ports. This is necessary for DNS services but should be carefully managed to avoid granting unnecessary capabilities.

  • Security Implication: Minimizing the capabilities granted to containers enhances security by reducing the potential attack surface.
  • Best Practice: Ensure that no additional unnecessary capabilities are granted, and review the security context settings regularly as part of a security audit.

102-133: Review CoreDNS server and plugin configurations.

The server configuration includes essential plugins like health, ready, kubernetes, and prometheus, which are crucial for the operation and monitoring of the DNS service. The configuration blocks are well-defined, providing necessary settings for each plugin.

  • Configuration Completeness: The inclusion of lameduck duration in the health check and TTL settings in the Kubernetes plugin are good practices that enhance the reliability and performance of the DNS service.
  • Best Practice: Regularly review and update the plugin configurations to align with CoreDNS updates and security best practices.

290-314: Assess Horizontal Pod Autoscaler (HPA) and cluster-proportional autoscaler configurations.

The HPA is disabled by default, which is a conservative choice allowing manual scaling. The cluster-proportional autoscaler is also disabled but configured with detailed settings for scaling based on cluster size, which can be very effective in large deployments.

  • Scalability: These autoscalers can help in scaling the DNS service based on actual load and cluster changes, which is crucial for maintaining performance and availability.
  • Configuration Advice: Consider enabling the autoscaler in environments with fluctuating load patterns to ensure DNS service scalability.
packages/system/coredns/charts/coredns/README.md (4)

1-10: Validate introductory and TL;DR sections.

The introduction and TL;DR sections provide a clear overview of CoreDNS and its deployment using Helm. The commands are correctly formatted and provide a quick start option for users.

  • Documentation Clarity: The introduction succinctly explains what CoreDNS is and how it can be deployed, which is useful for new users.
  • Command Accuracy: The Helm commands are correctly provided, ensuring users can easily add the repository and install CoreDNS.
Tools
Markdownlint

8-8: null
Dollar signs used before commands without showing output

(MD014, commands-show-output)


9-9: null
Dollar signs used before commands without showing output

(MD014, commands-show-output)


5-5: Punctuation: ';'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


20-46: Ensure prerequisites and uninstallation instructions are clear.

The prerequisites clearly specify the minimum Kubernetes version required, which is crucial for compatibility. The uninstallation instructions are straightforward, providing commands to remove the deployment.

  • Documentation Completeness: Including prerequisites helps users determine if their environment is suitable for the chart.
  • Command Accuracy: The uninstallation command is correctly formatted and explained, ensuring users can cleanly remove CoreDNS if needed.
Tools
Markdownlint

29-29: null
Dollar signs used before commands without showing output

(MD014, commands-show-output)


30-30: null
Dollar signs used before commands without showing output

(MD014, commands-show-output)


42-42: null
Dollar signs used before commands without showing output

(MD014, commands-show-output)


47-123: Examine configuration table and autoscaling details.

The configuration table is comprehensive, detailing various parameters that can be set during deployment. The autoscaling section provides valuable information on how to enable and configure autoscalers for CoreDNS.

  • Documentation Accuracy: The table matches the settings described in the values.yaml file, ensuring consistency across documents.
  • Configuration Explanation: The autoscaling details are well-explained, providing context on how scaling behaves based on cluster metrics.
Tools
Markdownlint

106-106: Expected: 3; Actual: 2; Too few cells, row will be missing data
Table column count

(MD056, table-column-count)


124-253: Check adoption of existing resources and script examples.

The section on adopting existing CoreDNS resources provides detailed steps and scripts for integrating existing deployments with Helm. The scripts are well-documented and include necessary warnings and tips.

  • Script Accuracy: The bash scripts are correctly formatted and include robust error handling with set -euo pipefail.
  • Documentation Best Practices: The inclusion of detailed steps and scripts enhances the usability of the documentation for advanced deployment scenarios.
Tools
LanguageTool

[typographical] ~136-~136: After the expression ‘for example’ a comma is usually used.
Context: ...ns to add to autoscaler config map. For example to stop CI renaming them ...

(COMMA_FOR_EXAMPLE)


[uncategorized] ~145-~145: A comma may be missing after the conjunctive/linking adverb ‘Otherwise’.
Context: ...oyment if deployment.enabled is true. Otherwise the name of an existing deployment for ...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)

Markdownlint

163-163: null
Dollar signs used before commands without showing output

(MD014, commands-show-output)


202-202: null
Bare URL used

(MD034, no-bare-urls)


204-204: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


223-223: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


233-233: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


248-248: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Comment on lines +1 to +33
{{- if .Values.autoscaler.enabled }}
---
kind: ConfigMap
apiVersion: v1
metadata:
name: {{ template "coredns.fullname" . }}-autoscaler
namespace: {{ .Release.Namespace }}
labels: {{- include "coredns.labels.autoscaler" . | nindent 4 }}
{{- if .Values.customLabels }}
{{- toYaml .Values.customLabels | nindent 4 }}
{{- end }}
{{- if or .Values.autoscaler.configmap.annotations .Values.customAnnotations }}
annotations:
{{- if .Values.customAnnotations }}
{{- toYaml .Values.customAnnotations | nindent 4 }}
{{- end }}
{{- if .Values.autoscaler.configmap.annotations -}}
{{ toYaml .Values.autoscaler.configmap.annotations | nindent 4 }}
{{- end }}
{{- end }}
data:
# When cluster is using large nodes(with more cores), "coresPerReplica" should dominate.
# If using small nodes, "nodesPerReplica" should dominate.
linear: |-
{
"coresPerReplica": {{ .Values.autoscaler.coresPerReplica | float64 }},
"nodesPerReplica": {{ .Values.autoscaler.nodesPerReplica | float64 }},
"preventSinglePointFailure": {{ .Values.autoscaler.preventSinglePointFailure }},
"min": {{ .Values.autoscaler.min | int }},
"max": {{ .Values.autoscaler.max | int }},
"includeUnschedulableNodes": {{ .Values.autoscaler.includeUnschedulableNodes }}
}
{{- end }}
Copy link

Choose a reason for hiding this comment

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

Correct indentation issues and approve the ConfigMap configuration.

The Helm templating is correctly used to conditionally apply configurations based on autoscaler settings. However, there are several indentation issues that need to be corrected to maintain YAML file readability and prevent potential errors:

  • Lines 9, 10, and 11 should have an indentation of 2 spaces instead of 4.

Regarding the static analysis error on line 1, it is a common issue with Helm templates and can be safely ignored as a false positive.

Apply this diff to correct the indentation issues:

-    {{- toYaml .Values.customLabels | nindent 4 }}
+    {{- toYaml .Values.customLabels | nindent 2 }}
-    {{- toYaml .Values.customAnnotations | nindent 4 }}
+    {{- toYaml .Values.customAnnotations | nindent 2 }}
-    {{ toYaml .Values.autoscaler.configmap.annotations | nindent 4 }}
+    {{ toYaml .Values.autoscaler.configmap.annotations | nindent 2 }}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{{- if .Values.autoscaler.enabled }}
---
kind: ConfigMap
apiVersion: v1
metadata:
name: {{ template "coredns.fullname" . }}-autoscaler
namespace: {{ .Release.Namespace }}
labels: {{- include "coredns.labels.autoscaler" . | nindent 4 }}
{{- if .Values.customLabels }}
{{- toYaml .Values.customLabels | nindent 4 }}
{{- end }}
{{- if or .Values.autoscaler.configmap.annotations .Values.customAnnotations }}
annotations:
{{- if .Values.customAnnotations }}
{{- toYaml .Values.customAnnotations | nindent 4 }}
{{- end }}
{{- if .Values.autoscaler.configmap.annotations -}}
{{ toYaml .Values.autoscaler.configmap.annotations | nindent 4 }}
{{- end }}
{{- end }}
data:
# When cluster is using large nodes(with more cores), "coresPerReplica" should dominate.
# If using small nodes, "nodesPerReplica" should dominate.
linear: |-
{
"coresPerReplica": {{ .Values.autoscaler.coresPerReplica | float64 }},
"nodesPerReplica": {{ .Values.autoscaler.nodesPerReplica | float64 }},
"preventSinglePointFailure": {{ .Values.autoscaler.preventSinglePointFailure }},
"min": {{ .Values.autoscaler.min | int }},
"max": {{ .Values.autoscaler.max | int }},
"includeUnschedulableNodes": {{ .Values.autoscaler.includeUnschedulableNodes }}
}
{{- end }}
{{- if .Values.autoscaler.enabled }}
---
kind: ConfigMap
apiVersion: v1
metadata:
name: {{ template "coredns.fullname" . }}-autoscaler
namespace: {{ .Release.Namespace }}
labels: {{- include "coredns.labels.autoscaler" . | nindent 4 }}
{{- if .Values.customLabels }}
{{- toYaml .Values.customLabels | nindent 2 }}
{{- end }}
{{- if or .Values.autoscaler.configmap.annotations .Values.customAnnotations }}
annotations:
{{- if .Values.customAnnotations }}
{{- toYaml .Values.customAnnotations | nindent 2 }}
{{- end }}
{{- if .Values.autoscaler.configmap.annotations -}}
{{ toYaml .Values.autoscaler.configmap.annotations | nindent 2 }}
{{- end }}
{{- end }}
data:
# When cluster is using large nodes(with more cores), "coresPerReplica" should dominate.
# If using small nodes, "nodesPerReplica" should dominate.
linear: |-
{
"coresPerReplica": {{ .Values.autoscaler.coresPerReplica | float64 }},
"nodesPerReplica": {{ .Values.autoscaler.nodesPerReplica | float64 }},
"preventSinglePointFailure": {{ .Values.autoscaler.preventSinglePointFailure }},
"min": {{ .Values.autoscaler.min | int }},
"max": {{ .Values.autoscaler.max | int }},
"includeUnschedulableNodes": {{ .Values.autoscaler.includeUnschedulableNodes }}
}
{{- end }}
Tools
yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)


[warning] 9-9: wrong indentation: expected 2 but found 4

(indentation)


[warning] 10-10: wrong indentation: expected 2 but found 4

(indentation)


[warning] 11-11: wrong indentation: expected 2 but found 4

(indentation)

Copy link
Member

@kvaps kvaps left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution. To automatically install coredns into tenant clusters we'd also need to add Helmrelease for it

Eg, similar to cilium:

apiVersion: helm.toolkit.fluxcd.io/v2

##
host: ""
controlPlane:
replicas: 2
storageClass: replicated
disabledDNSAddon: false
Copy link
Member

Choose a reason for hiding this comment

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

Can we disable it by default (don't provide such option for the user) and just using helm chart for coredns every time?

Comment on lines +90 to +94
{{- if not .Values.disabledDNSAddon }}
coreDNS:
dnsServiceIPs:
- 10.95.0.10
{{- end }}
Copy link
Member

Choose a reason for hiding this comment

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

Will it remove existing cordns deployment if we switch disabledDNSAddon from false to true?

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.

2 participants