Skip to content

Commit

Permalink
Feat/yamllint github action (grafana#51)
Browse files Browse the repository at this point in the history
* feat: add yamllint on push

Signed-off-by: Hans Knecht <[email protected]>

* chore: yaml lint passing

Signed-off-by: Hans Knecht <[email protected]>
  • Loading branch information
knechtionscoding authored Jul 22, 2021
1 parent 78fcea9 commit 04a92f7
Show file tree
Hide file tree
Showing 45 changed files with 298 additions and 235 deletions.
1 change: 1 addition & 0 deletions .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: "Create cluster using KinD"
on:
workflow_dispatch: {}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: "push"

on:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: "Unit Test"
on:
- push
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Yaml Lint
on: [push]
jobs:
lintAllTheThings:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: yaml-lint
uses: ibiqlik/action-yamllint@v3
13 changes: 13 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
extends: default
ignore: |
/config/crd/bases/*
rules:
line-length: disable
comments:
min-spaces-from-content: 1
trailing-spaces:
level: warning
truthy:
ignore: |
/.github/workflows
9 changes: 5 additions & 4 deletions config/certmanager/certificate.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
# 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 All @@ -13,13 +14,13 @@ spec:
apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml
name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml
namespace: system
spec:
# $(SERVICE_NAME) and $(SERVICE_NAMESPACE) will be substituted by kustomize
dnsNames:
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc.cluster.local
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc.cluster.local
issuerRef:
kind: Issuer
name: selfsigned-issuer
Expand Down
5 changes: 3 additions & 2 deletions config/certmanager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
resources:
- certificate.yaml
- certificate.yaml

configurations:
- kustomizeconfig.yaml
- kustomizeconfig.yaml
25 changes: 13 additions & 12 deletions config/certmanager/kustomizeconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# 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
fieldSpecs:
- kind: Certificate
- kind: Issuer
group: cert-manager.io
path: spec/issuerRef/name
fieldSpecs:
- kind: Certificate
group: cert-manager.io
path: spec/issuerRef/name

varReference:
- kind: Certificate
group: cert-manager.io
path: spec/commonName
- kind: Certificate
group: cert-manager.io
path: spec/dnsNames
- kind: Certificate
group: cert-manager.io
path: spec/commonName
- kind: Certificate
group: cert-manager.io
path: spec/dnsNames
13 changes: 7 additions & 6 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
---
# This kustomization.yaml is not intended to be run by itself,
# since it depends on service name and namespace that are out of this kustomize package.
# It should be run by config/default
resources:
- bases/k6.io_k6s.yaml
- bases/k6.io_k6s.yaml
# +kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_k6s.yaml
#- patches/webhook_in_k6tests.yaml
# - patches/webhook_in_k6s.yaml
# - patches/webhook_in_k6tests.yaml
# +kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- patches/cainjection_in_k6s.yaml
#- patches/cainjection_in_k6tests.yaml
# - patches/cainjection_in_k6s.yaml
# - patches/cainjection_in_k6tests.yaml
# +kubebuilder:scaffold:crdkustomizecainjectionpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
configurations:
- kustomizeconfig.yaml
- kustomizeconfig.yaml
23 changes: 12 additions & 11 deletions config/crd/kustomizeconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# This file is for teaching kustomize how to substitute name and namespace reference in CRD
---
nameReference:
- kind: Service
version: v1
fieldSpecs:
- kind: CustomResourceDefinition
group: apiextensions.k8s.io
path: spec/conversion/webhookClientConfig/service/name
- kind: Service
version: v1
fieldSpecs:
- kind: CustomResourceDefinition
group: apiextensions.k8s.io
path: spec/conversion/webhookClientConfig/service/name

namespace:
- kind: CustomResourceDefinition
group: apiextensions.k8s.io
path: spec/conversion/webhookClientConfig/service/namespace
create: false
- kind: CustomResourceDefinition
group: apiextensions.k8s.io
path: spec/conversion/webhookClientConfig/service/namespace
create: false

varReference:
- path: metadata/annotations
- path: metadata/annotations
1 change: 1 addition & 0 deletions config/crd/patches/cainjection_in_k6s.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# The following patch adds a directive for certmanager to inject CA into the CRD
# CRD conversion requires k8s 1.13 or later.
apiVersion: apiextensions.k8s.io/v1beta1
Expand Down
1 change: 1 addition & 0 deletions config/crd/patches/webhook_in_k6s.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# The following patch enables conversion webhook for CRD
# CRD conversion requires k8s 1.13 or later.
apiVersion: apiextensions.k8s.io/v1beta1
Expand Down
41 changes: 21 additions & 20 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,63 +1,64 @@
---
namespace: k6-operator-system
namePrefix: k6-operator-

# Labels to add to all resources and selectors.
#commonLabels:
# commonLabels:
# someName: someValue

bases:
- ../crd
- ../rbac
- ../manager
- ../crd
- ../rbac
- ../manager
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
#- ../webhook
# - ../webhook
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
#- ../certmanager
# - ../certmanager
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
#- ../prometheus
# - ../prometheus

patchesStrategicMerge:
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- manager_auth_proxy_patch.yaml
- manager_auth_proxy_patch.yaml

# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
#- manager_webhook_patch.yaml
# - manager_webhook_patch.yaml

# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
# 'CERTMANAGER' needs to be enabled to use ca injection
#- webhookcainjection_patch.yaml
# - webhookcainjection_patch.yaml

# the following config is for teaching kustomize how to do var substitution
vars:
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
#- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
# objref:
# - name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
# objref:
# kind: Certificate
# group: cert-manager.io
# version: v1alpha2
# name: serving-cert # this name should match the one in certificate.yaml
# fieldref:
# fieldref:
# fieldpath: metadata.namespace
#- name: CERTIFICATE_NAME
# objref:
# - name: CERTIFICATE_NAME
# objref:
# kind: Certificate
# group: cert-manager.io
# version: v1alpha2
# name: serving-cert # this name should match the one in certificate.yaml
#- name: SERVICE_NAMESPACE # namespace of the service
# objref:
# - name: SERVICE_NAMESPACE # namespace of the service
# objref:
# kind: Service
# version: v1
# name: webhook-service
# fieldref:
# fieldref:
# fieldpath: metadata.namespace
#- name: SERVICE_NAME
# objref:
# - name: SERVICE_NAME
# objref:
# kind: Service
# version: v1
# name: webhook-service
31 changes: 16 additions & 15 deletions config/default/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 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 All @@ -9,17 +10,17 @@ spec:
template:
spec:
containers:
- name: kube-rbac-proxy
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
- "--logtostderr=true"
- "--v=10"
ports:
- containerPort: 8443
name: https
- name: manager
args:
- "--metrics-addr=127.0.0.1:8080"
- "--enable-leader-election"
- name: kube-rbac-proxy
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
- "--logtostderr=true"
- "--v=10"
ports:
- containerPort: 8443
name: https
- name: manager
args:
- "--metrics-addr=127.0.0.1:8080"
- "--enable-leader-election"
27 changes: 14 additions & 13 deletions config/default/manager_webhook_patch.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -7,17 +8,17 @@ spec:
template:
spec:
containers:
- name: manager
ports:
- containerPort: 9443
name: webhook-server
protocol: TCP
volumeMounts:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true
- name: manager
ports:
- containerPort: 9443
name: webhook-server
protocol: TCP
volumeMounts:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true
volumes:
- name: cert
secret:
defaultMode: 420
secretName: webhook-server-cert
- name: cert
secret:
defaultMode: 420
secretName: webhook-server-cert
1 change: 1 addition & 0 deletions config/default/webhookcainjection_patch.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# This patch add annotation to admission webhook config and
# the variables $(CERTIFICATE_NAMESPACE) and $(CERTIFICATE_NAME) will be substituted by kustomize.
apiVersion: admissionregistration.k8s.io/v1beta1
Expand Down
9 changes: 5 additions & 4 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
resources:
- manager.yaml
- manager.yaml
images:
- name: controller
newName: ghcr.io/k6io/operator
newTag: latest
- name: controller
newName: ghcr.io/k6io/operator
newTag: latest
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
1 change: 1 addition & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: v1
kind: Namespace
metadata:
Expand Down
Loading

0 comments on commit 04a92f7

Please sign in to comment.