From 92765a29db4da7ad11b85a1e9af08230fcfded1b Mon Sep 17 00:00:00 2001 From: evelynliu <1821584441@qq.com> Date: Wed, 29 Nov 2023 11:33:19 -0600 Subject: [PATCH 1/2] Add .yamllint config file to use yamllint to enhance linting for yaml files --- .yamllint | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .yamllint diff --git a/.yamllint b/.yamllint new file mode 100644 index 000000000..14541eadd --- /dev/null +++ b/.yamllint @@ -0,0 +1,43 @@ +extends: default + +rules: + # Rules to control the number of spaces around operators + braces: + min-spaces-inside: 0 # No spaces required inside braces + max-spaces-inside: 1 # Maximum one space inside braces + brackets: + min-spaces-inside: 0 + max-spaces-inside: 1 + colons: + max-spaces-before: 0 + max-spaces-after: 1 + commas: + max-spaces-before: 0 + max-spaces-after: 1 + hyphens: + max-spaces-after: 1 + +# Rules to control indentation + indentation: + spaces: consistent # Spaces should be consistently used for indentation + indent-sequences: whatever # Either indenting or not indenting individual block sequences is OK + comments-indentation: enable # Comments should be indented the same as the content + +# Rules to control lines + line-length: + max: 120 # Maximum 120 characters per line + allow-non-breakable-words: true # Allow long words without breaks + allow-non-breakable-inline-mappings: true # Allow long inline mappings without breaks + empty-lines: + max: 2 # Maximum two consecutive empty lines allowed + trailing-spaces: enable # Ensure no trailing spaces at the end of lines + +# Other rules + comments: + min-spaces-from-content: 1 # At least one space required between content and comment + key-duplicates: enable # Ensure no duplicate keys in mappings + document-start: + present: false # Do not require document start marker + + + From 0c4bfa76de50564f4c8a89d4c87aae7d1360f4c0 Mon Sep 17 00:00:00 2001 From: evelynliu <1821584441@qq.com> Date: Tue, 19 Dec 2023 15:15:54 -0600 Subject: [PATCH 2/2] Included a Makefile target to install yamllint, skipped linting autogenerated config dir, fixed linting issues seen --- .yamllint | 24 +++++++++---------- Makefile | 5 ++++ metadata.yaml | 2 +- templates/bases/vpc/kcp.yaml | 4 ++-- .../cluster-with-kcp.yaml | 4 ++-- templates/cluster-template-powervs/kcp.yaml | 1 - .../cluster-with-kcp.yaml | 4 ++-- templates/cluster-template/cluster.yaml | 1 - templates/cluster-template/kcp.yaml | 1 - test/e2e/data/cni/calico/calico.yaml | 2 +- 10 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.yamllint b/.yamllint index 14541eadd..a5ba70419 100644 --- a/.yamllint +++ b/.yamllint @@ -1,5 +1,8 @@ extends: default +ignore: + - config # Skip autogenerated config dir from liniting + rules: # Rules to control the number of spaces around operators braces: @@ -17,27 +20,24 @@ rules: hyphens: max-spaces-after: 1 -# Rules to control indentation + # Rules to control indentation indentation: spaces: consistent # Spaces should be consistently used for indentation indent-sequences: whatever # Either indenting or not indenting individual block sequences is OK comments-indentation: enable # Comments should be indented the same as the content -# Rules to control lines + # Rules to control lines line-length: - max: 120 # Maximum 120 characters per line + max: 150 # Maximum 150 characters per line allow-non-breakable-words: true # Allow long words without breaks allow-non-breakable-inline-mappings: true # Allow long inline mappings without breaks empty-lines: max: 2 # Maximum two consecutive empty lines allowed trailing-spaces: enable # Ensure no trailing spaces at the end of lines - -# Other rules - comments: - min-spaces-from-content: 1 # At least one space required between content and comment - key-duplicates: enable # Ensure no duplicate keys in mappings - document-start: - present: false # Do not require document start marker - - + # Other rules + comments: + min-spaces-from-content: 1 # At least one space required between content and comment + key-duplicates: enable # Ensure no duplicate keys in mappings + truthy: + allowed-values: ['true', 'false', 'on', 'off'] # Allow only these values for boolean scalars diff --git a/Makefile b/Makefile index d7cc390b6..652cddf6f 100644 --- a/Makefile +++ b/Makefile @@ -150,6 +150,11 @@ vet: help: # Display this help @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n\nTargets:\n"} /^[0-9A-Za-z_-]+:.*?##/ { printf " \033[36m%-45s\033[0m %s\n", $$1, $$2 } /^\$$\([0-9A-Za-z_-]+\):.*?##/ { gsub("_","-", $$1); printf " \033[36m%-45s\033[0m %s\n", tolower(substr($$1, 3, length($$1)-7)), $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) +# Install yamllint if not present +.PHONY: install-yamllint +install-yamllint: + @which yamllint > /dev/null || (echo "Installing yamllint..." && pip install yamllint) + ## -------------------------------------- ## Generate / Manifests ## -------------------------------------- diff --git a/metadata.yaml b/metadata.yaml index 1697defb9..63ab7d808 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -22,4 +22,4 @@ releaseSeries: contract: v1beta1 - major: 0 minor: 7 - contract: v1beta1 + contract: v1beta1 diff --git a/templates/bases/vpc/kcp.yaml b/templates/bases/vpc/kcp.yaml index 217a83d97..deafe82e5 100644 --- a/templates/bases/vpc/kcp.yaml +++ b/templates/bases/vpc/kcp.yaml @@ -26,14 +26,14 @@ spec: initConfiguration: nodeRegistration: criSocket: /var/run/containerd/containerd.sock - kubeletExtraArgs: + kubeletExtraArgs: cloud-provider: external eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' joinConfiguration: discovery: {} nodeRegistration: criSocket: /var/run/containerd/containerd.sock - kubeletExtraArgs: + kubeletExtraArgs: cloud-provider: external eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' --- diff --git a/templates/cluster-template-powervs-clusterclass/cluster-with-kcp.yaml b/templates/cluster-template-powervs-clusterclass/cluster-with-kcp.yaml index 6e87cad87..bdc682b66 100644 --- a/templates/cluster-template-powervs-clusterclass/cluster-with-kcp.yaml +++ b/templates/cluster-template-powervs-clusterclass/cluster-with-kcp.yaml @@ -53,12 +53,12 @@ spec: ref: apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate - name: "${IBMPOWERVS_CLUSTER_CLASS_NAME}-md-0" + name: "${IBMPOWERVS_CLUSTER_CLASS_NAME}-md-0" infrastructure: ref: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: IBMPowerVSMachineTemplate - name: "${IBMPOWERVS_CLUSTER_CLASS_NAME}-worker-machinetemplate" + name: "${IBMPOWERVS_CLUSTER_CLASS_NAME}-worker-machinetemplate" --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: IBMPowerVSClusterTemplate diff --git a/templates/cluster-template-powervs/kcp.yaml b/templates/cluster-template-powervs/kcp.yaml index d5200d353..65b9f438a 100644 --- a/templates/cluster-template-powervs/kcp.yaml +++ b/templates/cluster-template-powervs/kcp.yaml @@ -13,4 +13,3 @@ spec: nodeRegistration: kubeletExtraArgs: provider-id: ibmpowervs://${CLUSTER_NAME}/'{{ v1.local_hostname }}' - diff --git a/templates/cluster-template-vpc-clusterclass/cluster-with-kcp.yaml b/templates/cluster-template-vpc-clusterclass/cluster-with-kcp.yaml index cfcec444a..73344a343 100644 --- a/templates/cluster-template-vpc-clusterclass/cluster-with-kcp.yaml +++ b/templates/cluster-template-vpc-clusterclass/cluster-with-kcp.yaml @@ -104,13 +104,13 @@ spec: initConfiguration: nodeRegistration: criSocket: /var/run/containerd/containerd.sock - kubeletExtraArgs: + kubeletExtraArgs: cloud-provider: external eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' joinConfiguration: discovery: {} nodeRegistration: criSocket: /var/run/containerd/containerd.sock - kubeletExtraArgs: + kubeletExtraArgs: cloud-provider: external eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%' diff --git a/templates/cluster-template/cluster.yaml b/templates/cluster-template/cluster.yaml index a89e4d0c2..05c4be781 100644 --- a/templates/cluster-template/cluster.yaml +++ b/templates/cluster-template/cluster.yaml @@ -5,4 +5,3 @@ metadata: namespace: "${NAMESPACE}" labels: ccm: external - diff --git a/templates/cluster-template/kcp.yaml b/templates/cluster-template/kcp.yaml index acc2b3141..99fb17ce6 100644 --- a/templates/cluster-template/kcp.yaml +++ b/templates/cluster-template/kcp.yaml @@ -12,4 +12,3 @@ spec: apiServer: extraArgs: cloud-provider: external - diff --git a/test/e2e/data/cni/calico/calico.yaml b/test/e2e/data/cni/calico/calico.yaml index 59cf30942..950c74d18 100644 --- a/test/e2e/data/cni/calico/calico.yaml +++ b/test/e2e/data/cni/calico/calico.yaml @@ -4229,7 +4229,7 @@ rules: resources: - endpointslices verbs: - - watch + - watch - list - apiGroups: [""] resources: