Skip to content

Commit 2664b5a

Browse files
authored
[Maintenance] Add & Enable YAML Linter (#1251)
1 parent e4045c7 commit 2664b5a

File tree

67 files changed

+8991
-8833
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+8991
-8833
lines changed

.golangci.yaml

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
---
2-
31
run:
42
issues-exit-code: 3
53
timeout: 30m
@@ -8,21 +6,19 @@ run:
86
- .gobuild
97
- deps
108
- tools
11-
129
linters:
1310
disable-all: true
1411
enable:
15-
- gosimple
16-
- govet
17-
- ineffassign
12+
- gosimple
13+
- govet
14+
- ineffassign
1815
- staticcheck
19-
- typecheck
20-
- unconvert
21-
- unparam
16+
- typecheck
17+
- unconvert
18+
- unparam
2219
- unused
2320
- importas
2421
- gci
25-
2622
linters-settings:
2723
importas:
2824
no-unaliased: true

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- (Improvement) Reduce CI on Commit Travis runs
1212
- (Maintenance) Add license range rewrite command
1313
- (Feature) Optional Action
14+
- (Maintenance) Add & Enable YAML Linter
1415

1516
## [1.2.24](https://github.com/arangodb/kube-arangodb/tree/1.2.24) (2023-01-25)
1617
- (Bugfix) Fix deployment creation on ARM64

Makefile

+16-2
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ EXCLUDE_DIRS := vendor .gobuild deps tools pkg/generated/clientset pkg/generated
198198
EXCLUDE_FILES := *generated.deepcopy.go
199199
SOURCES_QUERY := find ./ -type f -name '*.go' ! -name '*.pb.go' $(foreach EXCLUDE_DIR,$(EXCLUDE_DIRS), ! -path "*/$(EXCLUDE_DIR)/*") $(foreach EXCLUDE_FILE,$(EXCLUDE_FILES), ! -path "*/$(EXCLUDE_FILE)")
200200
SOURCES := $(shell $(SOURCES_QUERY))
201+
202+
YAML_EXCLUDE_DIRS := vendor .gobuild deps tools pkg/generated/clientset pkg/generated/informers pkg/generated/listers chart/kube-arangodb/templates chart/kube-arangodb-crd/templates chart/arangodb-ingress-proxy/templates
203+
YAML_EXCLUDE_FILES :=
204+
YAML_QUERY := find ./ -type f -name '*.yaml' $(foreach EXCLUDE_DIR,$(YAML_EXCLUDE_DIRS), ! -path "*/$(EXCLUDE_DIR)/*") $(foreach EXCLUDE_FILE,$(YAML_EXCLUDE_FILES), ! -path "*/$(EXCLUDE_FILE)")
205+
YAMLS := $(shell $(YAML_QUERY))
206+
201207
DASHBOARDSOURCES := $(shell find $(DASHBOARDDIR)/src -name '*.js') $(DASHBOARDDIR)/package.json
202208
LINT_EXCLUDES:=
203209
ifeq ($(RELEASE_MODE),enterprise)
@@ -242,6 +248,12 @@ fmt:
242248
@$(GOPATH)/bin/goimports -w $(SOURCES)
243249
@$(GOPATH)/bin/gci write -s "standard" -s "default" -s "prefix(github.com/arangodb)" -s "prefix(github.com/arangodb/kube-arangodb)" $(SOURCES)
244250

251+
.PHONY: yamlfmt
252+
yamlfmt:
253+
@echo ">> Ensuring style of yaml files"
254+
@$(GOPATH)/bin/yamlfmt -w $(YAMLS)
255+
@$(GOPATH)/bin/yamlfmt -w $(YAMLS)
256+
245257
.PHONY: license
246258
license:
247259
@echo ">> Ensuring license of files"
@@ -507,6 +519,8 @@ tools-min: update-vendor
507519
@GOBIN=$(GOPATH)/bin go install golang.org/x/tools/cmd/goimports@0bb7e5c47b1a31f85d4f173edc878a8e049764a5
508520
@echo ">> Fetching license check"
509521
@GOBIN=$(GOPATH)/bin go install github.com/google/addlicense@6d92264d717064f28b32464f0f9693a5b4ef0239
522+
@echo ">> Fetching yamlfmt"
523+
@GOBIN=$(GOPATH)/bin go install github.com/UltiRequiem/[email protected]
510524

511525
.PHONY: tools
512526
tools: tools-min
@@ -599,7 +613,7 @@ check-community:
599613
@$(MAKE) _check RELEASE_MODE=community
600614

601615
_check:
602-
@$(MAKE) fmt license-verify linter run-unit-tests bin
616+
@$(MAKE) fmt yamlfmt license-verify linter run-unit-tests bin
603617

604618
generate: generate-internal generate-proto fmt
605619

@@ -613,4 +627,4 @@ generate-proto:
613627
$(PROTOSOURCES)
614628

615629
.PHONY: fix
616-
fix: license-range fmt license
630+
fix: license-range fmt license yamlfmt
+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
---
2-
31
replicas: 2
42
imagePullPolicy: Always
5-
image: nginx:1.16.1-alpine
3+
image: nginx:1.16.1-alpine

chart/kube-arangodb-crd/Chart.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
---
2-
31
name: kube-arangodb-crd
42
version: 1.2.24
5-
63
description: "ArangoDB Kubernetes Custom Resource Definitions"
74
tillerVersion: ">2.7"
8-
9-
appVersion: 3.5.0
5+
appVersion: 3.5.0

chart/kube-arangodb/Chart.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
---
2-
31
name: kube-arangodb
42
version: 1.2.24
5-
63
description: "ArangoDB Kubernetes Operator"
74
tillerVersion: ">2.7"
8-
9-
appVersion: 3.5.0
5+
appVersion: 3.5.0

chart/kube-arangodb/crds/member.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
4-
name: arangomembers.database.arangodb.com
4+
name: arangomembers.database.arangodb.com
55
spec:
66
group: database.arangodb.com
77
names:
@@ -30,4 +30,4 @@ spec:
3030
served: true
3131
storage: false
3232
subresources:
33-
status: {}
33+
status: {}

chart/kube-arangodb/values.yaml

+2-21
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,46 @@
1-
---
2-
31
operator:
42
image: arangodb/kube-arangodb:1.2.24
53
imagePullPolicy: IfNotPresent
64
imagePullSecrets: []
7-
85
scope: legacy
9-
106
architectures:
11-
- amd64
12-
7+
- amd64
138
debug: false
14-
159
args: []
16-
1710
service:
1811
type: ClusterIP
19-
2012
annotations: {}
21-
2213
resources:
2314
limits:
2415
cpu: 1
2516
memory: 256Mi
2617
requests:
2718
cpu: 250m
2819
memory: 256Mi
29-
3020
securityContext:
3121
runAsUser: 1000
32-
3322
replicaCount: 2
34-
3523
updateStrategy:
3624
type: Recreate
37-
3825
allowChaos: false
39-
4026
nodeSelector: {}
41-
4227
enableCRDManagement: true
43-
4428
features:
4529
deployment: true
4630
deploymentReplications: true
4731
storage: false
4832
backup: false
4933
apps: false
5034
k8sToK8sClusterSync: false
51-
5235
images:
5336
base: alpine:3.11
5437
metricsExporter: arangodb/arangodb-exporter:0.1.7
5538
arango: arangodb/arangodb:latest
56-
5739
tolerations: []
58-
5940
rbac:
6041
enabled: true
6142
extensions:
6243
monitoring: true
6344
acs: true
6445
at: true
65-
debug: false
46+
debug: false

examples/arango-local-storage.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ spec:
77
name: my-local-ssd
88
isDefault: true
99
localPath:
10-
- /var/lib/arango-storage
10+
- /var/lib/arango-storage

examples/arangojob.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ spec:
1010
containers:
1111
- name: pi
1212
image: perl
13-
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
13+
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
1414
restartPolicy: Never
15-
backoffLimit: 4
15+
backoffLimit: 4

examples/cluster1-with-sync.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ spec:
1414
externalAccess:
1515
type: LoadBalancer
1616
loadBalancerIP: 192.168.140.210
17-

examples/cluster2-with-sync.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ spec:
1414
externalAccess:
1515
type: LoadBalancer
1616
loadBalancerIP: 192.168.140.211
17-

examples/metrics/deployment-operator-servicemonitor.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ spec:
1414
app.kubernetes.io/name: kube-arangodb
1515
namespaceSelector:
1616
matchNames:
17-
- default
17+
- default
1818
endpoints:
19-
- port: server
20-
scheme: https
21-
tlsConfig:
22-
insecureSkipVerify: true
19+
- port: server
20+
scheme: https
21+
tlsConfig:
22+
insecureSkipVerify: true

examples/nodeport-cluster.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ spec:
99
type: NodePort
1010
publishNotReadyAddresses: true
1111
ports:
12-
- protocol: TCP
13-
port: 8529
14-
targetPort: 8529
15-
nodePort: 31529
12+
- protocol: TCP
13+
port: 8529
14+
targetPort: 8529
15+
nodePort: 31529

examples/nodeport-single-server.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
role: single
99
type: NodePort
1010
ports:
11-
- protocol: TCP
12-
port: 8529
13-
targetPort: 8529
14-
nodePort: 30529
11+
- protocol: TCP
12+
port: 8529
13+
targetPort: 8529
14+
nodePort: 30529

examples/reboot-pod.yaml

-11
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,13 @@ spec:
2929
valueFrom:
3030
fieldRef:
3131
fieldPath: metadata.name
32-
3332
---
34-
3533
apiVersion: v1
3634
kind: ServiceAccount
3735
metadata:
3836
name: arango-deployment-operator-reboot
3937
namespace: default
40-
4138
---
42-
4339
apiVersion: rbac.authorization.k8s.io/v1
4440
kind: Role
4541
metadata:
@@ -52,10 +48,7 @@ rules:
5248
- apiGroups: ["database.arangodb.com"]
5349
resources: ["arangodeployments"]
5450
verbs: ["*"]
55-
56-
5751
---
58-
5952
apiVersion: rbac.authorization.k8s.io/v1
6053
kind: RoleBinding
6154
metadata:
@@ -69,9 +62,7 @@ subjects:
6962
- kind: ServiceAccount
7063
name: arango-deployment-operator-reboot
7164
namespace: default
72-
7365
---
74-
7566
apiVersion: rbac.authorization.k8s.io/v1
7667
kind: ClusterRole
7768
metadata:
@@ -81,9 +72,7 @@ rules:
8172
- apiGroups: [""]
8273
resources: ["persistentvolumes"]
8374
verbs: ["*"]
84-
8575
---
86-
8776
apiVersion: rbac.authorization.k8s.io/v1
8877
kind: ClusterRoleBinding
8978
metadata:

examples/single-server-no-auth.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ spec:
66
mode: Single
77
auth:
88
jwtSecretName: None
9-

internal/actions.yaml

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
---
2-
31
default_timeout: 10m
4-
52
actions:
63
PlaceHolder:
74
description: Empty placeholder action
@@ -232,4 +229,4 @@ actions:
232229
description: Runs the Resource sync
233230
TimezoneSecretSet:
234231
description: Set timezone details in cluster
235-
timeout: 30m
232+
timeout: 30m

internal/metrics.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
---
2-
31
documentation: docs/generated/metrics
42
destination: pkg/generated/metric_descriptions
5-
63
namespaces:
74
arangodb_operator:
85
agency_cache:

0 commit comments

Comments
 (0)