Skip to content

Commit

Permalink
add action to lint yaml
Browse files Browse the repository at this point in the history
and fix existing yamllint failures

Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
  • Loading branch information
everettraven authored and Sajiyah-Salat committed Jun 11, 2023
1 parent 7af971b commit b454503
Show file tree
Hide file tree
Showing 25 changed files with 46 additions and 41 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,13 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
labels: kind/bug
body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: yaml-lint
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: testdata
config_data: "{extends: relaxed, rules: {line-length: {max: 120}}}"
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (f *KustomizeConfig) SetTemplateDefaults() error {
}

//nolint:lll
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref and var substitution
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref and var substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (f *KustomizeConfig) SetTemplateDefaults() error {
}

//nolint:lll
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref substitution
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,5 +327,5 @@ const recorderTemplate = `
Recorder: mgr.GetEventRecorderFor("%s-controller"),`

const envVarTemplate = `
- name: %s_IMAGE
- name: %s_IMAGE
value: %s`
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ kind: {{ .Resource.Kind }}
metadata:
name: {{ lower .Resource.Kind }}-sample
spec:
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
size: 1
{{ if not (isEmptyStr .Port) -}}
{{ if not (isEmptyStr .Port) -}}
# TODO(user): edit the following value to ensure the container has the right port to be initialized
containerPort: {{ .Port }}
{{- end }}
containerPort: {{ .Port }}
{{- end }}
`
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (f *Certificate) SetTemplateDefaults() error {

const certManagerTemplate = `# The following manifests contain a self-signed issuer CR and a certificate CR.
# More document can be found at https://docs.cert-manager.io
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for
# breaking changes
apiVersion: cert-manager.io/v1alpha2
kind: Issuer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (f *KustomizeConfig) SetTemplateDefaults() error {
}

//nolint:lll
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref and var substitution
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref and var substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (f *ManagerAuthProxyPatch) SetTemplateDefaults() error {
return nil
}

const kustomizeAuthProxyPatchTemplate = `# This patch inject a sidecar container which is a HTTP proxy for the
const kustomizeAuthProxyPatchTemplate = `# This patch inject a sidecar container which is a HTTP proxy for the
# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
apiVersion: apps/v1
kind: Deployment
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v2/config/certmanager/certificate.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The following manifests contain a self-signed issuer CR and a certificate CR.
# More document can be found at https://docs.cert-manager.io
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for
# breaking changes
apiVersion: cert-manager.io/v1alpha2
kind: Issuer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref and var substitution
# This configuration is for teaching kustomize how to update name ref and var substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This patch inject a sidecar container which is a HTTP proxy for the
# This patch inject a sidecar container which is a HTTP proxy for the
# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
apiVersion: apps/v1
kind: Deployment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref and var substitution
# This configuration is for teaching kustomize how to update name ref and var substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref and var substitution
# This configuration is for teaching kustomize how to update name ref and var substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref and var substitution
# This configuration is for teaching kustomize how to update name ref and var substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ spec:
image: controller:latest
name: manager
env:
- name: BUSYBOX_IMAGE
- name: BUSYBOX_IMAGE
value: busybox:1.28
- name: MEMCACHED_IMAGE
- name: MEMCACHED_IMAGE
value: memcached:1.4.36-alpine
securityContext:
allowPrivilegeEscalation: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ kind: Busybox
metadata:
name: busybox-sample
spec:
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
size: 1


Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ kind: Memcached
metadata:
name: memcached-sample
spec:
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
size: 1

# TODO(user): edit the following value to ensure the container has the right port to be initialized
# TODO(user): edit the following value to ensure the container has the right port to be initialized
containerPort: 11211
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref and var substitution
# This configuration is for teaching kustomize how to update name ref and var substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref substitution
# This configuration is for teaching kustomize how to update name ref substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref substitution
# This configuration is for teaching kustomize how to update name ref substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref substitution
# This configuration is for teaching kustomize how to update name ref substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ spec:
image: controller:latest
name: manager
env:
- name: BUSYBOX_IMAGE
- name: BUSYBOX_IMAGE
value: busybox:1.28
- name: MEMCACHED_IMAGE
- name: MEMCACHED_IMAGE
value: memcached:1.4.36-alpine
securityContext:
allowPrivilegeEscalation: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ kind: Busybox
metadata:
name: busybox-sample
spec:
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
size: 1


Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ kind: Memcached
metadata:
name: memcached-sample
spec:
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
size: 1

# TODO(user): edit the following value to ensure the container has the right port to be initialized
# TODO(user): edit the following value to ensure the container has the right port to be initialized
containerPort: 11211
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref substitution
# This configuration is for teaching kustomize how to update name ref substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down

0 comments on commit b454503

Please sign in to comment.