forked from yannh/kubeconform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
453 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: some-values | ||
annotations: | ||
cert(manager.io/cluster-issuer": issue #275 | ||
data: | ||
file.name: "a value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: some-values | ||
annotations: | ||
some.domain/some-key: | ||
data: | ||
file.name: "a value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: some-values | ||
annotations: | ||
some.domain/some-key: null | ||
data: | ||
file.name: "a value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: some-values | ||
labels: | ||
abcdefghijklmnopqrstuvwxyz-01234567890-ABCDEFGHIJKLMNOPQRSTUVWXYZ: "123456789_123456789_123456789_123456789_123456789_123456789_123" | ||
data: | ||
file.name: "a value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: some-values | ||
labels: | ||
abcdefghijklmnopqrstuvwxyz-01234567890-ABCDEFGHIJKLMNOPQRSTUVWXYZ.example.com/ABCDEFGHIJKLMNOPQRSTUVWXYZ: "123456789_123456789_123456789_123456789_123456789_123456789_123" | ||
data: | ||
file.name: "a value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: some-values | ||
labels: | ||
some.domain/some-key: "123456789_123456789_123456789_123456789_123456789_123456789_1234" | ||
data: | ||
file.name: "a value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: some-values | ||
namespace: my-namespace | ||
annotation: | ||
flub: annotation should be annotations | ||
data: | ||
file.name: "a value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
data: | ||
file.name: "a value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
|
||
data: | ||
file.name: "a value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: abcdefghijklmnopqrstuvwxyz-01234567890-ABCDEFGHIJKLMNOPQRSTUVWXYZ | ||
data: | ||
file.name: "a value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package registry | ||
|
||
import ( | ||
"embed" | ||
) | ||
|
||
//go:embed *.json | ||
var content embed.FS | ||
|
||
type EmbeddedRegistry struct { | ||
debug bool | ||
strict bool | ||
} | ||
|
||
// NewEmbeddedRegistry creates a new "registry", that will serve schemas from embedded resource | ||
func NewEmbeddedRegistry(debug bool, strict bool) *EmbeddedRegistry { | ||
return &EmbeddedRegistry{ | ||
debug, strict, | ||
} | ||
} | ||
|
||
// DownloadSchema retrieves the schema from a file for the resource | ||
func (r EmbeddedRegistry) DownloadSchema(resourceKind, resourceAPIVersion, k8sVersion string) (string, []byte, error) { | ||
var fileName string | ||
if r.strict { | ||
fileName = resourceKind + "-strict.json" | ||
} else { | ||
fileName = resourceKind + ".json" | ||
} | ||
bytes, err := content.ReadFile(fileName) | ||
if err != nil { | ||
return resourceKind, nil, nil | ||
} | ||
return "embedded:" + resourceKind, bytes, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "object", | ||
"properties": { | ||
"apiVersion": { | ||
"$ref": "#/$defs/PREFIXED" | ||
}, | ||
"kind": { | ||
"$ref": "#/$defs/NAME" | ||
}, | ||
"metadata": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"annotations": { | ||
"type": "object", | ||
"propertyNames": { | ||
"$ref": "#/$defs/PREFIXED" | ||
}, | ||
"patternProperties": { | ||
"^.+$": { | ||
"type": "string", | ||
"minLength": 1 | ||
} | ||
} | ||
}, | ||
"finalizers": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"generateName": { | ||
"$ref": "#/$defs/RFC-1123-prefix" | ||
}, | ||
"labels": { | ||
"type": "object", | ||
"propertyNames": { | ||
"$ref": "#/$defs/PREFIXED" | ||
}, | ||
"patternProperties": { | ||
"^.+$": { | ||
"$ref": "#/$defs/NAME" | ||
} | ||
} | ||
}, | ||
"managedFields": { | ||
"type": "array", | ||
"items": { | ||
"type": "object" | ||
} | ||
}, | ||
"name": { | ||
"$ref": "#/$defs/RFC-1123" | ||
}, | ||
"namespace": { | ||
"$ref": "#/$defs/RFC-1123" | ||
} | ||
}, | ||
"oneOf": [ | ||
{ | ||
"required": [ | ||
"name" | ||
] | ||
}, | ||
{ | ||
"required": [ | ||
"generateName" | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"required": [ | ||
"apiVersion", | ||
"kind", | ||
"metadata" | ||
], | ||
"$defs": { | ||
"PREFIXED": { | ||
"allOf": [ | ||
{ | ||
"pattern": "^(.{0,253}/)?.{1,63}$", | ||
"type": "string" | ||
}, | ||
{ | ||
"pattern": "^([a-z0-9-]{1,63}(\\.[a-z0-9-]{1,63})*/)?[a-z0-9A-Z]+([_.-][a-z0-9A-Z]+)*$" | ||
} | ||
] | ||
}, | ||
"NAME": { | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 63, | ||
"pattern": "^[a-z0-9A-Z]+([_.-][a-z0-9A-Z]+)*$" | ||
}, | ||
"RFC-1123": { | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 63, | ||
"pattern": "^[a-z0-9]+(-+[a-z0-9]+)*$" | ||
}, | ||
"RFC-1123-prefix": { | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 58, | ||
"pattern": "^[a-z0-9]+[a-z0-9-]*$" | ||
} | ||
} | ||
} |
Oops, something went wrong.