Skip to content

Commit

Permalink
feat: node transformer
Browse files Browse the repository at this point in the history
Node transformer allows you to add extra labels/annotations and modify platform metadata.

Signed-off-by: Serge Logvinov <[email protected]>
  • Loading branch information
sergelogvinov committed May 2, 2024
1 parent db305e7 commit 22e3984
Show file tree
Hide file tree
Showing 24 changed files with 1,189 additions and 141 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
go-version-file: 'go.mod'

- name: Lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v5
with:
version: v1.56.2
args: --config=.golangci.yml
version: v1.57.1
args: --timeout=5m --config=.golangci.yml
- name: Build
timeout-minutes: 10
run: make images
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/release-charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ jobs:

- name: Install Helm
uses: azure/setup-helm@v4
with:
version: v3.12.2
- name: Install Cosign
uses: sigstore/[email protected]

Expand Down
30 changes: 23 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# options for analysis running
run:
go: '1.21'
# default concurrency is a available CPU number
# concurrency: 4

Expand All @@ -20,7 +19,8 @@ run:
# won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know.
skip-files:
exclude-files:
- charts/
- docs/

# list of build tags, all linters use it. Default is empty list.
Expand All @@ -34,7 +34,13 @@ run:
# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number"
format: line-number
formats:
- format: line-number
path: stdout
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
sort-results: true

# all available settings of specific linters
linters-settings:
Expand All @@ -46,15 +52,13 @@ linters-settings:
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: true
govet:
# report about shadowed variables
check-shadowing: true
govet: {}
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 15
min-complexity: 20
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
Expand All @@ -66,6 +70,8 @@ linters-settings:
min-len: 3
# minimal occurrences count to trigger, 3 by default
min-occurrences: 3
depguard:
list-type: blacklist
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
Expand Down Expand Up @@ -167,11 +173,21 @@ linters:
- wrapcheck
- perfsprint

# temporarily disabled linters
- copyloopvar
# https://github.com/golangci/golangci-lint/issues/4606
- intrange

# abandoned linters for which golangci shows the warning that the repo is archived by the owner
- golint
- interfacer
- maligned
- scopelint
- varcheck
- structcheck
- deadcode
- ifshort
- perfsprint

disable-all: false
fast: false
Expand Down
2 changes: 1 addition & 1 deletion charts/talos-cloud-controller-manager/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ keywords:
maintainers:
- name: sergelogvinov
url: https://github.com/sergelogvinov
version: 0.2.3
version: 0.3.0
appVersion: "v1.6.0"
3 changes: 2 additions & 1 deletion charts/talos-cloud-controller-manager/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# talos-cloud-controller-manager

![Version: 0.2.3](https://img.shields.io/badge/Version-0.2.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.6.0](https://img.shields.io/badge/AppVersion-v1.6.0-informational?style=flat-square)
![Version: 0.3.0](https://img.shields.io/badge/Version-0.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.6.0](https://img.shields.io/badge/AppVersion-v1.6.0-informational?style=flat-square)

Talos Cloud Controller Manager Helm Chart

Expand Down Expand Up @@ -79,5 +79,6 @@ helm upgrade -i --namespace=kube-system -f talos-ccm.yaml \
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created. |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template. |
| tolerations | list | `[{"effect":"NoSchedule","key":"node-role.kubernetes.io/control-plane","operator":"Exists"},{"effect":"NoSchedule","key":"node.cloudprovider.kubernetes.io/uninitialized","operator":"Exists"}]` | Tolerations for data pods assignment. ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ |
| transformations | list | `[]` | List of node transformations. Available matchExpressions key values: https://github.com/siderolabs/talos/blob/main/pkg/machinery/resources/runtime/platform_metadata.go#L28 |
| updateStrategy | object | `{"rollingUpdate":{"maxUnavailable":1},"type":"RollingUpdate"}` | Deployment update stategy type. ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#updating-a-deployment |
| useDaemonSet | bool | `false` | Deploy CCM in Daemonset mode. CCM will use hostNetwork and current node to access kubernetes/talos API You can run it without CNI plugin. |
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ data:
{{- if .Values.features.approveNodeCSR }}
approveNodeCSR: true
{{- end }}
{{- with .Values.transformations }}
transformations:
{{- toYaml . | nindent 6 }}
{{- end }}
17 changes: 17 additions & 0 deletions charts/talos-cloud-controller-manager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,23 @@ features:
# `approveNodeCSR` - check and approve node CSR.
approveNodeCSR: true

# -- List of node transformations.
# Available matchExpressions key values: https://github.com/siderolabs/talos/blob/main/pkg/machinery/resources/runtime/platform_metadata.go#L28
transformations: []
# - name: control-plane region
# nodeSelector:
# - matchExpressions:
# - key: hostname
# operator: Regexp
# values:
# - ^control-.+$
# annotations:
# talos.dev/instance-id: "{{ .InstanceID }}"
# labels:
# talos.dev/instance-spot: "{{ .Spot }}"
# platformMetadata:
# Region: "us-west-2"

# -- Log verbosity level. See https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md
# for description of individual verbosity levels.
logVerbosityLevel: 2
Expand Down
12 changes: 6 additions & 6 deletions docs/deploy/cloud-controller-manager-daemonset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceAccount
metadata:
name: talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand All @@ -18,7 +18,7 @@ kind: ServiceAccount
metadata:
name: talos-cloud-controller-manager-talos-secrets
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand All @@ -34,7 +34,7 @@ kind: ConfigMap
metadata:
name: talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand All @@ -51,7 +51,7 @@ kind: ClusterRole
metadata:
name: system:talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand Down Expand Up @@ -159,7 +159,7 @@ kind: Service
metadata:
name: talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand All @@ -183,7 +183,7 @@ kind: DaemonSet
metadata:
name: talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand Down
12 changes: 6 additions & 6 deletions docs/deploy/cloud-controller-manager-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceAccount
metadata:
name: talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand All @@ -18,7 +18,7 @@ kind: ServiceAccount
metadata:
name: talos-cloud-controller-manager-talos-secrets
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand All @@ -34,7 +34,7 @@ kind: ConfigMap
metadata:
name: talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand All @@ -51,7 +51,7 @@ kind: ClusterRole
metadata:
name: system:talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand Down Expand Up @@ -159,7 +159,7 @@ kind: Service
metadata:
name: talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand All @@ -183,7 +183,7 @@ kind: Deployment
metadata:
name: talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand Down
12 changes: 6 additions & 6 deletions docs/deploy/cloud-controller-manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: ServiceAccount
metadata:
name: talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand All @@ -18,7 +18,7 @@ kind: ServiceAccount
metadata:
name: talos-cloud-controller-manager-talos-secrets
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand All @@ -34,7 +34,7 @@ kind: ConfigMap
metadata:
name: talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand All @@ -51,7 +51,7 @@ kind: ClusterRole
metadata:
name: system:talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand Down Expand Up @@ -159,7 +159,7 @@ kind: Service
metadata:
name: talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand All @@ -183,7 +183,7 @@ kind: Deployment
metadata:
name: talos-cloud-controller-manager
labels:
helm.sh/chart: talos-cloud-controller-manager-0.2.3
helm.sh/chart: talos-cloud-controller-manager-0.3.0
app.kubernetes.io/name: talos-cloud-controller-manager
app.kubernetes.io/instance: talos-cloud-controller-manager
app.kubernetes.io/version: "v1.6.0"
Expand Down
Loading

0 comments on commit 22e3984

Please sign in to comment.