Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
fix crd generation
Browse files Browse the repository at this point in the history
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
  • Loading branch information
shubham-cmyk committed Oct 8, 2023
1 parent b40a0f6 commit b257788
Show file tree
Hide file tree
Showing 6 changed files with 628 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ ifneq ($(shell go list -f '{{.Version}}' -m sigs.k8s.io/controller-tools), $(she
go install sigs.k8s.io/controller-tools/cmd/controller-gen@$$(go list -f '{{.Version}}' -m sigs.k8s.io/controller-tools)
go mod tidy
endif
controller-gen crd paths=./pkg/apis/... output:crd:dir=config/crds output:stdout
controller-gen crd paths=./pkg/apis/... output:crd:dir=config/crd/bases output:stdout
./hack/update_codegen.sh


Expand Down
119 changes: 119 additions & 0 deletions config/crd/bases/kuttl.dev_testasserts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: testasserts.kuttl.dev
spec:
group: kuttl.dev
names:
kind: TestAssert
listKind: TestAssertList
plural: testasserts
singular: testassert
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: TestAssert represents the settings needed to verify the result
of a test step.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
collectors:
description: Collectors is a set of pod log collectors fired on an assert
failure
items:
description: TestCollector are post assert / error commands that allow
for the collection of information sent to the test log. Type can be
pod, command or event. For backward compatibility, pod is default
and doesn't need to be specified For pod, At least one of `pod` or
`selector` is required. For command, Command must be specified and
Type can be == "command" but no other fields are valid For event,
Type must be == "events" and Namespace and Name can be specified,
if no ns or name, the default events are provided. If no name, than
all events for that ns are provided.
properties:
command:
description: Cmd is a command to run for collection. It requires
an empty Type or Type=command
type: string
container:
description: Container in pod to get logs from else --all-containers
is used.
type: string
namespace:
description: namespace to use. The current test namespace will be
used by default.
type: string
pod:
description: The pod name to access logs.
type: string
selector:
description: Selector is a label query to select pod.
type: string
tail:
description: Tail is the number of last lines to collect from pods.
If omitted or zero, then the default is 10 if you use a selector,
or -1 (all) if you use a pod name. This matches default behavior
of `kubectl logs`.
type: integer
type:
description: Type is a collector type which is pod, command or events
command is default type if command field is not empty misconfiguration
will lead to warning message in the logs
type: string
type: object
type: array
commands:
description: Commands is a set of commands to be run as assertions for
the current step
items:
description: TestAssertCommand an assertion based on the result of the
execution of a command
properties:
command:
description: The command and argument to run as a string.
type: string
namespaced:
description: If set, the `--namespace` flag will be appended to
the command with the namespace to use.
type: boolean
script:
description: Ability to run a shell script from TestStep (without
a script file) namespaced and command should not be used with
script. namespaced is ignored and command is an error. env expansion
is depended upon the shell but ENV is passed to the runtime env.
type: string
skipLogOutput:
description: If set, the output from the command is NOT logged. Useful
for sensitive logs or to reduce noise.
type: boolean
required:
- command
- namespaced
- script
- skipLogOutput
type: object
type: array
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
timeout:
description: Override the default timeout of 30 seconds (in seconds).
type: integer
required:
- timeout
type: object
served: true
storage: true
257 changes: 257 additions & 0 deletions config/crd/bases/kuttl.dev_teststeps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: teststeps.kuttl.dev
spec:
group: kuttl.dev
names:
kind: TestStep
listKind: TestStepList
plural: teststeps
singular: teststep
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: TestStep settings to apply to a test step.go
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
apply:
description: Apply, Assert and Error lists of files or directories to
use in the test step. Useful to reuse a number of applies across tests
/ test steps. all relative paths are relative to the folder the TestStep
is defined in.
items:
description: Apply holds infos for an apply statement
properties:
file:
type: string
shouldFail:
type: boolean
type: object
type: array
assert:
items:
properties:
file:
description: File specifies the relative or full path to the YAML
containing the expected content.
type: string
options:
properties:
arrays:
items:
description: AssertArray specifies conditions for verifying
content within a YAML against a Kubernetes resource.
properties:
match:
description: PartialObjectMetadata is a generic representation
of any object with ObjectMeta. It allows clients to
get access to a particular ObjectMeta schema without
knowing the details of the version.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema
of this representation of an object. Servers should
convert recognized schemas to the latest internal
value, and may reject unrecognized values. More
info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing
the REST resource this object represents. Servers
may infer this from the endpoint the client submits
requests to. Cannot be updated. In CamelCase. More
info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
description: 'Standard object''s metadata. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
type: object
type: object
path:
description: Path indicates the location within the YAML
file to extract data for verification.
type: string
strategy:
description: Strategy defines how the extracted data should
be compared against the Kubernetes resource.
type: string
required:
- path
- strategy
type: object
type: array
type: object
required:
- file
type: object
type: array
commands:
description: Commands to run prior at the beginning of the test step.
items:
description: Command describes a command to run as a part of a test
step or suite.
properties:
background:
description: If set, the command is run in the background.
type: boolean
command:
description: The command and argument to run as a string.
type: string
ignoreFailure:
description: If set, exit failures (`exec.ExitError`) will be ignored.
`exec.Error` are NOT ignored.
type: boolean
namespaced:
description: If set, the `--namespace` flag will be appended to
the command with the namespace to use.
type: boolean
output:
description: Output defines the expected output criteria for the
command. It can check if the command's output equals or contains
specific strings.
properties:
stderr:
description: Stderr contains the expected output criteria for
the standard error.
properties:
expected:
description: Value is the expected value or pattern that
should be matched against the command's output.
type: string
match:
description: MatchType is the type of match that should
be applied for validation. This could be "Equals", "Contains",
or "Wildcard".
type: string
required:
- expected
- match
type: object
stdout:
description: Stdout contains the expected output criteria for
the standard output.
properties:
expected:
description: Value is the expected value or pattern that
should be matched against the command's output.
type: string
match:
description: MatchType is the type of match that should
be applied for validation. This could be "Equals", "Contains",
or "Wildcard".
type: string
required:
- expected
- match
type: object
type: object
script:
description: Ability to run a shell script from TestStep (without
a script file) namespaced and command should not be used with
script. namespaced is ignored and command is an error. env expansion
is depended upon the shell but ENV is passed to the runtime env.
type: string
skipLogOutput:
description: If set, the output from the command is NOT logged. Useful
for sensitive logs or to reduce noise.
type: boolean
timeout:
description: Override the TestSuite timeout for this command (in
seconds).
type: integer
required:
- background
- command
- ignoreFailure
- namespaced
- script
- skipLogOutput
- timeout
type: object
type: array
delete:
description: Objects to delete at the beginning of the test step.
items:
description: ObjectReference is a Kubernetes object reference with added
labels to allow referencing objects by label.
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of an
entire object, this string should contain a valid JSON/Go field
access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen only
to have some well-defined way of referencing a part of an object.
TODO: this design is not final and this field is subject to change
in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
labels:
additionalProperties:
type: string
description: Labels to match on.
type: object
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference is
made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
required:
- labels
type: object
x-kubernetes-map-type: atomic
type: array
error:
items:
type: string
type: array
index:
format: int64
type: integer
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
kubeconfig:
description: Kubeconfig to use when applying and asserting for this step.
type: string
metadata:
type: object
unitTest:
description: Indicates that this is a unit test - safe to run without
a real Kubernetes cluster.
type: boolean
required:
- commands
- unitTest
type: object
served: true
storage: true
Loading

0 comments on commit b257788

Please sign in to comment.