Skip to content

Commit

Permalink
control-service: Update helm template license headers (#1670)
Browse files Browse the repository at this point in the history
### What
Update helm template license headers to use template-style comments
Ignore helm templates in pre-commit yaml license hook Create new
pre-commit license hook to add template-style comments to helm templates

### Why
Regular yaml comments at the top of files break parsing for helm charts
This breaks control-service deployments

### How was this tested

Tested installing the charts on a local k8s cluster using helm

Ran `helm upgrade --install --debug --wait --timeout 10m0s
cicd-control-service .` on the chart, which gave me the same output as
the failing pipeline. Edited the comments until the apiVersion error
disappeared.

```
Error: UPGRADE FAILED: error validating "": error validating data: apiVersion not set
```

https://gitlab.com/vmware-analytics/versatile-data-kit/-/jobs/3813924321

Signed-off-by: Dilyan Marinov <[email protected]>
  • Loading branch information
DeltaMichael authored Feb 24, 2023
1 parent fefa259 commit 1516bcb
Show file tree
Hide file tree
Showing 23 changed files with 97 additions and 42 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ tests.xml
temp
gradlew
gradlew.bat

# Ignore downloaded helm charts
projects/control-service/projects/helm_charts/pipelines-control-service/charts/*
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,20 @@ repos:
- /*| *| */
- id: insert-license
files: (\.yaml$|\.yml$)
# exclude control service helm chart templates as they require template-style comments
exclude: ^projects/control-service/projects/helm_charts/pipelines-control-service/templates
args:
- --use-current-year
- --license-filepath
- NOTICE.txt
- id: insert-license
files: (^projects/control-service/projects/helm_charts/pipelines-control-service/templates/.+\.yaml$|^projects/control-service/projects/helm_charts/pipelines-control-service/templates/.+\.yml$)
args:
- --use-current-year
- --license-filepath
- NOTICE.txt
- --comment-style
- '{{- /*| | */}}'
- id: insert-license
files: \.py$
args:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if .Values.datajobTemplate.enabled }}
apiVersion: v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

apiVersion: apps/v1
kind: Deployment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2023-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if .Values.fluentd.enabled }}
apiVersion: logs.vdp.vmware.com/v1beta1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if .Values.dataJob.fluentd.enabled }}
apiVersion: logs.vdp.vmware.com/v1beta1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if .Values.ingress.enabled -}}
kind: Ingress
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if .Values.alerting.enabled }}
apiVersion: monitoring.coreos.com/v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if and .Values.rbac.create .Values.rbac.datajobsDeployment.create -}}
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if and .Values.serviceAccount.create .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if and .Values.serviceAccount.create .Values.rbac.create .Values.rbac.datajobsDeployment.create }}
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

## Create a secret with JDBC credentials for embedded database (PostgreSQL or CockroachDB) only if externalSecretName is not supplied.
## If any of the fields are empty, we fall-back to defaults (f.e. local dev environment)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

## Create a secret with Kerberos keytab for authentication if kerberos authentication flag is turned on.
## The keytab file contents are set from the values.yaml file and are intended to be populated by an env
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if .Values.deploymentDataJobBaseImage.password }}
apiVersion: v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if .Values.deploymentBuilderImage.password }}
apiVersion: v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if and (eq .Values.deploymentDockerRegistryType "generic") .Values.deploymentDockerRegistryUsernameReadOnly .Values.deploymentDockerRegistryPasswordReadOnly }}
apiVersion: v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if (include "shouldCreatePipelinesControlServiceDockerRepoSecret" .) }}
apiVersion: v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if (include "shouldCreateVdkSdkDockerRepoSecret" .) }}
apiVersion: v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

apiVersion: v1
kind: Secret
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

apiVersion: v1
kind: Service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if .Values.serviceAccount.create }}
apiVersion: v1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
{{- /*
Copyright 2021-2023 VMware, Inc.
SPDX-License-Identifier: Apache-2.0
*/}}

{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
Expand Down

0 comments on commit 1516bcb

Please sign in to comment.