Skip to content

Commit

Permalink
Merge pull request #626 from robscott/yaml-delimiter-cleanup
Browse files Browse the repository at this point in the history
馃悰 Updating WriteYAML to not add empty line to start files
  • Loading branch information
k8s-ci-robot committed Sep 30, 2021
2 parents 699d149 + a5f3860 commit 384bf3e
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 14 deletions.
1 change: 0 additions & 1 deletion pkg/crd/testdata/gen/bar.example.com_foos.v1beta1.yaml
@@ -1,4 +1,3 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
Expand Down
1 change: 0 additions & 1 deletion pkg/crd/testdata/gen/bar.example.com_foos.yaml
@@ -1,4 +1,3 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
2 changes: 1 addition & 1 deletion pkg/genall/genall.go
Expand Up @@ -135,7 +135,7 @@ func (g GenerationContext) WriteYAML(itemPath string, objs ...interface{}) error
if err != nil {
return err
}
n, err := out.Write(append([]byte("\n---\n"), yamlContent...))
n, err := out.Write(append([]byte("---\n"), yamlContent...))
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/webhook/parser_integration_test.go
Expand Up @@ -178,7 +178,7 @@ var _ = Describe("Webhook Generation From Parsing to CustomResourceDefinition",
})

func unmarshalBothV1(in []byte) (mutating admissionregv1.MutatingWebhookConfiguration, validating admissionregv1.ValidatingWebhookConfiguration) {
documents := bytes.Split(in, []byte("\n---\n"))[1:]
documents := bytes.Split(in, []byte("\n---\n"))
ExpectWithOffset(1, documents).To(HaveLen(2), "expected two documents in file, found %d", len(documents))

ExpectWithOffset(1, yaml.UnmarshalStrict(documents[0], &mutating)).To(Succeed(), "expected the first document in the file to be a mutating webhook configuration")
Expand Down
@@ -1,4 +1,3 @@

---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
Expand Down Expand Up @@ -28,7 +27,6 @@ webhooks:
resources:
- cronjobs
sideEffects: None

---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
Expand Down
2 changes: 0 additions & 2 deletions pkg/webhook/testdata/invalid-sideEffects/manifests.yaml
@@ -1,4 +1,3 @@

---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
Expand Down Expand Up @@ -28,7 +27,6 @@ webhooks:
resources:
- cronjobs
sideEffects: None

---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
Expand Down
@@ -1,4 +1,3 @@

---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
Expand Down Expand Up @@ -28,7 +27,6 @@ webhooks:
resources:
- cronjobs
sideEffects: None

---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
Expand Down
2 changes: 0 additions & 2 deletions pkg/webhook/testdata/manifests.yaml
@@ -1,4 +1,3 @@

---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
Expand Down Expand Up @@ -28,7 +27,6 @@ webhooks:
resources:
- cronjobs
sideEffects: None

---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
Expand Down
2 changes: 0 additions & 2 deletions pkg/webhook/testdata/valid/manifests.yaml
@@ -1,4 +1,3 @@

---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
Expand Down Expand Up @@ -28,7 +27,6 @@ webhooks:
resources:
- cronjobs
sideEffects: None

---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
Expand Down

0 comments on commit 384bf3e

Please sign in to comment.