diff --git a/.github/scripts/.helm-tests/default/result.yaml b/.github/scripts/.helm-tests/default/result.yaml index 2087701e63..0209d2e3ec 100644 --- a/.github/scripts/.helm-tests/default/result.yaml +++ b/.github/scripts/.helm-tests/default/result.yaml @@ -394,6 +394,103 @@ spec: storage: true subresources: status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnApp is the Schema for the keptnapps API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnApp. + properties: + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + revision: + default: 1 + description: Revision can be modified to trigger another deployment + of a KeptnApp of the same version. This can be used for restarting + a KeptnApp which failed to deploy, e.g. due to a failed preDeploymentEvaluation/preDeploymentTask. + type: integer + version: + description: Version defines the version of the application. For automatically + created KeptnApps, the version is a function of all KeptnWorkloads + that are part of the KeptnApp. + type: string + workloads: + description: Workloads is a list of all KeptnWorkloads that are part + of the KeptnApp. + items: + description: KeptnWorkloadRef refers to a KeptnWorkload that is + part of a KeptnApp + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: array + required: + - version + type: object + status: + description: Status describes the current state of the KeptnApp. + properties: + currentVersion: + description: CurrentVersion indicates the version that is currently + deployed or being reconciled. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} --- # Source: keptn/charts/lifecycleOperator/templates/keptnappcreationrequest-crd.yaml apiVersion: apiextensions.k8s.io/v1 @@ -457,6 +554,42 @@ spec: storage: true subresources: status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnAppCreationRequest is the Schema for the keptnappcreationrequests + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnAppCreationRequest. + properties: + appName: + description: AppName is the name of the KeptnApp the KeptnAppCreationRequest + should create if no user-defined object with that name is found. + type: string + required: + - appName + type: object + status: + description: Status describes the current state of the KeptnAppCreationRequest. + type: string + type: object + served: true + storage: false + subresources: + status: {} --- # Source: keptn/charts/lifecycleOperator/templates/keptnappversion-crd.yaml apiVersion: apiextensions.k8s.io/v1 @@ -1276,37 +1409,40 @@ spec: storage: true subresources: status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptnconfig-crd.yaml -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: keptnconfigs.options.keptn.sh - annotations: - controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' - labels: - app.kubernetes.io/part-of: keptn - crdGroup: lifecycle.keptn.sh - keptn.sh/inject-cert: "true" - app.kubernetes.io/instance: keptn-test - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: lifecycle-operator - app.kubernetes.io/version: vmyversion - helm.sh/chart: lifecycle-operator-0.1.0 -spec: - group: options.keptn.sh - names: - kind: KeptnConfig - listKind: KeptnConfigList - plural: keptnconfigs - singular: keptnconfig - scope: Namespaced - versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.appName + name: AppName + type: string + - jsonPath: .spec.version + name: Version + type: string + - jsonPath: .status.currentPhase + name: Phase + type: string + - jsonPath: .status.preDeploymentStatus + name: PreDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.preDeploymentEvaluationStatus + name: PreDeploymentEvaluationStatus + priority: 1 + type: string + - jsonPath: .status.workloadOverallStatus + name: WorkloadOverallStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentStatus + name: PostDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentEvaluationStatus + name: PostDeploymentEvaluationStatus + priority: 1 + type: string + name: v1beta1 schema: openAPIV3Schema: - description: KeptnConfig is the Schema for the keptnconfigs API + description: KeptnAppVersion is the Schema for the keptnappversions API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -1321,37 +1457,281 @@ spec: metadata: type: object spec: - description: KeptnConfigSpec defines the desired state of KeptnConfig + description: Spec describes the desired state of the KeptnAppVersion. properties: - OTelCollectorUrl: - description: OTelCollectorUrl can be used to set the Open Telemetry - collector that the lifecycle operator should use + appName: + description: AppName is the name of the KeptnApp. type: string - cloudEventsEndpoint: - description: CloudEventsEndpoint can be used to set the endpoint where - Cloud Events should be posted by the lifecycle operator + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + previousVersion: + description: PreviousVersion is the version of the KeptnApp that has + been deployed prior to this version. type: string - keptnAppCreationRequestTimeoutSeconds: - default: 30 - description: KeptnAppCreationRequestTimeoutSeconds is used to set - the interval in which automatic app discovery searches for workload - to put into the same auto-generated KeptnApp + revision: + default: 1 + description: Revision can be modified to trigger another deployment + of a KeptnApp of the same version. This can be used for restarting + a KeptnApp which failed to deploy, e.g. due to a failed preDeploymentEvaluation/preDeploymentTask. type: integer - type: object - status: - description: unused field - type: string - type: object - served: true - storage: true + traceId: + additionalProperties: + type: string + description: TraceId contains the OpenTelemetry trace ID. + type: object + version: + description: Version defines the version of the application. For automatically + created KeptnApps, the version is a function of all KeptnWorkloads + that are part of the KeptnApp. + type: string + workloads: + description: Workloads is a list of all KeptnWorkloads that are part + of the KeptnApp. + items: + description: KeptnWorkloadRef refers to a KeptnWorkload that is + part of a KeptnApp + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: array + required: + - appName + - version + type: object + status: + description: Status describes the current state of the KeptnAppVersion. + properties: + currentPhase: + description: CurrentPhase indicates the current phase of the KeptnAppVersion. + type: string + endTime: + description: EndTime represents the time at which the deployment of + the KeptnAppVersion finished. + format: date-time + type: string + phaseTraceIDs: + additionalProperties: + additionalProperties: + type: string + description: MapCarrier is a TextMapCarrier that uses a map held + in memory as a storage medium for propagated key-value pairs. + type: object + description: PhaseTraceIDs contains the trace IDs of the OpenTelemetry + spans of each phase of the KeptnAppVersion. + type: object + postDeploymentEvaluationStatus: + default: Pending + description: PostDeploymentEvaluationStatus indicates the current + status of the KeptnAppVersion's PostDeploymentEvaluation phase. + type: string + postDeploymentEvaluationTaskStatus: + description: PostDeploymentEvaluationTaskStatus indicates the current + state of each postDeploymentEvaluation of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + postDeploymentStatus: + default: Pending + description: PostDeploymentStatus indicates the current status of + the KeptnAppVersion's PostDeployment phase. + type: string + postDeploymentTaskStatus: + description: PostDeploymentTaskStatus indicates the current state + of each postDeploymentTask of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + preDeploymentEvaluationStatus: + default: Pending + description: PreDeploymentEvaluationStatus indicates the current status + of the KeptnAppVersion's PreDeploymentEvaluation phase. + type: string + preDeploymentEvaluationTaskStatus: + description: PreDeploymentEvaluationTaskStatus indicates the current + state of each preDeploymentEvaluation of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + preDeploymentStatus: + default: Pending + description: PreDeploymentStatus indicates the current status of the + KeptnAppVersion's PreDeployment phase. + type: string + preDeploymentTaskStatus: + description: PreDeploymentTaskStatus indicates the current state of + each preDeploymentTask of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + startTime: + description: StartTime represents the time at which the deployment + of the KeptnAppVersion started. + format: date-time + type: string + status: + default: Pending + description: Status represents the overall status of the KeptnAppVersion. + type: string + workloadOverallStatus: + default: Pending + description: WorkloadOverallStatus indicates the current status of + the KeptnAppVersion's Workload deployment phase. + type: string + workloadStatus: + description: WorkloadStatus contains the current status of each KeptnWorkload + that is part of the KeptnAppVersion. + items: + properties: + status: + default: Pending + description: Status indicates the current status of the KeptnWorkload. + type: string + workload: + description: Workload refers to a KeptnWorkload that is part + of the KeptnAppVersion. + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: object + type: array + type: object + type: object + served: true + storage: false subresources: status: {} --- -# Source: keptn/charts/lifecycleOperator/templates/keptnevaluation-crd.yaml +# Source: keptn/charts/lifecycleOperator/templates/keptnconfig-crd.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: keptnevaluations.lifecycle.keptn.sh + name: keptnconfigs.options.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' @@ -1365,36 +1745,106 @@ metadata: app.kubernetes.io/version: vmyversion helm.sh/chart: lifecycle-operator-0.1.0 spec: - group: lifecycle.keptn.sh + group: options.keptn.sh names: - kind: KeptnEvaluation - listKind: KeptnEvaluationList - plural: keptnevaluations - shortNames: - - ke - singular: keptnevaluation + kind: KeptnConfig + listKind: KeptnConfigList + plural: keptnconfigs + singular: keptnconfig scope: Namespaced versions: - - additionalPrinterColumns: - - jsonPath: .spec.appName - name: AppName - type: string - - jsonPath: .spec.appVersion - name: AppVersion - type: string - - jsonPath: .spec.workload - name: WorkloadName - type: string - - jsonPath: .spec.workloadVersion - name: WorkloadVersion - type: string - - jsonPath: .status.retryCount - name: RetryCount - type: string - - jsonPath: .status.evaluationStatus - name: EvaluationStatus - type: string - - jsonPath: .status.overallStatus + - name: v1alpha1 + schema: + openAPIV3Schema: + description: KeptnConfig is the Schema for the keptnconfigs API + 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: + type: object + spec: + description: KeptnConfigSpec defines the desired state of KeptnConfig + properties: + OTelCollectorUrl: + description: OTelCollectorUrl can be used to set the Open Telemetry + collector that the lifecycle operator should use + type: string + cloudEventsEndpoint: + description: CloudEventsEndpoint can be used to set the endpoint where + Cloud Events should be posted by the lifecycle operator + type: string + keptnAppCreationRequestTimeoutSeconds: + default: 30 + description: KeptnAppCreationRequestTimeoutSeconds is used to set + the interval in which automatic app discovery searches for workload + to put into the same auto-generated KeptnApp + type: integer + type: object + status: + description: unused field + type: string + type: object + served: true + storage: true + subresources: + status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptnevaluation-crd.yaml +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptnevaluations.lifecycle.keptn.sh + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' + labels: + app.kubernetes.io/part-of: keptn + crdGroup: lifecycle.keptn.sh + keptn.sh/inject-cert: "true" + app.kubernetes.io/instance: keptn-test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: lifecycle-operator + app.kubernetes.io/version: vmyversion + helm.sh/chart: lifecycle-operator-0.1.0 +spec: + group: lifecycle.keptn.sh + names: + kind: KeptnEvaluation + listKind: KeptnEvaluationList + plural: keptnevaluations + shortNames: + - ke + singular: keptnevaluation + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.appName + name: AppName + type: string + - jsonPath: .spec.appVersion + name: AppVersion + type: string + - jsonPath: .spec.workload + name: WorkloadName + type: string + - jsonPath: .spec.workloadVersion + name: WorkloadVersion + type: string + - jsonPath: .status.retryCount + name: RetryCount + type: string + - jsonPath: .status.evaluationStatus + name: EvaluationStatus + type: string + - jsonPath: .status.overallStatus name: OverallStatus type: string name: v1alpha1 @@ -1731,6 +2181,150 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.appName + name: AppName + type: string + - jsonPath: .spec.appVersion + name: AppVersion + type: string + - jsonPath: .spec.workload + name: WorkloadName + type: string + - jsonPath: .spec.workloadVersion + name: WorkloadVersion + type: string + - jsonPath: .status.retryCount + name: RetryCount + type: string + - jsonPath: .status.evaluationStatus + name: EvaluationStatus + type: string + - jsonPath: .status.overallStatus + name: OverallStatus + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnEvaluation is the Schema for the keptnevaluations API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnEvaluation. + properties: + appName: + description: AppName defines the KeptnApp for which the KeptnEvaluation + is done. + type: string + appVersion: + description: AppVersion defines the version of the KeptnApp for which + the KeptnEvaluation is done. + type: string + checkType: + description: Type indicates whether the KeptnEvaluation is part of + the pre- or postDeployment phase. + type: string + evaluationDefinition: + description: EvaluationDefinition refers to the name of the KeptnEvaluationDefinition + which includes the objectives for the KeptnEvaluation. The KeptnEvaluationDefinition + can be located in the same namespace as the KeptnEvaluation, or + in the Keptn namespace. + type: string + failAction: + type: string + retries: + default: 10 + description: Retries indicates how many times the KeptnEvaluation + can be attempted in the case of an error or missed evaluation objective, + before considering the KeptnEvaluation to be failed. + type: integer + retryInterval: + default: 5s + description: RetryInterval specifies the interval at which the KeptnEvaluation + is retried in the case of an error or a missed objective. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + workload: + description: Workload defines the KeptnWorkload for which the KeptnEvaluation + is done. + type: string + workloadVersion: + description: WorkloadVersion defines the version of the KeptnWorkload + for which the KeptnEvaluation is done. + type: string + required: + - evaluationDefinition + - workloadVersion + type: object + status: + description: Status describes the current state of the KeptnEvaluation. + properties: + endTime: + description: EndTime represents the time at which the KeptnEvaluation + finished. + format: date-time + type: string + evaluationStatus: + additionalProperties: + properties: + message: + description: Message contains additional information about the + evaluation of an objective. This can include explanations + about why an evaluation has failed (e.g. due to a missed objective), + or if there was any error during the evaluation of the objective. + type: string + status: + description: Status indicates the status of the objective being + evaluated. + type: string + value: + description: Value represents the value of the KeptnMetric being + evaluated. + type: string + required: + - status + - value + type: object + description: EvaluationStatus describes the status of each objective + of the KeptnEvaluationDefinition referenced by the KeptnEvaluation. + type: object + overallStatus: + default: Pending + description: OverallStatus describes the overall status of the KeptnEvaluation. + The Overall status is derived from the status of the individual + objectives of the KeptnEvaluationDefinition referenced by the KeptnEvaluation. + type: string + retryCount: + default: 0 + description: RetryCount indicates how many times the KeptnEvaluation + has been attempted already. + type: integer + startTime: + description: StartTime represents the time at which the KeptnEvaluation + started. + format: date-time + type: string + required: + - evaluationStatus + - overallStatus + - retryCount + type: object + type: object + served: true + storage: false + subresources: + status: {} --- # Source: keptn/charts/lifecycleOperator/templates/keptnevaluationdefinition-crd.yaml apiVersion: apiextensions.k8s.io/v1 @@ -1924,26 +2518,88 @@ spec: storage: true subresources: status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptnevaluationprovider-crd.yaml -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: keptnevaluationproviders.lifecycle.keptn.sh - annotations: - controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' - labels: - app.kubernetes.io/part-of: keptn - crdGroup: lifecycle.keptn.sh - keptn.sh/inject-cert: "true" - app.kubernetes.io/instance: keptn-test - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: lifecycle-operator - app.kubernetes.io/version: vmyversion - helm.sh/chart: lifecycle-operator-0.1.0 -spec: - conversion: + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnEvaluationDefinition is the Schema for the keptnevaluationdefinitions + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnEvaluationDefinition. + properties: + objectives: + description: Objectives is a list of objectives that have to be met + for a KeptnEvaluation referencing this KeptnEvaluationDefinition + to be successful. + items: + properties: + evaluationTarget: + description: EvaluationTarget specifies the target value for + the references KeptnMetric. Needs to start with either '<' + or '>', followed by the target value (e.g. '<10'). + type: string + keptnMetricRef: + description: KeptnMetricRef references the KeptnMetric that + should be evaluated. + properties: + name: + description: Name is the name of the referenced KeptnMetric. + type: string + namespace: + description: Namespace is the namespace where the referenced + KeptnMetric is located. + type: string + required: + - name + type: object + required: + - evaluationTarget + - keptnMetricRef + type: object + type: array + required: + - objectives + type: object + status: + description: unused field + type: string + type: object + served: true + storage: false + subresources: + status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptnevaluationprovider-crd.yaml +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptnevaluationproviders.lifecycle.keptn.sh + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' + labels: + app.kubernetes.io/part-of: keptn + crdGroup: lifecycle.keptn.sh + keptn.sh/inject-cert: "true" + app.kubernetes.io/instance: keptn-test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: lifecycle-operator + app.kubernetes.io/version: vmyversion + helm.sh/chart: lifecycle-operator-0.1.0 +spec: + conversion: strategy: Webhook webhook: clientConfig: @@ -2435,271 +3091,2005 @@ spec: the KeptnTask is being executed for. type: string type: object - parameters: - description: Parameters contains parameters that will be passed to - the job that executes the task. - properties: - map: - additionalProperties: - type: string - description: Inline contains the parameters that will be made - available to the job executing the KeptnTask via the 'DATA' - environment variable. The 'DATA' environment variable's content - will be a json encoded string containing all properties of the - map provided. - type: object - type: object - retries: - default: 10 - description: Retries indicates how many times the KeptnTask can be - attempted in the case of an error before considering the KeptnTask - to be failed. - format: int32 - type: integer - secureParameters: - description: SecureParameters contains secure parameters that will - be passed to the job that executes the task. These will be stored - and accessed as secrets in the cluster. + parameters: + description: Parameters contains parameters that will be passed to + the job that executes the task. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's content + will be a json encoded string containing all properties of the + map provided. + type: object + type: object + retries: + default: 10 + description: Retries indicates how many times the KeptnTask can be + attempted in the case of an error before considering the KeptnTask + to be failed. + format: int32 + type: integer + secureParameters: + description: SecureParameters contains secure parameters that will + be passed to the job that executes the task. These will be stored + and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key of the + referenced secret. + type: string + type: object + taskDefinition: + description: TaskDefinition refers to the name of the KeptnTaskDefinition + which includes the specification for the task to be performed. The + KeptnTaskDefinition can be located in the same namespace as the + KeptnTask, or in the Keptn namespace. + type: string + timeout: + default: 5m + description: Timeout specifies the maximum time to wait for the task + to be completed successfully. If the task does not complete successfully + within this time frame, it will be considered to be failed. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + required: + - taskDefinition + type: object + status: + description: Status describes the current state of the KeptnTask. + properties: + endTime: + description: EndTime represents the time at which the KeptnTask finished. + format: date-time + type: string + jobName: + description: JobName is the name of the Job executing the Task. + type: string + message: + description: Message contains information about unexpected errors + encountered during the execution of the KeptnTask. + type: string + reason: + description: Reason contains more information about the reason for + the last transition of the Job executing the KeptnTask. + type: string + startTime: + description: StartTime represents the time at which the KeptnTask + started. + format: date-time + type: string + status: + default: Pending + description: Status represents the overall state of the KeptnTask. + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.appVersion + name: AppVersion + type: string + - jsonPath: .spec.workload + name: WorkloadName + type: string + - jsonPath: .spec.workloadVersion + name: WorkloadVersion + type: string + - jsonPath: .status.jobName + name: Job Name + type: string + - jsonPath: .status.status + name: Status + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnTask is the Schema for the keptntasks API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnTask. + properties: + checkType: + description: Type indicates whether the KeptnTask is part of the pre- + or postDeployment phase. + type: string + context: + description: Context contains contextual information about the task + execution. + properties: + appName: + description: AppName the name of the KeptnApp the KeptnTask is + being executed for. + type: string + appVersion: + description: AppVersion the version of the KeptnApp the KeptnTask + is being executed for. + type: string + objectType: + description: ObjectType indicates whether the KeptnTask is being + executed for a KeptnApp or KeptnWorkload. + type: string + taskType: + description: TaskType indicates whether the KeptnTask is part + of the pre- or postDeployment phase. + type: string + workloadName: + description: WorkloadName the name of the KeptnWorkload the KeptnTask + is being executed for. + type: string + workloadVersion: + description: WorkloadVersion the version of the KeptnWorkload + the KeptnTask is being executed for. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed to + the job that executes the task. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's content + will be a json encoded string containing all properties of the + map provided. + type: object + type: object + retries: + default: 10 + description: Retries indicates how many times the KeptnTask can be + attempted in the case of an error before considering the KeptnTask + to be failed. + format: int32 + type: integer + secureParameters: + description: SecureParameters contains secure parameters that will + be passed to the job that executes the task. These will be stored + and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key of the + referenced secret. + type: string + type: object + taskDefinition: + description: TaskDefinition refers to the name of the KeptnTaskDefinition + which includes the specification for the task to be performed. The + KeptnTaskDefinition can be located in the same namespace as the + KeptnTask, or in the Keptn namespace. + type: string + timeout: + default: 5m + description: Timeout specifies the maximum time to wait for the task + to be completed successfully. If the task does not complete successfully + within this time frame, it will be considered to be failed. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + required: + - taskDefinition + type: object + status: + description: Status describes the current state of the KeptnTask. + properties: + endTime: + description: EndTime represents the time at which the KeptnTask finished. + format: date-time + type: string + jobName: + description: JobName is the name of the Job executing the Task. + type: string + message: + description: Message contains information about unexpected errors + encountered during the execution of the KeptnTask. + type: string + reason: + description: Reason contains more information about the reason for + the last transition of the Job executing the KeptnTask. + type: string + startTime: + description: StartTime represents the time at which the KeptnTask + started. + format: date-time + type: string + status: + default: Pending + description: Status represents the overall state of the KeptnTask. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptntaskdefinition-crd.yaml +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptntaskdefinitions.lifecycle.keptn.sh + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' + labels: + app.kubernetes.io/part-of: keptn + crdGroup: lifecycle.keptn.sh + keptn.sh/inject-cert: "true" + app.kubernetes.io/instance: keptn-test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: lifecycle-operator + app.kubernetes.io/version: vmyversion + helm.sh/chart: lifecycle-operator-0.1.0 +spec: + group: lifecycle.keptn.sh + names: + kind: KeptnTaskDefinition + listKind: KeptnTaskDefinitionList + plural: keptntaskdefinitions + singular: keptntaskdefinition + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions + API + 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: + type: object + spec: + description: KeptnTaskDefinitionSpec defines the desired state of KeptnTaskDefinition + properties: + function: + properties: + configMapRef: + properties: + name: + type: string + type: object + functionRef: + properties: + name: + type: string + type: object + httpRef: + properties: + url: + type: string + type: object + inline: + properties: + code: + type: string + type: object + parameters: + properties: + map: + additionalProperties: + type: string + type: object + type: object + secureParameters: + properties: + secret: + type: string + type: object + type: object + type: object + status: + description: KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition + properties: + function: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed state + of cluster Important: Run "make" to regenerate code after modifying + this file' + properties: + configMap: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed + state of cluster Important: Run "make" to regenerate code after + modifying this file' + type: string + type: object + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha2 + schema: + openAPIV3Schema: + description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions + API + 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: + type: object + spec: + description: KeptnTaskDefinitionSpec defines the desired state of KeptnTaskDefinition + properties: + function: + properties: + configMapRef: + properties: + name: + type: string + type: object + functionRef: + properties: + name: + type: string + type: object + httpRef: + properties: + url: + type: string + type: object + inline: + properties: + code: + type: string + type: object + parameters: + properties: + map: + additionalProperties: + type: string + type: object + type: object + secureParameters: + properties: + secret: + type: string + type: object + type: object + type: object + status: + description: KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition + properties: + function: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed state + of cluster Important: Run "make" to regenerate code after modifying + this file' + properties: + configMap: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed + state of cluster Important: Run "make" to regenerate code after + modifying this file' + type: string + type: object + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha3 + schema: + openAPIV3Schema: + description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnTaskDefinition. + properties: + automountServiceAccountToken: + description: automountServiceAccountToken allows to enable K8s to + assign cluster API credentials to a pod, if set to false the pod + will decline the serviceAccount + properties: + type: + type: boolean + required: + - type + type: object + container: + description: Container contains the definition for the container that + is to be used in Job based on the KeptnTaskDefinitions. + properties: + args: + description: 'Arguments to the entrypoint. The container image''s + CMD is used if this is not provided. Variable references $(VAR_NAME) + are expanded using the container''s environment. If a variable + cannot be resolved, the reference in the input string will be + unchanged. Double $$ are reduced to a single $, which allows + for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references + will never be expanded, regardless of whether the variable exists + or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + command: + description: 'Entrypoint array. Not executed within a shell. The + container image''s ENTRYPOINT is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container''s + environment. If a variable cannot be resolved, the reference + in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: + i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether + the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + env: + description: List of environment variables to set in the container. + Cannot be updated. + items: + description: EnvVar represents an environment variable present + in a Container. + properties: + name: + description: Name of the environment variable. Must be a + C_IDENTIFIER. + type: string + value: + description: 'Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in + the container and any service environment variables. If + a variable cannot be resolved, the reference in the input + string will be unchanged. Double $$ are reduced to a single + $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless + of whether the variable exists or not. Defaults to "".' + type: string + valueFrom: + description: Source for the environment variable's value. + Cannot be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the ConfigMap or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: 'Selects a field of the pod: supports metadata.name, + metadata.namespace, `metadata.labels['''']`, + `metadata.annotations['''']`, spec.nodeName, + spec.serviceAccountName, status.hostIP, status.podIP, + status.podIPs.' + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the + specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: 'Selects a resource of the container: only + resources limits and requests (limits.cpu, limits.memory, + limits.ephemeral-storage, requests.cpu, requests.memory + and requests.ephemeral-storage) are currently supported.' + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the + exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + description: List of sources to populate environment variables + in the container. The keys defined within a source must be a + C_IDENTIFIER. All invalid keys will be reported as an event + when the container is starting. When a key exists in multiple + sources, the value associated with the last source will take + precedence. Values defined by an Env with a duplicate key will + take precedence. Cannot be updated. + items: + description: EnvFromSource represents the source of a set of + ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend to each key + in the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the Secret must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + description: 'Container image name. More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config management + to default or override container images in workload controllers + like Deployments and StatefulSets.' + type: string + imagePullPolicy: + description: 'Image pull policy. One of Always, Never, IfNotPresent. + Defaults to Always if :latest tag is specified, or IfNotPresent + otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images' + type: string + lifecycle: + description: Actions that the management system should take in + response to container lifecycle events. Cannot be updated. + properties: + postStart: + description: 'PostStart is called immediately after a container + is created. If the handler fails, the container is terminated + and restarted according to its restart policy. Other management + of the container blocks until the hook completes. More info: + https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute + inside the container, the working directory for + the command is root ('/') in the container's filesystem. + The command is simply exec'd, it is not run inside + a shell, so traditional shell instructions ('|', + etc) won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is treated + as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to + the pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: The header field name. This will + be canonicalized upon output, so case-variant + names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported as + a LifecycleHandler and kept for the backward compatibility. + There are no validation of this field and lifecycle + hooks will fail in runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + description: 'PreStop is called immediately before a container + is terminated due to an API request or management event + such as liveness/startup probe failure, preemption, resource + contention, etc. The handler is not called if the container + crashes or exits. The Pod''s termination grace period countdown + begins before the PreStop hook is executed. Regardless of + the outcome of the handler, the container will eventually + terminate within the Pod''s termination grace period (unless + delayed by finalizers). Other management of the container + blocks until the hook completes or until the termination + grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute + inside the container, the working directory for + the command is root ('/') in the container's filesystem. + The command is simply exec'd, it is not run inside + a shell, so traditional shell instructions ('|', + etc) won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is treated + as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to + the pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: The header field name. This will + be canonicalized upon output, so case-variant + names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported as + a LifecycleHandler and kept for the backward compatibility. + There are no validation of this field and lifecycle + hooks will fail in runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + description: 'Periodic probe of container liveness. Container + will be restarted if the probe fails. Cannot be updated. More + info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + name: + description: Name of the container specified as a DNS_LABEL. Each + container in a pod must have a unique name (DNS_LABEL). Cannot + be updated. + type: string + ports: + description: List of ports to expose from the container. Not specifying + a port here DOES NOT prevent that port from being exposed. Any + port which is listening on the default "0.0.0.0" address inside + a container will be accessible from the network. Modifying this + array with strategic merge patch may corrupt the data. For more + information See https://github.com/kubernetes/kubernetes/issues/108255. + Cannot be updated. + items: + description: ContainerPort represents a network port in a single + container. + properties: + containerPort: + description: Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. + format: int32 + type: integer + hostIP: + description: What host IP to bind the external port to. + type: string + hostPort: + description: Number of port to expose on the host. If specified, + this must be a valid port number, 0 < x < 65536. If HostNetwork + is specified, this must match ContainerPort. Most containers + do not need this. + format: int32 + type: integer + name: + description: If specified, this must be an IANA_SVC_NAME + and unique within the pod. Each named port in a pod must + have a unique name. Name for the port that can be referred + to by services. + type: string + protocol: + default: TCP + description: Protocol for port. Must be UDP, TCP, or SCTP. + Defaults to "TCP". + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + description: 'Periodic probe of container service readiness. Container + will be removed from service endpoints if the probe fails. Cannot + be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + resizePolicy: + description: Resources resize policy for the container. + items: + description: ContainerResizePolicy represents resource resize + policy for the container. + properties: + resourceName: + description: 'Name of the resource to which this resource + resize policy applies. Supported values: cpu, memory.' + type: string + restartPolicy: + description: Restart policy to apply when specified resource + is resized. If not specified, it defaults to NotRequired. + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + description: 'Compute Resources required by this container. Cannot + be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only be + set for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in + pod.spec.resourceClaims of the Pod where this field + is used. It makes that resource available inside a + container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. Requests cannot exceed + Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object + restartPolicy: + description: 'RestartPolicy defines the restart behavior of individual + containers in a pod. This field may only be set for init containers, + and the only allowed value is "Always". For non-init containers + or when this field is not specified, the restart behavior is + defined by the Pod''s restart policy and the container type. + Setting the RestartPolicy as "Always" for the init container + will have the following effect: this init container will be + continually restarted on exit until all regular containers have + terminated. Once all regular containers have completed, all + init containers with restartPolicy "Always" will be shut down. + This lifecycle differs from normal init containers and is often + referred to as a "sidecar" container. Although this init container + still starts in the init container sequence, it does not wait + for the container to complete before proceeding to the next + init container. Instead, the next init container starts immediately + after this init container is started, or after any startupProbe + has successfully completed.' + type: string + securityContext: + description: 'SecurityContext defines the security options the + container should be run with. If set, the fields of SecurityContext + override the equivalent fields of PodSecurityContext. More info: + https://kubernetes.io/docs/tasks/configure-pod-container/security-context/' + properties: + allowPrivilegeEscalation: + description: 'AllowPrivilegeEscalation controls whether a + process can gain more privileges than its parent process. + This bool directly controls if the no_new_privs flag will + be set on the container process. AllowPrivilegeEscalation + is true always when the container is: 1) run as Privileged + 2) has CAP_SYS_ADMIN Note that this field cannot be set + when spec.os.name is windows.' + type: boolean + capabilities: + description: The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the + container runtime. Note that this field cannot be set when + spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + type: object + privileged: + description: Run container in privileged mode. Processes in + privileged containers are essentially equivalent to root + on the host. Defaults to false. Note that this field cannot + be set when spec.os.name is windows. + type: boolean + procMount: + description: procMount denotes the type of proc mount to use + for the containers. The default is DefaultProcMount which + uses the container runtime defaults for readonly paths and + masked paths. This requires the ProcMountType feature flag + to be enabled. Note that this field cannot be set when spec.os.name + is windows. + type: string + readOnlyRootFilesystem: + description: Whether this container has a read-only root filesystem. + Default is false. Note that this field cannot be set when + spec.os.name is windows. + type: boolean + runAsGroup: + description: The GID to run the entrypoint of the container + process. Uses runtime default if unset. May also be set + in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. Note that this field cannot be set when + spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: Indicates that the container must run as a non-root + user. If true, the Kubelet will validate the image at runtime + to ensure that it does not run as UID 0 (root) and fail + to start the container if it does. If unset or false, no + such validation will be performed. May also be set in PodSecurityContext. If + set in both SecurityContext and PodSecurityContext, the + value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: The UID to run the entrypoint of the container + process. Defaults to user specified in image metadata if + unspecified. May also be set in PodSecurityContext. If + set in both SecurityContext and PodSecurityContext, the + value specified in SecurityContext takes precedence. Note + that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random + SELinux context for each container. May also be set in + PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. Note that this field cannot be set when + spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies + to the container. + type: string + role: + description: Role is a SELinux role label that applies + to the container. + type: string + type: + description: Type is a SELinux type label that applies + to the container. + type: string + user: + description: User is a SELinux user label that applies + to the container. + type: string + type: object + seccompProfile: + description: The seccomp options to use by this container. + If seccomp options are provided at both the pod & container + level, the container options override the pod options. Note + that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: localhostProfile indicates a profile defined + in a file on the node should be used. The profile must + be preconfigured on the node to work. Must be a descending + path, relative to the kubelet's configured seccomp profile + location. Must be set if type is "Localhost". Must NOT + be set for any other type. + type: string + type: + description: "type indicates which kind of seccomp profile + will be applied. Valid options are: \n Localhost - a + profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile + should be used. Unconfined - no profile should be applied." + type: string + required: + - type + type: object + windowsOptions: + description: The Windows specific settings applied to all + containers. If unspecified, the options from the PodSecurityContext + will be used. If set in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is + linux. + properties: + gmsaCredentialSpec: + description: GMSACredentialSpec is where the GMSA admission + webhook (https://github.com/kubernetes-sigs/windows-gmsa) + inlines the contents of the GMSA credential spec named + by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the + GMSA credential spec to use. + type: string + hostProcess: + description: HostProcess determines if a container should + be run as a 'Host Process' container. All of a Pod's + containers must have the same effective HostProcess + value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, + if HostProcess is true then HostNetwork must also be + set to true. + type: boolean + runAsUserName: + description: The UserName in Windows to run the entrypoint + of the container process. Defaults to the user specified + in image metadata if unspecified. May also be set in + PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. + type: string + type: object + type: object + startupProbe: + description: 'StartupProbe indicates that the Pod has successfully + initialized. If specified, no other probes are executed until + this completes successfully. If this probe fails, the Pod will + be restarted, just as if the livenessProbe failed. This can + be used to provide different probe parameters at the beginning + of a Pod''s lifecycle, when it might take a long time to load + data or warm a cache, than during steady-state operation. This + cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + stdin: + description: Whether this container should allocate a buffer for + stdin in the container runtime. If this is not set, reads from + stdin in the container will always result in EOF. Default is + false. + type: boolean + stdinOnce: + description: Whether the container runtime should close the stdin + channel after it has been opened by a single attach. When stdin + is true the stdin stream will remain open across multiple attach + sessions. If stdinOnce is set to true, stdin is opened on container + start, is empty until the first client attaches to stdin, and + then remains open and accepts data until the client disconnects, + at which time stdin is closed and remains closed until the container + is restarted. If this flag is false, a container processes that + reads from stdin will never receive an EOF. Default is false + type: boolean + terminationMessagePath: + description: 'Optional: Path at which the file to which the container''s + termination message will be written is mounted into the container''s + filesystem. Message written is intended to be brief final status, + such as an assertion failure message. Will be truncated by the + node if greater than 4096 bytes. The total message length across + all containers will be limited to 12kb. Defaults to /dev/termination-log. + Cannot be updated.' + type: string + terminationMessagePolicy: + description: Indicate how the termination message should be populated. + File will use the contents of terminationMessagePath to populate + the container status message on both success and failure. FallbackToLogsOnError + will use the last chunk of container log output if the termination + message file is empty and the container exited with an error. + The log output is limited to 2048 bytes or 80 lines, whichever + is smaller. Defaults to File. Cannot be updated. + type: string + tty: + description: Whether this container should allocate a TTY for + itself, also requires 'stdin' to be true. Default is false. + type: boolean + volumeDevices: + description: volumeDevices is the list of block devices to be + used by the container. + items: + description: volumeDevice describes a mapping of a raw block + device within a container. + properties: + devicePath: + description: devicePath is the path inside of the container + that the device will be mapped to. + type: string + name: + description: name must match the name of a persistentVolumeClaim + in the pod + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + description: Pod volumes to mount into the container's filesystem. + Cannot be updated. + items: + description: VolumeMount describes a mounting of a Volume within + a container. + properties: + mountPath: + description: Path within the container at which the volume + should be mounted. Must not contain ':'. + type: string + mountPropagation: + description: mountPropagation determines how mounts are + propagated from the host to container and the other way + around. When not set, MountPropagationNone is used. This + field is beta in 1.10. + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: Mounted read-only if true, read-write otherwise + (false or unspecified). Defaults to false. + type: boolean + subPath: + description: Path within the volume from which the container's + volume should be mounted. Defaults to "" (volume's root). + type: string + subPathExpr: + description: Expanded path within the volume from which + the container's volume should be mounted. Behaves similarly + to SubPath but environment variable references $(VAR_NAME) + are expanded using the container's environment. Defaults + to "" (volume's root). SubPathExpr and SubPath are mutually + exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + description: Container's working directory. If not specified, + the container runtime's default will be used, which might be + configured in the container image. Cannot be updated. + type: string + required: + - name + type: object + deno: + description: Deno contains the definition for the Deno function that + is to be executed in KeptnTasks based on the KeptnTaskDefinitions. properties: - secret: - description: Secret contains the parameters that will be made - available to the job executing the KeptnTask via the 'SECRET_DATA' - environment variable. The 'SECRET_DATA' environment variable's - content will the same as value of the 'SECRET_DATA' key of the - referenced secret. + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command type: string + configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. + properties: + name: + description: Name is the name of the referenced ConfigMap. + type: string + type: object + functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. + properties: + name: + description: Name is the name of the referenced KeptnTaskDefinition. + type: string + type: object + httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. + properties: + url: + description: Url is the URL containing the code of the function. + type: string + type: object + inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. + properties: + code: + description: Code contains the code of the function. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. + type: object + type: object + secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. + type: string + type: object type: object - taskDefinition: - description: TaskDefinition refers to the name of the KeptnTaskDefinition - which includes the specification for the task to be performed. The - KeptnTaskDefinition can be located in the same namespace as the - KeptnTask, or in the Keptn namespace. - type: string - timeout: - default: 5m - description: Timeout specifies the maximum time to wait for the task - to be completed successfully. If the task does not complete successfully - within this time frame, it will be considered to be failed. - pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ - type: string - required: - - taskDefinition - type: object - status: - description: Status describes the current state of the KeptnTask. - properties: - endTime: - description: EndTime represents the time at which the KeptnTask finished. - format: date-time - type: string - jobName: - description: JobName is the name of the Job executing the Task. - type: string - message: - description: Message contains information about unexpected errors - encountered during the execution of the KeptnTask. - type: string - reason: - description: Reason contains more information about the reason for - the last transition of the Job executing the KeptnTask. - type: string - startTime: - description: StartTime represents the time at which the KeptnTask - started. - format: date-time - type: string - status: - default: Pending - description: Status represents the overall state of the KeptnTask. - type: string - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptntaskdefinition-crd.yaml -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: keptntaskdefinitions.lifecycle.keptn.sh - annotations: - controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' - labels: - app.kubernetes.io/part-of: keptn - crdGroup: lifecycle.keptn.sh - keptn.sh/inject-cert: "true" - app.kubernetes.io/instance: keptn-test - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: lifecycle-operator - app.kubernetes.io/version: vmyversion - helm.sh/chart: lifecycle-operator-0.1.0 -spec: - group: lifecycle.keptn.sh - names: - kind: KeptnTaskDefinition - listKind: KeptnTaskDefinitionList - plural: keptntaskdefinitions - singular: keptntaskdefinition - scope: Namespaced - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions - API - 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: - type: object - spec: - description: KeptnTaskDefinitionSpec defines the desired state of KeptnTaskDefinition - properties: function: + description: Deprecated Function contains the definition for the function + that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. properties: + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command + type: string configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. properties: name: + description: Name is the name of the referenced ConfigMap. type: string type: object functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. properties: name: + description: Name is the name of the referenced KeptnTaskDefinition. type: string type: object httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. properties: url: + description: Url is the URL containing the code of the function. type: string type: object inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. properties: code: + description: Code contains the code of the function. type: string type: object parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. properties: map: additionalProperties: type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. type: object type: object secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. properties: secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. type: string type: object type: object - type: object - status: - description: KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition - properties: - function: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed state - of cluster Important: Run "make" to regenerate code after modifying - this file' + python: + description: Python contains the definition for the python function + that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. properties: - configMap: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed - state of cluster Important: Run "make" to regenerate code after - modifying this file' + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command type: string - type: object - type: object - type: object - served: true - storage: false - subresources: - status: {} - - name: v1alpha2 - schema: - openAPIV3Schema: - description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions - API - 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: - type: object - spec: - description: KeptnTaskDefinitionSpec defines the desired state of KeptnTaskDefinition - properties: - function: - properties: configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. properties: name: + description: Name is the name of the referenced ConfigMap. type: string type: object functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. properties: name: + description: Name is the name of the referenced KeptnTaskDefinition. type: string type: object httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. properties: url: + description: Url is the URL containing the code of the function. type: string type: object inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. properties: code: + description: Code contains the code of the function. type: string type: object parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. properties: map: additionalProperties: type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. type: object type: object secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. properties: secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. type: string type: object type: object + retries: + default: 10 + description: Retries specifies how many times a job executing the + KeptnTaskDefinition should be restarted in the case of an unsuccessful + attempt. + format: int32 + type: integer + serviceAccount: + description: Service Account to be used in jobs to authenticate with + the Kubernetes API and access cluster resources. + properties: + name: + type: string + required: + - name + type: object + timeout: + default: 5m + description: Timeout specifies the maximum time to wait for the task + to be completed successfully. If the task does not complete successfully + within this time frame, it will be considered to be failed. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + ttlSecondsAfterFinished: + default: 300 + description: TTLSecondsAfterFinished controller makes a job eligible + to be cleaned up after it is finished. The timer starts when the + status shows up to be Complete or Failed. + format: int32 + type: integer + imagePullSecrets: + description: ImagePullSecrets is an optional field to specify the + names of secrets to use for pulling container images + items: + description: LocalObjectReference contains enough information to + let you locate the referenced object inside the same namespace. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + type: array type: object status: - description: KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition + description: Status describes the current state of the KeptnTaskDefinition. properties: function: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed state - of cluster Important: Run "make" to regenerate code after modifying - this file' + description: Function contains status information of the function + definition for the task. properties: configMap: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed - state of cluster Important: Run "make" to regenerate code after - modifying this file' + description: ConfigMap indicates the ConfigMap in which the function + code is stored. type: string type: object type: object type: object served: true - storage: false + storage: true subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions @@ -4275,36 +6665,116 @@ spec: type: object type: object served: true - storage: true + storage: false + subresources: + status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptnworkload-crd.yaml +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptnworkloads.lifecycle.keptn.sh + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' + labels: + app.kubernetes.io/part-of: keptn + crdGroup: lifecycle.keptn.sh + keptn.sh/inject-cert: "true" + app.kubernetes.io/instance: keptn-test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: lifecycle-operator + app.kubernetes.io/version: vmyversion + helm.sh/chart: lifecycle-operator-0.1.0 +spec: + group: lifecycle.keptn.sh + names: + kind: KeptnWorkload + listKind: KeptnWorkloadList + plural: keptnworkloads + singular: keptnworkload + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: KeptnWorkload is the Schema for the keptnworkloads API + 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: + type: object + spec: + description: KeptnWorkloadSpec defines the desired state of KeptnWorkload + properties: + app: + type: string + postDeploymentEvaluations: + items: + type: string + type: array + postDeploymentTasks: + items: + type: string + type: array + preDeploymentEvaluations: + items: + type: string + type: array + preDeploymentTasks: + items: + type: string + type: array + resourceReference: + properties: + kind: + type: string + name: + type: string + uid: + description: UID is a type that holds unique ID values, including + UUIDs. Because we don't ONLY use UUIDs, this is an alias to + string. Being a type captures intent and helps make sure that + UIDs and names do not get conflated. + type: string + required: + - kind + - name + - uid + type: object + version: + type: string + required: + - app + - resourceReference + - version + type: object + status: + description: KeptnWorkloadStatus defines the observed state of KeptnWorkload + properties: + currentVersion: + type: string + type: object + type: object + served: true + storage: false subresources: status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptnworkload-crd.yaml -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: keptnworkloads.lifecycle.keptn.sh - annotations: - controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' - labels: - app.kubernetes.io/part-of: keptn - crdGroup: lifecycle.keptn.sh - keptn.sh/inject-cert: "true" - app.kubernetes.io/instance: keptn-test - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: lifecycle-operator - app.kubernetes.io/version: vmyversion - helm.sh/chart: lifecycle-operator-0.1.0 -spec: - group: lifecycle.keptn.sh - names: - kind: KeptnWorkload - listKind: KeptnWorkloadList - plural: keptnworkloads - singular: keptnworkload - scope: Namespaced - versions: - additionalPrinterColumns: - jsonPath: .spec.app name: AppName @@ -4312,7 +6782,7 @@ spec: - jsonPath: .spec.version name: Version type: string - name: v1alpha1 + name: v1alpha2 schema: openAPIV3Schema: description: KeptnWorkload is the Schema for the keptnworkloads API @@ -4392,7 +6862,7 @@ spec: - jsonPath: .spec.version name: Version type: string - name: v1alpha2 + name: v1alpha3 schema: openAPIV3Schema: description: KeptnWorkload is the Schema for the keptnworkloads API @@ -4410,27 +6880,49 @@ spec: metadata: type: object spec: - description: KeptnWorkloadSpec defines the desired state of KeptnWorkload + description: Spec describes the desired state of the KeptnWorkload. properties: app: + description: AppName is the name of the KeptnApp containing the KeptnWorkload. type: string postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. items: type: string type: array postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnWorkload, or in the Keptn namespace. items: type: string type: array preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. items: type: string type: array preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnApp, or in the Keptn namespace. items: type: string type: array resourceReference: + description: ResourceReference is a reference to the Kubernetes resource + (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload + is representing. properties: kind: type: string @@ -4448,6 +6940,7 @@ spec: - uid type: object version: + description: Version defines the version of the KeptnWorkload. type: string required: - app @@ -4455,14 +6948,16 @@ spec: - version type: object status: - description: KeptnWorkloadStatus defines the observed state of KeptnWorkload + description: Status describes the current state of the KeptnWorkload. properties: currentVersion: + description: CurrentVersion indicates the version that is currently + deployed or being reconciled. type: string type: object type: object served: true - storage: false + storage: true subresources: status: {} - additionalPrinterColumns: @@ -4472,7 +6967,7 @@ spec: - jsonPath: .spec.version name: Version type: string - name: v1alpha3 + name: v1beta1 schema: openAPIV3Schema: description: KeptnWorkload is the Schema for the keptnworkloads API @@ -4567,7 +7062,7 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} --- @@ -4642,7 +7137,230 @@ spec: name: PostDeploymentEvaluationStatus priority: 1 type: string - name: v1alpha1 + name: v1alpha1 + schema: + openAPIV3Schema: + description: KeptnWorkloadInstance is the Schema for the keptnworkloadinstances + API + 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: + type: object + spec: + description: KeptnWorkloadInstanceSpec defines the desired state of KeptnWorkloadInstance + properties: + app: + type: string + postDeploymentEvaluations: + items: + type: string + type: array + postDeploymentTasks: + items: + type: string + type: array + preDeploymentEvaluations: + items: + type: string + type: array + preDeploymentTasks: + items: + type: string + type: array + previousVersion: + type: string + resourceReference: + properties: + kind: + type: string + name: + type: string + uid: + description: UID is a type that holds unique ID values, including + UUIDs. Because we don't ONLY use UUIDs, this is an alias to + string. Being a type captures intent and helps make sure that + UIDs and names do not get conflated. + type: string + required: + - kind + - name + - uid + type: object + traceId: + additionalProperties: + type: string + type: object + version: + type: string + workloadName: + type: string + required: + - app + - resourceReference + - version + - workloadName + type: object + status: + description: KeptnWorkloadInstanceStatus defines the observed state of + KeptnWorkloadInstance + properties: + currentPhase: + type: string + deploymentStatus: + default: Pending + type: string + endTime: + format: date-time + type: string + phaseTraceIDs: + additionalProperties: + additionalProperties: + type: string + description: MapCarrier is a TextMapCarrier that uses a map held + in memory as a storage medium for propagated key-value pairs. + type: object + description: PhaseTraceID is a map storing TraceIDs of OpenTelemetry + spans in lifecycle phases + type: object + postDeploymentEvaluationStatus: + default: Pending + type: string + postDeploymentEvaluationTaskStatus: + items: + properties: + endTime: + format: date-time + type: string + evaluationDefinitionName: + type: string + evaluationName: + type: string + startTime: + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + postDeploymentStatus: + default: Pending + type: string + postDeploymentTaskStatus: + items: + properties: + endTime: + format: date-time + type: string + startTime: + format: date-time + type: string + status: + default: Pending + type: string + taskDefinitionName: + type: string + taskName: + type: string + type: object + type: array + preDeploymentEvaluationStatus: + default: Pending + type: string + preDeploymentEvaluationTaskStatus: + items: + properties: + endTime: + format: date-time + type: string + evaluationDefinitionName: + type: string + evaluationName: + type: string + startTime: + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + preDeploymentStatus: + default: Pending + type: string + preDeploymentTaskStatus: + items: + properties: + endTime: + format: date-time + type: string + startTime: + format: date-time + type: string + status: + default: Pending + type: string + taskDefinitionName: + type: string + taskName: + type: string + type: object + type: array + startTime: + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.workloadName + name: WorkloadName + type: string + - jsonPath: .spec.version + name: WorkloadVersion + type: string + - jsonPath: .status.currentPhase + name: Phase + type: string + - jsonPath: .status.preDeploymentStatus + name: PreDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.preDeploymentEvaluationStatus + name: PreDeploymentEvaluationStatus + priority: 1 + type: string + - jsonPath: .status.deploymentStatus + name: DeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentStatus + name: PostDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentEvaluationStatus + name: PostDeploymentEvaluationStatus + priority: 1 + type: string + name: v1alpha2 schema: openAPIV3Schema: description: KeptnWorkloadInstance is the Schema for the keptnworkloadinstances @@ -4733,8 +7451,6 @@ spec: description: MapCarrier is a TextMapCarrier that uses a map held in memory as a storage medium for propagated key-value pairs. type: object - description: PhaseTraceID is a map storing TraceIDs of OpenTelemetry - spans in lifecycle phases type: object postDeploymentEvaluationStatus: default: Pending @@ -4742,12 +7458,14 @@ spec: postDeploymentEvaluationTaskStatus: items: properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string endTime: format: date-time type: string - evaluationDefinitionName: - type: string - evaluationName: + name: + description: Name is the name of the Evaluation/Task type: string startTime: format: date-time @@ -4763,19 +7481,21 @@ spec: postDeploymentTaskStatus: items: properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string endTime: format: date-time type: string + name: + description: Name is the name of the Evaluation/Task + type: string startTime: format: date-time type: string status: default: Pending type: string - taskDefinitionName: - type: string - taskName: - type: string type: object type: array preDeploymentEvaluationStatus: @@ -4784,12 +7504,14 @@ spec: preDeploymentEvaluationTaskStatus: items: properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string endTime: format: date-time type: string - evaluationDefinitionName: - type: string - evaluationName: + name: + description: Name is the name of the Evaluation/Task type: string startTime: format: date-time @@ -4805,19 +7527,21 @@ spec: preDeploymentTaskStatus: items: properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string endTime: format: date-time type: string + name: + description: Name is the name of the Evaluation/Task + type: string startTime: format: date-time type: string status: default: Pending type: string - taskDefinitionName: - type: string - taskName: - type: string type: object type: array startTime: @@ -4865,7 +7589,7 @@ spec: name: PostDeploymentEvaluationStatus priority: 1 type: string - name: v1alpha2 + name: v1alpha3 schema: openAPIV3Schema: description: KeptnWorkloadInstance is the Schema for the keptnworkloadinstances @@ -4884,29 +7608,53 @@ spec: metadata: type: object spec: - description: KeptnWorkloadInstanceSpec defines the desired state of KeptnWorkloadInstance + description: Spec describes the desired state of the KeptnWorkloadInstance. properties: app: + description: AppName is the name of the KeptnApp containing the KeptnWorkload. type: string postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. items: type: string type: array postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnWorkload, or in the Keptn namespace. items: type: string type: array preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. items: type: string type: array preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnApp, or in the Keptn namespace. items: type: string type: array previousVersion: + description: PreviousVersion is the version of the KeptnWorkload that + has been deployed prior to this version. type: string resourceReference: + description: ResourceReference is a reference to the Kubernetes resource + (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload + is representing. properties: kind: type: string @@ -4926,10 +7674,13 @@ spec: traceId: additionalProperties: type: string + description: TraceId contains the OpenTelemetry trace ID. type: object version: + description: Version defines the version of the KeptnWorkload. type: string workloadName: + description: WorkloadName is the name of the KeptnWorkload. type: string required: - app @@ -4938,15 +7689,21 @@ spec: - workloadName type: object status: - description: KeptnWorkloadInstanceStatus defines the observed state of - KeptnWorkloadInstance + description: Status describes the current state of the KeptnWorkloadInstance. properties: currentPhase: + description: 'CurrentPhase indicates the current phase of the KeptnWorkloadInstance. + This can be: - PreDeploymentTasks - PreDeploymentEvaluations - Deployment + - PostDeploymentTasks - PostDeploymentEvaluations' type: string deploymentStatus: default: Pending + description: DeploymentStatus indicates the current status of the + KeptnWorkloadInstance's Deployment phase. type: string endTime: + description: EndTime represents the time at which the deployment of + the KeptnWorkloadInstance finished. format: date-time type: string phaseTraceIDs: @@ -4956,23 +7713,33 @@ spec: description: MapCarrier is a TextMapCarrier that uses a map held in memory as a storage medium for propagated key-value pairs. type: object + description: PhaseTraceIDs contains the trace IDs of the OpenTelemetry + spans of each phase of the KeptnWorkloadInstance type: object postDeploymentEvaluationStatus: default: Pending + description: PostDeploymentEvaluationStatus indicates the current + status of the KeptnWorkloadInstance's PostDeploymentEvaluation phase. type: string postDeploymentEvaluationTaskStatus: + description: PostDeploymentEvaluationTaskStatus indicates the current + state of each postDeploymentEvaluation of the KeptnWorkloadInstance. items: properties: definitionName: description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition type: string endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. format: date-time type: string name: description: Name is the name of the Evaluation/Task type: string startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. format: date-time type: string status: @@ -4982,20 +7749,28 @@ spec: type: array postDeploymentStatus: default: Pending + description: PostDeploymentStatus indicates the current status of + the KeptnWorkloadInstance's PostDeployment phase. type: string postDeploymentTaskStatus: + description: PostDeploymentTaskStatus indicates the current state + of each postDeploymentTask of the KeptnWorkloadInstance. items: properties: definitionName: description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition type: string endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. format: date-time type: string name: description: Name is the name of the Evaluation/Task type: string startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. format: date-time type: string status: @@ -5005,20 +7780,28 @@ spec: type: array preDeploymentEvaluationStatus: default: Pending + description: PreDeploymentEvaluationStatus indicates the current status + of the KeptnWorkloadInstance's PreDeploymentEvaluation phase. type: string preDeploymentEvaluationTaskStatus: + description: PreDeploymentEvaluationTaskStatus indicates the current + state of each preDeploymentEvaluation of the KeptnWorkloadInstance. items: properties: definitionName: description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition type: string endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. format: date-time type: string name: description: Name is the name of the Evaluation/Task type: string startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. format: date-time type: string status: @@ -5028,20 +7811,28 @@ spec: type: array preDeploymentStatus: default: Pending + description: PreDeploymentStatus indicates the current status of the + KeptnWorkloadInstance's PreDeployment phase. type: string preDeploymentTaskStatus: + description: PreDeploymentTaskStatus indicates the current state of + each preDeploymentTask of the KeptnWorkloadInstance. items: properties: definitionName: description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition type: string endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. format: date-time type: string name: description: Name is the name of the Evaluation/Task type: string startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. format: date-time type: string status: @@ -5050,17 +7841,49 @@ spec: type: object type: array startTime: + description: StartTime represents the time at which the deployment + of the KeptnWorkloadInstance started. format: date-time type: string status: default: Pending + description: Status represents the overall status of the KeptnWorkloadInstance. type: string type: object type: object served: true - storage: false + storage: true subresources: status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptnworkloadversion-crd.yaml +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptnworkloadversions.lifecycle.keptn.sh + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' + labels: + app.kubernetes.io/part-of: keptn + crdGroup: lifecycle.keptn.sh + keptn.sh/inject-cert: "true" + app.kubernetes.io/instance: keptn-test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: lifecycle-operator + app.kubernetes.io/version: vmyversion + helm.sh/chart: lifecycle-operator-0.1.0 +spec: + group: lifecycle.keptn.sh + names: + kind: KeptnWorkloadVersion + listKind: KeptnWorkloadVersionList + plural: keptnworkloadversions + shortNames: + - kwv + singular: keptnworkloadversion + scope: Namespaced + versions: - additionalPrinterColumns: - jsonPath: .spec.app name: AppName @@ -5094,10 +7917,10 @@ spec: name: PostDeploymentEvaluationStatus priority: 1 type: string - name: v1alpha3 + name: v1alpha4 schema: openAPIV3Schema: - description: KeptnWorkloadInstance is the Schema for the keptnworkloadinstances + description: KeptnWorkloadVersion is the Schema for the keptnworkloadversions API properties: apiVersion: @@ -5113,7 +7936,7 @@ spec: metadata: type: object spec: - description: Spec describes the desired state of the KeptnWorkloadInstance. + description: Spec describes the desired state of the KeptnWorkloadVersion. properties: app: description: AppName is the name of the KeptnApp containing the KeptnWorkload. @@ -5194,21 +8017,21 @@ spec: - workloadName type: object status: - description: Status describes the current state of the KeptnWorkloadInstance. + description: Status describes the current state of the KeptnWorkloadVersion. properties: currentPhase: - description: 'CurrentPhase indicates the current phase of the KeptnWorkloadInstance. + description: 'CurrentPhase indicates the current phase of the KeptnWorkloadVersion. This can be: - PreDeploymentTasks - PreDeploymentEvaluations - Deployment - PostDeploymentTasks - PostDeploymentEvaluations' type: string deploymentStatus: default: Pending description: DeploymentStatus indicates the current status of the - KeptnWorkloadInstance's Deployment phase. + KeptnWorkloadVersion's Deployment phase. type: string endTime: description: EndTime represents the time at which the deployment of - the KeptnWorkloadInstance finished. + the KeptnWorkloadVersion finished. format: date-time type: string phaseTraceIDs: @@ -5219,16 +8042,16 @@ spec: in memory as a storage medium for propagated key-value pairs. type: object description: PhaseTraceIDs contains the trace IDs of the OpenTelemetry - spans of each phase of the KeptnWorkloadInstance + spans of each phase of the KeptnWorkloadVersion type: object postDeploymentEvaluationStatus: default: Pending description: PostDeploymentEvaluationStatus indicates the current - status of the KeptnWorkloadInstance's PostDeploymentEvaluation phase. + status of the KeptnWorkloadVersion's PostDeploymentEvaluation phase. type: string postDeploymentEvaluationTaskStatus: description: PostDeploymentEvaluationTaskStatus indicates the current - state of each postDeploymentEvaluation of the KeptnWorkloadInstance. + state of each postDeploymentEvaluation of the KeptnWorkloadVersion. items: properties: definitionName: @@ -5255,11 +8078,11 @@ spec: postDeploymentStatus: default: Pending description: PostDeploymentStatus indicates the current status of - the KeptnWorkloadInstance's PostDeployment phase. + the KeptnWorkloadVersion's PostDeployment phase. type: string postDeploymentTaskStatus: description: PostDeploymentTaskStatus indicates the current state - of each postDeploymentTask of the KeptnWorkloadInstance. + of each postDeploymentTask of the KeptnWorkloadVersion. items: properties: definitionName: @@ -5286,11 +8109,11 @@ spec: preDeploymentEvaluationStatus: default: Pending description: PreDeploymentEvaluationStatus indicates the current status - of the KeptnWorkloadInstance's PreDeploymentEvaluation phase. + of the KeptnWorkloadVersion's PreDeploymentEvaluation phase. type: string preDeploymentEvaluationTaskStatus: description: PreDeploymentEvaluationTaskStatus indicates the current - state of each preDeploymentEvaluation of the KeptnWorkloadInstance. + state of each preDeploymentEvaluation of the KeptnWorkloadVersion. items: properties: definitionName: @@ -5317,11 +8140,11 @@ spec: preDeploymentStatus: default: Pending description: PreDeploymentStatus indicates the current status of the - KeptnWorkloadInstance's PreDeployment phase. + KeptnWorkloadVersion's PreDeployment phase. type: string preDeploymentTaskStatus: description: PreDeploymentTaskStatus indicates the current state of - each preDeploymentTask of the KeptnWorkloadInstance. + each preDeploymentTask of the KeptnWorkloadVersion. items: properties: definitionName: @@ -5347,12 +8170,12 @@ spec: type: array startTime: description: StartTime represents the time at which the deployment - of the KeptnWorkloadInstance started. + of the KeptnWorkloadVersion started. format: date-time type: string status: default: Pending - description: Status represents the overall status of the KeptnWorkloadInstance. + description: Status represents the overall status of the KeptnWorkloadVersion. type: string type: object type: object @@ -5360,35 +8183,6 @@ spec: storage: true subresources: status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptnworkloadversion-crd.yaml -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: keptnworkloadversions.lifecycle.keptn.sh - annotations: - controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' - labels: - app.kubernetes.io/part-of: keptn - crdGroup: lifecycle.keptn.sh - keptn.sh/inject-cert: "true" - app.kubernetes.io/instance: keptn-test - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: lifecycle-operator - app.kubernetes.io/version: vmyversion - helm.sh/chart: lifecycle-operator-0.1.0 -spec: - group: lifecycle.keptn.sh - names: - kind: KeptnWorkloadVersion - listKind: KeptnWorkloadVersionList - plural: keptnworkloadversions - shortNames: - - kwv - singular: keptnworkloadversion - scope: Namespaced - versions: - additionalPrinterColumns: - jsonPath: .spec.app name: AppName @@ -5422,7 +8216,7 @@ spec: name: PostDeploymentEvaluationStatus priority: 1 type: string - name: v1alpha4 + name: v1beta1 schema: openAPIV3Schema: description: KeptnWorkloadVersion is the Schema for the keptnworkloadversions @@ -5685,7 +8479,7 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} --- diff --git a/.github/scripts/.helm-tests/lifecycle-only/result.yaml b/.github/scripts/.helm-tests/lifecycle-only/result.yaml index c59c756aec..11fc48113f 100644 --- a/.github/scripts/.helm-tests/lifecycle-only/result.yaml +++ b/.github/scripts/.helm-tests/lifecycle-only/result.yaml @@ -340,6 +340,103 @@ spec: storage: true subresources: status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnApp is the Schema for the keptnapps API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnApp. + properties: + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + revision: + default: 1 + description: Revision can be modified to trigger another deployment + of a KeptnApp of the same version. This can be used for restarting + a KeptnApp which failed to deploy, e.g. due to a failed preDeploymentEvaluation/preDeploymentTask. + type: integer + version: + description: Version defines the version of the application. For automatically + created KeptnApps, the version is a function of all KeptnWorkloads + that are part of the KeptnApp. + type: string + workloads: + description: Workloads is a list of all KeptnWorkloads that are part + of the KeptnApp. + items: + description: KeptnWorkloadRef refers to a KeptnWorkload that is + part of a KeptnApp + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: array + required: + - version + type: object + status: + description: Status describes the current state of the KeptnApp. + properties: + currentVersion: + description: CurrentVersion indicates the version that is currently + deployed or being reconciled. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} --- # Source: keptn/charts/lifecycleOperator/templates/keptnappcreationrequest-crd.yaml apiVersion: apiextensions.k8s.io/v1 @@ -403,6 +500,42 @@ spec: storage: true subresources: status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnAppCreationRequest is the Schema for the keptnappcreationrequests + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnAppCreationRequest. + properties: + appName: + description: AppName is the name of the KeptnApp the KeptnAppCreationRequest + should create if no user-defined object with that name is found. + type: string + required: + - appName + type: object + status: + description: Status describes the current state of the KeptnAppCreationRequest. + type: string + type: object + served: true + storage: false + subresources: + status: {} --- # Source: keptn/charts/lifecycleOperator/templates/keptnappversion-crd.yaml apiVersion: apiextensions.k8s.io/v1 @@ -1222,37 +1355,40 @@ spec: storage: true subresources: status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptnconfig-crd.yaml -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: keptnconfigs.options.keptn.sh - annotations: - controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' - labels: - app.kubernetes.io/part-of: keptn - crdGroup: lifecycle.keptn.sh - keptn.sh/inject-cert: "true" - app.kubernetes.io/instance: keptn-test - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: lifecycle-operator - app.kubernetes.io/version: vmyversion - helm.sh/chart: lifecycle-operator-0.1.0 -spec: - group: options.keptn.sh - names: - kind: KeptnConfig - listKind: KeptnConfigList - plural: keptnconfigs - singular: keptnconfig - scope: Namespaced - versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.appName + name: AppName + type: string + - jsonPath: .spec.version + name: Version + type: string + - jsonPath: .status.currentPhase + name: Phase + type: string + - jsonPath: .status.preDeploymentStatus + name: PreDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.preDeploymentEvaluationStatus + name: PreDeploymentEvaluationStatus + priority: 1 + type: string + - jsonPath: .status.workloadOverallStatus + name: WorkloadOverallStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentStatus + name: PostDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentEvaluationStatus + name: PostDeploymentEvaluationStatus + priority: 1 + type: string + name: v1beta1 schema: openAPIV3Schema: - description: KeptnConfig is the Schema for the keptnconfigs API + description: KeptnAppVersion is the Schema for the keptnappversions API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -1267,37 +1403,281 @@ spec: metadata: type: object spec: - description: KeptnConfigSpec defines the desired state of KeptnConfig + description: Spec describes the desired state of the KeptnAppVersion. properties: - OTelCollectorUrl: - description: OTelCollectorUrl can be used to set the Open Telemetry - collector that the lifecycle operator should use + appName: + description: AppName is the name of the KeptnApp. type: string - cloudEventsEndpoint: - description: CloudEventsEndpoint can be used to set the endpoint where - Cloud Events should be posted by the lifecycle operator + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + previousVersion: + description: PreviousVersion is the version of the KeptnApp that has + been deployed prior to this version. type: string - keptnAppCreationRequestTimeoutSeconds: - default: 30 - description: KeptnAppCreationRequestTimeoutSeconds is used to set - the interval in which automatic app discovery searches for workload - to put into the same auto-generated KeptnApp + revision: + default: 1 + description: Revision can be modified to trigger another deployment + of a KeptnApp of the same version. This can be used for restarting + a KeptnApp which failed to deploy, e.g. due to a failed preDeploymentEvaluation/preDeploymentTask. type: integer - type: object - status: - description: unused field - type: string - type: object - served: true - storage: true - subresources: - status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptnevaluation-crd.yaml + traceId: + additionalProperties: + type: string + description: TraceId contains the OpenTelemetry trace ID. + type: object + version: + description: Version defines the version of the application. For automatically + created KeptnApps, the version is a function of all KeptnWorkloads + that are part of the KeptnApp. + type: string + workloads: + description: Workloads is a list of all KeptnWorkloads that are part + of the KeptnApp. + items: + description: KeptnWorkloadRef refers to a KeptnWorkload that is + part of a KeptnApp + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: array + required: + - appName + - version + type: object + status: + description: Status describes the current state of the KeptnAppVersion. + properties: + currentPhase: + description: CurrentPhase indicates the current phase of the KeptnAppVersion. + type: string + endTime: + description: EndTime represents the time at which the deployment of + the KeptnAppVersion finished. + format: date-time + type: string + phaseTraceIDs: + additionalProperties: + additionalProperties: + type: string + description: MapCarrier is a TextMapCarrier that uses a map held + in memory as a storage medium for propagated key-value pairs. + type: object + description: PhaseTraceIDs contains the trace IDs of the OpenTelemetry + spans of each phase of the KeptnAppVersion. + type: object + postDeploymentEvaluationStatus: + default: Pending + description: PostDeploymentEvaluationStatus indicates the current + status of the KeptnAppVersion's PostDeploymentEvaluation phase. + type: string + postDeploymentEvaluationTaskStatus: + description: PostDeploymentEvaluationTaskStatus indicates the current + state of each postDeploymentEvaluation of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + postDeploymentStatus: + default: Pending + description: PostDeploymentStatus indicates the current status of + the KeptnAppVersion's PostDeployment phase. + type: string + postDeploymentTaskStatus: + description: PostDeploymentTaskStatus indicates the current state + of each postDeploymentTask of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + preDeploymentEvaluationStatus: + default: Pending + description: PreDeploymentEvaluationStatus indicates the current status + of the KeptnAppVersion's PreDeploymentEvaluation phase. + type: string + preDeploymentEvaluationTaskStatus: + description: PreDeploymentEvaluationTaskStatus indicates the current + state of each preDeploymentEvaluation of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + preDeploymentStatus: + default: Pending + description: PreDeploymentStatus indicates the current status of the + KeptnAppVersion's PreDeployment phase. + type: string + preDeploymentTaskStatus: + description: PreDeploymentTaskStatus indicates the current state of + each preDeploymentTask of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + startTime: + description: StartTime represents the time at which the deployment + of the KeptnAppVersion started. + format: date-time + type: string + status: + default: Pending + description: Status represents the overall status of the KeptnAppVersion. + type: string + workloadOverallStatus: + default: Pending + description: WorkloadOverallStatus indicates the current status of + the KeptnAppVersion's Workload deployment phase. + type: string + workloadStatus: + description: WorkloadStatus contains the current status of each KeptnWorkload + that is part of the KeptnAppVersion. + items: + properties: + status: + default: Pending + description: Status indicates the current status of the KeptnWorkload. + type: string + workload: + description: Workload refers to a KeptnWorkload that is part + of the KeptnAppVersion. + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: object + type: array + type: object + type: object + served: true + storage: false + subresources: + status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptnconfig-crd.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: keptnevaluations.lifecycle.keptn.sh + name: keptnconfigs.options.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' @@ -1311,33 +1691,103 @@ metadata: app.kubernetes.io/version: vmyversion helm.sh/chart: lifecycle-operator-0.1.0 spec: - group: lifecycle.keptn.sh + group: options.keptn.sh names: - kind: KeptnEvaluation - listKind: KeptnEvaluationList - plural: keptnevaluations - shortNames: - - ke - singular: keptnevaluation + kind: KeptnConfig + listKind: KeptnConfigList + plural: keptnconfigs + singular: keptnconfig scope: Namespaced versions: - - additionalPrinterColumns: - - jsonPath: .spec.appName - name: AppName - type: string - - jsonPath: .spec.appVersion - name: AppVersion - type: string - - jsonPath: .spec.workload - name: WorkloadName - type: string - - jsonPath: .spec.workloadVersion - name: WorkloadVersion - type: string - - jsonPath: .status.retryCount - name: RetryCount - type: string - - jsonPath: .status.evaluationStatus + - name: v1alpha1 + schema: + openAPIV3Schema: + description: KeptnConfig is the Schema for the keptnconfigs API + 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: + type: object + spec: + description: KeptnConfigSpec defines the desired state of KeptnConfig + properties: + OTelCollectorUrl: + description: OTelCollectorUrl can be used to set the Open Telemetry + collector that the lifecycle operator should use + type: string + cloudEventsEndpoint: + description: CloudEventsEndpoint can be used to set the endpoint where + Cloud Events should be posted by the lifecycle operator + type: string + keptnAppCreationRequestTimeoutSeconds: + default: 30 + description: KeptnAppCreationRequestTimeoutSeconds is used to set + the interval in which automatic app discovery searches for workload + to put into the same auto-generated KeptnApp + type: integer + type: object + status: + description: unused field + type: string + type: object + served: true + storage: true + subresources: + status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptnevaluation-crd.yaml +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptnevaluations.lifecycle.keptn.sh + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' + labels: + app.kubernetes.io/part-of: keptn + crdGroup: lifecycle.keptn.sh + keptn.sh/inject-cert: "true" + app.kubernetes.io/instance: keptn-test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: lifecycle-operator + app.kubernetes.io/version: vmyversion + helm.sh/chart: lifecycle-operator-0.1.0 +spec: + group: lifecycle.keptn.sh + names: + kind: KeptnEvaluation + listKind: KeptnEvaluationList + plural: keptnevaluations + shortNames: + - ke + singular: keptnevaluation + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.appName + name: AppName + type: string + - jsonPath: .spec.appVersion + name: AppVersion + type: string + - jsonPath: .spec.workload + name: WorkloadName + type: string + - jsonPath: .spec.workloadVersion + name: WorkloadVersion + type: string + - jsonPath: .status.retryCount + name: RetryCount + type: string + - jsonPath: .status.evaluationStatus name: EvaluationStatus type: string - jsonPath: .status.overallStatus @@ -1677,6 +2127,150 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.appName + name: AppName + type: string + - jsonPath: .spec.appVersion + name: AppVersion + type: string + - jsonPath: .spec.workload + name: WorkloadName + type: string + - jsonPath: .spec.workloadVersion + name: WorkloadVersion + type: string + - jsonPath: .status.retryCount + name: RetryCount + type: string + - jsonPath: .status.evaluationStatus + name: EvaluationStatus + type: string + - jsonPath: .status.overallStatus + name: OverallStatus + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnEvaluation is the Schema for the keptnevaluations API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnEvaluation. + properties: + appName: + description: AppName defines the KeptnApp for which the KeptnEvaluation + is done. + type: string + appVersion: + description: AppVersion defines the version of the KeptnApp for which + the KeptnEvaluation is done. + type: string + checkType: + description: Type indicates whether the KeptnEvaluation is part of + the pre- or postDeployment phase. + type: string + evaluationDefinition: + description: EvaluationDefinition refers to the name of the KeptnEvaluationDefinition + which includes the objectives for the KeptnEvaluation. The KeptnEvaluationDefinition + can be located in the same namespace as the KeptnEvaluation, or + in the Keptn namespace. + type: string + failAction: + type: string + retries: + default: 10 + description: Retries indicates how many times the KeptnEvaluation + can be attempted in the case of an error or missed evaluation objective, + before considering the KeptnEvaluation to be failed. + type: integer + retryInterval: + default: 5s + description: RetryInterval specifies the interval at which the KeptnEvaluation + is retried in the case of an error or a missed objective. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + workload: + description: Workload defines the KeptnWorkload for which the KeptnEvaluation + is done. + type: string + workloadVersion: + description: WorkloadVersion defines the version of the KeptnWorkload + for which the KeptnEvaluation is done. + type: string + required: + - evaluationDefinition + - workloadVersion + type: object + status: + description: Status describes the current state of the KeptnEvaluation. + properties: + endTime: + description: EndTime represents the time at which the KeptnEvaluation + finished. + format: date-time + type: string + evaluationStatus: + additionalProperties: + properties: + message: + description: Message contains additional information about the + evaluation of an objective. This can include explanations + about why an evaluation has failed (e.g. due to a missed objective), + or if there was any error during the evaluation of the objective. + type: string + status: + description: Status indicates the status of the objective being + evaluated. + type: string + value: + description: Value represents the value of the KeptnMetric being + evaluated. + type: string + required: + - status + - value + type: object + description: EvaluationStatus describes the status of each objective + of the KeptnEvaluationDefinition referenced by the KeptnEvaluation. + type: object + overallStatus: + default: Pending + description: OverallStatus describes the overall status of the KeptnEvaluation. + The Overall status is derived from the status of the individual + objectives of the KeptnEvaluationDefinition referenced by the KeptnEvaluation. + type: string + retryCount: + default: 0 + description: RetryCount indicates how many times the KeptnEvaluation + has been attempted already. + type: integer + startTime: + description: StartTime represents the time at which the KeptnEvaluation + started. + format: date-time + type: string + required: + - evaluationStatus + - overallStatus + - retryCount + type: object + type: object + served: true + storage: false + subresources: + status: {} --- # Source: keptn/charts/lifecycleOperator/templates/keptnevaluationdefinition-crd.yaml apiVersion: apiextensions.k8s.io/v1 @@ -1870,30 +2464,92 @@ spec: storage: true subresources: status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptnevaluationprovider-crd.yaml -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: keptnevaluationproviders.lifecycle.keptn.sh - annotations: - controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' - labels: - app.kubernetes.io/part-of: keptn - crdGroup: lifecycle.keptn.sh - keptn.sh/inject-cert: "true" - app.kubernetes.io/instance: keptn-test - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: lifecycle-operator - app.kubernetes.io/version: vmyversion - helm.sh/chart: lifecycle-operator-0.1.0 -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnEvaluationDefinition is the Schema for the keptnevaluationdefinitions + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnEvaluationDefinition. + properties: + objectives: + description: Objectives is a list of objectives that have to be met + for a KeptnEvaluation referencing this KeptnEvaluationDefinition + to be successful. + items: + properties: + evaluationTarget: + description: EvaluationTarget specifies the target value for + the references KeptnMetric. Needs to start with either '<' + or '>', followed by the target value (e.g. '<10'). + type: string + keptnMetricRef: + description: KeptnMetricRef references the KeptnMetric that + should be evaluated. + properties: + name: + description: Name is the name of the referenced KeptnMetric. + type: string + namespace: + description: Namespace is the namespace where the referenced + KeptnMetric is located. + type: string + required: + - name + type: object + required: + - evaluationTarget + - keptnMetricRef + type: object + type: array + required: + - objectives + type: object + status: + description: unused field + type: string + type: object + served: true + storage: false + subresources: + status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptnevaluationprovider-crd.yaml +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptnevaluationproviders.lifecycle.keptn.sh + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' + labels: + app.kubernetes.io/part-of: keptn + crdGroup: lifecycle.keptn.sh + keptn.sh/inject-cert: "true" + app.kubernetes.io/instance: keptn-test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: lifecycle-operator + app.kubernetes.io/version: vmyversion + helm.sh/chart: lifecycle-operator-0.1.0 +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: name: 'lifecycle-webhook-service' namespace: 'helmtests' path: /convert @@ -2464,6 +3120,161 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.appVersion + name: AppVersion + type: string + - jsonPath: .spec.workload + name: WorkloadName + type: string + - jsonPath: .spec.workloadVersion + name: WorkloadVersion + type: string + - jsonPath: .status.jobName + name: Job Name + type: string + - jsonPath: .status.status + name: Status + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnTask is the Schema for the keptntasks API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnTask. + properties: + checkType: + description: Type indicates whether the KeptnTask is part of the pre- + or postDeployment phase. + type: string + context: + description: Context contains contextual information about the task + execution. + properties: + appName: + description: AppName the name of the KeptnApp the KeptnTask is + being executed for. + type: string + appVersion: + description: AppVersion the version of the KeptnApp the KeptnTask + is being executed for. + type: string + objectType: + description: ObjectType indicates whether the KeptnTask is being + executed for a KeptnApp or KeptnWorkload. + type: string + taskType: + description: TaskType indicates whether the KeptnTask is part + of the pre- or postDeployment phase. + type: string + workloadName: + description: WorkloadName the name of the KeptnWorkload the KeptnTask + is being executed for. + type: string + workloadVersion: + description: WorkloadVersion the version of the KeptnWorkload + the KeptnTask is being executed for. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed to + the job that executes the task. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's content + will be a json encoded string containing all properties of the + map provided. + type: object + type: object + retries: + default: 10 + description: Retries indicates how many times the KeptnTask can be + attempted in the case of an error before considering the KeptnTask + to be failed. + format: int32 + type: integer + secureParameters: + description: SecureParameters contains secure parameters that will + be passed to the job that executes the task. These will be stored + and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key of the + referenced secret. + type: string + type: object + taskDefinition: + description: TaskDefinition refers to the name of the KeptnTaskDefinition + which includes the specification for the task to be performed. The + KeptnTaskDefinition can be located in the same namespace as the + KeptnTask, or in the Keptn namespace. + type: string + timeout: + default: 5m + description: Timeout specifies the maximum time to wait for the task + to be completed successfully. If the task does not complete successfully + within this time frame, it will be considered to be failed. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + required: + - taskDefinition + type: object + status: + description: Status describes the current state of the KeptnTask. + properties: + endTime: + description: EndTime represents the time at which the KeptnTask finished. + format: date-time + type: string + jobName: + description: JobName is the name of the Job executing the Task. + type: string + message: + description: Message contains information about unexpected errors + encountered during the execution of the KeptnTask. + type: string + reason: + description: Reason contains more information about the reason for + the last transition of the Job executing the KeptnTask. + type: string + startTime: + description: StartTime represents the time at which the KeptnTask + started. + format: date-time + type: string + status: + default: Pending + description: Status represents the overall state of the KeptnTask. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} --- # Source: keptn/charts/lifecycleOperator/templates/keptntaskdefinition-crd.yaml apiVersion: apiextensions.k8s.io/v1 @@ -2547,105 +3358,1684 @@ spec: type: string type: object type: object - type: object - status: - description: KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition - properties: + type: object + status: + description: KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition + properties: + function: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed state + of cluster Important: Run "make" to regenerate code after modifying + this file' + properties: + configMap: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed + state of cluster Important: Run "make" to regenerate code after + modifying this file' + type: string + type: object + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha2 + schema: + openAPIV3Schema: + description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions + API + 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: + type: object + spec: + description: KeptnTaskDefinitionSpec defines the desired state of KeptnTaskDefinition + properties: + function: + properties: + configMapRef: + properties: + name: + type: string + type: object + functionRef: + properties: + name: + type: string + type: object + httpRef: + properties: + url: + type: string + type: object + inline: + properties: + code: + type: string + type: object + parameters: + properties: + map: + additionalProperties: + type: string + type: object + type: object + secureParameters: + properties: + secret: + type: string + type: object + type: object + type: object + status: + description: KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition + properties: + function: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed state + of cluster Important: Run "make" to regenerate code after modifying + this file' + properties: + configMap: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed + state of cluster Important: Run "make" to regenerate code after + modifying this file' + type: string + type: object + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha3 + schema: + openAPIV3Schema: + description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnTaskDefinition. + properties: + automountServiceAccountToken: + description: automountServiceAccountToken allows to enable K8s to + assign cluster API credentials to a pod, if set to false the pod + will decline the serviceAccount + properties: + type: + type: boolean + required: + - type + type: object + container: + description: Container contains the definition for the container that + is to be used in Job based on the KeptnTaskDefinitions. + properties: + args: + description: 'Arguments to the entrypoint. The container image''s + CMD is used if this is not provided. Variable references $(VAR_NAME) + are expanded using the container''s environment. If a variable + cannot be resolved, the reference in the input string will be + unchanged. Double $$ are reduced to a single $, which allows + for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references + will never be expanded, regardless of whether the variable exists + or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + command: + description: 'Entrypoint array. Not executed within a shell. The + container image''s ENTRYPOINT is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container''s + environment. If a variable cannot be resolved, the reference + in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: + i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether + the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + env: + description: List of environment variables to set in the container. + Cannot be updated. + items: + description: EnvVar represents an environment variable present + in a Container. + properties: + name: + description: Name of the environment variable. Must be a + C_IDENTIFIER. + type: string + value: + description: 'Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in + the container and any service environment variables. If + a variable cannot be resolved, the reference in the input + string will be unchanged. Double $$ are reduced to a single + $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless + of whether the variable exists or not. Defaults to "".' + type: string + valueFrom: + description: Source for the environment variable's value. + Cannot be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the ConfigMap or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: 'Selects a field of the pod: supports metadata.name, + metadata.namespace, `metadata.labels['''']`, + `metadata.annotations['''']`, spec.nodeName, + spec.serviceAccountName, status.hostIP, status.podIP, + status.podIPs.' + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the + specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: 'Selects a resource of the container: only + resources limits and requests (limits.cpu, limits.memory, + limits.ephemeral-storage, requests.cpu, requests.memory + and requests.ephemeral-storage) are currently supported.' + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the + exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + description: List of sources to populate environment variables + in the container. The keys defined within a source must be a + C_IDENTIFIER. All invalid keys will be reported as an event + when the container is starting. When a key exists in multiple + sources, the value associated with the last source will take + precedence. Values defined by an Env with a duplicate key will + take precedence. Cannot be updated. + items: + description: EnvFromSource represents the source of a set of + ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend to each key + in the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the Secret must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + description: 'Container image name. More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config management + to default or override container images in workload controllers + like Deployments and StatefulSets.' + type: string + imagePullPolicy: + description: 'Image pull policy. One of Always, Never, IfNotPresent. + Defaults to Always if :latest tag is specified, or IfNotPresent + otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images' + type: string + lifecycle: + description: Actions that the management system should take in + response to container lifecycle events. Cannot be updated. + properties: + postStart: + description: 'PostStart is called immediately after a container + is created. If the handler fails, the container is terminated + and restarted according to its restart policy. Other management + of the container blocks until the hook completes. More info: + https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute + inside the container, the working directory for + the command is root ('/') in the container's filesystem. + The command is simply exec'd, it is not run inside + a shell, so traditional shell instructions ('|', + etc) won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is treated + as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to + the pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: The header field name. This will + be canonicalized upon output, so case-variant + names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported as + a LifecycleHandler and kept for the backward compatibility. + There are no validation of this field and lifecycle + hooks will fail in runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + description: 'PreStop is called immediately before a container + is terminated due to an API request or management event + such as liveness/startup probe failure, preemption, resource + contention, etc. The handler is not called if the container + crashes or exits. The Pod''s termination grace period countdown + begins before the PreStop hook is executed. Regardless of + the outcome of the handler, the container will eventually + terminate within the Pod''s termination grace period (unless + delayed by finalizers). Other management of the container + blocks until the hook completes or until the termination + grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute + inside the container, the working directory for + the command is root ('/') in the container's filesystem. + The command is simply exec'd, it is not run inside + a shell, so traditional shell instructions ('|', + etc) won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is treated + as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to + the pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: The header field name. This will + be canonicalized upon output, so case-variant + names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported as + a LifecycleHandler and kept for the backward compatibility. + There are no validation of this field and lifecycle + hooks will fail in runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + description: 'Periodic probe of container liveness. Container + will be restarted if the probe fails. Cannot be updated. More + info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + name: + description: Name of the container specified as a DNS_LABEL. Each + container in a pod must have a unique name (DNS_LABEL). Cannot + be updated. + type: string + ports: + description: List of ports to expose from the container. Not specifying + a port here DOES NOT prevent that port from being exposed. Any + port which is listening on the default "0.0.0.0" address inside + a container will be accessible from the network. Modifying this + array with strategic merge patch may corrupt the data. For more + information See https://github.com/kubernetes/kubernetes/issues/108255. + Cannot be updated. + items: + description: ContainerPort represents a network port in a single + container. + properties: + containerPort: + description: Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. + format: int32 + type: integer + hostIP: + description: What host IP to bind the external port to. + type: string + hostPort: + description: Number of port to expose on the host. If specified, + this must be a valid port number, 0 < x < 65536. If HostNetwork + is specified, this must match ContainerPort. Most containers + do not need this. + format: int32 + type: integer + name: + description: If specified, this must be an IANA_SVC_NAME + and unique within the pod. Each named port in a pod must + have a unique name. Name for the port that can be referred + to by services. + type: string + protocol: + default: TCP + description: Protocol for port. Must be UDP, TCP, or SCTP. + Defaults to "TCP". + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + description: 'Periodic probe of container service readiness. Container + will be removed from service endpoints if the probe fails. Cannot + be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + resizePolicy: + description: Resources resize policy for the container. + items: + description: ContainerResizePolicy represents resource resize + policy for the container. + properties: + resourceName: + description: 'Name of the resource to which this resource + resize policy applies. Supported values: cpu, memory.' + type: string + restartPolicy: + description: Restart policy to apply when specified resource + is resized. If not specified, it defaults to NotRequired. + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + description: 'Compute Resources required by this container. Cannot + be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only be + set for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in + pod.spec.resourceClaims of the Pod where this field + is used. It makes that resource available inside a + container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. Requests cannot exceed + Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object + restartPolicy: + description: 'RestartPolicy defines the restart behavior of individual + containers in a pod. This field may only be set for init containers, + and the only allowed value is "Always". For non-init containers + or when this field is not specified, the restart behavior is + defined by the Pod''s restart policy and the container type. + Setting the RestartPolicy as "Always" for the init container + will have the following effect: this init container will be + continually restarted on exit until all regular containers have + terminated. Once all regular containers have completed, all + init containers with restartPolicy "Always" will be shut down. + This lifecycle differs from normal init containers and is often + referred to as a "sidecar" container. Although this init container + still starts in the init container sequence, it does not wait + for the container to complete before proceeding to the next + init container. Instead, the next init container starts immediately + after this init container is started, or after any startupProbe + has successfully completed.' + type: string + securityContext: + description: 'SecurityContext defines the security options the + container should be run with. If set, the fields of SecurityContext + override the equivalent fields of PodSecurityContext. More info: + https://kubernetes.io/docs/tasks/configure-pod-container/security-context/' + properties: + allowPrivilegeEscalation: + description: 'AllowPrivilegeEscalation controls whether a + process can gain more privileges than its parent process. + This bool directly controls if the no_new_privs flag will + be set on the container process. AllowPrivilegeEscalation + is true always when the container is: 1) run as Privileged + 2) has CAP_SYS_ADMIN Note that this field cannot be set + when spec.os.name is windows.' + type: boolean + capabilities: + description: The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the + container runtime. Note that this field cannot be set when + spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + type: object + privileged: + description: Run container in privileged mode. Processes in + privileged containers are essentially equivalent to root + on the host. Defaults to false. Note that this field cannot + be set when spec.os.name is windows. + type: boolean + procMount: + description: procMount denotes the type of proc mount to use + for the containers. The default is DefaultProcMount which + uses the container runtime defaults for readonly paths and + masked paths. This requires the ProcMountType feature flag + to be enabled. Note that this field cannot be set when spec.os.name + is windows. + type: string + readOnlyRootFilesystem: + description: Whether this container has a read-only root filesystem. + Default is false. Note that this field cannot be set when + spec.os.name is windows. + type: boolean + runAsGroup: + description: The GID to run the entrypoint of the container + process. Uses runtime default if unset. May also be set + in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. Note that this field cannot be set when + spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: Indicates that the container must run as a non-root + user. If true, the Kubelet will validate the image at runtime + to ensure that it does not run as UID 0 (root) and fail + to start the container if it does. If unset or false, no + such validation will be performed. May also be set in PodSecurityContext. If + set in both SecurityContext and PodSecurityContext, the + value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: The UID to run the entrypoint of the container + process. Defaults to user specified in image metadata if + unspecified. May also be set in PodSecurityContext. If + set in both SecurityContext and PodSecurityContext, the + value specified in SecurityContext takes precedence. Note + that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random + SELinux context for each container. May also be set in + PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. Note that this field cannot be set when + spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies + to the container. + type: string + role: + description: Role is a SELinux role label that applies + to the container. + type: string + type: + description: Type is a SELinux type label that applies + to the container. + type: string + user: + description: User is a SELinux user label that applies + to the container. + type: string + type: object + seccompProfile: + description: The seccomp options to use by this container. + If seccomp options are provided at both the pod & container + level, the container options override the pod options. Note + that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: localhostProfile indicates a profile defined + in a file on the node should be used. The profile must + be preconfigured on the node to work. Must be a descending + path, relative to the kubelet's configured seccomp profile + location. Must be set if type is "Localhost". Must NOT + be set for any other type. + type: string + type: + description: "type indicates which kind of seccomp profile + will be applied. Valid options are: \n Localhost - a + profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile + should be used. Unconfined - no profile should be applied." + type: string + required: + - type + type: object + windowsOptions: + description: The Windows specific settings applied to all + containers. If unspecified, the options from the PodSecurityContext + will be used. If set in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is + linux. + properties: + gmsaCredentialSpec: + description: GMSACredentialSpec is where the GMSA admission + webhook (https://github.com/kubernetes-sigs/windows-gmsa) + inlines the contents of the GMSA credential spec named + by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the + GMSA credential spec to use. + type: string + hostProcess: + description: HostProcess determines if a container should + be run as a 'Host Process' container. All of a Pod's + containers must have the same effective HostProcess + value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, + if HostProcess is true then HostNetwork must also be + set to true. + type: boolean + runAsUserName: + description: The UserName in Windows to run the entrypoint + of the container process. Defaults to the user specified + in image metadata if unspecified. May also be set in + PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. + type: string + type: object + type: object + startupProbe: + description: 'StartupProbe indicates that the Pod has successfully + initialized. If specified, no other probes are executed until + this completes successfully. If this probe fails, the Pod will + be restarted, just as if the livenessProbe failed. This can + be used to provide different probe parameters at the beginning + of a Pod''s lifecycle, when it might take a long time to load + data or warm a cache, than during steady-state operation. This + cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + stdin: + description: Whether this container should allocate a buffer for + stdin in the container runtime. If this is not set, reads from + stdin in the container will always result in EOF. Default is + false. + type: boolean + stdinOnce: + description: Whether the container runtime should close the stdin + channel after it has been opened by a single attach. When stdin + is true the stdin stream will remain open across multiple attach + sessions. If stdinOnce is set to true, stdin is opened on container + start, is empty until the first client attaches to stdin, and + then remains open and accepts data until the client disconnects, + at which time stdin is closed and remains closed until the container + is restarted. If this flag is false, a container processes that + reads from stdin will never receive an EOF. Default is false + type: boolean + terminationMessagePath: + description: 'Optional: Path at which the file to which the container''s + termination message will be written is mounted into the container''s + filesystem. Message written is intended to be brief final status, + such as an assertion failure message. Will be truncated by the + node if greater than 4096 bytes. The total message length across + all containers will be limited to 12kb. Defaults to /dev/termination-log. + Cannot be updated.' + type: string + terminationMessagePolicy: + description: Indicate how the termination message should be populated. + File will use the contents of terminationMessagePath to populate + the container status message on both success and failure. FallbackToLogsOnError + will use the last chunk of container log output if the termination + message file is empty and the container exited with an error. + The log output is limited to 2048 bytes or 80 lines, whichever + is smaller. Defaults to File. Cannot be updated. + type: string + tty: + description: Whether this container should allocate a TTY for + itself, also requires 'stdin' to be true. Default is false. + type: boolean + volumeDevices: + description: volumeDevices is the list of block devices to be + used by the container. + items: + description: volumeDevice describes a mapping of a raw block + device within a container. + properties: + devicePath: + description: devicePath is the path inside of the container + that the device will be mapped to. + type: string + name: + description: name must match the name of a persistentVolumeClaim + in the pod + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + description: Pod volumes to mount into the container's filesystem. + Cannot be updated. + items: + description: VolumeMount describes a mounting of a Volume within + a container. + properties: + mountPath: + description: Path within the container at which the volume + should be mounted. Must not contain ':'. + type: string + mountPropagation: + description: mountPropagation determines how mounts are + propagated from the host to container and the other way + around. When not set, MountPropagationNone is used. This + field is beta in 1.10. + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: Mounted read-only if true, read-write otherwise + (false or unspecified). Defaults to false. + type: boolean + subPath: + description: Path within the volume from which the container's + volume should be mounted. Defaults to "" (volume's root). + type: string + subPathExpr: + description: Expanded path within the volume from which + the container's volume should be mounted. Behaves similarly + to SubPath but environment variable references $(VAR_NAME) + are expanded using the container's environment. Defaults + to "" (volume's root). SubPathExpr and SubPath are mutually + exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + description: Container's working directory. If not specified, + the container runtime's default will be used, which might be + configured in the container image. Cannot be updated. + type: string + required: + - name + type: object + deno: + description: Deno contains the definition for the Deno function that + is to be executed in KeptnTasks based on the KeptnTaskDefinitions. + properties: + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command + type: string + configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. + properties: + name: + description: Name is the name of the referenced ConfigMap. + type: string + type: object + functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. + properties: + name: + description: Name is the name of the referenced KeptnTaskDefinition. + type: string + type: object + httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. + properties: + url: + description: Url is the URL containing the code of the function. + type: string + type: object + inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. + properties: + code: + description: Code contains the code of the function. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. + type: object + type: object + secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. + type: string + type: object + type: object function: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed state - of cluster Important: Run "make" to regenerate code after modifying - this file' + description: Deprecated Function contains the definition for the function + that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. properties: - configMap: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed - state of cluster Important: Run "make" to regenerate code after - modifying this file' + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command type: string + configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. + properties: + name: + description: Name is the name of the referenced ConfigMap. + type: string + type: object + functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. + properties: + name: + description: Name is the name of the referenced KeptnTaskDefinition. + type: string + type: object + httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. + properties: + url: + description: Url is the URL containing the code of the function. + type: string + type: object + inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. + properties: + code: + description: Code contains the code of the function. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. + type: object + type: object + secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. + type: string + type: object type: object - type: object - type: object - served: true - storage: false - subresources: - status: {} - - name: v1alpha2 - schema: - openAPIV3Schema: - description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions - API - 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: - type: object - spec: - description: KeptnTaskDefinitionSpec defines the desired state of KeptnTaskDefinition - properties: - function: + python: + description: Python contains the definition for the python function + that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. properties: + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command + type: string configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. properties: name: + description: Name is the name of the referenced ConfigMap. type: string type: object functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. properties: name: + description: Name is the name of the referenced KeptnTaskDefinition. type: string type: object httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. properties: url: + description: Url is the URL containing the code of the function. type: string type: object inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. properties: code: + description: Code contains the code of the function. type: string type: object parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. properties: map: additionalProperties: type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. type: object type: object secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. properties: secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. type: string type: object type: object + retries: + default: 10 + description: Retries specifies how many times a job executing the + KeptnTaskDefinition should be restarted in the case of an unsuccessful + attempt. + format: int32 + type: integer + serviceAccount: + description: Service Account to be used in jobs to authenticate with + the Kubernetes API and access cluster resources. + properties: + name: + type: string + required: + - name + type: object + timeout: + default: 5m + description: Timeout specifies the maximum time to wait for the task + to be completed successfully. If the task does not complete successfully + within this time frame, it will be considered to be failed. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + ttlSecondsAfterFinished: + default: 300 + description: TTLSecondsAfterFinished controller makes a job eligible + to be cleaned up after it is finished. The timer starts when the + status shows up to be Complete or Failed. + format: int32 + type: integer + imagePullSecrets: + description: ImagePullSecrets is an optional field to specify the + names of secrets to use for pulling container images + items: + description: LocalObjectReference contains enough information to + let you locate the referenced object inside the same namespace. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + type: array type: object status: - description: KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition + description: Status describes the current state of the KeptnTaskDefinition. properties: function: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed state - of cluster Important: Run "make" to regenerate code after modifying - this file' + description: Function contains status information of the function + definition for the task. properties: configMap: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed - state of cluster Important: Run "make" to regenerate code after - modifying this file' + description: ConfigMap indicates the ConfigMap in which the function + code is stored. type: string type: object type: object type: object served: true - storage: false + storage: true subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions @@ -4221,7 +6611,7 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} --- @@ -4328,7 +6718,192 @@ spec: type: object type: object served: true - storage: false + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1alpha2 + schema: + openAPIV3Schema: + description: KeptnWorkload is the Schema for the keptnworkloads API + 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: + type: object + spec: + description: KeptnWorkloadSpec defines the desired state of KeptnWorkload + properties: + app: + type: string + postDeploymentEvaluations: + items: + type: string + type: array + postDeploymentTasks: + items: + type: string + type: array + preDeploymentEvaluations: + items: + type: string + type: array + preDeploymentTasks: + items: + type: string + type: array + resourceReference: + properties: + kind: + type: string + name: + type: string + uid: + description: UID is a type that holds unique ID values, including + UUIDs. Because we don't ONLY use UUIDs, this is an alias to + string. Being a type captures intent and helps make sure that + UIDs and names do not get conflated. + type: string + required: + - kind + - name + - uid + type: object + version: + type: string + required: + - app + - resourceReference + - version + type: object + status: + description: KeptnWorkloadStatus defines the observed state of KeptnWorkload + properties: + currentVersion: + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1alpha3 + schema: + openAPIV3Schema: + description: KeptnWorkload is the Schema for the keptnworkloads API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnWorkload. + properties: + app: + description: AppName is the name of the KeptnApp containing the KeptnWorkload. + type: string + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnWorkload, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + resourceReference: + description: ResourceReference is a reference to the Kubernetes resource + (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload + is representing. + properties: + kind: + type: string + name: + type: string + uid: + description: UID is a type that holds unique ID values, including + UUIDs. Because we don't ONLY use UUIDs, this is an alias to + string. Being a type captures intent and helps make sure that + UIDs and names do not get conflated. + type: string + required: + - kind + - name + - uid + type: object + version: + description: Version defines the version of the KeptnWorkload. + type: string + required: + - app + - resourceReference + - version + type: object + status: + description: Status describes the current state of the KeptnWorkload. + properties: + currentVersion: + description: CurrentVersion indicates the version that is currently + deployed or being reconciled. + type: string + type: object + type: object + served: true + storage: true subresources: status: {} - additionalPrinterColumns: @@ -4338,7 +6913,7 @@ spec: - jsonPath: .spec.version name: Version type: string - name: v1alpha2 + name: v1beta1 schema: openAPIV3Schema: description: KeptnWorkload is the Schema for the keptnworkloads API @@ -4356,27 +6931,49 @@ spec: metadata: type: object spec: - description: KeptnWorkloadSpec defines the desired state of KeptnWorkload + description: Spec describes the desired state of the KeptnWorkload. properties: app: + description: AppName is the name of the KeptnApp containing the KeptnWorkload. type: string postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. items: type: string type: array postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnWorkload, or in the Keptn namespace. items: type: string type: array preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. items: type: string type: array preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnApp, or in the Keptn namespace. items: type: string type: array resourceReference: + description: ResourceReference is a reference to the Kubernetes resource + (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload + is representing. properties: kind: type: string @@ -4394,6 +6991,7 @@ spec: - uid type: object version: + description: Version defines the version of the KeptnWorkload. type: string required: - app @@ -4401,9 +6999,11 @@ spec: - version type: object status: - description: KeptnWorkloadStatus defines the observed state of KeptnWorkload + description: Status describes the current state of the KeptnWorkload. properties: currentVersion: + description: CurrentVersion indicates the version that is currently + deployed or being reconciled. type: string type: object type: object @@ -4411,17 +7011,83 @@ spec: storage: false subresources: status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptnworkloadinstance-crd.yaml +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptnworkloadinstances.lifecycle.keptn.sh + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' + labels: + app.kubernetes.io/part-of: keptn + crdGroup: lifecycle.keptn.sh + keptn.sh/inject-cert: "true" + app.kubernetes.io/instance: keptn-test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: lifecycle-operator + app.kubernetes.io/version: vmyversion + helm.sh/chart: lifecycle-operator-0.1.0 +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + name: 'lifecycle-webhook-service' + namespace: 'helmtests' + path: /convert + conversionReviewVersions: + - v1 + group: lifecycle.keptn.sh + names: + kind: KeptnWorkloadInstance + listKind: KeptnWorkloadInstanceList + plural: keptnworkloadinstances + shortNames: + - kwi + singular: keptnworkloadinstance + scope: Namespaced + versions: - additionalPrinterColumns: - jsonPath: .spec.app name: AppName type: string + - jsonPath: .spec.workloadName + name: WorkloadName + type: string - jsonPath: .spec.version - name: Version + name: WorkloadVersion type: string - name: v1alpha3 + - jsonPath: .status.currentPhase + name: Phase + type: string + - jsonPath: .status.preDeploymentStatus + name: PreDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.preDeploymentEvaluationStatus + name: PreDeploymentEvaluationStatus + priority: 1 + type: string + - jsonPath: .status.deploymentStatus + name: DeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentStatus + name: PostDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentEvaluationStatus + name: PostDeploymentEvaluationStatus + priority: 1 + type: string + name: v1alpha1 schema: openAPIV3Schema: - description: KeptnWorkload is the Schema for the keptnworkloads API + description: KeptnWorkloadInstance is the Schema for the keptnworkloadinstances + API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -4436,49 +7102,29 @@ spec: metadata: type: object spec: - description: Spec describes the desired state of the KeptnWorkload. + description: KeptnWorkloadInstanceSpec defines the desired state of KeptnWorkloadInstance properties: app: - description: AppName is the name of the KeptnApp containing the KeptnWorkload. type: string postDeploymentEvaluations: - description: PostDeploymentEvaluations is a list of all evaluations - to be performed during the post-deployment phase of the KeptnWorkload. - The items of this list refer to the names of KeptnEvaluationDefinitions - located in the same namespace as the KeptnWorkload, or in the Keptn - namespace. items: type: string type: array postDeploymentTasks: - description: PostDeploymentTasks is a list of all tasks to be performed - during the post-deployment phase of the KeptnWorkload. The items - of this list refer to the names of KeptnTaskDefinitions located - in the same namespace as the KeptnWorkload, or in the Keptn namespace. items: type: string type: array preDeploymentEvaluations: - description: PreDeploymentEvaluations is a list of all evaluations - to be performed during the pre-deployment phase of the KeptnWorkload. - The items of this list refer to the names of KeptnEvaluationDefinitions - located in the same namespace as the KeptnWorkload, or in the Keptn - namespace. items: type: string type: array preDeploymentTasks: - description: PreDeploymentTasks is a list of all tasks to be performed - during the pre-deployment phase of the KeptnWorkload. The items - of this list refer to the names of KeptnTaskDefinitions located - in the same namespace as the KeptnApp, or in the Keptn namespace. items: type: string type: array + previousVersion: + type: string resourceReference: - description: ResourceReference is a reference to the Kubernetes resource - (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload - is representing. properties: kind: type: string @@ -4495,66 +7141,138 @@ spec: - name - uid type: object + traceId: + additionalProperties: + type: string + type: object version: - description: Version defines the version of the KeptnWorkload. + type: string + workloadName: type: string required: - app - resourceReference - version + - workloadName type: object status: - description: Status describes the current state of the KeptnWorkload. + description: KeptnWorkloadInstanceStatus defines the observed state of + KeptnWorkloadInstance properties: - currentVersion: - description: CurrentVersion indicates the version that is currently - deployed or being reconciled. + currentPhase: + type: string + deploymentStatus: + default: Pending + type: string + endTime: + format: date-time + type: string + phaseTraceIDs: + additionalProperties: + additionalProperties: + type: string + description: MapCarrier is a TextMapCarrier that uses a map held + in memory as a storage medium for propagated key-value pairs. + type: object + description: PhaseTraceID is a map storing TraceIDs of OpenTelemetry + spans in lifecycle phases + type: object + postDeploymentEvaluationStatus: + default: Pending + type: string + postDeploymentEvaluationTaskStatus: + items: + properties: + endTime: + format: date-time + type: string + evaluationDefinitionName: + type: string + evaluationName: + type: string + startTime: + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + postDeploymentStatus: + default: Pending + type: string + postDeploymentTaskStatus: + items: + properties: + endTime: + format: date-time + type: string + startTime: + format: date-time + type: string + status: + default: Pending + type: string + taskDefinitionName: + type: string + taskName: + type: string + type: object + type: array + preDeploymentEvaluationStatus: + default: Pending + type: string + preDeploymentEvaluationTaskStatus: + items: + properties: + endTime: + format: date-time + type: string + evaluationDefinitionName: + type: string + evaluationName: + type: string + startTime: + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + preDeploymentStatus: + default: Pending + type: string + preDeploymentTaskStatus: + items: + properties: + endTime: + format: date-time + type: string + startTime: + format: date-time + type: string + status: + default: Pending + type: string + taskDefinitionName: + type: string + taskName: + type: string + type: object + type: array + startTime: + format: date-time + type: string + status: + default: Pending type: string type: object type: object served: true - storage: true + storage: false subresources: status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptnworkloadinstance-crd.yaml -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: keptnworkloadinstances.lifecycle.keptn.sh - annotations: - controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' - labels: - app.kubernetes.io/part-of: keptn - crdGroup: lifecycle.keptn.sh - keptn.sh/inject-cert: "true" - app.kubernetes.io/instance: keptn-test - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: lifecycle-operator - app.kubernetes.io/version: vmyversion - helm.sh/chart: lifecycle-operator-0.1.0 -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - name: 'lifecycle-webhook-service' - namespace: 'helmtests' - path: /convert - conversionReviewVersions: - - v1 - group: lifecycle.keptn.sh - names: - kind: KeptnWorkloadInstance - listKind: KeptnWorkloadInstanceList - plural: keptnworkloadinstances - shortNames: - - kwi - singular: keptnworkloadinstance - scope: Namespaced - versions: - additionalPrinterColumns: - jsonPath: .spec.app name: AppName @@ -4588,7 +7306,7 @@ spec: name: PostDeploymentEvaluationStatus priority: 1 type: string - name: v1alpha1 + name: v1alpha2 schema: openAPIV3Schema: description: KeptnWorkloadInstance is the Schema for the keptnworkloadinstances @@ -4679,8 +7397,6 @@ spec: description: MapCarrier is a TextMapCarrier that uses a map held in memory as a storage medium for propagated key-value pairs. type: object - description: PhaseTraceID is a map storing TraceIDs of OpenTelemetry - spans in lifecycle phases type: object postDeploymentEvaluationStatus: default: Pending @@ -4688,12 +7404,14 @@ spec: postDeploymentEvaluationTaskStatus: items: properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string endTime: format: date-time type: string - evaluationDefinitionName: - type: string - evaluationName: + name: + description: Name is the name of the Evaluation/Task type: string startTime: format: date-time @@ -4709,19 +7427,21 @@ spec: postDeploymentTaskStatus: items: properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string endTime: format: date-time type: string + name: + description: Name is the name of the Evaluation/Task + type: string startTime: format: date-time type: string status: default: Pending type: string - taskDefinitionName: - type: string - taskName: - type: string type: object type: array preDeploymentEvaluationStatus: @@ -4730,12 +7450,14 @@ spec: preDeploymentEvaluationTaskStatus: items: properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string endTime: format: date-time type: string - evaluationDefinitionName: - type: string - evaluationName: + name: + description: Name is the name of the Evaluation/Task type: string startTime: format: date-time @@ -4751,19 +7473,21 @@ spec: preDeploymentTaskStatus: items: properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string endTime: format: date-time type: string + name: + description: Name is the name of the Evaluation/Task + type: string startTime: format: date-time type: string status: default: Pending type: string - taskDefinitionName: - type: string - taskName: - type: string type: object type: array startTime: @@ -4811,7 +7535,7 @@ spec: name: PostDeploymentEvaluationStatus priority: 1 type: string - name: v1alpha2 + name: v1alpha3 schema: openAPIV3Schema: description: KeptnWorkloadInstance is the Schema for the keptnworkloadinstances @@ -4830,29 +7554,53 @@ spec: metadata: type: object spec: - description: KeptnWorkloadInstanceSpec defines the desired state of KeptnWorkloadInstance + description: Spec describes the desired state of the KeptnWorkloadInstance. properties: app: + description: AppName is the name of the KeptnApp containing the KeptnWorkload. type: string postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. items: type: string type: array postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnWorkload, or in the Keptn namespace. items: type: string type: array preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. items: type: string type: array preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnApp, or in the Keptn namespace. items: type: string type: array previousVersion: + description: PreviousVersion is the version of the KeptnWorkload that + has been deployed prior to this version. type: string resourceReference: + description: ResourceReference is a reference to the Kubernetes resource + (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload + is representing. properties: kind: type: string @@ -4872,10 +7620,13 @@ spec: traceId: additionalProperties: type: string + description: TraceId contains the OpenTelemetry trace ID. type: object version: + description: Version defines the version of the KeptnWorkload. type: string workloadName: + description: WorkloadName is the name of the KeptnWorkload. type: string required: - app @@ -4884,15 +7635,21 @@ spec: - workloadName type: object status: - description: KeptnWorkloadInstanceStatus defines the observed state of - KeptnWorkloadInstance + description: Status describes the current state of the KeptnWorkloadInstance. properties: currentPhase: + description: 'CurrentPhase indicates the current phase of the KeptnWorkloadInstance. + This can be: - PreDeploymentTasks - PreDeploymentEvaluations - Deployment + - PostDeploymentTasks - PostDeploymentEvaluations' type: string deploymentStatus: default: Pending + description: DeploymentStatus indicates the current status of the + KeptnWorkloadInstance's Deployment phase. type: string endTime: + description: EndTime represents the time at which the deployment of + the KeptnWorkloadInstance finished. format: date-time type: string phaseTraceIDs: @@ -4902,23 +7659,33 @@ spec: description: MapCarrier is a TextMapCarrier that uses a map held in memory as a storage medium for propagated key-value pairs. type: object + description: PhaseTraceIDs contains the trace IDs of the OpenTelemetry + spans of each phase of the KeptnWorkloadInstance type: object postDeploymentEvaluationStatus: default: Pending + description: PostDeploymentEvaluationStatus indicates the current + status of the KeptnWorkloadInstance's PostDeploymentEvaluation phase. type: string postDeploymentEvaluationTaskStatus: + description: PostDeploymentEvaluationTaskStatus indicates the current + state of each postDeploymentEvaluation of the KeptnWorkloadInstance. items: properties: definitionName: description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition type: string endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. format: date-time type: string name: description: Name is the name of the Evaluation/Task type: string startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. format: date-time type: string status: @@ -4928,20 +7695,28 @@ spec: type: array postDeploymentStatus: default: Pending + description: PostDeploymentStatus indicates the current status of + the KeptnWorkloadInstance's PostDeployment phase. type: string postDeploymentTaskStatus: + description: PostDeploymentTaskStatus indicates the current state + of each postDeploymentTask of the KeptnWorkloadInstance. items: properties: definitionName: description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition type: string endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. format: date-time type: string name: description: Name is the name of the Evaluation/Task type: string startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. format: date-time type: string status: @@ -4951,20 +7726,28 @@ spec: type: array preDeploymentEvaluationStatus: default: Pending + description: PreDeploymentEvaluationStatus indicates the current status + of the KeptnWorkloadInstance's PreDeploymentEvaluation phase. type: string preDeploymentEvaluationTaskStatus: + description: PreDeploymentEvaluationTaskStatus indicates the current + state of each preDeploymentEvaluation of the KeptnWorkloadInstance. items: properties: definitionName: description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition type: string endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. format: date-time type: string name: description: Name is the name of the Evaluation/Task type: string startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. format: date-time type: string status: @@ -4974,20 +7757,28 @@ spec: type: array preDeploymentStatus: default: Pending + description: PreDeploymentStatus indicates the current status of the + KeptnWorkloadInstance's PreDeployment phase. type: string preDeploymentTaskStatus: + description: PreDeploymentTaskStatus indicates the current state of + each preDeploymentTask of the KeptnWorkloadInstance. items: properties: definitionName: description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition type: string endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. format: date-time type: string name: description: Name is the name of the Evaluation/Task type: string startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. format: date-time type: string status: @@ -4996,17 +7787,49 @@ spec: type: object type: array startTime: + description: StartTime represents the time at which the deployment + of the KeptnWorkloadInstance started. format: date-time type: string status: default: Pending + description: Status represents the overall status of the KeptnWorkloadInstance. type: string type: object type: object served: true - storage: false + storage: true subresources: status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptnworkloadversion-crd.yaml +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptnworkloadversions.lifecycle.keptn.sh + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' + labels: + app.kubernetes.io/part-of: keptn + crdGroup: lifecycle.keptn.sh + keptn.sh/inject-cert: "true" + app.kubernetes.io/instance: keptn-test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: lifecycle-operator + app.kubernetes.io/version: vmyversion + helm.sh/chart: lifecycle-operator-0.1.0 +spec: + group: lifecycle.keptn.sh + names: + kind: KeptnWorkloadVersion + listKind: KeptnWorkloadVersionList + plural: keptnworkloadversions + shortNames: + - kwv + singular: keptnworkloadversion + scope: Namespaced + versions: - additionalPrinterColumns: - jsonPath: .spec.app name: AppName @@ -5040,10 +7863,10 @@ spec: name: PostDeploymentEvaluationStatus priority: 1 type: string - name: v1alpha3 + name: v1alpha4 schema: openAPIV3Schema: - description: KeptnWorkloadInstance is the Schema for the keptnworkloadinstances + description: KeptnWorkloadVersion is the Schema for the keptnworkloadversions API properties: apiVersion: @@ -5059,7 +7882,7 @@ spec: metadata: type: object spec: - description: Spec describes the desired state of the KeptnWorkloadInstance. + description: Spec describes the desired state of the KeptnWorkloadVersion. properties: app: description: AppName is the name of the KeptnApp containing the KeptnWorkload. @@ -5140,21 +7963,21 @@ spec: - workloadName type: object status: - description: Status describes the current state of the KeptnWorkloadInstance. + description: Status describes the current state of the KeptnWorkloadVersion. properties: currentPhase: - description: 'CurrentPhase indicates the current phase of the KeptnWorkloadInstance. + description: 'CurrentPhase indicates the current phase of the KeptnWorkloadVersion. This can be: - PreDeploymentTasks - PreDeploymentEvaluations - Deployment - PostDeploymentTasks - PostDeploymentEvaluations' type: string deploymentStatus: default: Pending description: DeploymentStatus indicates the current status of the - KeptnWorkloadInstance's Deployment phase. + KeptnWorkloadVersion's Deployment phase. type: string endTime: description: EndTime represents the time at which the deployment of - the KeptnWorkloadInstance finished. + the KeptnWorkloadVersion finished. format: date-time type: string phaseTraceIDs: @@ -5165,16 +7988,16 @@ spec: in memory as a storage medium for propagated key-value pairs. type: object description: PhaseTraceIDs contains the trace IDs of the OpenTelemetry - spans of each phase of the KeptnWorkloadInstance + spans of each phase of the KeptnWorkloadVersion type: object postDeploymentEvaluationStatus: default: Pending description: PostDeploymentEvaluationStatus indicates the current - status of the KeptnWorkloadInstance's PostDeploymentEvaluation phase. + status of the KeptnWorkloadVersion's PostDeploymentEvaluation phase. type: string postDeploymentEvaluationTaskStatus: description: PostDeploymentEvaluationTaskStatus indicates the current - state of each postDeploymentEvaluation of the KeptnWorkloadInstance. + state of each postDeploymentEvaluation of the KeptnWorkloadVersion. items: properties: definitionName: @@ -5201,11 +8024,11 @@ spec: postDeploymentStatus: default: Pending description: PostDeploymentStatus indicates the current status of - the KeptnWorkloadInstance's PostDeployment phase. + the KeptnWorkloadVersion's PostDeployment phase. type: string postDeploymentTaskStatus: description: PostDeploymentTaskStatus indicates the current state - of each postDeploymentTask of the KeptnWorkloadInstance. + of each postDeploymentTask of the KeptnWorkloadVersion. items: properties: definitionName: @@ -5232,11 +8055,11 @@ spec: preDeploymentEvaluationStatus: default: Pending description: PreDeploymentEvaluationStatus indicates the current status - of the KeptnWorkloadInstance's PreDeploymentEvaluation phase. + of the KeptnWorkloadVersion's PreDeploymentEvaluation phase. type: string preDeploymentEvaluationTaskStatus: description: PreDeploymentEvaluationTaskStatus indicates the current - state of each preDeploymentEvaluation of the KeptnWorkloadInstance. + state of each preDeploymentEvaluation of the KeptnWorkloadVersion. items: properties: definitionName: @@ -5263,11 +8086,11 @@ spec: preDeploymentStatus: default: Pending description: PreDeploymentStatus indicates the current status of the - KeptnWorkloadInstance's PreDeployment phase. + KeptnWorkloadVersion's PreDeployment phase. type: string preDeploymentTaskStatus: description: PreDeploymentTaskStatus indicates the current state of - each preDeploymentTask of the KeptnWorkloadInstance. + each preDeploymentTask of the KeptnWorkloadVersion. items: properties: definitionName: @@ -5293,12 +8116,12 @@ spec: type: array startTime: description: StartTime represents the time at which the deployment - of the KeptnWorkloadInstance started. + of the KeptnWorkloadVersion started. format: date-time type: string status: default: Pending - description: Status represents the overall status of the KeptnWorkloadInstance. + description: Status represents the overall status of the KeptnWorkloadVersion. type: string type: object type: object @@ -5306,35 +8129,6 @@ spec: storage: true subresources: status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptnworkloadversion-crd.yaml -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: keptnworkloadversions.lifecycle.keptn.sh - annotations: - controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' - labels: - app.kubernetes.io/part-of: keptn - crdGroup: lifecycle.keptn.sh - keptn.sh/inject-cert: "true" - app.kubernetes.io/instance: keptn-test - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: lifecycle-operator - app.kubernetes.io/version: vmyversion - helm.sh/chart: lifecycle-operator-0.1.0 -spec: - group: lifecycle.keptn.sh - names: - kind: KeptnWorkloadVersion - listKind: KeptnWorkloadVersionList - plural: keptnworkloadversions - shortNames: - - kwv - singular: keptnworkloadversion - scope: Namespaced - versions: - additionalPrinterColumns: - jsonPath: .spec.app name: AppName @@ -5368,7 +8162,7 @@ spec: name: PostDeploymentEvaluationStatus priority: 1 type: string - name: v1alpha4 + name: v1beta1 schema: openAPIV3Schema: description: KeptnWorkloadVersion is the Schema for the keptnworkloadversions @@ -5631,7 +8425,7 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} --- diff --git a/.github/scripts/.helm-tests/lifecycle-with-certs/result.yaml b/.github/scripts/.helm-tests/lifecycle-with-certs/result.yaml index 8863a68ae6..627128b087 100644 --- a/.github/scripts/.helm-tests/lifecycle-with-certs/result.yaml +++ b/.github/scripts/.helm-tests/lifecycle-with-certs/result.yaml @@ -355,6 +355,103 @@ spec: storage: true subresources: status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnApp is the Schema for the keptnapps API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnApp. + properties: + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + revision: + default: 1 + description: Revision can be modified to trigger another deployment + of a KeptnApp of the same version. This can be used for restarting + a KeptnApp which failed to deploy, e.g. due to a failed preDeploymentEvaluation/preDeploymentTask. + type: integer + version: + description: Version defines the version of the application. For automatically + created KeptnApps, the version is a function of all KeptnWorkloads + that are part of the KeptnApp. + type: string + workloads: + description: Workloads is a list of all KeptnWorkloads that are part + of the KeptnApp. + items: + description: KeptnWorkloadRef refers to a KeptnWorkload that is + part of a KeptnApp + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: array + required: + - version + type: object + status: + description: Status describes the current state of the KeptnApp. + properties: + currentVersion: + description: CurrentVersion indicates the version that is currently + deployed or being reconciled. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} --- # Source: keptn/charts/lifecycleOperator/templates/keptnappcreationrequest-crd.yaml apiVersion: apiextensions.k8s.io/v1 @@ -418,6 +515,42 @@ spec: storage: true subresources: status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnAppCreationRequest is the Schema for the keptnappcreationrequests + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnAppCreationRequest. + properties: + appName: + description: AppName is the name of the KeptnApp the KeptnAppCreationRequest + should create if no user-defined object with that name is found. + type: string + required: + - appName + type: object + status: + description: Status describes the current state of the KeptnAppCreationRequest. + type: string + type: object + served: true + storage: false + subresources: + status: {} --- # Source: keptn/charts/lifecycleOperator/templates/keptnappversion-crd.yaml apiVersion: apiextensions.k8s.io/v1 @@ -1237,37 +1370,40 @@ spec: storage: true subresources: status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptnconfig-crd.yaml -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: keptnconfigs.options.keptn.sh - annotations: - controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' - labels: - app.kubernetes.io/part-of: keptn - crdGroup: lifecycle.keptn.sh - keptn.sh/inject-cert: "true" - app.kubernetes.io/instance: keptn-test - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: lifecycle-operator - app.kubernetes.io/version: vmyversion - helm.sh/chart: lifecycle-operator-0.1.0 -spec: - group: options.keptn.sh - names: - kind: KeptnConfig - listKind: KeptnConfigList - plural: keptnconfigs - singular: keptnconfig - scope: Namespaced - versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.appName + name: AppName + type: string + - jsonPath: .spec.version + name: Version + type: string + - jsonPath: .status.currentPhase + name: Phase + type: string + - jsonPath: .status.preDeploymentStatus + name: PreDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.preDeploymentEvaluationStatus + name: PreDeploymentEvaluationStatus + priority: 1 + type: string + - jsonPath: .status.workloadOverallStatus + name: WorkloadOverallStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentStatus + name: PostDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentEvaluationStatus + name: PostDeploymentEvaluationStatus + priority: 1 + type: string + name: v1beta1 schema: openAPIV3Schema: - description: KeptnConfig is the Schema for the keptnconfigs API + description: KeptnAppVersion is the Schema for the keptnappversions API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -1282,37 +1418,281 @@ spec: metadata: type: object spec: - description: KeptnConfigSpec defines the desired state of KeptnConfig + description: Spec describes the desired state of the KeptnAppVersion. properties: - OTelCollectorUrl: - description: OTelCollectorUrl can be used to set the Open Telemetry - collector that the lifecycle operator should use + appName: + description: AppName is the name of the KeptnApp. type: string - cloudEventsEndpoint: - description: CloudEventsEndpoint can be used to set the endpoint where - Cloud Events should be posted by the lifecycle operator + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + previousVersion: + description: PreviousVersion is the version of the KeptnApp that has + been deployed prior to this version. type: string - keptnAppCreationRequestTimeoutSeconds: - default: 30 - description: KeptnAppCreationRequestTimeoutSeconds is used to set - the interval in which automatic app discovery searches for workload - to put into the same auto-generated KeptnApp + revision: + default: 1 + description: Revision can be modified to trigger another deployment + of a KeptnApp of the same version. This can be used for restarting + a KeptnApp which failed to deploy, e.g. due to a failed preDeploymentEvaluation/preDeploymentTask. type: integer - type: object - status: - description: unused field - type: string - type: object - served: true - storage: true - subresources: - status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptnevaluation-crd.yaml + traceId: + additionalProperties: + type: string + description: TraceId contains the OpenTelemetry trace ID. + type: object + version: + description: Version defines the version of the application. For automatically + created KeptnApps, the version is a function of all KeptnWorkloads + that are part of the KeptnApp. + type: string + workloads: + description: Workloads is a list of all KeptnWorkloads that are part + of the KeptnApp. + items: + description: KeptnWorkloadRef refers to a KeptnWorkload that is + part of a KeptnApp + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: array + required: + - appName + - version + type: object + status: + description: Status describes the current state of the KeptnAppVersion. + properties: + currentPhase: + description: CurrentPhase indicates the current phase of the KeptnAppVersion. + type: string + endTime: + description: EndTime represents the time at which the deployment of + the KeptnAppVersion finished. + format: date-time + type: string + phaseTraceIDs: + additionalProperties: + additionalProperties: + type: string + description: MapCarrier is a TextMapCarrier that uses a map held + in memory as a storage medium for propagated key-value pairs. + type: object + description: PhaseTraceIDs contains the trace IDs of the OpenTelemetry + spans of each phase of the KeptnAppVersion. + type: object + postDeploymentEvaluationStatus: + default: Pending + description: PostDeploymentEvaluationStatus indicates the current + status of the KeptnAppVersion's PostDeploymentEvaluation phase. + type: string + postDeploymentEvaluationTaskStatus: + description: PostDeploymentEvaluationTaskStatus indicates the current + state of each postDeploymentEvaluation of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + postDeploymentStatus: + default: Pending + description: PostDeploymentStatus indicates the current status of + the KeptnAppVersion's PostDeployment phase. + type: string + postDeploymentTaskStatus: + description: PostDeploymentTaskStatus indicates the current state + of each postDeploymentTask of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + preDeploymentEvaluationStatus: + default: Pending + description: PreDeploymentEvaluationStatus indicates the current status + of the KeptnAppVersion's PreDeploymentEvaluation phase. + type: string + preDeploymentEvaluationTaskStatus: + description: PreDeploymentEvaluationTaskStatus indicates the current + state of each preDeploymentEvaluation of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + preDeploymentStatus: + default: Pending + description: PreDeploymentStatus indicates the current status of the + KeptnAppVersion's PreDeployment phase. + type: string + preDeploymentTaskStatus: + description: PreDeploymentTaskStatus indicates the current state of + each preDeploymentTask of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + startTime: + description: StartTime represents the time at which the deployment + of the KeptnAppVersion started. + format: date-time + type: string + status: + default: Pending + description: Status represents the overall status of the KeptnAppVersion. + type: string + workloadOverallStatus: + default: Pending + description: WorkloadOverallStatus indicates the current status of + the KeptnAppVersion's Workload deployment phase. + type: string + workloadStatus: + description: WorkloadStatus contains the current status of each KeptnWorkload + that is part of the KeptnAppVersion. + items: + properties: + status: + default: Pending + description: Status indicates the current status of the KeptnWorkload. + type: string + workload: + description: Workload refers to a KeptnWorkload that is part + of the KeptnAppVersion. + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: object + type: array + type: object + type: object + served: true + storage: false + subresources: + status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptnconfig-crd.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: keptnevaluations.lifecycle.keptn.sh + name: keptnconfigs.options.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' @@ -1326,33 +1706,103 @@ metadata: app.kubernetes.io/version: vmyversion helm.sh/chart: lifecycle-operator-0.1.0 spec: - group: lifecycle.keptn.sh + group: options.keptn.sh names: - kind: KeptnEvaluation - listKind: KeptnEvaluationList - plural: keptnevaluations - shortNames: - - ke - singular: keptnevaluation + kind: KeptnConfig + listKind: KeptnConfigList + plural: keptnconfigs + singular: keptnconfig scope: Namespaced versions: - - additionalPrinterColumns: - - jsonPath: .spec.appName - name: AppName - type: string - - jsonPath: .spec.appVersion - name: AppVersion - type: string - - jsonPath: .spec.workload - name: WorkloadName - type: string - - jsonPath: .spec.workloadVersion - name: WorkloadVersion - type: string - - jsonPath: .status.retryCount - name: RetryCount - type: string - - jsonPath: .status.evaluationStatus + - name: v1alpha1 + schema: + openAPIV3Schema: + description: KeptnConfig is the Schema for the keptnconfigs API + 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: + type: object + spec: + description: KeptnConfigSpec defines the desired state of KeptnConfig + properties: + OTelCollectorUrl: + description: OTelCollectorUrl can be used to set the Open Telemetry + collector that the lifecycle operator should use + type: string + cloudEventsEndpoint: + description: CloudEventsEndpoint can be used to set the endpoint where + Cloud Events should be posted by the lifecycle operator + type: string + keptnAppCreationRequestTimeoutSeconds: + default: 30 + description: KeptnAppCreationRequestTimeoutSeconds is used to set + the interval in which automatic app discovery searches for workload + to put into the same auto-generated KeptnApp + type: integer + type: object + status: + description: unused field + type: string + type: object + served: true + storage: true + subresources: + status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptnevaluation-crd.yaml +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptnevaluations.lifecycle.keptn.sh + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' + labels: + app.kubernetes.io/part-of: keptn + crdGroup: lifecycle.keptn.sh + keptn.sh/inject-cert: "true" + app.kubernetes.io/instance: keptn-test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: lifecycle-operator + app.kubernetes.io/version: vmyversion + helm.sh/chart: lifecycle-operator-0.1.0 +spec: + group: lifecycle.keptn.sh + names: + kind: KeptnEvaluation + listKind: KeptnEvaluationList + plural: keptnevaluations + shortNames: + - ke + singular: keptnevaluation + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.appName + name: AppName + type: string + - jsonPath: .spec.appVersion + name: AppVersion + type: string + - jsonPath: .spec.workload + name: WorkloadName + type: string + - jsonPath: .spec.workloadVersion + name: WorkloadVersion + type: string + - jsonPath: .status.retryCount + name: RetryCount + type: string + - jsonPath: .status.evaluationStatus name: EvaluationStatus type: string - jsonPath: .status.overallStatus @@ -1692,6 +2142,150 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.appName + name: AppName + type: string + - jsonPath: .spec.appVersion + name: AppVersion + type: string + - jsonPath: .spec.workload + name: WorkloadName + type: string + - jsonPath: .spec.workloadVersion + name: WorkloadVersion + type: string + - jsonPath: .status.retryCount + name: RetryCount + type: string + - jsonPath: .status.evaluationStatus + name: EvaluationStatus + type: string + - jsonPath: .status.overallStatus + name: OverallStatus + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnEvaluation is the Schema for the keptnevaluations API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnEvaluation. + properties: + appName: + description: AppName defines the KeptnApp for which the KeptnEvaluation + is done. + type: string + appVersion: + description: AppVersion defines the version of the KeptnApp for which + the KeptnEvaluation is done. + type: string + checkType: + description: Type indicates whether the KeptnEvaluation is part of + the pre- or postDeployment phase. + type: string + evaluationDefinition: + description: EvaluationDefinition refers to the name of the KeptnEvaluationDefinition + which includes the objectives for the KeptnEvaluation. The KeptnEvaluationDefinition + can be located in the same namespace as the KeptnEvaluation, or + in the Keptn namespace. + type: string + failAction: + type: string + retries: + default: 10 + description: Retries indicates how many times the KeptnEvaluation + can be attempted in the case of an error or missed evaluation objective, + before considering the KeptnEvaluation to be failed. + type: integer + retryInterval: + default: 5s + description: RetryInterval specifies the interval at which the KeptnEvaluation + is retried in the case of an error or a missed objective. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + workload: + description: Workload defines the KeptnWorkload for which the KeptnEvaluation + is done. + type: string + workloadVersion: + description: WorkloadVersion defines the version of the KeptnWorkload + for which the KeptnEvaluation is done. + type: string + required: + - evaluationDefinition + - workloadVersion + type: object + status: + description: Status describes the current state of the KeptnEvaluation. + properties: + endTime: + description: EndTime represents the time at which the KeptnEvaluation + finished. + format: date-time + type: string + evaluationStatus: + additionalProperties: + properties: + message: + description: Message contains additional information about the + evaluation of an objective. This can include explanations + about why an evaluation has failed (e.g. due to a missed objective), + or if there was any error during the evaluation of the objective. + type: string + status: + description: Status indicates the status of the objective being + evaluated. + type: string + value: + description: Value represents the value of the KeptnMetric being + evaluated. + type: string + required: + - status + - value + type: object + description: EvaluationStatus describes the status of each objective + of the KeptnEvaluationDefinition referenced by the KeptnEvaluation. + type: object + overallStatus: + default: Pending + description: OverallStatus describes the overall status of the KeptnEvaluation. + The Overall status is derived from the status of the individual + objectives of the KeptnEvaluationDefinition referenced by the KeptnEvaluation. + type: string + retryCount: + default: 0 + description: RetryCount indicates how many times the KeptnEvaluation + has been attempted already. + type: integer + startTime: + description: StartTime represents the time at which the KeptnEvaluation + started. + format: date-time + type: string + required: + - evaluationStatus + - overallStatus + - retryCount + type: object + type: object + served: true + storage: false + subresources: + status: {} --- # Source: keptn/charts/lifecycleOperator/templates/keptnevaluationdefinition-crd.yaml apiVersion: apiextensions.k8s.io/v1 @@ -1885,30 +2479,92 @@ spec: storage: true subresources: status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptnevaluationprovider-crd.yaml -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: keptnevaluationproviders.lifecycle.keptn.sh - annotations: - controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' - labels: - app.kubernetes.io/part-of: keptn - crdGroup: lifecycle.keptn.sh - keptn.sh/inject-cert: "true" - app.kubernetes.io/instance: keptn-test - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: lifecycle-operator - app.kubernetes.io/version: vmyversion - helm.sh/chart: lifecycle-operator-0.1.0 -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnEvaluationDefinition is the Schema for the keptnevaluationdefinitions + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnEvaluationDefinition. + properties: + objectives: + description: Objectives is a list of objectives that have to be met + for a KeptnEvaluation referencing this KeptnEvaluationDefinition + to be successful. + items: + properties: + evaluationTarget: + description: EvaluationTarget specifies the target value for + the references KeptnMetric. Needs to start with either '<' + or '>', followed by the target value (e.g. '<10'). + type: string + keptnMetricRef: + description: KeptnMetricRef references the KeptnMetric that + should be evaluated. + properties: + name: + description: Name is the name of the referenced KeptnMetric. + type: string + namespace: + description: Namespace is the namespace where the referenced + KeptnMetric is located. + type: string + required: + - name + type: object + required: + - evaluationTarget + - keptnMetricRef + type: object + type: array + required: + - objectives + type: object + status: + description: unused field + type: string + type: object + served: true + storage: false + subresources: + status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptnevaluationprovider-crd.yaml +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptnevaluationproviders.lifecycle.keptn.sh + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' + labels: + app.kubernetes.io/part-of: keptn + crdGroup: lifecycle.keptn.sh + keptn.sh/inject-cert: "true" + app.kubernetes.io/instance: keptn-test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: lifecycle-operator + app.kubernetes.io/version: vmyversion + helm.sh/chart: lifecycle-operator-0.1.0 +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: name: 'lifecycle-webhook-service' namespace: 'helmtests' path: /convert @@ -2479,6 +3135,161 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.appVersion + name: AppVersion + type: string + - jsonPath: .spec.workload + name: WorkloadName + type: string + - jsonPath: .spec.workloadVersion + name: WorkloadVersion + type: string + - jsonPath: .status.jobName + name: Job Name + type: string + - jsonPath: .status.status + name: Status + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnTask is the Schema for the keptntasks API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnTask. + properties: + checkType: + description: Type indicates whether the KeptnTask is part of the pre- + or postDeployment phase. + type: string + context: + description: Context contains contextual information about the task + execution. + properties: + appName: + description: AppName the name of the KeptnApp the KeptnTask is + being executed for. + type: string + appVersion: + description: AppVersion the version of the KeptnApp the KeptnTask + is being executed for. + type: string + objectType: + description: ObjectType indicates whether the KeptnTask is being + executed for a KeptnApp or KeptnWorkload. + type: string + taskType: + description: TaskType indicates whether the KeptnTask is part + of the pre- or postDeployment phase. + type: string + workloadName: + description: WorkloadName the name of the KeptnWorkload the KeptnTask + is being executed for. + type: string + workloadVersion: + description: WorkloadVersion the version of the KeptnWorkload + the KeptnTask is being executed for. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed to + the job that executes the task. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's content + will be a json encoded string containing all properties of the + map provided. + type: object + type: object + retries: + default: 10 + description: Retries indicates how many times the KeptnTask can be + attempted in the case of an error before considering the KeptnTask + to be failed. + format: int32 + type: integer + secureParameters: + description: SecureParameters contains secure parameters that will + be passed to the job that executes the task. These will be stored + and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key of the + referenced secret. + type: string + type: object + taskDefinition: + description: TaskDefinition refers to the name of the KeptnTaskDefinition + which includes the specification for the task to be performed. The + KeptnTaskDefinition can be located in the same namespace as the + KeptnTask, or in the Keptn namespace. + type: string + timeout: + default: 5m + description: Timeout specifies the maximum time to wait for the task + to be completed successfully. If the task does not complete successfully + within this time frame, it will be considered to be failed. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + required: + - taskDefinition + type: object + status: + description: Status describes the current state of the KeptnTask. + properties: + endTime: + description: EndTime represents the time at which the KeptnTask finished. + format: date-time + type: string + jobName: + description: JobName is the name of the Job executing the Task. + type: string + message: + description: Message contains information about unexpected errors + encountered during the execution of the KeptnTask. + type: string + reason: + description: Reason contains more information about the reason for + the last transition of the Job executing the KeptnTask. + type: string + startTime: + description: StartTime represents the time at which the KeptnTask + started. + format: date-time + type: string + status: + default: Pending + description: Status represents the overall state of the KeptnTask. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} --- # Source: keptn/charts/lifecycleOperator/templates/keptntaskdefinition-crd.yaml apiVersion: apiextensions.k8s.io/v1 @@ -2562,105 +3373,1684 @@ spec: type: string type: object type: object - type: object - status: - description: KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition - properties: + type: object + status: + description: KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition + properties: + function: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed state + of cluster Important: Run "make" to regenerate code after modifying + this file' + properties: + configMap: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed + state of cluster Important: Run "make" to regenerate code after + modifying this file' + type: string + type: object + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha2 + schema: + openAPIV3Schema: + description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions + API + 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: + type: object + spec: + description: KeptnTaskDefinitionSpec defines the desired state of KeptnTaskDefinition + properties: + function: + properties: + configMapRef: + properties: + name: + type: string + type: object + functionRef: + properties: + name: + type: string + type: object + httpRef: + properties: + url: + type: string + type: object + inline: + properties: + code: + type: string + type: object + parameters: + properties: + map: + additionalProperties: + type: string + type: object + type: object + secureParameters: + properties: + secret: + type: string + type: object + type: object + type: object + status: + description: KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition + properties: + function: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed state + of cluster Important: Run "make" to regenerate code after modifying + this file' + properties: + configMap: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed + state of cluster Important: Run "make" to regenerate code after + modifying this file' + type: string + type: object + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha3 + schema: + openAPIV3Schema: + description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnTaskDefinition. + properties: + automountServiceAccountToken: + description: automountServiceAccountToken allows to enable K8s to + assign cluster API credentials to a pod, if set to false the pod + will decline the serviceAccount + properties: + type: + type: boolean + required: + - type + type: object + container: + description: Container contains the definition for the container that + is to be used in Job based on the KeptnTaskDefinitions. + properties: + args: + description: 'Arguments to the entrypoint. The container image''s + CMD is used if this is not provided. Variable references $(VAR_NAME) + are expanded using the container''s environment. If a variable + cannot be resolved, the reference in the input string will be + unchanged. Double $$ are reduced to a single $, which allows + for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references + will never be expanded, regardless of whether the variable exists + or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + command: + description: 'Entrypoint array. Not executed within a shell. The + container image''s ENTRYPOINT is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container''s + environment. If a variable cannot be resolved, the reference + in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: + i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether + the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + env: + description: List of environment variables to set in the container. + Cannot be updated. + items: + description: EnvVar represents an environment variable present + in a Container. + properties: + name: + description: Name of the environment variable. Must be a + C_IDENTIFIER. + type: string + value: + description: 'Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in + the container and any service environment variables. If + a variable cannot be resolved, the reference in the input + string will be unchanged. Double $$ are reduced to a single + $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless + of whether the variable exists or not. Defaults to "".' + type: string + valueFrom: + description: Source for the environment variable's value. + Cannot be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the ConfigMap or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: 'Selects a field of the pod: supports metadata.name, + metadata.namespace, `metadata.labels['''']`, + `metadata.annotations['''']`, spec.nodeName, + spec.serviceAccountName, status.hostIP, status.podIP, + status.podIPs.' + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the + specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: 'Selects a resource of the container: only + resources limits and requests (limits.cpu, limits.memory, + limits.ephemeral-storage, requests.cpu, requests.memory + and requests.ephemeral-storage) are currently supported.' + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the + exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + description: List of sources to populate environment variables + in the container. The keys defined within a source must be a + C_IDENTIFIER. All invalid keys will be reported as an event + when the container is starting. When a key exists in multiple + sources, the value associated with the last source will take + precedence. Values defined by an Env with a duplicate key will + take precedence. Cannot be updated. + items: + description: EnvFromSource represents the source of a set of + ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend to each key + in the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the Secret must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + description: 'Container image name. More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config management + to default or override container images in workload controllers + like Deployments and StatefulSets.' + type: string + imagePullPolicy: + description: 'Image pull policy. One of Always, Never, IfNotPresent. + Defaults to Always if :latest tag is specified, or IfNotPresent + otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images' + type: string + lifecycle: + description: Actions that the management system should take in + response to container lifecycle events. Cannot be updated. + properties: + postStart: + description: 'PostStart is called immediately after a container + is created. If the handler fails, the container is terminated + and restarted according to its restart policy. Other management + of the container blocks until the hook completes. More info: + https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute + inside the container, the working directory for + the command is root ('/') in the container's filesystem. + The command is simply exec'd, it is not run inside + a shell, so traditional shell instructions ('|', + etc) won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is treated + as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to + the pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: The header field name. This will + be canonicalized upon output, so case-variant + names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported as + a LifecycleHandler and kept for the backward compatibility. + There are no validation of this field and lifecycle + hooks will fail in runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + description: 'PreStop is called immediately before a container + is terminated due to an API request or management event + such as liveness/startup probe failure, preemption, resource + contention, etc. The handler is not called if the container + crashes or exits. The Pod''s termination grace period countdown + begins before the PreStop hook is executed. Regardless of + the outcome of the handler, the container will eventually + terminate within the Pod''s termination grace period (unless + delayed by finalizers). Other management of the container + blocks until the hook completes or until the termination + grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute + inside the container, the working directory for + the command is root ('/') in the container's filesystem. + The command is simply exec'd, it is not run inside + a shell, so traditional shell instructions ('|', + etc) won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is treated + as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to + the pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: The header field name. This will + be canonicalized upon output, so case-variant + names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported as + a LifecycleHandler and kept for the backward compatibility. + There are no validation of this field and lifecycle + hooks will fail in runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + description: 'Periodic probe of container liveness. Container + will be restarted if the probe fails. Cannot be updated. More + info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + name: + description: Name of the container specified as a DNS_LABEL. Each + container in a pod must have a unique name (DNS_LABEL). Cannot + be updated. + type: string + ports: + description: List of ports to expose from the container. Not specifying + a port here DOES NOT prevent that port from being exposed. Any + port which is listening on the default "0.0.0.0" address inside + a container will be accessible from the network. Modifying this + array with strategic merge patch may corrupt the data. For more + information See https://github.com/kubernetes/kubernetes/issues/108255. + Cannot be updated. + items: + description: ContainerPort represents a network port in a single + container. + properties: + containerPort: + description: Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. + format: int32 + type: integer + hostIP: + description: What host IP to bind the external port to. + type: string + hostPort: + description: Number of port to expose on the host. If specified, + this must be a valid port number, 0 < x < 65536. If HostNetwork + is specified, this must match ContainerPort. Most containers + do not need this. + format: int32 + type: integer + name: + description: If specified, this must be an IANA_SVC_NAME + and unique within the pod. Each named port in a pod must + have a unique name. Name for the port that can be referred + to by services. + type: string + protocol: + default: TCP + description: Protocol for port. Must be UDP, TCP, or SCTP. + Defaults to "TCP". + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + description: 'Periodic probe of container service readiness. Container + will be removed from service endpoints if the probe fails. Cannot + be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + resizePolicy: + description: Resources resize policy for the container. + items: + description: ContainerResizePolicy represents resource resize + policy for the container. + properties: + resourceName: + description: 'Name of the resource to which this resource + resize policy applies. Supported values: cpu, memory.' + type: string + restartPolicy: + description: Restart policy to apply when specified resource + is resized. If not specified, it defaults to NotRequired. + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + description: 'Compute Resources required by this container. Cannot + be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only be + set for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in + pod.spec.resourceClaims of the Pod where this field + is used. It makes that resource available inside a + container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. Requests cannot exceed + Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object + restartPolicy: + description: 'RestartPolicy defines the restart behavior of individual + containers in a pod. This field may only be set for init containers, + and the only allowed value is "Always". For non-init containers + or when this field is not specified, the restart behavior is + defined by the Pod''s restart policy and the container type. + Setting the RestartPolicy as "Always" for the init container + will have the following effect: this init container will be + continually restarted on exit until all regular containers have + terminated. Once all regular containers have completed, all + init containers with restartPolicy "Always" will be shut down. + This lifecycle differs from normal init containers and is often + referred to as a "sidecar" container. Although this init container + still starts in the init container sequence, it does not wait + for the container to complete before proceeding to the next + init container. Instead, the next init container starts immediately + after this init container is started, or after any startupProbe + has successfully completed.' + type: string + securityContext: + description: 'SecurityContext defines the security options the + container should be run with. If set, the fields of SecurityContext + override the equivalent fields of PodSecurityContext. More info: + https://kubernetes.io/docs/tasks/configure-pod-container/security-context/' + properties: + allowPrivilegeEscalation: + description: 'AllowPrivilegeEscalation controls whether a + process can gain more privileges than its parent process. + This bool directly controls if the no_new_privs flag will + be set on the container process. AllowPrivilegeEscalation + is true always when the container is: 1) run as Privileged + 2) has CAP_SYS_ADMIN Note that this field cannot be set + when spec.os.name is windows.' + type: boolean + capabilities: + description: The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the + container runtime. Note that this field cannot be set when + spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + type: object + privileged: + description: Run container in privileged mode. Processes in + privileged containers are essentially equivalent to root + on the host. Defaults to false. Note that this field cannot + be set when spec.os.name is windows. + type: boolean + procMount: + description: procMount denotes the type of proc mount to use + for the containers. The default is DefaultProcMount which + uses the container runtime defaults for readonly paths and + masked paths. This requires the ProcMountType feature flag + to be enabled. Note that this field cannot be set when spec.os.name + is windows. + type: string + readOnlyRootFilesystem: + description: Whether this container has a read-only root filesystem. + Default is false. Note that this field cannot be set when + spec.os.name is windows. + type: boolean + runAsGroup: + description: The GID to run the entrypoint of the container + process. Uses runtime default if unset. May also be set + in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. Note that this field cannot be set when + spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: Indicates that the container must run as a non-root + user. If true, the Kubelet will validate the image at runtime + to ensure that it does not run as UID 0 (root) and fail + to start the container if it does. If unset or false, no + such validation will be performed. May also be set in PodSecurityContext. If + set in both SecurityContext and PodSecurityContext, the + value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: The UID to run the entrypoint of the container + process. Defaults to user specified in image metadata if + unspecified. May also be set in PodSecurityContext. If + set in both SecurityContext and PodSecurityContext, the + value specified in SecurityContext takes precedence. Note + that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random + SELinux context for each container. May also be set in + PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. Note that this field cannot be set when + spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies + to the container. + type: string + role: + description: Role is a SELinux role label that applies + to the container. + type: string + type: + description: Type is a SELinux type label that applies + to the container. + type: string + user: + description: User is a SELinux user label that applies + to the container. + type: string + type: object + seccompProfile: + description: The seccomp options to use by this container. + If seccomp options are provided at both the pod & container + level, the container options override the pod options. Note + that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: localhostProfile indicates a profile defined + in a file on the node should be used. The profile must + be preconfigured on the node to work. Must be a descending + path, relative to the kubelet's configured seccomp profile + location. Must be set if type is "Localhost". Must NOT + be set for any other type. + type: string + type: + description: "type indicates which kind of seccomp profile + will be applied. Valid options are: \n Localhost - a + profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile + should be used. Unconfined - no profile should be applied." + type: string + required: + - type + type: object + windowsOptions: + description: The Windows specific settings applied to all + containers. If unspecified, the options from the PodSecurityContext + will be used. If set in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is + linux. + properties: + gmsaCredentialSpec: + description: GMSACredentialSpec is where the GMSA admission + webhook (https://github.com/kubernetes-sigs/windows-gmsa) + inlines the contents of the GMSA credential spec named + by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the + GMSA credential spec to use. + type: string + hostProcess: + description: HostProcess determines if a container should + be run as a 'Host Process' container. All of a Pod's + containers must have the same effective HostProcess + value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, + if HostProcess is true then HostNetwork must also be + set to true. + type: boolean + runAsUserName: + description: The UserName in Windows to run the entrypoint + of the container process. Defaults to the user specified + in image metadata if unspecified. May also be set in + PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. + type: string + type: object + type: object + startupProbe: + description: 'StartupProbe indicates that the Pod has successfully + initialized. If specified, no other probes are executed until + this completes successfully. If this probe fails, the Pod will + be restarted, just as if the livenessProbe failed. This can + be used to provide different probe parameters at the beginning + of a Pod''s lifecycle, when it might take a long time to load + data or warm a cache, than during steady-state operation. This + cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + stdin: + description: Whether this container should allocate a buffer for + stdin in the container runtime. If this is not set, reads from + stdin in the container will always result in EOF. Default is + false. + type: boolean + stdinOnce: + description: Whether the container runtime should close the stdin + channel after it has been opened by a single attach. When stdin + is true the stdin stream will remain open across multiple attach + sessions. If stdinOnce is set to true, stdin is opened on container + start, is empty until the first client attaches to stdin, and + then remains open and accepts data until the client disconnects, + at which time stdin is closed and remains closed until the container + is restarted. If this flag is false, a container processes that + reads from stdin will never receive an EOF. Default is false + type: boolean + terminationMessagePath: + description: 'Optional: Path at which the file to which the container''s + termination message will be written is mounted into the container''s + filesystem. Message written is intended to be brief final status, + such as an assertion failure message. Will be truncated by the + node if greater than 4096 bytes. The total message length across + all containers will be limited to 12kb. Defaults to /dev/termination-log. + Cannot be updated.' + type: string + terminationMessagePolicy: + description: Indicate how the termination message should be populated. + File will use the contents of terminationMessagePath to populate + the container status message on both success and failure. FallbackToLogsOnError + will use the last chunk of container log output if the termination + message file is empty and the container exited with an error. + The log output is limited to 2048 bytes or 80 lines, whichever + is smaller. Defaults to File. Cannot be updated. + type: string + tty: + description: Whether this container should allocate a TTY for + itself, also requires 'stdin' to be true. Default is false. + type: boolean + volumeDevices: + description: volumeDevices is the list of block devices to be + used by the container. + items: + description: volumeDevice describes a mapping of a raw block + device within a container. + properties: + devicePath: + description: devicePath is the path inside of the container + that the device will be mapped to. + type: string + name: + description: name must match the name of a persistentVolumeClaim + in the pod + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + description: Pod volumes to mount into the container's filesystem. + Cannot be updated. + items: + description: VolumeMount describes a mounting of a Volume within + a container. + properties: + mountPath: + description: Path within the container at which the volume + should be mounted. Must not contain ':'. + type: string + mountPropagation: + description: mountPropagation determines how mounts are + propagated from the host to container and the other way + around. When not set, MountPropagationNone is used. This + field is beta in 1.10. + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: Mounted read-only if true, read-write otherwise + (false or unspecified). Defaults to false. + type: boolean + subPath: + description: Path within the volume from which the container's + volume should be mounted. Defaults to "" (volume's root). + type: string + subPathExpr: + description: Expanded path within the volume from which + the container's volume should be mounted. Behaves similarly + to SubPath but environment variable references $(VAR_NAME) + are expanded using the container's environment. Defaults + to "" (volume's root). SubPathExpr and SubPath are mutually + exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + description: Container's working directory. If not specified, + the container runtime's default will be used, which might be + configured in the container image. Cannot be updated. + type: string + required: + - name + type: object + deno: + description: Deno contains the definition for the Deno function that + is to be executed in KeptnTasks based on the KeptnTaskDefinitions. + properties: + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command + type: string + configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. + properties: + name: + description: Name is the name of the referenced ConfigMap. + type: string + type: object + functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. + properties: + name: + description: Name is the name of the referenced KeptnTaskDefinition. + type: string + type: object + httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. + properties: + url: + description: Url is the URL containing the code of the function. + type: string + type: object + inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. + properties: + code: + description: Code contains the code of the function. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. + type: object + type: object + secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. + type: string + type: object + type: object function: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed state - of cluster Important: Run "make" to regenerate code after modifying - this file' + description: Deprecated Function contains the definition for the function + that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. properties: - configMap: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed - state of cluster Important: Run "make" to regenerate code after - modifying this file' + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command type: string + configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. + properties: + name: + description: Name is the name of the referenced ConfigMap. + type: string + type: object + functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. + properties: + name: + description: Name is the name of the referenced KeptnTaskDefinition. + type: string + type: object + httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. + properties: + url: + description: Url is the URL containing the code of the function. + type: string + type: object + inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. + properties: + code: + description: Code contains the code of the function. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. + type: object + type: object + secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. + type: string + type: object type: object - type: object - type: object - served: true - storage: false - subresources: - status: {} - - name: v1alpha2 - schema: - openAPIV3Schema: - description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions - API - 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: - type: object - spec: - description: KeptnTaskDefinitionSpec defines the desired state of KeptnTaskDefinition - properties: - function: + python: + description: Python contains the definition for the python function + that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. properties: + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command + type: string configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. properties: name: + description: Name is the name of the referenced ConfigMap. type: string type: object functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. properties: name: + description: Name is the name of the referenced KeptnTaskDefinition. type: string type: object httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. properties: url: + description: Url is the URL containing the code of the function. type: string type: object inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. properties: code: + description: Code contains the code of the function. type: string type: object parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. properties: map: additionalProperties: type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. type: object type: object secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. properties: secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. type: string type: object type: object + retries: + default: 10 + description: Retries specifies how many times a job executing the + KeptnTaskDefinition should be restarted in the case of an unsuccessful + attempt. + format: int32 + type: integer + serviceAccount: + description: Service Account to be used in jobs to authenticate with + the Kubernetes API and access cluster resources. + properties: + name: + type: string + required: + - name + type: object + timeout: + default: 5m + description: Timeout specifies the maximum time to wait for the task + to be completed successfully. If the task does not complete successfully + within this time frame, it will be considered to be failed. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + ttlSecondsAfterFinished: + default: 300 + description: TTLSecondsAfterFinished controller makes a job eligible + to be cleaned up after it is finished. The timer starts when the + status shows up to be Complete or Failed. + format: int32 + type: integer + imagePullSecrets: + description: ImagePullSecrets is an optional field to specify the + names of secrets to use for pulling container images + items: + description: LocalObjectReference contains enough information to + let you locate the referenced object inside the same namespace. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + type: array type: object status: - description: KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition + description: Status describes the current state of the KeptnTaskDefinition. properties: function: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed state - of cluster Important: Run "make" to regenerate code after modifying - this file' + description: Function contains status information of the function + definition for the task. properties: configMap: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed - state of cluster Important: Run "make" to regenerate code after - modifying this file' + description: ConfigMap indicates the ConfigMap in which the function + code is stored. type: string type: object type: object type: object served: true - storage: false + storage: true subresources: status: {} - - name: v1alpha3 + - name: v1beta1 schema: openAPIV3Schema: description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions @@ -4236,7 +6626,7 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} --- @@ -4343,7 +6733,192 @@ spec: type: object type: object served: true - storage: false + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1alpha2 + schema: + openAPIV3Schema: + description: KeptnWorkload is the Schema for the keptnworkloads API + 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: + type: object + spec: + description: KeptnWorkloadSpec defines the desired state of KeptnWorkload + properties: + app: + type: string + postDeploymentEvaluations: + items: + type: string + type: array + postDeploymentTasks: + items: + type: string + type: array + preDeploymentEvaluations: + items: + type: string + type: array + preDeploymentTasks: + items: + type: string + type: array + resourceReference: + properties: + kind: + type: string + name: + type: string + uid: + description: UID is a type that holds unique ID values, including + UUIDs. Because we don't ONLY use UUIDs, this is an alias to + string. Being a type captures intent and helps make sure that + UIDs and names do not get conflated. + type: string + required: + - kind + - name + - uid + type: object + version: + type: string + required: + - app + - resourceReference + - version + type: object + status: + description: KeptnWorkloadStatus defines the observed state of KeptnWorkload + properties: + currentVersion: + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1alpha3 + schema: + openAPIV3Schema: + description: KeptnWorkload is the Schema for the keptnworkloads API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnWorkload. + properties: + app: + description: AppName is the name of the KeptnApp containing the KeptnWorkload. + type: string + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnWorkload, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + resourceReference: + description: ResourceReference is a reference to the Kubernetes resource + (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload + is representing. + properties: + kind: + type: string + name: + type: string + uid: + description: UID is a type that holds unique ID values, including + UUIDs. Because we don't ONLY use UUIDs, this is an alias to + string. Being a type captures intent and helps make sure that + UIDs and names do not get conflated. + type: string + required: + - kind + - name + - uid + type: object + version: + description: Version defines the version of the KeptnWorkload. + type: string + required: + - app + - resourceReference + - version + type: object + status: + description: Status describes the current state of the KeptnWorkload. + properties: + currentVersion: + description: CurrentVersion indicates the version that is currently + deployed or being reconciled. + type: string + type: object + type: object + served: true + storage: true subresources: status: {} - additionalPrinterColumns: @@ -4353,7 +6928,7 @@ spec: - jsonPath: .spec.version name: Version type: string - name: v1alpha2 + name: v1beta1 schema: openAPIV3Schema: description: KeptnWorkload is the Schema for the keptnworkloads API @@ -4371,27 +6946,49 @@ spec: metadata: type: object spec: - description: KeptnWorkloadSpec defines the desired state of KeptnWorkload + description: Spec describes the desired state of the KeptnWorkload. properties: app: + description: AppName is the name of the KeptnApp containing the KeptnWorkload. type: string postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. items: type: string type: array postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnWorkload, or in the Keptn namespace. items: type: string type: array preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. items: type: string type: array preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnApp, or in the Keptn namespace. items: type: string type: array resourceReference: + description: ResourceReference is a reference to the Kubernetes resource + (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload + is representing. properties: kind: type: string @@ -4409,6 +7006,7 @@ spec: - uid type: object version: + description: Version defines the version of the KeptnWorkload. type: string required: - app @@ -4416,9 +7014,11 @@ spec: - version type: object status: - description: KeptnWorkloadStatus defines the observed state of KeptnWorkload + description: Status describes the current state of the KeptnWorkload. properties: currentVersion: + description: CurrentVersion indicates the version that is currently + deployed or being reconciled. type: string type: object type: object @@ -4426,17 +7026,83 @@ spec: storage: false subresources: status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptnworkloadinstance-crd.yaml +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptnworkloadinstances.lifecycle.keptn.sh + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' + labels: + app.kubernetes.io/part-of: keptn + crdGroup: lifecycle.keptn.sh + keptn.sh/inject-cert: "true" + app.kubernetes.io/instance: keptn-test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: lifecycle-operator + app.kubernetes.io/version: vmyversion + helm.sh/chart: lifecycle-operator-0.1.0 +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + name: 'lifecycle-webhook-service' + namespace: 'helmtests' + path: /convert + conversionReviewVersions: + - v1 + group: lifecycle.keptn.sh + names: + kind: KeptnWorkloadInstance + listKind: KeptnWorkloadInstanceList + plural: keptnworkloadinstances + shortNames: + - kwi + singular: keptnworkloadinstance + scope: Namespaced + versions: - additionalPrinterColumns: - jsonPath: .spec.app name: AppName type: string + - jsonPath: .spec.workloadName + name: WorkloadName + type: string - jsonPath: .spec.version - name: Version + name: WorkloadVersion type: string - name: v1alpha3 + - jsonPath: .status.currentPhase + name: Phase + type: string + - jsonPath: .status.preDeploymentStatus + name: PreDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.preDeploymentEvaluationStatus + name: PreDeploymentEvaluationStatus + priority: 1 + type: string + - jsonPath: .status.deploymentStatus + name: DeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentStatus + name: PostDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentEvaluationStatus + name: PostDeploymentEvaluationStatus + priority: 1 + type: string + name: v1alpha1 schema: openAPIV3Schema: - description: KeptnWorkload is the Schema for the keptnworkloads API + description: KeptnWorkloadInstance is the Schema for the keptnworkloadinstances + API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -4451,49 +7117,29 @@ spec: metadata: type: object spec: - description: Spec describes the desired state of the KeptnWorkload. + description: KeptnWorkloadInstanceSpec defines the desired state of KeptnWorkloadInstance properties: app: - description: AppName is the name of the KeptnApp containing the KeptnWorkload. type: string postDeploymentEvaluations: - description: PostDeploymentEvaluations is a list of all evaluations - to be performed during the post-deployment phase of the KeptnWorkload. - The items of this list refer to the names of KeptnEvaluationDefinitions - located in the same namespace as the KeptnWorkload, or in the Keptn - namespace. items: type: string type: array postDeploymentTasks: - description: PostDeploymentTasks is a list of all tasks to be performed - during the post-deployment phase of the KeptnWorkload. The items - of this list refer to the names of KeptnTaskDefinitions located - in the same namespace as the KeptnWorkload, or in the Keptn namespace. items: type: string type: array preDeploymentEvaluations: - description: PreDeploymentEvaluations is a list of all evaluations - to be performed during the pre-deployment phase of the KeptnWorkload. - The items of this list refer to the names of KeptnEvaluationDefinitions - located in the same namespace as the KeptnWorkload, or in the Keptn - namespace. items: type: string type: array preDeploymentTasks: - description: PreDeploymentTasks is a list of all tasks to be performed - during the pre-deployment phase of the KeptnWorkload. The items - of this list refer to the names of KeptnTaskDefinitions located - in the same namespace as the KeptnApp, or in the Keptn namespace. items: type: string type: array + previousVersion: + type: string resourceReference: - description: ResourceReference is a reference to the Kubernetes resource - (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload - is representing. properties: kind: type: string @@ -4510,66 +7156,138 @@ spec: - name - uid type: object + traceId: + additionalProperties: + type: string + type: object version: - description: Version defines the version of the KeptnWorkload. + type: string + workloadName: type: string required: - app - resourceReference - version + - workloadName type: object status: - description: Status describes the current state of the KeptnWorkload. + description: KeptnWorkloadInstanceStatus defines the observed state of + KeptnWorkloadInstance properties: - currentVersion: - description: CurrentVersion indicates the version that is currently - deployed or being reconciled. + currentPhase: + type: string + deploymentStatus: + default: Pending + type: string + endTime: + format: date-time + type: string + phaseTraceIDs: + additionalProperties: + additionalProperties: + type: string + description: MapCarrier is a TextMapCarrier that uses a map held + in memory as a storage medium for propagated key-value pairs. + type: object + description: PhaseTraceID is a map storing TraceIDs of OpenTelemetry + spans in lifecycle phases + type: object + postDeploymentEvaluationStatus: + default: Pending + type: string + postDeploymentEvaluationTaskStatus: + items: + properties: + endTime: + format: date-time + type: string + evaluationDefinitionName: + type: string + evaluationName: + type: string + startTime: + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + postDeploymentStatus: + default: Pending + type: string + postDeploymentTaskStatus: + items: + properties: + endTime: + format: date-time + type: string + startTime: + format: date-time + type: string + status: + default: Pending + type: string + taskDefinitionName: + type: string + taskName: + type: string + type: object + type: array + preDeploymentEvaluationStatus: + default: Pending + type: string + preDeploymentEvaluationTaskStatus: + items: + properties: + endTime: + format: date-time + type: string + evaluationDefinitionName: + type: string + evaluationName: + type: string + startTime: + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + preDeploymentStatus: + default: Pending + type: string + preDeploymentTaskStatus: + items: + properties: + endTime: + format: date-time + type: string + startTime: + format: date-time + type: string + status: + default: Pending + type: string + taskDefinitionName: + type: string + taskName: + type: string + type: object + type: array + startTime: + format: date-time + type: string + status: + default: Pending type: string type: object type: object served: true - storage: true + storage: false subresources: status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptnworkloadinstance-crd.yaml -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: keptnworkloadinstances.lifecycle.keptn.sh - annotations: - controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' - labels: - app.kubernetes.io/part-of: keptn - crdGroup: lifecycle.keptn.sh - keptn.sh/inject-cert: "true" - app.kubernetes.io/instance: keptn-test - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: lifecycle-operator - app.kubernetes.io/version: vmyversion - helm.sh/chart: lifecycle-operator-0.1.0 -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - name: 'lifecycle-webhook-service' - namespace: 'helmtests' - path: /convert - conversionReviewVersions: - - v1 - group: lifecycle.keptn.sh - names: - kind: KeptnWorkloadInstance - listKind: KeptnWorkloadInstanceList - plural: keptnworkloadinstances - shortNames: - - kwi - singular: keptnworkloadinstance - scope: Namespaced - versions: - additionalPrinterColumns: - jsonPath: .spec.app name: AppName @@ -4603,7 +7321,7 @@ spec: name: PostDeploymentEvaluationStatus priority: 1 type: string - name: v1alpha1 + name: v1alpha2 schema: openAPIV3Schema: description: KeptnWorkloadInstance is the Schema for the keptnworkloadinstances @@ -4694,8 +7412,6 @@ spec: description: MapCarrier is a TextMapCarrier that uses a map held in memory as a storage medium for propagated key-value pairs. type: object - description: PhaseTraceID is a map storing TraceIDs of OpenTelemetry - spans in lifecycle phases type: object postDeploymentEvaluationStatus: default: Pending @@ -4703,12 +7419,14 @@ spec: postDeploymentEvaluationTaskStatus: items: properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string endTime: format: date-time type: string - evaluationDefinitionName: - type: string - evaluationName: + name: + description: Name is the name of the Evaluation/Task type: string startTime: format: date-time @@ -4724,19 +7442,21 @@ spec: postDeploymentTaskStatus: items: properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string endTime: format: date-time type: string + name: + description: Name is the name of the Evaluation/Task + type: string startTime: format: date-time type: string status: default: Pending type: string - taskDefinitionName: - type: string - taskName: - type: string type: object type: array preDeploymentEvaluationStatus: @@ -4745,12 +7465,14 @@ spec: preDeploymentEvaluationTaskStatus: items: properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string endTime: format: date-time type: string - evaluationDefinitionName: - type: string - evaluationName: + name: + description: Name is the name of the Evaluation/Task type: string startTime: format: date-time @@ -4766,19 +7488,21 @@ spec: preDeploymentTaskStatus: items: properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string endTime: format: date-time type: string + name: + description: Name is the name of the Evaluation/Task + type: string startTime: format: date-time type: string status: default: Pending type: string - taskDefinitionName: - type: string - taskName: - type: string type: object type: array startTime: @@ -4826,7 +7550,7 @@ spec: name: PostDeploymentEvaluationStatus priority: 1 type: string - name: v1alpha2 + name: v1alpha3 schema: openAPIV3Schema: description: KeptnWorkloadInstance is the Schema for the keptnworkloadinstances @@ -4845,29 +7569,53 @@ spec: metadata: type: object spec: - description: KeptnWorkloadInstanceSpec defines the desired state of KeptnWorkloadInstance + description: Spec describes the desired state of the KeptnWorkloadInstance. properties: app: + description: AppName is the name of the KeptnApp containing the KeptnWorkload. type: string postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. items: type: string type: array postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnWorkload, or in the Keptn namespace. items: type: string type: array preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. items: type: string type: array preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnApp, or in the Keptn namespace. items: type: string type: array previousVersion: + description: PreviousVersion is the version of the KeptnWorkload that + has been deployed prior to this version. type: string resourceReference: + description: ResourceReference is a reference to the Kubernetes resource + (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload + is representing. properties: kind: type: string @@ -4887,10 +7635,13 @@ spec: traceId: additionalProperties: type: string + description: TraceId contains the OpenTelemetry trace ID. type: object version: + description: Version defines the version of the KeptnWorkload. type: string workloadName: + description: WorkloadName is the name of the KeptnWorkload. type: string required: - app @@ -4899,15 +7650,21 @@ spec: - workloadName type: object status: - description: KeptnWorkloadInstanceStatus defines the observed state of - KeptnWorkloadInstance + description: Status describes the current state of the KeptnWorkloadInstance. properties: currentPhase: + description: 'CurrentPhase indicates the current phase of the KeptnWorkloadInstance. + This can be: - PreDeploymentTasks - PreDeploymentEvaluations - Deployment + - PostDeploymentTasks - PostDeploymentEvaluations' type: string deploymentStatus: default: Pending + description: DeploymentStatus indicates the current status of the + KeptnWorkloadInstance's Deployment phase. type: string endTime: + description: EndTime represents the time at which the deployment of + the KeptnWorkloadInstance finished. format: date-time type: string phaseTraceIDs: @@ -4917,23 +7674,33 @@ spec: description: MapCarrier is a TextMapCarrier that uses a map held in memory as a storage medium for propagated key-value pairs. type: object + description: PhaseTraceIDs contains the trace IDs of the OpenTelemetry + spans of each phase of the KeptnWorkloadInstance type: object postDeploymentEvaluationStatus: default: Pending + description: PostDeploymentEvaluationStatus indicates the current + status of the KeptnWorkloadInstance's PostDeploymentEvaluation phase. type: string postDeploymentEvaluationTaskStatus: + description: PostDeploymentEvaluationTaskStatus indicates the current + state of each postDeploymentEvaluation of the KeptnWorkloadInstance. items: properties: definitionName: description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition type: string endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. format: date-time type: string name: description: Name is the name of the Evaluation/Task type: string startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. format: date-time type: string status: @@ -4943,20 +7710,28 @@ spec: type: array postDeploymentStatus: default: Pending + description: PostDeploymentStatus indicates the current status of + the KeptnWorkloadInstance's PostDeployment phase. type: string postDeploymentTaskStatus: + description: PostDeploymentTaskStatus indicates the current state + of each postDeploymentTask of the KeptnWorkloadInstance. items: properties: definitionName: description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition type: string endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. format: date-time type: string name: description: Name is the name of the Evaluation/Task type: string startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. format: date-time type: string status: @@ -4966,20 +7741,28 @@ spec: type: array preDeploymentEvaluationStatus: default: Pending + description: PreDeploymentEvaluationStatus indicates the current status + of the KeptnWorkloadInstance's PreDeploymentEvaluation phase. type: string preDeploymentEvaluationTaskStatus: + description: PreDeploymentEvaluationTaskStatus indicates the current + state of each preDeploymentEvaluation of the KeptnWorkloadInstance. items: properties: definitionName: description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition type: string endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. format: date-time type: string name: description: Name is the name of the Evaluation/Task type: string startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. format: date-time type: string status: @@ -4989,20 +7772,28 @@ spec: type: array preDeploymentStatus: default: Pending + description: PreDeploymentStatus indicates the current status of the + KeptnWorkloadInstance's PreDeployment phase. type: string preDeploymentTaskStatus: + description: PreDeploymentTaskStatus indicates the current state of + each preDeploymentTask of the KeptnWorkloadInstance. items: properties: definitionName: description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition type: string endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. format: date-time type: string name: description: Name is the name of the Evaluation/Task type: string startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. format: date-time type: string status: @@ -5011,17 +7802,49 @@ spec: type: object type: array startTime: + description: StartTime represents the time at which the deployment + of the KeptnWorkloadInstance started. format: date-time type: string status: default: Pending + description: Status represents the overall status of the KeptnWorkloadInstance. type: string type: object type: object served: true - storage: false + storage: true subresources: status: {} +--- +# Source: keptn/charts/lifecycleOperator/templates/keptnworkloadversion-crd.yaml +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: keptnworkloadversions.lifecycle.keptn.sh + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' + labels: + app.kubernetes.io/part-of: keptn + crdGroup: lifecycle.keptn.sh + keptn.sh/inject-cert: "true" + app.kubernetes.io/instance: keptn-test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: lifecycle-operator + app.kubernetes.io/version: vmyversion + helm.sh/chart: lifecycle-operator-0.1.0 +spec: + group: lifecycle.keptn.sh + names: + kind: KeptnWorkloadVersion + listKind: KeptnWorkloadVersionList + plural: keptnworkloadversions + shortNames: + - kwv + singular: keptnworkloadversion + scope: Namespaced + versions: - additionalPrinterColumns: - jsonPath: .spec.app name: AppName @@ -5055,10 +7878,10 @@ spec: name: PostDeploymentEvaluationStatus priority: 1 type: string - name: v1alpha3 + name: v1alpha4 schema: openAPIV3Schema: - description: KeptnWorkloadInstance is the Schema for the keptnworkloadinstances + description: KeptnWorkloadVersion is the Schema for the keptnworkloadversions API properties: apiVersion: @@ -5074,7 +7897,7 @@ spec: metadata: type: object spec: - description: Spec describes the desired state of the KeptnWorkloadInstance. + description: Spec describes the desired state of the KeptnWorkloadVersion. properties: app: description: AppName is the name of the KeptnApp containing the KeptnWorkload. @@ -5155,21 +7978,21 @@ spec: - workloadName type: object status: - description: Status describes the current state of the KeptnWorkloadInstance. + description: Status describes the current state of the KeptnWorkloadVersion. properties: currentPhase: - description: 'CurrentPhase indicates the current phase of the KeptnWorkloadInstance. + description: 'CurrentPhase indicates the current phase of the KeptnWorkloadVersion. This can be: - PreDeploymentTasks - PreDeploymentEvaluations - Deployment - PostDeploymentTasks - PostDeploymentEvaluations' type: string deploymentStatus: default: Pending description: DeploymentStatus indicates the current status of the - KeptnWorkloadInstance's Deployment phase. + KeptnWorkloadVersion's Deployment phase. type: string endTime: description: EndTime represents the time at which the deployment of - the KeptnWorkloadInstance finished. + the KeptnWorkloadVersion finished. format: date-time type: string phaseTraceIDs: @@ -5180,16 +8003,16 @@ spec: in memory as a storage medium for propagated key-value pairs. type: object description: PhaseTraceIDs contains the trace IDs of the OpenTelemetry - spans of each phase of the KeptnWorkloadInstance + spans of each phase of the KeptnWorkloadVersion type: object postDeploymentEvaluationStatus: default: Pending description: PostDeploymentEvaluationStatus indicates the current - status of the KeptnWorkloadInstance's PostDeploymentEvaluation phase. + status of the KeptnWorkloadVersion's PostDeploymentEvaluation phase. type: string postDeploymentEvaluationTaskStatus: description: PostDeploymentEvaluationTaskStatus indicates the current - state of each postDeploymentEvaluation of the KeptnWorkloadInstance. + state of each postDeploymentEvaluation of the KeptnWorkloadVersion. items: properties: definitionName: @@ -5216,11 +8039,11 @@ spec: postDeploymentStatus: default: Pending description: PostDeploymentStatus indicates the current status of - the KeptnWorkloadInstance's PostDeployment phase. + the KeptnWorkloadVersion's PostDeployment phase. type: string postDeploymentTaskStatus: description: PostDeploymentTaskStatus indicates the current state - of each postDeploymentTask of the KeptnWorkloadInstance. + of each postDeploymentTask of the KeptnWorkloadVersion. items: properties: definitionName: @@ -5247,11 +8070,11 @@ spec: preDeploymentEvaluationStatus: default: Pending description: PreDeploymentEvaluationStatus indicates the current status - of the KeptnWorkloadInstance's PreDeploymentEvaluation phase. + of the KeptnWorkloadVersion's PreDeploymentEvaluation phase. type: string preDeploymentEvaluationTaskStatus: description: PreDeploymentEvaluationTaskStatus indicates the current - state of each preDeploymentEvaluation of the KeptnWorkloadInstance. + state of each preDeploymentEvaluation of the KeptnWorkloadVersion. items: properties: definitionName: @@ -5278,11 +8101,11 @@ spec: preDeploymentStatus: default: Pending description: PreDeploymentStatus indicates the current status of the - KeptnWorkloadInstance's PreDeployment phase. + KeptnWorkloadVersion's PreDeployment phase. type: string preDeploymentTaskStatus: description: PreDeploymentTaskStatus indicates the current state of - each preDeploymentTask of the KeptnWorkloadInstance. + each preDeploymentTask of the KeptnWorkloadVersion. items: properties: definitionName: @@ -5308,12 +8131,12 @@ spec: type: array startTime: description: StartTime represents the time at which the deployment - of the KeptnWorkloadInstance started. + of the KeptnWorkloadVersion started. format: date-time type: string status: default: Pending - description: Status represents the overall status of the KeptnWorkloadInstance. + description: Status represents the overall status of the KeptnWorkloadVersion. type: string type: object type: object @@ -5321,35 +8144,6 @@ spec: storage: true subresources: status: {} ---- -# Source: keptn/charts/lifecycleOperator/templates/keptnworkloadversion-crd.yaml -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: keptnworkloadversions.lifecycle.keptn.sh - annotations: - controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' - labels: - app.kubernetes.io/part-of: keptn - crdGroup: lifecycle.keptn.sh - keptn.sh/inject-cert: "true" - app.kubernetes.io/instance: keptn-test - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/name: lifecycle-operator - app.kubernetes.io/version: vmyversion - helm.sh/chart: lifecycle-operator-0.1.0 -spec: - group: lifecycle.keptn.sh - names: - kind: KeptnWorkloadVersion - listKind: KeptnWorkloadVersionList - plural: keptnworkloadversions - shortNames: - - kwv - singular: keptnworkloadversion - scope: Namespaced - versions: - additionalPrinterColumns: - jsonPath: .spec.app name: AppName @@ -5383,7 +8177,7 @@ spec: name: PostDeploymentEvaluationStatus priority: 1 type: string - name: v1alpha4 + name: v1beta1 schema: openAPIV3Schema: description: KeptnWorkloadVersion is the Schema for the keptnworkloadversions @@ -5646,7 +8440,7 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} --- diff --git a/docs/content/en/docs/reference/api-reference/lifecycle/v1beta1/_index.md b/docs/content/en/docs/reference/api-reference/lifecycle/v1beta1/_index.md new file mode 100644 index 0000000000..748383022f --- /dev/null +++ b/docs/content/en/docs/reference/api-reference/lifecycle/v1beta1/_index.md @@ -0,0 +1,949 @@ +--- +title: v1beta1 +description: Reference information for lifecycle.keptn.sh/v1beta1 +--- + + +## Packages +- [lifecycle.keptn.sh/v1beta1](#lifecyclekeptnshv1beta1) + + +## lifecycle.keptn.sh/v1beta1 + +Package v1beta1 contains API Schema definitions for the lifecycle v1beta1 API group + +### Resource Types +- [KeptnApp](#keptnapp) +- [KeptnAppCreationRequest](#keptnappcreationrequest) +- [KeptnAppCreationRequestList](#keptnappcreationrequestlist) +- [KeptnAppList](#keptnapplist) +- [KeptnAppVersion](#keptnappversion) +- [KeptnAppVersionList](#keptnappversionlist) +- [KeptnEvaluation](#keptnevaluation) +- [KeptnEvaluationDefinition](#keptnevaluationdefinition) +- [KeptnEvaluationDefinitionList](#keptnevaluationdefinitionlist) +- [KeptnEvaluationList](#keptnevaluationlist) +- [KeptnTask](#keptntask) +- [KeptnTaskDefinition](#keptntaskdefinition) +- [KeptnTaskDefinitionList](#keptntaskdefinitionlist) +- [KeptnTaskList](#keptntasklist) +- [KeptnWorkload](#keptnworkload) +- [KeptnWorkloadList](#keptnworkloadlist) +- [KeptnWorkloadVersion](#keptnworkloadversion) +- [KeptnWorkloadVersionList](#keptnworkloadversionlist) + + + +#### AutomountServiceAccountTokenSpec + + + + + +_Appears in:_ +- [KeptnTaskDefinitionSpec](#keptntaskdefinitionspec) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `type` _boolean_ | || x | + + +#### ConfigMapReference + + + + + +_Appears in:_ +- [RuntimeSpec](#runtimespec) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `name` _string_ | Name is the name of the referenced ConfigMap. || ✓ | + + +#### ContainerSpec + + + + + +_Appears in:_ +- [KeptnTaskDefinitionSpec](#keptntaskdefinitionspec) + + + +#### EvaluationStatusItem + + + + + +_Appears in:_ +- [KeptnEvaluationStatus](#keptnevaluationstatus) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `value` _string_ | Value represents the value of the KeptnMetric being evaluated. || x | +| `status` _string_ | Status indicates the status of the objective being evaluated. || x | +| `message` _string_ | Message contains additional information about the evaluation of an objective. This can include explanations about why an evaluation has failed (e.g. due to a missed objective), or if there was any error during the evaluation of the objective. || ✓ | + + +#### FunctionReference + + + + + +_Appears in:_ +- [RuntimeSpec](#runtimespec) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `name` _string_ | Name is the name of the referenced KeptnTaskDefinition. || ✓ | + + +#### FunctionStatus + + + + + +_Appears in:_ +- [KeptnTaskDefinitionStatus](#keptntaskdefinitionstatus) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `configMap` _string_ | ConfigMap indicates the ConfigMap in which the function code is stored. || ✓ | + + +#### HttpReference + + + + + +_Appears in:_ +- [RuntimeSpec](#runtimespec) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `url` _string_ | Url is the URL containing the code of the function. || ✓ | + + +#### Inline + + + + + +_Appears in:_ +- [RuntimeSpec](#runtimespec) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `code` _string_ | Code contains the code of the function. || ✓ | + + +#### ItemStatus + + + + + +_Appears in:_ +- [KeptnAppVersionStatus](#keptnappversionstatus) +- [KeptnWorkloadVersionStatus](#keptnworkloadversionstatus) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `definitionName` _string_ | DefinitionName is the name of the EvaluationDefinition/TaskDefinition || ✓ | +| `status` _string_ | |Pending| ✓ | +| `name` _string_ | Name is the name of the Evaluation/Task || ✓ | +| `startTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#time-v1-meta)_ | StartTime represents the time at which the Item (Evaluation/Task) started. || ✓ | +| `endTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#time-v1-meta)_ | EndTime represents the time at which the Item (Evaluation/Task) started. || ✓ | + + +#### KeptnApp + + + +KeptnApp is the Schema for the keptnapps API + +_Appears in:_ +- [KeptnAppList](#keptnapplist) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnApp` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `spec` _[KeptnAppSpec](#keptnappspec)_ | Spec describes the desired state of the KeptnApp. || ✓ | +| `status` _[KeptnAppStatus](#keptnappstatus)_ | Status describes the current state of the KeptnApp. || ✓ | + + +#### KeptnAppCreationRequest + + + +KeptnAppCreationRequest is the Schema for the keptnappcreationrequests API + +_Appears in:_ +- [KeptnAppCreationRequestList](#keptnappcreationrequestlist) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnAppCreationRequest` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `spec` _[KeptnAppCreationRequestSpec](#keptnappcreationrequestspec)_ | Spec describes the desired state of the KeptnAppCreationRequest. || ✓ | +| `status` _string_ | Status describes the current state of the KeptnAppCreationRequest. || ✓ | + + +#### KeptnAppCreationRequestList + + + +KeptnAppCreationRequestList contains a list of KeptnAppCreationRequest + + + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnAppCreationRequestList` | | | +| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `items` _[KeptnAppCreationRequest](#keptnappcreationrequest) array_ | || x | + + +#### KeptnAppCreationRequestSpec + + + +KeptnAppCreationRequestSpec defines the desired state of KeptnAppCreationRequest + +_Appears in:_ +- [KeptnAppCreationRequest](#keptnappcreationrequest) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `appName` _string_ | AppName is the name of the KeptnApp the KeptnAppCreationRequest should create if no user-defined object with that name is found. || x | + + +#### KeptnAppList + + + +KeptnAppList contains a list of KeptnApp + + + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnAppList` | | | +| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `items` _[KeptnApp](#keptnapp) array_ | || x | + + +#### KeptnAppSpec + + + +KeptnAppSpec defines the desired state of KeptnApp + +_Appears in:_ +- [KeptnApp](#keptnapp) +- [KeptnAppVersionSpec](#keptnappversionspec) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `version` _string_ | Version defines the version of the application. For automatically created KeptnApps, the version is a function of all KeptnWorkloads that are part of the KeptnApp. || x | +| `revision` _integer_ | Revision can be modified to trigger another deployment of a KeptnApp of the same version. This can be used for restarting a KeptnApp which failed to deploy, e.g. due to a failed preDeploymentEvaluation/preDeploymentTask. |1| ✓ | +| `workloads` _[KeptnWorkloadRef](#keptnworkloadref) array_ | Workloads is a list of all KeptnWorkloads that are part of the KeptnApp. || ✓ | +| `preDeploymentTasks` _string array_ | PreDeploymentTasks is a list of all tasks to be performed during the pre-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnTaskDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || ✓ | +| `postDeploymentTasks` _string array_ | PostDeploymentTasks is a list of all tasks to be performed during the post-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnTaskDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || ✓ | +| `preDeploymentEvaluations` _string array_ | PreDeploymentEvaluations is a list of all evaluations to be performed during the pre-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || ✓ | +| `postDeploymentEvaluations` _string array_ | PostDeploymentEvaluations is a list of all evaluations to be performed during the post-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || ✓ | + + +#### KeptnAppStatus + + + +KeptnAppStatus defines the observed state of KeptnApp + +_Appears in:_ +- [KeptnApp](#keptnapp) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `currentVersion` _string_ | CurrentVersion indicates the version that is currently deployed or being reconciled. || ✓ | + + +#### KeptnAppVersion + + + +KeptnAppVersion is the Schema for the keptnappversions API + +_Appears in:_ +- [KeptnAppVersionList](#keptnappversionlist) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnAppVersion` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `spec` _[KeptnAppVersionSpec](#keptnappversionspec)_ | Spec describes the desired state of the KeptnAppVersion. || ✓ | +| `status` _[KeptnAppVersionStatus](#keptnappversionstatus)_ | Status describes the current state of the KeptnAppVersion. || ✓ | + + +#### KeptnAppVersionList + + + +KeptnAppVersionList contains a list of KeptnAppVersion + + + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnAppVersionList` | | | +| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `items` _[KeptnAppVersion](#keptnappversion) array_ | || x | + + +#### KeptnAppVersionSpec + + + +KeptnAppVersionSpec defines the desired state of KeptnAppVersion + +_Appears in:_ +- [KeptnAppVersion](#keptnappversion) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `version` _string_ | Version defines the version of the application. For automatically created KeptnApps, the version is a function of all KeptnWorkloads that are part of the KeptnApp. || x | +| `revision` _integer_ | Revision can be modified to trigger another deployment of a KeptnApp of the same version. This can be used for restarting a KeptnApp which failed to deploy, e.g. due to a failed preDeploymentEvaluation/preDeploymentTask. |1| ✓ | +| `workloads` _[KeptnWorkloadRef](#keptnworkloadref) array_ | Workloads is a list of all KeptnWorkloads that are part of the KeptnApp. || ✓ | +| `preDeploymentTasks` _string array_ | PreDeploymentTasks is a list of all tasks to be performed during the pre-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnTaskDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || ✓ | +| `postDeploymentTasks` _string array_ | PostDeploymentTasks is a list of all tasks to be performed during the post-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnTaskDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || ✓ | +| `preDeploymentEvaluations` _string array_ | PreDeploymentEvaluations is a list of all evaluations to be performed during the pre-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || ✓ | +| `postDeploymentEvaluations` _string array_ | PostDeploymentEvaluations is a list of all evaluations to be performed during the post-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || ✓ | +| `appName` _string_ | AppName is the name of the KeptnApp. || x | +| `previousVersion` _string_ | PreviousVersion is the version of the KeptnApp that has been deployed prior to this version. || ✓ | +| `traceId` _object (keys:string, values:string)_ | TraceId contains the OpenTelemetry trace ID. || ✓ | + + +#### KeptnAppVersionStatus + + + +KeptnAppVersionStatus defines the observed state of KeptnAppVersion + +_Appears in:_ +- [KeptnAppVersion](#keptnappversion) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `preDeploymentStatus` _string_ | PreDeploymentStatus indicates the current status of the KeptnAppVersion's PreDeployment phase. |Pending| ✓ | +| `postDeploymentStatus` _string_ | PostDeploymentStatus indicates the current status of the KeptnAppVersion's PostDeployment phase. |Pending| ✓ | +| `preDeploymentEvaluationStatus` _string_ | PreDeploymentEvaluationStatus indicates the current status of the KeptnAppVersion's PreDeploymentEvaluation phase. |Pending| ✓ | +| `postDeploymentEvaluationStatus` _string_ | PostDeploymentEvaluationStatus indicates the current status of the KeptnAppVersion's PostDeploymentEvaluation phase. |Pending| ✓ | +| `workloadOverallStatus` _string_ | WorkloadOverallStatus indicates the current status of the KeptnAppVersion's Workload deployment phase. |Pending| ✓ | +| `workloadStatus` _[WorkloadStatus](#workloadstatus) array_ | WorkloadStatus contains the current status of each KeptnWorkload that is part of the KeptnAppVersion. || ✓ | +| `currentPhase` _string_ | CurrentPhase indicates the current phase of the KeptnAppVersion. || ✓ | +| `preDeploymentTaskStatus` _[ItemStatus](#itemstatus) array_ | PreDeploymentTaskStatus indicates the current state of each preDeploymentTask of the KeptnAppVersion. || ✓ | +| `postDeploymentTaskStatus` _[ItemStatus](#itemstatus) array_ | PostDeploymentTaskStatus indicates the current state of each postDeploymentTask of the KeptnAppVersion. || ✓ | +| `preDeploymentEvaluationTaskStatus` _[ItemStatus](#itemstatus) array_ | PreDeploymentEvaluationTaskStatus indicates the current state of each preDeploymentEvaluation of the KeptnAppVersion. || ✓ | +| `postDeploymentEvaluationTaskStatus` _[ItemStatus](#itemstatus) array_ | PostDeploymentEvaluationTaskStatus indicates the current state of each postDeploymentEvaluation of the KeptnAppVersion. || ✓ | +| `phaseTraceIDs` _[MapCarrier](https://pkg.go.dev/go.opentelemetry.io/otel/propagation#MapCarrier)_ | PhaseTraceIDs contains the trace IDs of the OpenTelemetry spans of each phase of the KeptnAppVersion. || ✓ | +| `status` _string_ | Status represents the overall status of the KeptnAppVersion. |Pending| ✓ | +| `startTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#time-v1-meta)_ | StartTime represents the time at which the deployment of the KeptnAppVersion started. || ✓ | +| `endTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#time-v1-meta)_ | EndTime represents the time at which the deployment of the KeptnAppVersion finished. || ✓ | + + +#### KeptnEvaluation + + + +KeptnEvaluation is the Schema for the keptnevaluations API + +_Appears in:_ +- [KeptnEvaluationList](#keptnevaluationlist) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnEvaluation` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `spec` _[KeptnEvaluationSpec](#keptnevaluationspec)_ | Spec describes the desired state of the KeptnEvaluation. || ✓ | +| `status` _[KeptnEvaluationStatus](#keptnevaluationstatus)_ | Status describes the current state of the KeptnEvaluation. || ✓ | + + +#### KeptnEvaluationDefinition + + + +KeptnEvaluationDefinition is the Schema for the keptnevaluationdefinitions API + +_Appears in:_ +- [KeptnEvaluationDefinitionList](#keptnevaluationdefinitionlist) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnEvaluationDefinition` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `spec` _[KeptnEvaluationDefinitionSpec](#keptnevaluationdefinitionspec)_ | Spec describes the desired state of the KeptnEvaluationDefinition. || ✓ | +| `status` _string_ | unused field || ✓ | + + +#### KeptnEvaluationDefinitionList + + + +KeptnEvaluationDefinitionList contains a list of KeptnEvaluationDefinition + + + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnEvaluationDefinitionList` | | | +| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `items` _[KeptnEvaluationDefinition](#keptnevaluationdefinition) array_ | || x | + + +#### KeptnEvaluationDefinitionSpec + + + +KeptnEvaluationDefinitionSpec defines the desired state of KeptnEvaluationDefinition + +_Appears in:_ +- [KeptnEvaluationDefinition](#keptnevaluationdefinition) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `objectives` _[Objective](#objective) array_ | Objectives is a list of objectives that have to be met for a KeptnEvaluation referencing this KeptnEvaluationDefinition to be successful. || x | + + +#### KeptnEvaluationList + + + +KeptnEvaluationList contains a list of KeptnEvaluation + + + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnEvaluationList` | | | +| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `items` _[KeptnEvaluation](#keptnevaluation) array_ | || x | + + +#### KeptnEvaluationSpec + + + +KeptnEvaluationSpec defines the desired state of KeptnEvaluation + +_Appears in:_ +- [KeptnEvaluation](#keptnevaluation) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `workload` _string_ | Workload defines the KeptnWorkload for which the KeptnEvaluation is done. || ✓ | +| `workloadVersion` _string_ | WorkloadVersion defines the version of the KeptnWorkload for which the KeptnEvaluation is done. || x | +| `appName` _string_ | AppName defines the KeptnApp for which the KeptnEvaluation is done. || ✓ | +| `appVersion` _string_ | AppVersion defines the version of the KeptnApp for which the KeptnEvaluation is done. || ✓ | +| `evaluationDefinition` _string_ | EvaluationDefinition refers to the name of the KeptnEvaluationDefinition which includes the objectives for the KeptnEvaluation. The KeptnEvaluationDefinition can be located in the same namespace as the KeptnEvaluation, or in the Keptn namespace. || x | +| `retries` _integer_ | Retries indicates how many times the KeptnEvaluation can be attempted in the case of an error or missed evaluation objective, before considering the KeptnEvaluation to be failed. |10| ✓ | +| `retryInterval` _[Duration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#duration-v1-meta)_ | RetryInterval specifies the interval at which the KeptnEvaluation is retried in the case of an error or a missed objective. |5s| ✓ | +| `failAction` _string_ | || ✓ | +| `checkType` _string_ | Type indicates whether the KeptnEvaluation is part of the pre- or postDeployment phase. || ✓ | + + +#### KeptnEvaluationStatus + + + +KeptnEvaluationStatus defines the observed state of KeptnEvaluation + +_Appears in:_ +- [KeptnEvaluation](#keptnevaluation) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `retryCount` _integer_ | RetryCount indicates how many times the KeptnEvaluation has been attempted already. |0| x | +| `evaluationStatus` _object (keys:string, values:[EvaluationStatusItem](#evaluationstatusitem))_ | EvaluationStatus describes the status of each objective of the KeptnEvaluationDefinition referenced by the KeptnEvaluation. || x | +| `overallStatus` _string_ | OverallStatus describes the overall status of the KeptnEvaluation. The Overall status is derived from the status of the individual objectives of the KeptnEvaluationDefinition referenced by the KeptnEvaluation. |Pending| x | +| `startTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#time-v1-meta)_ | StartTime represents the time at which the KeptnEvaluation started. || ✓ | +| `endTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#time-v1-meta)_ | EndTime represents the time at which the KeptnEvaluation finished. || ✓ | + + +#### KeptnMetricReference + + + + + +_Appears in:_ +- [Objective](#objective) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `name` _string_ | Name is the name of the referenced KeptnMetric. || x | +| `namespace` _string_ | Namespace is the namespace where the referenced KeptnMetric is located. || ✓ | + + +#### KeptnTask + + + +KeptnTask is the Schema for the keptntasks API + +_Appears in:_ +- [KeptnTaskList](#keptntasklist) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnTask` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `spec` _[KeptnTaskSpec](#keptntaskspec)_ | Spec describes the desired state of the KeptnTask. || ✓ | +| `status` _[KeptnTaskStatus](#keptntaskstatus)_ | Status describes the current state of the KeptnTask. || ✓ | + + +#### KeptnTaskDefinition + + + +KeptnTaskDefinition is the Schema for the keptntaskdefinitions API + +_Appears in:_ +- [KeptnTaskDefinitionList](#keptntaskdefinitionlist) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnTaskDefinition` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `spec` _[KeptnTaskDefinitionSpec](#keptntaskdefinitionspec)_ | Spec describes the desired state of the KeptnTaskDefinition. || ✓ | +| `status` _[KeptnTaskDefinitionStatus](#keptntaskdefinitionstatus)_ | Status describes the current state of the KeptnTaskDefinition. || ✓ | + + +#### KeptnTaskDefinitionList + + + +KeptnTaskDefinitionList contains a list of KeptnTaskDefinition + + + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnTaskDefinitionList` | | | +| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `items` _[KeptnTaskDefinition](#keptntaskdefinition) array_ | || x | + + +#### KeptnTaskDefinitionSpec + + + +KeptnTaskDefinitionSpec defines the desired state of KeptnTaskDefinition + +_Appears in:_ +- [KeptnTaskDefinition](#keptntaskdefinition) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `function` _[RuntimeSpec](#runtimespec)_ | Deprecated Function contains the definition for the function that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. || ✓ | +| `python` _[RuntimeSpec](#runtimespec)_ | Python contains the definition for the python function that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. || ✓ | +| `deno` _[RuntimeSpec](#runtimespec)_ | Deno contains the definition for the Deno function that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. || ✓ | +| `container` _[ContainerSpec](#containerspec)_ | Container contains the definition for the container that is to be used in Job based on the KeptnTaskDefinitions. || ✓ | +| `retries` _integer_ | Retries specifies how many times a job executing the KeptnTaskDefinition should be restarted in the case of an unsuccessful attempt. |10| ✓ | +| `timeout` _[Duration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#duration-v1-meta)_ | Timeout specifies the maximum time to wait for the task to be completed successfully. If the task does not complete successfully within this time frame, it will be considered to be failed. |5m| ✓ | +| `serviceAccount` _[ServiceAccountSpec](#serviceaccountspec)_ | ServiceAccount specifies the service account to be used in jobs to authenticate with the Kubernetes API and access cluster resources. || ✓ | +| `automountServiceAccountToken` _[AutomountServiceAccountTokenSpec](#automountserviceaccounttokenspec)_ | AutomountServiceAccountToken allows to enable K8s to assign cluster API credentials to a pod, if set to false the pod will decline the service account || ✓ | +| `ttlSecondsAfterFinished` _integer_ | TTLSecondsAfterFinished controller makes a job eligible to be cleaned up after it is finished. The timer starts when the status shows up to be Complete or Failed. |300| ✓ | +| `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#localobjectreference-v1-core) array_ | ImagePullSecrets is an optional field to specify the names of secrets to use for pulling container images || ✓ | + + +#### KeptnTaskDefinitionStatus + + + +KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition + +_Appears in:_ +- [KeptnTaskDefinition](#keptntaskdefinition) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `function` _[FunctionStatus](#functionstatus)_ | Function contains status information of the function definition for the task. || ✓ | + + +#### KeptnTaskList + + + +KeptnTaskList contains a list of KeptnTask + + + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnTaskList` | | | +| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `items` _[KeptnTask](#keptntask) array_ | || x | + + +#### KeptnTaskSpec + + + +KeptnTaskSpec defines the desired state of KeptnTask + +_Appears in:_ +- [KeptnTask](#keptntask) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `taskDefinition` _string_ | TaskDefinition refers to the name of the KeptnTaskDefinition which includes the specification for the task to be performed. The KeptnTaskDefinition can be located in the same namespace as the KeptnTask, or in the Keptn namespace. || x | +| `context` _[TaskContext](#taskcontext)_ | Context contains contextual information about the task execution. || ✓ | +| `parameters` _[TaskParameters](#taskparameters)_ | Parameters contains parameters that will be passed to the job that executes the task. || ✓ | +| `secureParameters` _[SecureParameters](#secureparameters)_ | SecureParameters contains secure parameters that will be passed to the job that executes the task. These will be stored and accessed as secrets in the cluster. || ✓ | +| `checkType` _string_ | Type indicates whether the KeptnTask is part of the pre- or postDeployment phase. || ✓ | +| `retries` _integer_ | Retries indicates how many times the KeptnTask can be attempted in the case of an error before considering the KeptnTask to be failed. |10| ✓ | +| `timeout` _[Duration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#duration-v1-meta)_ | Timeout specifies the maximum time to wait for the task to be completed successfully. If the task does not complete successfully within this time frame, it will be considered to be failed. |5m| ✓ | + + +#### KeptnTaskStatus + + + +KeptnTaskStatus defines the observed state of KeptnTask + +_Appears in:_ +- [KeptnTask](#keptntask) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `jobName` _string_ | JobName is the name of the Job executing the Task. || ✓ | +| `status` _string_ | Status represents the overall state of the KeptnTask. |Pending| ✓ | +| `message` _string_ | Message contains information about unexpected errors encountered during the execution of the KeptnTask. || ✓ | +| `startTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#time-v1-meta)_ | StartTime represents the time at which the KeptnTask started. || ✓ | +| `endTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#time-v1-meta)_ | EndTime represents the time at which the KeptnTask finished. || ✓ | +| `reason` _string_ | Reason contains more information about the reason for the last transition of the Job executing the KeptnTask. || ✓ | + + +#### KeptnWorkload + + + +KeptnWorkload is the Schema for the keptnworkloads API + +_Appears in:_ +- [KeptnWorkloadList](#keptnworkloadlist) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnWorkload` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `spec` _[KeptnWorkloadSpec](#keptnworkloadspec)_ | Spec describes the desired state of the KeptnWorkload. || ✓ | +| `status` _[KeptnWorkloadStatus](#keptnworkloadstatus)_ | Status describes the current state of the KeptnWorkload. || ✓ | + + +#### KeptnWorkloadList + + + +KeptnWorkloadList contains a list of KeptnWorkload + + + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnWorkloadList` | | | +| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `items` _[KeptnWorkload](#keptnworkload) array_ | || x | + + +#### KeptnWorkloadRef + + + +KeptnWorkloadRef refers to a KeptnWorkload that is part of a KeptnApp + +_Appears in:_ +- [KeptnAppSpec](#keptnappspec) +- [KeptnAppVersionSpec](#keptnappversionspec) +- [WorkloadStatus](#workloadstatus) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `name` _string_ | Name is the name of the KeptnWorkload. || x | +| `version` _string_ | Version is the version of the KeptnWorkload. || x | + + +#### KeptnWorkloadSpec + + + +KeptnWorkloadSpec defines the desired state of KeptnWorkload + +_Appears in:_ +- [KeptnWorkload](#keptnworkload) +- [KeptnWorkloadVersionSpec](#keptnworkloadversionspec) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `app` _string_ | AppName is the name of the KeptnApp containing the KeptnWorkload. || x | +| `version` _string_ | Version defines the version of the KeptnWorkload. || x | +| `preDeploymentTasks` _string array_ | PreDeploymentTasks is a list of all tasks to be performed during the pre-deployment phase of the KeptnWorkload. The items of this list refer to the names of KeptnTaskDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || ✓ | +| `postDeploymentTasks` _string array_ | PostDeploymentTasks is a list of all tasks to be performed during the post-deployment phase of the KeptnWorkload. The items of this list refer to the names of KeptnTaskDefinitions located in the same namespace as the KeptnWorkload, or in the Keptn namespace. || ✓ | +| `preDeploymentEvaluations` _string array_ | PreDeploymentEvaluations is a list of all evaluations to be performed during the pre-deployment phase of the KeptnWorkload. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnWorkload, or in the Keptn namespace. || ✓ | +| `postDeploymentEvaluations` _string array_ | PostDeploymentEvaluations is a list of all evaluations to be performed during the post-deployment phase of the KeptnWorkload. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnWorkload, or in the Keptn namespace. || ✓ | +| `resourceReference` _[ResourceReference](#resourcereference)_ | ResourceReference is a reference to the Kubernetes resource (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload is representing. || x | + + +#### KeptnWorkloadStatus + + + +KeptnWorkloadStatus defines the observed state of KeptnWorkload + +_Appears in:_ +- [KeptnWorkload](#keptnworkload) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `currentVersion` _string_ | CurrentVersion indicates the version that is currently deployed or being reconciled. || ✓ | + + +#### KeptnWorkloadVersion + + + +KeptnWorkloadVersion is the Schema for the keptnworkloadversions API + +_Appears in:_ +- [KeptnWorkloadVersionList](#keptnworkloadversionlist) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnWorkloadVersion` | | | +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `spec` _[KeptnWorkloadVersionSpec](#keptnworkloadversionspec)_ | Spec describes the desired state of the KeptnWorkloadVersion. || ✓ | +| `status` _[KeptnWorkloadVersionStatus](#keptnworkloadversionstatus)_ | Status describes the current state of the KeptnWorkloadVersion. || ✓ | + + +#### KeptnWorkloadVersionList + + + +KeptnWorkloadVersionList contains a list of KeptnWorkloadVersion + + + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `apiVersion` _string_ | `lifecycle.keptn.sh/v1beta1` | | | +| `kind` _string_ | `KeptnWorkloadVersionList` | | | +| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ | +| `items` _[KeptnWorkloadVersion](#keptnworkloadversion) array_ | || x | + + +#### KeptnWorkloadVersionSpec + + + +KeptnWorkloadVersionSpec defines the desired state of KeptnWorkloadVersion + +_Appears in:_ +- [KeptnWorkloadVersion](#keptnworkloadversion) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `app` _string_ | AppName is the name of the KeptnApp containing the KeptnWorkload. || x | +| `version` _string_ | Version defines the version of the KeptnWorkload. || x | +| `preDeploymentTasks` _string array_ | PreDeploymentTasks is a list of all tasks to be performed during the pre-deployment phase of the KeptnWorkload. The items of this list refer to the names of KeptnTaskDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || ✓ | +| `postDeploymentTasks` _string array_ | PostDeploymentTasks is a list of all tasks to be performed during the post-deployment phase of the KeptnWorkload. The items of this list refer to the names of KeptnTaskDefinitions located in the same namespace as the KeptnWorkload, or in the Keptn namespace. || ✓ | +| `preDeploymentEvaluations` _string array_ | PreDeploymentEvaluations is a list of all evaluations to be performed during the pre-deployment phase of the KeptnWorkload. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnWorkload, or in the Keptn namespace. || ✓ | +| `postDeploymentEvaluations` _string array_ | PostDeploymentEvaluations is a list of all evaluations to be performed during the post-deployment phase of the KeptnWorkload. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnWorkload, or in the Keptn namespace. || ✓ | +| `resourceReference` _[ResourceReference](#resourcereference)_ | ResourceReference is a reference to the Kubernetes resource (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload is representing. || x | +| `workloadName` _string_ | WorkloadName is the name of the KeptnWorkload. || x | +| `previousVersion` _string_ | PreviousVersion is the version of the KeptnWorkload that has been deployed prior to this version. || ✓ | +| `traceId` _object (keys:string, values:string)_ | TraceId contains the OpenTelemetry trace ID. || ✓ | + + +#### KeptnWorkloadVersionStatus + + + +KeptnWorkloadVersionStatus defines the observed state of KeptnWorkloadVersion + +_Appears in:_ +- [KeptnWorkloadVersion](#keptnworkloadversion) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `preDeploymentStatus` _string_ | PreDeploymentStatus indicates the current status of the KeptnWorkloadVersion's PreDeployment phase. |Pending| ✓ | +| `deploymentStatus` _string_ | DeploymentStatus indicates the current status of the KeptnWorkloadVersion's Deployment phase. |Pending| ✓ | +| `preDeploymentEvaluationStatus` _string_ | PreDeploymentEvaluationStatus indicates the current status of the KeptnWorkloadVersion's PreDeploymentEvaluation phase. |Pending| ✓ | +| `postDeploymentEvaluationStatus` _string_ | PostDeploymentEvaluationStatus indicates the current status of the KeptnWorkloadVersion's PostDeploymentEvaluation phase. |Pending| ✓ | +| `postDeploymentStatus` _string_ | PostDeploymentStatus indicates the current status of the KeptnWorkloadVersion's PostDeployment phase. |Pending| ✓ | +| `preDeploymentTaskStatus` _[ItemStatus](#itemstatus) array_ | PreDeploymentTaskStatus indicates the current state of each preDeploymentTask of the KeptnWorkloadVersion. || ✓ | +| `postDeploymentTaskStatus` _[ItemStatus](#itemstatus) array_ | PostDeploymentTaskStatus indicates the current state of each postDeploymentTask of the KeptnWorkloadVersion. || ✓ | +| `preDeploymentEvaluationTaskStatus` _[ItemStatus](#itemstatus) array_ | PreDeploymentEvaluationTaskStatus indicates the current state of each preDeploymentEvaluation of the KeptnWorkloadVersion. || ✓ | +| `postDeploymentEvaluationTaskStatus` _[ItemStatus](#itemstatus) array_ | PostDeploymentEvaluationTaskStatus indicates the current state of each postDeploymentEvaluation of the KeptnWorkloadVersion. || ✓ | +| `startTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#time-v1-meta)_ | StartTime represents the time at which the deployment of the KeptnWorkloadVersion started. || ✓ | +| `endTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#time-v1-meta)_ | EndTime represents the time at which the deployment of the KeptnWorkloadVersion finished. || ✓ | +| `currentPhase` _string_ | CurrentPhase indicates the current phase of the KeptnWorkloadVersion. This can be: - PreDeploymentTasks - PreDeploymentEvaluations - Deployment - PostDeploymentTasks - PostDeploymentEvaluations || ✓ | +| `phaseTraceIDs` _[MapCarrier](https://pkg.go.dev/go.opentelemetry.io/otel/propagation#MapCarrier)_ | PhaseTraceIDs contains the trace IDs of the OpenTelemetry spans of each phase of the KeptnWorkloadVersion || ✓ | +| `status` _string_ | Status represents the overall status of the KeptnWorkloadVersion. |Pending| ✓ | + + +#### Objective + + + + + +_Appears in:_ +- [KeptnEvaluationDefinitionSpec](#keptnevaluationdefinitionspec) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `keptnMetricRef` _[KeptnMetricReference](#keptnmetricreference)_ | KeptnMetricRef references the KeptnMetric that should be evaluated. || x | +| `evaluationTarget` _string_ | EvaluationTarget specifies the target value for the references KeptnMetric. Needs to start with either '<' or '>', followed by the target value (e.g. '<10'). || x | + + +#### ResourceReference + + + +ResourceReference represents the parent resource of Workload + +_Appears in:_ +- [KeptnWorkloadSpec](#keptnworkloadspec) +- [KeptnWorkloadVersionSpec](#keptnworkloadversionspec) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `uid` _string_ | || x | +| `kind` _string_ | || x | +| `name` _string_ | || x | + + +#### RuntimeSpec + + + + + +_Appears in:_ +- [KeptnTaskDefinitionSpec](#keptntaskdefinitionspec) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `functionRef` _[FunctionReference](#functionreference)_ | FunctionReference allows to reference another KeptnTaskDefinition which contains the source code of the function to be executes for KeptnTasks based on this KeptnTaskDefinition. This can be useful when you have multiple KeptnTaskDefinitions that should execute the same logic, but each with different parameters. || ✓ | +| `inline` _[Inline](#inline)_ | Inline allows to specify the code that should be executed directly in the KeptnTaskDefinition, as a multi-line string. || ✓ | +| `httpRef` _[HttpReference](#httpreference)_ | HttpReference allows to point to an HTTP URL containing the code of the function. || ✓ | +| `configMapRef` _[ConfigMapReference](#configmapreference)_ | ConfigMapReference allows to reference a ConfigMap containing the code of the function. When referencing a ConfigMap, the code of the function must be available as a value of the 'code' key of the referenced ConfigMap. || ✓ | +| `parameters` _[TaskParameters](#taskparameters)_ | Parameters contains parameters that will be passed to the job that executes the task as env variables. || ✓ | +| `secureParameters` _[SecureParameters](#secureparameters)_ | SecureParameters contains secure parameters that will be passed to the job that executes the task. These will be stored and accessed as secrets in the cluster. || ✓ | +| `cmdParameters` _string_ | CmdParameters contains parameters that will be passed to the command || ✓ | + + +#### SecureParameters + + + + + +_Appears in:_ +- [KeptnTaskSpec](#keptntaskspec) +- [RuntimeSpec](#runtimespec) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `secret` _string_ | Secret contains the parameters that will be made available to the job executing the KeptnTask via the 'SECRET_DATA' environment variable. The 'SECRET_DATA' environment variable's content will the same as value of the 'SECRET_DATA' key of the referenced secret. || ✓ | + + +#### ServiceAccountSpec + + + + + +_Appears in:_ +- [KeptnTaskDefinitionSpec](#keptntaskdefinitionspec) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `name` _string_ | || x | + + +#### TaskContext + + + + + +_Appears in:_ +- [KeptnTaskSpec](#keptntaskspec) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `workloadName` _string_ | WorkloadName the name of the KeptnWorkload the KeptnTask is being executed for. || ✓ | +| `appName` _string_ | AppName the name of the KeptnApp the KeptnTask is being executed for. || ✓ | +| `appVersion` _string_ | AppVersion the version of the KeptnApp the KeptnTask is being executed for. || ✓ | +| `workloadVersion` _string_ | WorkloadVersion the version of the KeptnWorkload the KeptnTask is being executed for. || ✓ | +| `taskType` _string_ | TaskType indicates whether the KeptnTask is part of the pre- or postDeployment phase. || ✓ | +| `objectType` _string_ | ObjectType indicates whether the KeptnTask is being executed for a KeptnApp or KeptnWorkload. || ✓ | + + +#### TaskParameters + + + + + +_Appears in:_ +- [KeptnTaskSpec](#keptntaskspec) +- [RuntimeSpec](#runtimespec) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `map` _object (keys:string, values:string)_ | Inline contains the parameters that will be made available to the job executing the KeptnTask via the 'DATA' environment variable. The 'DATA' environment variable's content will be a json encoded string containing all properties of the map provided. || ✓ | + + +#### WorkloadStatus + + + + + +_Appears in:_ +- [KeptnAppVersionStatus](#keptnappversionstatus) + +| Field | Description | Default | Optional | +| --- | --- | --- | --- | +| `workload` _[KeptnWorkloadRef](#keptnworkloadref)_ | Workload refers to a KeptnWorkload that is part of the KeptnAppVersion. || ✓ | +| `status` _string_ | Status indicates the current status of the KeptnWorkload. |Pending| ✓ | + + diff --git a/lifecycle-operator/PROJECT b/lifecycle-operator/PROJECT index 189f0c59f1..c751ac60e9 100644 --- a/lifecycle-operator/PROJECT +++ b/lifecycle-operator/PROJECT @@ -279,3 +279,80 @@ resources: path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha4 version: v1alpha4 version: "3" +- api: + crdVersion: v1 + namespaced: true + domain: keptn.sh + group: lifecycle + kind: KeptnApp + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1 + version: v1beta1 +- api: + crdVersion: v1 + namespaced: true + domain: keptn.sh + group: lifecycle + kind: KeptnAppVersion + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1 + version: v1beta1 +- api: + crdVersion: v1 + namespaced: true + domain: keptn.sh + group: lifecycle + kind: KeptnEvaluation + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1 + version: v1beta1 +- api: + crdVersion: v1 + namespaced: true + domain: keptn.sh + group: lifecycle + kind: KeptnEvaluationDefinition + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1 + version: v1beta1 +- api: + crdVersion: v1 + namespaced: true + domain: keptn.sh + group: lifecycle + kind: KeptnTask + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1 + version: v1beta1 +- api: + crdVersion: v1 + namespaced: true + domain: keptn.sh + group: lifecycle + kind: KeptnTaskDefinition + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1 + version: v1beta1 + webhooks: + validation: true + webhookVersion: v1 +- api: + crdVersion: v1 + namespaced: true + domain: keptn.sh + group: lifecycle + kind: KeptnWorkload + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1 + version: v1beta1 +- api: + crdVersion: v1 + namespaced: true + controller: true + domain: keptn.sh + group: lifecycle + kind: KeptnAppCreationRequest + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1 + version: v1beta1 +- api: + crdVersion: v1 + namespaced: true + domain: keptn.sh + group: lifecycle + kind: KeptnWorkloadVersion + path: github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1 + version: v1beta1 +version: "3" diff --git a/lifecycle-operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types.go b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types.go index 61ffd26d89..42514716f6 100644 --- a/lifecycle-operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types.go +++ b/lifecycle-operator/apis/lifecycle/v1alpha3/keptnappcreationrequest_types.go @@ -34,6 +34,7 @@ type KeptnAppCreationRequestSpec struct { // +kubebuilder:object:root=true // +kubebuilder:subresource:status +// +kubebuilder:storageversion // KeptnAppCreationRequest is the Schema for the keptnappcreationrequests API type KeptnAppCreationRequest struct { diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/common/common.go b/lifecycle-operator/apis/lifecycle/v1beta1/common/common.go new file mode 100644 index 0000000000..f3d81d56c5 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/common/common.go @@ -0,0 +1,214 @@ +package common + +import ( + "crypto/sha256" + "encoding/hex" + "errors" + "math/rand" + "strconv" + + operatorcommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/common" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const WorkloadAnnotation = "keptn.sh/workload" +const VersionAnnotation = "keptn.sh/version" +const AppAnnotation = "keptn.sh/app" +const PreDeploymentTaskAnnotation = "keptn.sh/pre-deployment-tasks" +const PostDeploymentTaskAnnotation = "keptn.sh/post-deployment-tasks" +const K8sRecommendedWorkloadAnnotations = "app.kubernetes.io/name" +const K8sRecommendedVersionAnnotations = "app.kubernetes.io/version" +const K8sRecommendedAppAnnotations = "app.kubernetes.io/part-of" +const K8sRecommendedManagedByAnnotations = "app.kubernetes.io/managed-by" +const PreDeploymentEvaluationAnnotation = "keptn.sh/pre-deployment-evaluations" +const PostDeploymentEvaluationAnnotation = "keptn.sh/post-deployment-evaluations" +const SchedulingGateRemoved = "keptn.sh/scheduling-gate-removed" +const TaskNameAnnotation = "keptn.sh/task-name" +const NamespaceEnabledAnnotation = "keptn.sh/lifecycle-toolkit" +const CreateAppTaskSpanName = "create_%s_app_task" +const CreateWorkloadTaskSpanName = "create_%s_deployment_task" +const CreateAppEvalSpanName = "create_%s_app_evaluation" +const CreateWorkloadEvalSpanName = "create_%s_deployment_evaluation" +const AppTypeAnnotation = "keptn.sh/app-type" +const KeptnGate = "keptn-prechecks-gate" +const ContainerNameAnnotation = "keptn.sh/container" + +const MinKeptnNameLen = 80 +const MaxK8sObjectLength = 253 + +var ErrCannotCastKeptnAppVersion = errors.New("cannot cast KeptnAppVersion to v1alpha3") +var ErrCannotCastKeptnApp = errors.New("cannot cast KeptnApp to v1alpha3") + +type AppType string + +const ( + AppTypeSingleService AppType = "single-service" + AppTypeMultiService AppType = "multi-service" +) + +// KeptnState is a string containing current Phase state (Progressing/Succeeded/Failed/Unknown/Pending/Cancelled) +type KeptnState string + +const ( + StateProgressing KeptnState = "Progressing" + StateSucceeded KeptnState = "Succeeded" + StateFailed KeptnState = "Failed" + StateUnknown KeptnState = "Unknown" + StatePending KeptnState = "Pending" + StateDeprecated KeptnState = "Deprecated" + // Deprecated: Use StateDeprecated instead. Should only be used in checks for backwards compatibility reasons +) + +func (k KeptnState) IsCompleted() bool { + return k == StateSucceeded || k == StateFailed || k == StateDeprecated +} + +func (k KeptnState) IsSucceeded() bool { + return k == StateSucceeded +} + +func (k KeptnState) IsFailed() bool { + return k == StateFailed +} + +func (k KeptnState) IsDeprecated() bool { + return k == StateDeprecated +} + +func (k KeptnState) IsPending() bool { + return k == StatePending +} + +type StatusSummary struct { + Total int + Progressing int + Failed int + Succeeded int + Pending int + Unknown int + Deprecated int +} + +func UpdateStatusSummary(status KeptnState, summary StatusSummary) StatusSummary { + switch status { + case StateFailed: + summary.Failed++ + case StateDeprecated: + summary.Deprecated++ + case StateSucceeded: + summary.Succeeded++ + case StateProgressing: + summary.Progressing++ + case StatePending, "": + summary.Pending++ + case StateUnknown: + summary.Unknown++ + } + return summary +} + +func (s StatusSummary) GetTotalCount() int { + return s.Failed + s.Succeeded + s.Progressing + s.Pending + s.Unknown + s.Deprecated +} + +func GetOverallState(s StatusSummary) KeptnState { + if s.Failed > 0 || s.Deprecated > 0 { + return StateFailed + } + if s.Progressing > 0 { + return StateProgressing + } + if s.Pending > 0 { + return StatePending + } + if s.Unknown > 0 || s.GetTotalCount() != s.Total { + return StateUnknown + } + return StateSucceeded +} + +func TruncateString(s string, max int) string { + if len(s) > max { + return s[:max] + } + return s +} + +func Hash(num int64) string { + // generate the SHA-256 hash of the bytes + hash := sha256.Sum256([]byte(strconv.FormatInt(num, 10))) + // take the first 4 bytes of the hash and convert to hex + return hex.EncodeToString(hash[:4]) +} + +type CheckType string + +const PreDeploymentCheckType CheckType = "pre" +const PostDeploymentCheckType CheckType = "post" +const PreDeploymentEvaluationCheckType CheckType = "pre-eval" +const PostDeploymentEvaluationCheckType CheckType = "post-eval" + +type KeptnMeters struct { + TaskCount metric.Int64Counter + TaskDuration metric.Float64Histogram + DeploymentCount metric.Int64Counter + DeploymentDuration metric.Float64Histogram + AppCount metric.Int64Counter + AppDuration metric.Float64Histogram + EvaluationCount metric.Int64Counter + EvaluationDuration metric.Float64Histogram +} + +const ( + AppName attribute.Key = attribute.Key("keptn.deployment.app.name") + AppVersion attribute.Key = attribute.Key("keptn.deployment.app.version") + AppNamespace attribute.Key = attribute.Key("keptn.deployment.app.namespace") + AppStatus attribute.Key = attribute.Key("keptn.deployment.app.status") + AppPreviousVersion attribute.Key = attribute.Key("keptn.deployment.app.previousversion") + WorkloadName attribute.Key = attribute.Key("keptn.deployment.workload.name") + WorkloadVersion attribute.Key = attribute.Key("keptn.deployment.workload.version") + WorkloadPreviousVersion attribute.Key = attribute.Key("keptn.deployment.workload.previousversion") + WorkloadNamespace attribute.Key = attribute.Key("keptn.deployment.workload.namespace") + WorkloadStatus attribute.Key = attribute.Key("keptn.deployment.workload.status") + TaskStatus attribute.Key = attribute.Key("keptn.deployment.task.status") + TaskName attribute.Key = attribute.Key("keptn.deployment.task.name") + TaskType attribute.Key = attribute.Key("keptn.deployment.task.type") + EvaluationStatus attribute.Key = attribute.Key("keptn.deployment.evaluation.status") + EvaluationName attribute.Key = attribute.Key("keptn.deployment.evaluation.name") + EvaluationType attribute.Key = attribute.Key("keptn.deployment.evaluation.type") +) + +func GenerateTaskName(checkType CheckType, taskName string) string { + randomId := rand.Intn(99_999-10_000) + 10000 + return operatorcommon.CreateResourceName(MaxK8sObjectLength, MinKeptnNameLen, string(checkType), taskName, strconv.Itoa(randomId)) +} + +func GenerateJobName(taskName string) string { + randomId := rand.Intn(99_999-10_000) + 10000 + return operatorcommon.CreateResourceName(MaxK8sObjectLength, MinKeptnNameLen, taskName, strconv.Itoa(randomId)) +} + +func GenerateEvaluationName(checkType CheckType, evalName string) string { + randomId := rand.Intn(99_999-10_000) + 10000 + return operatorcommon.CreateResourceName(MaxK8sObjectLength, MinKeptnNameLen, string(checkType), evalName, strconv.Itoa(randomId)) +} + +// MergeMaps merges two maps into a new map. If a key exists in both maps, the +// value of the second map is picked. +func MergeMaps(m1 map[string]string, m2 map[string]string) map[string]string { + merged := make(map[string]string, len(m1)+len(m2)) + for key, value := range m1 { + merged[key] = value + } + for key, value := range m2 { + merged[key] = value + } + return merged +} + +// IsOwnerSupported returns whether the owner of the given object is supported to be considered a KeptnWorkload +func IsOwnerSupported(owner metav1.OwnerReference) bool { + return owner.Kind == "ReplicaSet" || owner.Kind == "Deployment" || owner.Kind == "StatefulSet" || owner.Kind == "DaemonSet" || owner.Kind == "Rollout" +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/common/common_test.go b/lifecycle-operator/apis/lifecycle/v1beta1/common/common_test.go new file mode 100644 index 0000000000..ea05466ed7 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/common/common_test.go @@ -0,0 +1,483 @@ +package common + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/require" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ExtraLongName = "loooooooooooooooooooooo00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ooooooo01234567891234567890123456789" + +func TestKeptnState_IsCompleted(t *testing.T) { + tests := []struct { + State KeptnState + Want bool + }{ + { + State: StateProgressing, + Want: false, + }, + { + State: StateFailed, + Want: true, + }, + { + State: StateSucceeded, + Want: true, + }, + { + State: StateDeprecated, + Want: true, + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, tt.Want, tt.State.IsCompleted()) + }) + } +} + +func TestKeptnState_IsSucceeded(t *testing.T) { + tests := []struct { + State KeptnState + Want bool + }{ + { + State: StateProgressing, + Want: false, + }, + { + State: StateSucceeded, + Want: true, + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, tt.State.IsSucceeded(), tt.Want) + }) + } +} + +func TestKeptnState_IsFailed(t *testing.T) { + tests := []struct { + State KeptnState + Want bool + }{ + { + State: StateSucceeded, + Want: false, + }, + { + State: StateFailed, + Want: true, + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, tt.State.IsFailed(), tt.Want) + }) + } +} + +func TestHash(t *testing.T) { + tests := []struct { + in int64 + out string + }{ + { + in: int64(1), + out: "6b86b273", + }, + { + in: int64(2), + out: "d4735e3a", + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, tt.out, Hash(tt.in)) + }) + } +} + +func TestKeptnState_IsDeprecated(t *testing.T) { + tests := []struct { + State KeptnState + Want bool + }{ + { + State: StateSucceeded, + Want: false, + }, + { + State: StateDeprecated, + Want: true, + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, tt.State.IsDeprecated(), tt.Want) + }) + } +} + +func TestKeptnKeptnState_IsPending(t *testing.T) { + tests := []struct { + State KeptnState + Want bool + }{ + { + State: StateSucceeded, + Want: false, + }, + { + State: StatePending, + Want: true, + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, tt.State.IsPending(), tt.Want) + }) + } +} + +func Test_UpdateStatusSummary(t *testing.T) { + emmptySummary := StatusSummary{0, 0, 0, 0, 0, 0, 0} + tests := []struct { + State KeptnState + Want StatusSummary + }{ + { + State: StateProgressing, + Want: StatusSummary{0, 1, 0, 0, 0, 0, 0}, + }, + { + State: StateFailed, + Want: StatusSummary{0, 0, 1, 0, 0, 0, 0}, + }, + { + State: StateSucceeded, + Want: StatusSummary{0, 0, 0, 1, 0, 0, 0}, + }, + { + State: StatePending, + Want: StatusSummary{0, 0, 0, 0, 1, 0, 0}, + }, + { + State: "", + Want: StatusSummary{0, 0, 0, 0, 1, 0, 0}, + }, + { + State: StateUnknown, + Want: StatusSummary{0, 0, 0, 0, 0, 1, 0}, + }, + { + State: StateDeprecated, + Want: StatusSummary{0, 0, 0, 0, 0, 0, 1}, + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, UpdateStatusSummary(tt.State, emmptySummary), tt.Want) + }) + } +} + +func Test_GetTotalCount(t *testing.T) { + summary := StatusSummary{2, 0, 2, 1, 0, 3, 5} + require.Equal(t, summary.GetTotalCount(), 11) +} + +func Test_GeOverallState(t *testing.T) { + tests := []struct { + Name string + Summary StatusSummary + Want KeptnState + }{ + { + Name: "failed", + Summary: StatusSummary{0, 0, 1, 0, 0, 0, 0}, + Want: StateFailed, + }, + { + Name: "deprecated", + Summary: StatusSummary{0, 0, 0, 0, 0, 0, 1}, + Want: StateFailed, + }, + { + Name: "progressing", + Summary: StatusSummary{0, 1, 0, 0, 0, 0, 0}, + Want: StateProgressing, + }, + { + Name: "pending", + Summary: StatusSummary{0, 0, 0, 0, 1, 0, 0}, + Want: StatePending, + }, + { + Name: "unknown", + Summary: StatusSummary{0, 0, 0, 0, 0, 1, 0}, + Want: StateUnknown, + }, + { + Name: "unknown totalcount", + Summary: StatusSummary{5, 0, 0, 0, 0, 1, 0}, + Want: StateUnknown, + }, + { + Name: "succeeded", + Summary: StatusSummary{1, 0, 0, 1, 0, 0, 0}, + Want: StateSucceeded, + }, + } + for _, tt := range tests { + t.Run(tt.Name, func(t *testing.T) { + require.Equal(t, GetOverallState(tt.Summary), tt.Want) + }) + } +} + +func Test_TruncateString(t *testing.T) { + tests := []struct { + Input string + Max int + Want string + }{ + { + Input: "some_string", + Max: 20, + Want: "some_string", + }, + { + Input: "some_string", + Max: 5, + Want: "some_", + }, + { + Input: "", + Max: 5, + Want: "", + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, TruncateString(tt.Input, tt.Max), tt.Want) + }) + } +} + +func Test_GenerateTaskName(t *testing.T) { + tests := []struct { + Check CheckType + Name string + Want string + }{ + { + Check: PreDeploymentCheckType, + Name: "short-name", + Want: "pre-short-name-", + }, + { + Check: PreDeploymentCheckType, + Name: "", + Want: "pre--", + }, + { + Check: PreDeploymentCheckType, + Name: ExtraLongName, + Want: "pre-loooooooooooooooooooooo00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ooooooo0123456789123456-", + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.True(t, strings.HasPrefix(GenerateTaskName(tt.Check, tt.Name), tt.Want)) + }) + } +} + +func Test_GenerateEvaluationName(t *testing.T) { + tests := []struct { + Check CheckType + Name string + Want string + }{ + { + Check: PreDeploymentEvaluationCheckType, + Name: "short-name", + Want: "pre-eval-short-name-", + }, + { + Check: PreDeploymentEvaluationCheckType, + Name: "", + Want: "pre-eval--", + }, + { + Check: PreDeploymentEvaluationCheckType, + Name: ExtraLongName, + Want: "pre-eval-loooooooooooooooooooooo00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ooooooo01234567891-", + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.True(t, strings.HasPrefix(GenerateEvaluationName(tt.Check, tt.Name), tt.Want)) + }) + } +} + +func Test_GenerateJobName(t *testing.T) { + tests := []struct { + Name string + Want string + }{ + { + Name: "short-name", + Want: "short-name-", + }, + { + Name: "", + Want: "-", + }, + { + Name: ExtraLongName, + Want: "loooooooooooooooooooooo00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ooooooo01234567891234567890-", + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.True(t, strings.HasPrefix(GenerateJobName(tt.Name), tt.Want)) + }) + } +} + +func Test_MergeMaps(t *testing.T) { + tests := []struct { + In1 map[string]string + In2 map[string]string + Want map[string]string + }{ + { + In1: nil, + In2: nil, + Want: map[string]string{}, + }, + { + In1: nil, + In2: map[string]string{ + "ll1": "ll2", + "ll3": "ll4", + }, + Want: map[string]string{ + "ll1": "ll2", + "ll3": "ll4", + }, + }, + { + In1: map[string]string{ + "ll1": "ll2", + "ll3": "ll4", + }, + In2: nil, + Want: map[string]string{ + "ll1": "ll2", + "ll3": "ll4", + }, + }, + { + In1: map[string]string{ + "ll1": "ll2", + "ll3": "ll4", + }, + In2: map[string]string{ + "ll5": "ll6", + "ll7": "ll8", + }, + Want: map[string]string{ + "ll1": "ll2", + "ll3": "ll4", + "ll5": "ll6", + "ll7": "ll8", + }, + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, MergeMaps(tt.In1, tt.In2), tt.Want) + }) + } +} + +func TestIsOwnerSupported(t *testing.T) { + type args struct { + owner v1.OwnerReference + } + tests := []struct { + name string + args args + want bool + }{ + { + name: "Deployment -> true", + args: args{ + owner: v1.OwnerReference{ + Kind: "Deployment", + }, + }, + want: true, + }, + { + name: "DaemonSet-> true", + args: args{ + owner: v1.OwnerReference{ + Kind: "DaemonSet", + }, + }, + want: true, + }, + { + name: "ReplicaSet-> true", + args: args{ + owner: v1.OwnerReference{ + Kind: "ReplicaSet", + }, + }, + want: true, + }, + { + name: "StatefulSet-> true", + args: args{ + owner: v1.OwnerReference{ + Kind: "StatefulSet", + }, + }, + want: true, + }, + { + name: "Rollout-> true", + args: args{ + owner: v1.OwnerReference{ + Kind: "Rollout", + }, + }, + want: true, + }, + { + name: "Job-> false", + args: args{ + owner: v1.OwnerReference{ + Kind: "Job", + }, + }, + want: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsOwnerSupported(tt.args.owner); got != tt.want { + t.Errorf("IsOwnerSupported() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/common/phases.go b/lifecycle-operator/apis/lifecycle/v1beta1/common/phases.go new file mode 100644 index 0000000000..32b8951959 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/common/phases.go @@ -0,0 +1,131 @@ +package common + +import ( + "strings" + + "go.opentelemetry.io/otel/propagation" +) + +type KeptnPhase KeptnPhaseType + +type KeptnPhaseType struct { + LongName string + ShortName string +} + +var phases = []KeptnPhaseType{ + PhaseWorkloadPreDeployment, + PhaseWorkloadPostDeployment, + PhaseWorkloadPreEvaluation, + PhaseWorkloadPostEvaluation, + PhaseWorkloadDeployment, + PhaseAppPreDeployment, + PhaseAppPostDeployment, + PhaseAppPreEvaluation, + PhaseAppPostEvaluation, + PhaseAppDeployment, + PhaseReconcileEvaluation, + PhaseReconcileTask, + PhaseReconcileWorkload, + PhaseUpdateWorkload, + PhaseCreateEvaluation, + PhaseCreateTask, + PhaseCreateAppCreationRequest, + PhaseCreateWorkload, + PhaseCreateWorkloadVersion, + PhaseCreateAppVersion, + PhaseAppCompleted, + PhaseWorkloadCompleted, + PhaseDeprecateAppVersion, + PhaseDeprecated, + PhaseAppCompleted, +} + +func (p KeptnPhaseType) IsEvaluation() bool { + return strings.Contains(p.ShortName, "DeployEvaluations") +} + +func (p KeptnPhaseType) IsPreEvaluation() bool { + return strings.Contains(p.ShortName, "PreDeployEvaluations") +} + +func (p KeptnPhaseType) IsPostEvaluation() bool { + return strings.Contains(p.ShortName, "PostDeployEvaluations") +} + +func (p KeptnPhaseType) IsTask() bool { + return strings.Contains(p.ShortName, "DeployTasks") +} + +func (p KeptnPhaseType) IsPreTask() bool { + return strings.Contains(p.ShortName, "PreDeployTasks") +} + +func (p KeptnPhaseType) IsPostTask() bool { + return strings.Contains(p.ShortName, "PostDeployTasks") +} + +func GetShortPhaseName(phase string) string { + for _, p := range phases { + if phase == p.ShortName { + return p.ShortName + } + } + + for _, p := range phases { + if phase == p.LongName { + return p.ShortName + } + } + + return "" +} + +var ( + PhaseWorkloadPreDeployment = KeptnPhaseType{LongName: "Workload Pre-Deployment Tasks", ShortName: "WorkloadPreDeployTasks"} + PhaseWorkloadPostDeployment = KeptnPhaseType{LongName: "Workload Post-Deployment Tasks", ShortName: "WorkloadPostDeployTasks"} + PhaseWorkloadPreEvaluation = KeptnPhaseType{LongName: "Workload Pre-Deployment Evaluations", ShortName: "WorkloadPreDeployEvaluations"} + PhaseWorkloadPostEvaluation = KeptnPhaseType{LongName: "Workload Post-Deployment Evaluations", ShortName: "WorkloadPostDeployEvaluations"} + PhaseWorkloadDeployment = KeptnPhaseType{LongName: "Workload Deployment", ShortName: "WorkloadDeploy"} + PhaseAppPreDeployment = KeptnPhaseType{LongName: "App Pre-Deployment Tasks", ShortName: "AppPreDeployTasks"} + PhaseAppPostDeployment = KeptnPhaseType{LongName: "App Post-Deployment Tasks", ShortName: "AppPostDeployTasks"} + PhaseAppPreEvaluation = KeptnPhaseType{LongName: "App Pre-Deployment Evaluations", ShortName: "AppPreDeployEvaluations"} + PhaseAppPostEvaluation = KeptnPhaseType{LongName: "App Post-Deployment Evaluations", ShortName: "AppPostDeployEvaluations"} + PhaseAppDeployment = KeptnPhaseType{LongName: "App Deployment", ShortName: "AppDeploy"} + PhaseReconcileEvaluation = KeptnPhaseType{LongName: "Reconcile Evaluation", ShortName: "ReconcileEvaluation"} + PhaseReconcileTask = KeptnPhaseType{LongName: "Reconcile Task", ShortName: "ReconcileTask"} + PhaseReconcileWorkload = KeptnPhaseType{LongName: "Reconcile Workloads", ShortName: "ReconcileWorkload"} + PhaseCreateEvaluation = KeptnPhaseType{LongName: "Create Evaluation", ShortName: "CreateEvaluation"} + PhaseCreateTask = KeptnPhaseType{LongName: "Create Task", ShortName: "CreateTask"} + PhaseCreateAppCreationRequest = KeptnPhaseType{LongName: "Create AppCreationRequest", ShortName: "CreateAppCreationRequest"} + PhaseCreateWorkload = KeptnPhaseType{LongName: "Create Workload", ShortName: "CreateWorkload"} + PhaseUpdateWorkload = KeptnPhaseType{LongName: "Update Workload", ShortName: "UpdateWorkload"} + PhaseCreateWorkloadVersion = KeptnPhaseType{LongName: "Create WorkloadVersion", ShortName: "CreateWorkloadVersion"} + PhaseCreateAppVersion = KeptnPhaseType{LongName: "Create AppVersion", ShortName: "CreateAppVersion"} + PhaseDeprecateAppVersion = KeptnPhaseType{LongName: "Deprecate AppVersion", ShortName: "DeprecateAppVersion"} + PhaseAppCompleted = KeptnPhaseType{LongName: "App Completed", ShortName: "AppCompleted"} + PhaseWorkloadCompleted = KeptnPhaseType{LongName: "Workload Completed", ShortName: "WorkloadCompleted"} + PhaseCompleted = KeptnPhaseType{LongName: "Completed", ShortName: "Completed"} + PhaseDeprecated = KeptnPhaseType{LongName: "Deprecated", ShortName: "Deprecated"} +) + +type PhaseTraceID map[string]propagation.MapCarrier + +func (pid PhaseTraceID) SetPhaseTraceID(phase string, carrier propagation.MapCarrier) { + pid[GetShortPhaseName(phase)] = carrier + +} + +func (pid PhaseTraceID) GetPhaseTraceID(phase string) propagation.MapCarrier { + return pid[GetShortPhaseName(phase)] +} + +var ( + PhaseStateFinished = "Finished" + PhaseStateStarted = "Started" + PhaseStateFailed = "Failed" + PhaseStateStatusChanged = "StatusChanged" + PhaseStateReconcileError = "ReconcileError" + PhaseStateReconcileTimeout = "ReconcileTimeout" + PhaseStateNotFound = "NotFound" +) diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/common/phases_test.go b/lifecycle-operator/apis/lifecycle/v1beta1/common/phases_test.go new file mode 100644 index 0000000000..271732c1f1 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/common/phases_test.go @@ -0,0 +1,275 @@ +package common + +import ( + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/propagation" +) + +func TestKeptnPhaseType_IsEvaluation(t *testing.T) { + tests := []struct { + State KeptnPhaseType + Want bool + }{ + { + State: PhaseWorkloadDeployment, + Want: false, + }, + { + State: PhaseWorkloadPostEvaluation, + Want: true, + }, + { + State: PhaseWorkloadPreEvaluation, + Want: true, + }, + { + State: PhaseAppPostEvaluation, + Want: true, + }, + { + State: PhaseAppPreEvaluation, + Want: true, + }, + { + State: PhaseAppPreDeployment, + Want: false, + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, tt.State.IsEvaluation(), tt.Want) + }) + } +} + +func TestKeptnPhaseType_IsPreEvaluation(t *testing.T) { + tests := []struct { + State KeptnPhaseType + Want bool + }{ + { + State: PhaseWorkloadDeployment, + Want: false, + }, + { + State: PhaseWorkloadPostEvaluation, + Want: false, + }, + { + State: PhaseWorkloadPreEvaluation, + Want: true, + }, + { + State: PhaseAppPostEvaluation, + Want: false, + }, + { + State: PhaseAppPreEvaluation, + Want: true, + }, + { + State: PhaseAppPreDeployment, + Want: false, + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, tt.State.IsPreEvaluation(), tt.Want) + }) + } +} + +func TestKeptnPhaseType_IsPostEvaluation(t *testing.T) { + tests := []struct { + State KeptnPhaseType + Want bool + }{ + { + State: PhaseWorkloadDeployment, + Want: false, + }, + { + State: PhaseWorkloadPostEvaluation, + Want: true, + }, + { + State: PhaseWorkloadPreEvaluation, + Want: false, + }, + { + State: PhaseAppPostEvaluation, + Want: true, + }, + { + State: PhaseAppPreEvaluation, + Want: false, + }, + { + State: PhaseAppPreDeployment, + Want: false, + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, tt.State.IsPostEvaluation(), tt.Want) + }) + } +} + +func TestKeptnPhaseType_IsTask(t *testing.T) { + tests := []struct { + State KeptnPhaseType + Want bool + }{ + { + State: PhaseWorkloadDeployment, + Want: false, + }, + { + State: PhaseWorkloadPostDeployment, + Want: true, + }, + { + State: PhaseWorkloadPreDeployment, + Want: true, + }, + { + State: PhaseAppPostDeployment, + Want: true, + }, + { + State: PhaseAppPreDeployment, + Want: true, + }, + { + State: PhaseAppPreEvaluation, + Want: false, + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, tt.State.IsTask(), tt.Want) + }) + } +} + +func TestKeptnPhaseType_IsPreTask(t *testing.T) { + tests := []struct { + State KeptnPhaseType + Want bool + }{ + { + State: PhaseWorkloadDeployment, + Want: false, + }, + { + State: PhaseWorkloadPostDeployment, + Want: false, + }, + { + State: PhaseWorkloadPreDeployment, + Want: true, + }, + { + State: PhaseAppPostDeployment, + Want: false, + }, + { + State: PhaseAppPreDeployment, + Want: true, + }, + { + State: PhaseAppPreEvaluation, + Want: false, + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, tt.State.IsPreTask(), tt.Want) + }) + } +} + +func TestKeptnPhaseType_IsPostTask(t *testing.T) { + tests := []struct { + State KeptnPhaseType + Want bool + }{ + { + State: PhaseWorkloadDeployment, + Want: false, + }, + { + State: PhaseWorkloadPostDeployment, + Want: true, + }, + { + State: PhaseWorkloadPreDeployment, + Want: false, + }, + { + State: PhaseAppPostDeployment, + Want: true, + }, + { + State: PhaseAppPreDeployment, + Want: false, + }, + { + State: PhaseAppPreEvaluation, + Want: false, + }, + } + for _, tt := range tests { + t.Run("", func(t *testing.T) { + require.Equal(t, tt.State.IsPostTask(), tt.Want) + }) + } +} + +func TestPhaseTraceID(t *testing.T) { + trace := PhaseTraceID{} + + trace.SetPhaseTraceID(PhaseAppDeployment.LongName, propagation.MapCarrier{ + "name": "trace", + "name2": "trace2", + }) + + require.Equal(t, PhaseTraceID{ + PhaseAppDeployment.ShortName: propagation.MapCarrier{ + "name": "trace", + "name2": "trace2", + }, + }, trace) + + trace.SetPhaseTraceID(PhaseWorkloadDeployment.ShortName, propagation.MapCarrier{ + "name3": "trace3", + }) + + require.Equal(t, PhaseTraceID{ + PhaseAppDeployment.ShortName: propagation.MapCarrier{ + "name": "trace", + "name2": "trace2", + }, + PhaseWorkloadDeployment.ShortName: propagation.MapCarrier{ + "name3": "trace3", + }, + }, trace) + + require.Equal(t, propagation.MapCarrier{ + "name": "trace", + "name2": "trace2", + }, trace.GetPhaseTraceID(PhaseAppDeployment.LongName)) + + require.Equal(t, propagation.MapCarrier{ + "name3": "trace3", + }, trace.GetPhaseTraceID(PhaseWorkloadDeployment.ShortName)) +} + +func TestGetShortPhaseName(t *testing.T) { + require.Equal(t, "WorkloadPreDeployTasks", GetShortPhaseName("WorkloadPreDeployTasks")) + require.Equal(t, "WorkloadPreDeployTasks", GetShortPhaseName("Workload Pre-Deployment Tasks")) + require.Equal(t, "", GetShortPhaseName("Workload Pre-Deploycdddment Tasks")) +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/groupversion_info.go b/lifecycle-operator/apis/lifecycle/v1beta1/groupversion_info.go new file mode 100644 index 0000000000..d0bc7dd8e6 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/groupversion_info.go @@ -0,0 +1,36 @@ +/* +Copyright 2023. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1beta1 contains API Schema definitions for the lifecycle v1beta1 API group +// +kubebuilder:object:generate=true +// +groupName=lifecycle.keptn.sh +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "lifecycle.keptn.sh", Version: "v1beta1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnapp_conversion.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnapp_conversion.go new file mode 100644 index 0000000000..5ed40ae1a5 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnapp_conversion.go @@ -0,0 +1,71 @@ +package v1beta1 + +import ( + "fmt" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +// ConvertTo converts the src v1beta1.KeptnApp to the hub version (v1alpha3.KeptnApp) +func (src *KeptnApp) ConvertTo(dstRaw conversion.Hub) error { + dst, ok := dstRaw.(*v1alpha3.KeptnApp) + + if !ok { + return fmt.Errorf("type %T %w", dstRaw, common.ErrCannotCastKeptnApp) + } + + // Copy equal stuff to new object + // DO NOT COPY TypeMeta + dst.ObjectMeta = src.ObjectMeta + + dst.Spec.Version = src.Spec.Version + for _, srcWl := range src.Spec.Workloads { + dst.Spec.Workloads = append(dst.Spec.Workloads, v1alpha3.KeptnWorkloadRef{ + Name: srcWl.Name, + Version: srcWl.Version, + }) + } + dst.Spec.PreDeploymentTasks = src.Spec.PreDeploymentTasks + dst.Spec.PostDeploymentTasks = src.Spec.PostDeploymentTasks + dst.Spec.PreDeploymentEvaluations = src.Spec.PreDeploymentEvaluations + dst.Spec.PostDeploymentEvaluations = src.Spec.PostDeploymentEvaluations + + dst.Status.CurrentVersion = src.Status.CurrentVersion + + dst.Spec.Revision = src.Spec.Revision + + return nil +} + +// ConvertFrom converts from the hub version (v1alpha3.KeptnApp) to this version (v1beta1.KeptnApp) +func (dst *KeptnApp) ConvertFrom(srcRaw conversion.Hub) error { + src, ok := srcRaw.(*v1alpha3.KeptnApp) + + if !ok { + return fmt.Errorf("type %T %w", srcRaw, common.ErrCannotCastKeptnApp) + } + + // Copy equal stuff to new object + // DO NOT COPY TypeMeta + dst.ObjectMeta = src.ObjectMeta + + dst.Spec.Version = src.Spec.Version + for _, srcWl := range src.Spec.Workloads { + dst.Spec.Workloads = append(dst.Spec.Workloads, KeptnWorkloadRef{ + Name: srcWl.Name, + Version: srcWl.Version, + }) + } + dst.Spec.PreDeploymentTasks = src.Spec.PreDeploymentTasks + dst.Spec.PostDeploymentTasks = src.Spec.PostDeploymentTasks + dst.Spec.PreDeploymentEvaluations = src.Spec.PreDeploymentEvaluations + dst.Spec.PostDeploymentEvaluations = src.Spec.PostDeploymentEvaluations + + dst.Status.CurrentVersion = src.Status.CurrentVersion + + dst.Spec.Revision = src.Spec.Revision + + return nil +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnapp_conversion_test.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnapp_conversion_test.go new file mode 100644 index 0000000000..e1ab29d828 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnapp_conversion_test.go @@ -0,0 +1,274 @@ +package v1beta1 + +import ( + "testing" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "github.com/stretchr/testify/require" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v2 "sigs.k8s.io/controller-runtime/pkg/webhook/conversion/testdata/api/v2" +) + +func TestKeptnApp_ConvertFrom(t *testing.T) { + tests := []struct { + name string + srcObj *v1alpha3.KeptnApp + wantErr bool + wantObj *KeptnApp + }{ + { + name: "Test that conversion from v1alpha3 to v1beta1 works", + srcObj: &v1alpha3.KeptnApp{ + TypeMeta: v1.TypeMeta{ + Kind: "KeptnApp", + APIVersion: "lifecycle.keptn.sh/v1alpha3", + }, + ObjectMeta: v1.ObjectMeta{ + Name: "some-keptn-app-name", + Namespace: "", + Labels: map[string]string{ + "some-label": "some-label-value", + }, + Annotations: map[string]string{ + "some-annotation": "some-annotation-value", + }, + }, + Spec: v1alpha3.KeptnAppSpec{ + Version: "1.2.3", + Revision: 1, + Workloads: []v1alpha3.KeptnWorkloadRef{ + { + Name: "workload-1", + Version: "1.2.3", + }, + { + Name: "workload-2", + Version: "4.5.6", + }, + }, + PreDeploymentTasks: []string{ + "some-pre-deployment-task1", + }, + PostDeploymentTasks: []string{ + "some-post-deployment-task2", + }, + PreDeploymentEvaluations: []string{ + "some-pre-evaluation-task1", + }, + PostDeploymentEvaluations: []string{ + "some-pre-evaluation-task2", + }, + }, + Status: v1alpha3.KeptnAppStatus{ + CurrentVersion: "1.2.3", + }, + }, + wantErr: false, + wantObj: &KeptnApp{ + ObjectMeta: v1.ObjectMeta{ + Name: "some-keptn-app-name", + Namespace: "", + Labels: map[string]string{ + "some-label": "some-label-value", + }, + Annotations: map[string]string{ + "some-annotation": "some-annotation-value", + }, + }, + Spec: KeptnAppSpec{ + Version: "1.2.3", + Revision: 1, + Workloads: []KeptnWorkloadRef{ + { + Name: "workload-1", + Version: "1.2.3", + }, + { + Name: "workload-2", + Version: "4.5.6", + }, + }, + PreDeploymentTasks: []string{ + "some-pre-deployment-task1", + }, + PostDeploymentTasks: []string{ + "some-post-deployment-task2", + }, + PreDeploymentEvaluations: []string{ + "some-pre-evaluation-task1", + }, + PostDeploymentEvaluations: []string{ + "some-pre-evaluation-task2", + }, + }, + Status: KeptnAppStatus{ + CurrentVersion: "1.2.3", + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + dst := &KeptnApp{ + TypeMeta: v1.TypeMeta{}, + ObjectMeta: v1.ObjectMeta{}, + Spec: KeptnAppSpec{}, + Status: KeptnAppStatus{}, + } + if err := dst.ConvertFrom(tt.srcObj); (err != nil) != tt.wantErr { + t.Errorf("ConvertFrom() error = %v, wantErr %v", err, tt.wantErr) + } + if tt.wantObj != nil { + require.Equal(t, tt.wantObj, dst, "Object was not converted correctly") + } + }) + } +} + +func TestKeptnApp_ConvertTo(t *testing.T) { + tests := []struct { + name string + src *KeptnApp + wantErr bool + wantObj *v1alpha3.KeptnApp + }{ + { + name: "Test that conversion from v1beta1 to v1alpha3 works", + src: &KeptnApp{ + TypeMeta: v1.TypeMeta{ + Kind: "KeptnApp", + APIVersion: "lifecycle.keptn.sh/v1beta1", + }, + ObjectMeta: v1.ObjectMeta{ + Name: "some-keptn-app-name", + Namespace: "", + Labels: map[string]string{ + "some-label": "some-label-value", + }, + Annotations: map[string]string{ + "some-annotation": "some-annotation-value", + }, + }, + Spec: KeptnAppSpec{ + Version: "1.2.3", + Revision: 1, + Workloads: []KeptnWorkloadRef{ + { + Name: "workload-1", + Version: "1.2.3", + }, + { + Name: "workload-2", + Version: "4.5.6", + }, + }, + PreDeploymentTasks: []string{ + "some-pre-deployment-task1", + }, + PostDeploymentTasks: []string{ + "some-post-deployment-task2", + }, + PreDeploymentEvaluations: []string{ + "some-pre-evaluation-task1", + }, + PostDeploymentEvaluations: []string{ + "some-pre-evaluation-task2", + }, + }, + Status: KeptnAppStatus{ + CurrentVersion: "1.2.3", + }, + }, + wantErr: false, + wantObj: &v1alpha3.KeptnApp{ + ObjectMeta: v1.ObjectMeta{ + Name: "some-keptn-app-name", + Namespace: "", + Labels: map[string]string{ + "some-label": "some-label-value", + }, + Annotations: map[string]string{ + "some-annotation": "some-annotation-value", + }, + }, + Spec: v1alpha3.KeptnAppSpec{ + Version: "1.2.3", + Revision: 1, + Workloads: []v1alpha3.KeptnWorkloadRef{ + { + Name: "workload-1", + Version: "1.2.3", + }, + { + Name: "workload-2", + Version: "4.5.6", + }, + }, + PreDeploymentTasks: []string{ + "some-pre-deployment-task1", + }, + PostDeploymentTasks: []string{ + "some-post-deployment-task2", + }, + PreDeploymentEvaluations: []string{ + "some-pre-evaluation-task1", + }, + PostDeploymentEvaluations: []string{ + "some-pre-evaluation-task2", + }, + }, + Status: v1alpha3.KeptnAppStatus{ + CurrentVersion: "1.2.3", + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + dst := v1alpha3.KeptnApp{ + TypeMeta: v1.TypeMeta{}, + ObjectMeta: v1.ObjectMeta{}, + Spec: v1alpha3.KeptnAppSpec{}, + Status: v1alpha3.KeptnAppStatus{}, + } + if err := tt.src.ConvertTo(&dst); (err != nil) != tt.wantErr { + t.Errorf("ConvertTo() error = %v, wantErr %v", err, tt.wantErr) + } + if tt.wantObj != nil { + require.Equal(t, tt.wantObj, &dst, "Object was not converted correctly") + } + }) + } +} + +func TestKeptnApp_ConvertFrom_Errorcase(t *testing.T) { + // A random different object is used here to simulate a different API version + testObj := v2.ExternalJob{} + + dst := &KeptnApp{ + TypeMeta: v1.TypeMeta{}, + ObjectMeta: v1.ObjectMeta{}, + Spec: KeptnAppSpec{}, + Status: KeptnAppStatus{}, + } + + if err := dst.ConvertFrom(&testObj); err == nil { + t.Errorf("ConvertFrom() error = %v", err) + } else { + require.ErrorIs(t, err, common.ErrCannotCastKeptnApp) + } +} + +func TestKeptnApp_ConvertTo_Errorcase(t *testing.T) { + testObj := KeptnApp{} + + // A random different object is used here to simulate a different API version + dst := v2.ExternalJob{} + + if err := testObj.ConvertTo(&dst); err == nil { + t.Errorf("ConvertTo() error = %v", err) + } else { + require.ErrorIs(t, err, common.ErrCannotCastKeptnApp) + } +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnapp_types.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnapp_types.go new file mode 100644 index 0000000000..ba2642bc3e --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnapp_types.go @@ -0,0 +1,149 @@ +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + operatorcommon "github.com/keptn/lifecycle-toolkit/lifecycle-operator/common" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// KeptnAppSpec defines the desired state of KeptnApp +type KeptnAppSpec struct { + // Version defines the version of the application. For automatically created KeptnApps, + // the version is a function of all KeptnWorkloads that are part of the KeptnApp. + Version string `json:"version"` + // Revision can be modified to trigger another deployment of a KeptnApp of the same version. + // This can be used for restarting a KeptnApp which failed to deploy, + // e.g. due to a failed preDeploymentEvaluation/preDeploymentTask. + // +kubebuilder:default:=1 + // +optional + Revision uint `json:"revision,omitempty"` + // Workloads is a list of all KeptnWorkloads that are part of the KeptnApp. + // +optional + Workloads []KeptnWorkloadRef `json:"workloads,omitempty"` + // PreDeploymentTasks is a list of all tasks to be performed during the pre-deployment phase of the KeptnApp. + // The items of this list refer to the names of KeptnTaskDefinitions + // located in the same namespace as the KeptnApp, or in the Keptn namespace. + // +optional + PreDeploymentTasks []string `json:"preDeploymentTasks,omitempty"` + // PostDeploymentTasks is a list of all tasks to be performed during the post-deployment phase of the KeptnApp. + // The items of this list refer to the names of KeptnTaskDefinitions + // located in the same namespace as the KeptnApp, or in the Keptn namespace. + // +optional + PostDeploymentTasks []string `json:"postDeploymentTasks,omitempty"` + // PreDeploymentEvaluations is a list of all evaluations to be performed + // during the pre-deployment phase of the KeptnApp. + // The items of this list refer to the names of KeptnEvaluationDefinitions + // located in the same namespace as the KeptnApp, or in the Keptn namespace. + // +optional + PreDeploymentEvaluations []string `json:"preDeploymentEvaluations,omitempty"` + // PostDeploymentEvaluations is a list of all evaluations to be performed + // during the post-deployment phase of the KeptnApp. + // The items of this list refer to the names of KeptnEvaluationDefinitions + // located in the same namespace as the KeptnApp, or in the Keptn namespace. + // +optional + PostDeploymentEvaluations []string `json:"postDeploymentEvaluations,omitempty"` +} + +// KeptnAppStatus defines the observed state of KeptnApp +type KeptnAppStatus struct { + // CurrentVersion indicates the version that is currently deployed or being reconciled. + // +optional + CurrentVersion string `json:"currentVersion,omitempty"` +} + +// KeptnWorkloadRef refers to a KeptnWorkload that is part of a KeptnApp +type KeptnWorkloadRef struct { + // Name is the name of the KeptnWorkload. + Name string `json:"name"` + // Version is the version of the KeptnWorkload. + Version string `json:"version"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status + +// KeptnApp is the Schema for the keptnapps API +type KeptnApp struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec describes the desired state of the KeptnApp. + // +optional + Spec KeptnAppSpec `json:"spec,omitempty"` + // Status describes the current state of the KeptnApp. + // +optional + Status KeptnAppStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// KeptnAppList contains a list of KeptnApp +type KeptnAppList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []KeptnApp `json:"items"` +} + +func init() { + SchemeBuilder.Register(&KeptnApp{}, &KeptnAppList{}) +} + +func (a KeptnApp) GetAppVersionName() string { + return operatorcommon.CreateResourceName(common.MaxK8sObjectLength, common.MinKeptnNameLen, a.Name, a.Spec.Version, common.Hash(a.Generation)) +} + +func (a KeptnApp) SetSpanAttributes(span trace.Span) { + span.SetAttributes(a.GetSpanAttributes()...) +} + +func (a KeptnApp) GenerateAppVersion(previousVersion string) KeptnAppVersion { + return KeptnAppVersion{ + ObjectMeta: metav1.ObjectMeta{ + Name: a.GetAppVersionName(), + Namespace: a.Namespace, + }, + Spec: KeptnAppVersionSpec{ + KeptnAppSpec: a.Spec, + AppName: a.Name, + PreviousVersion: previousVersion, + }, + } +} + +func (a KeptnApp) GetSpanAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(a.Name), + common.AppVersion.String(a.Spec.Version), + } +} + +func (a KeptnApp) GetEventAnnotations() map[string]string { + return map[string]string{ + "appName": a.Name, + "appVersion": a.Spec.Version, + "appRevision": common.Hash(a.Generation), + } +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnapp_types_test.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnapp_types_test.go new file mode 100644 index 0000000000..9dafc82e18 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnapp_types_test.go @@ -0,0 +1,52 @@ +package v1beta1 + +import ( + "testing" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/attribute" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func TestKeptnApp(t *testing.T) { + app := &KeptnApp{ + ObjectMeta: metav1.ObjectMeta{ + Name: "app", + Namespace: "namespace", + Generation: 1, + }, + Spec: KeptnAppSpec{ + Version: "version", + }, + } + + appVersionName := app.GetAppVersionName() + require.Equal(t, "app-version-6b86b273", appVersionName) + + appVersion := app.GenerateAppVersion("prev") + require.Equal(t, KeptnAppVersion{ + ObjectMeta: metav1.ObjectMeta{ + Name: "app-version-6b86b273", + Namespace: "namespace", + }, + Spec: KeptnAppVersionSpec{ + KeptnAppSpec: KeptnAppSpec{ + Version: "version", + }, + AppName: "app", + PreviousVersion: "prev", + }, + }, appVersion) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("app"), + common.AppVersion.String("version"), + }, app.GetSpanAttributes()) + + require.Equal(t, map[string]string{ + "appName": "app", + "appVersion": "version", + "appRevision": "6b86b273", + }, app.GetEventAnnotations()) +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnappcreationrequest_types.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnappcreationrequest_types.go new file mode 100644 index 0000000000..828fa6952e --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnappcreationrequest_types.go @@ -0,0 +1,78 @@ +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// KeptnAppCreationRequestSpec defines the desired state of KeptnAppCreationRequest +type KeptnAppCreationRequestSpec struct { + // AppName is the name of the KeptnApp the KeptnAppCreationRequest should create if no user-defined object with that name is found. + AppName string `json:"appName"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status + +// KeptnAppCreationRequest is the Schema for the keptnappcreationrequests API +type KeptnAppCreationRequest struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec describes the desired state of the KeptnAppCreationRequest. + // +optional + Spec KeptnAppCreationRequestSpec `json:"spec,omitempty"` + // Status describes the current state of the KeptnAppCreationRequest. + // +optional + Status string `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// KeptnAppCreationRequestList contains a list of KeptnAppCreationRequest +type KeptnAppCreationRequestList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []KeptnAppCreationRequest `json:"items"` +} + +func init() { + SchemeBuilder.Register(&KeptnAppCreationRequest{}, &KeptnAppCreationRequestList{}) +} + +func (kacr KeptnAppCreationRequest) IsSingleService() bool { + return kacr.Annotations[common.AppTypeAnnotation] == string(common.AppTypeSingleService) +} + +func (kacr KeptnAppCreationRequest) SetSpanAttributes(span trace.Span) { + span.SetAttributes(kacr.GetSpanAttributes()...) +} + +func (kacr KeptnAppCreationRequest) GetSpanAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(kacr.Name), + } +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnappcreationrequest_types_test.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnappcreationrequest_types_test.go new file mode 100644 index 0000000000..65e29ce574 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnappcreationrequest_types_test.go @@ -0,0 +1,74 @@ +package v1beta1 + +import ( + "testing" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/attribute" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func TestKeptnAppCreationRequest_IsSingleService(t *testing.T) { + type fields struct { + ObjectMeta v1.ObjectMeta + } + tests := []struct { + name string + fields fields + want bool + }{ + { + name: "single-service application", + fields: fields{ObjectMeta: v1.ObjectMeta{ + Annotations: map[string]string{ + common.AppTypeAnnotation: string(common.AppTypeSingleService), + }, + }}, + want: true, + }, + { + name: "multi-service application", + fields: fields{ObjectMeta: v1.ObjectMeta{ + Annotations: map[string]string{ + common.AppTypeAnnotation: string(common.AppTypeMultiService), + }, + }}, + want: false, + }, + { + name: "anything else", + fields: fields{ObjectMeta: v1.ObjectMeta{ + Annotations: map[string]string{ + common.AppTypeAnnotation: "", + }, + }}, + want: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + kacr := &KeptnAppCreationRequest{ + ObjectMeta: tt.fields.ObjectMeta, + } + if got := kacr.IsSingleService(); got != tt.want { + t.Errorf("IsSingleService() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestKeptnAppCreationRequest_GetSpanAttributes(t *testing.T) { + kacr := KeptnAppCreationRequest{ + ObjectMeta: v1.ObjectMeta{ + Name: "my-app", + }, + Spec: KeptnAppCreationRequestSpec{}, + } + + spanAttrs := kacr.GetSpanAttributes() + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String(kacr.Name), + }, spanAttrs) +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnappversion_conversion.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnappversion_conversion.go new file mode 100644 index 0000000000..7177db9c1a --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnappversion_conversion.go @@ -0,0 +1,235 @@ +package v1beta1 + +import ( + "fmt" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + v1alpha3common "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "go.opentelemetry.io/otel/propagation" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +// ConvertTo converts the src v1beta1.KeptnAppVersion to the hub version (v1alpha3.KeptnAppVersion) +// +//nolint:gocyclo +func (src *KeptnAppVersion) ConvertTo(dstRaw conversion.Hub) error { + dst, ok := dstRaw.(*v1alpha3.KeptnAppVersion) + + if !ok { + return fmt.Errorf("type %T %w", dstRaw, common.ErrCannotCastKeptnAppVersion) + } + + // Copy equal stuff to new object + // DO NOT COPY TypeMeta + dst.ObjectMeta = src.ObjectMeta + + dst.Spec.Version = src.Spec.Version + for _, srcWl := range src.Spec.Workloads { + dst.Spec.Workloads = append(dst.Spec.Workloads, v1alpha3.KeptnWorkloadRef{ + Name: srcWl.Name, + Version: srcWl.Version, + }) + } + dst.Spec.PreDeploymentTasks = src.Spec.PreDeploymentTasks + dst.Spec.PostDeploymentTasks = src.Spec.PostDeploymentTasks + dst.Spec.PreDeploymentEvaluations = src.Spec.PreDeploymentEvaluations + dst.Spec.PostDeploymentEvaluations = src.Spec.PostDeploymentEvaluations + + dst.Spec.AppName = src.Spec.AppName + dst.Spec.PreviousVersion = src.Spec.PreviousVersion + + dst.Spec.TraceId = make(map[string]string, len(src.Spec.TraceId)) + for k, v := range src.Spec.TraceId { + dst.Spec.TraceId[k] = v + } + + dst.Status.PreDeploymentStatus = v1alpha3common.KeptnState(src.Status.PreDeploymentStatus) + dst.Status.PostDeploymentStatus = v1alpha3common.KeptnState(src.Status.PostDeploymentStatus) + dst.Status.PreDeploymentEvaluationStatus = v1alpha3common.KeptnState(src.Status.PreDeploymentEvaluationStatus) + dst.Status.PostDeploymentEvaluationStatus = v1alpha3common.KeptnState(src.Status.PostDeploymentEvaluationStatus) + dst.Status.WorkloadOverallStatus = v1alpha3common.KeptnState(src.Status.WorkloadOverallStatus) + dst.Status.Status = v1alpha3common.KeptnState(src.Status.Status) + + for _, srcWls := range src.Status.WorkloadStatus { + dst.Status.WorkloadStatus = append(dst.Status.WorkloadStatus, v1alpha3.WorkloadStatus{ + Workload: v1alpha3.KeptnWorkloadRef{ + Name: srcWls.Workload.Name, + Version: srcWls.Workload.Version, + }, + Status: v1alpha3common.KeptnState(srcWls.Status), + }) + } + + dst.Status.CurrentPhase = src.Status.CurrentPhase + + // Set sensible defaults for new fields + dst.Spec.Revision = src.Spec.Revision + + // Convert changed fields + for _, item := range src.Status.PreDeploymentTaskStatus { + dst.Status.PreDeploymentTaskStatus = append(dst.Status.PreDeploymentTaskStatus, v1alpha3.ItemStatus{ + DefinitionName: item.DefinitionName, + Status: v1alpha3common.KeptnState(item.Status), + Name: item.Name, + StartTime: item.StartTime, + EndTime: item.EndTime, + }) + } + + for _, item := range src.Status.PostDeploymentTaskStatus { + dst.Status.PostDeploymentTaskStatus = append(dst.Status.PostDeploymentTaskStatus, v1alpha3.ItemStatus{ + DefinitionName: item.DefinitionName, + Status: v1alpha3common.KeptnState(item.Status), + Name: item.Name, + StartTime: item.StartTime, + EndTime: item.EndTime, + }) + } + + for _, item := range src.Status.PreDeploymentEvaluationTaskStatus { + dst.Status.PreDeploymentEvaluationTaskStatus = append(dst.Status.PreDeploymentEvaluationTaskStatus, v1alpha3.ItemStatus{ + DefinitionName: item.DefinitionName, + Status: v1alpha3common.KeptnState(item.Status), + Name: item.Name, + StartTime: item.StartTime, + EndTime: item.EndTime, + }) + } + + for _, item := range src.Status.PostDeploymentEvaluationTaskStatus { + dst.Status.PostDeploymentEvaluationTaskStatus = append(dst.Status.PostDeploymentEvaluationTaskStatus, v1alpha3.ItemStatus{ + DefinitionName: item.DefinitionName, + Status: v1alpha3common.KeptnState(item.Status), + Name: item.Name, + StartTime: item.StartTime, + EndTime: item.EndTime, + }) + } + + dst.Status.PhaseTraceIDs = make(v1alpha3common.PhaseTraceID, len(src.Status.PhaseTraceIDs)) + for k, v := range src.Status.PhaseTraceIDs { + c := make(propagation.MapCarrier, len(v)) + for k1, v1 := range v { + c[k1] = v1 + } + dst.Status.PhaseTraceIDs[k] = c + } + + dst.Status.StartTime = src.Status.StartTime + dst.Status.EndTime = src.Status.EndTime + + return nil +} + +// ConvertFrom converts from the hub version (v1alpha3.KeptnAppVersion) to this version (v1alpha3.KeptnAppVersion) +// +//nolint:gocyclo +func (dst *KeptnAppVersion) ConvertFrom(srcRaw conversion.Hub) error { + src, ok := srcRaw.(*v1alpha3.KeptnAppVersion) + + if !ok { + return fmt.Errorf("type %T %w", srcRaw, common.ErrCannotCastKeptnAppVersion) + } + + // Copy equal stuff to new object + // DO NOT COPY TypeMeta + dst.ObjectMeta = src.ObjectMeta + + dst.Spec.Version = src.Spec.Version + for _, srcWl := range src.Spec.Workloads { + dst.Spec.Workloads = append(dst.Spec.Workloads, KeptnWorkloadRef{ + Name: srcWl.Name, + Version: srcWl.Version, + }) + } + dst.Spec.PreDeploymentTasks = src.Spec.PreDeploymentTasks + dst.Spec.PostDeploymentTasks = src.Spec.PostDeploymentTasks + dst.Spec.PreDeploymentEvaluations = src.Spec.PreDeploymentEvaluations + dst.Spec.PostDeploymentEvaluations = src.Spec.PostDeploymentEvaluations + + dst.Spec.AppName = src.Spec.AppName + dst.Spec.PreviousVersion = src.Spec.PreviousVersion + + // Set sensible defaults for new fields + dst.Spec.Revision = src.Spec.Revision + + dst.Spec.TraceId = make(map[string]string, len(src.Spec.TraceId)) + for k, v := range src.Spec.TraceId { + dst.Spec.TraceId[k] = v + } + + dst.Status.PreDeploymentStatus = common.KeptnState(src.Status.PreDeploymentStatus) + dst.Status.PostDeploymentStatus = common.KeptnState(src.Status.PostDeploymentStatus) + dst.Status.PreDeploymentEvaluationStatus = common.KeptnState(src.Status.PreDeploymentEvaluationStatus) + dst.Status.PostDeploymentEvaluationStatus = common.KeptnState(src.Status.PostDeploymentEvaluationStatus) + dst.Status.WorkloadOverallStatus = common.KeptnState(src.Status.WorkloadOverallStatus) + dst.Status.Status = common.KeptnState(src.Status.Status) + + for _, srcWls := range src.Status.WorkloadStatus { + dst.Status.WorkloadStatus = append(dst.Status.WorkloadStatus, WorkloadStatus{ + Workload: KeptnWorkloadRef{ + Name: srcWls.Workload.Name, + Version: srcWls.Workload.Version, + }, + Status: common.KeptnState(srcWls.Status), + }) + } + + dst.Status.CurrentPhase = src.Status.CurrentPhase + + // Convert changed fields + for _, item := range src.Status.PreDeploymentTaskStatus { + dst.Status.PreDeploymentTaskStatus = append(dst.Status.PreDeploymentTaskStatus, ItemStatus{ + DefinitionName: item.DefinitionName, + Status: common.KeptnState(item.Status), + Name: item.Name, + StartTime: item.StartTime, + EndTime: item.EndTime, + }) + } + + for _, item := range src.Status.PostDeploymentTaskStatus { + dst.Status.PostDeploymentTaskStatus = append(dst.Status.PostDeploymentTaskStatus, ItemStatus{ + DefinitionName: item.DefinitionName, + Status: common.KeptnState(item.Status), + Name: item.Name, + StartTime: item.StartTime, + EndTime: item.EndTime, + }) + } + + for _, item := range src.Status.PreDeploymentEvaluationTaskStatus { + dst.Status.PreDeploymentEvaluationTaskStatus = append(dst.Status.PreDeploymentEvaluationTaskStatus, ItemStatus{ + DefinitionName: item.DefinitionName, + Status: common.KeptnState(item.Status), + Name: item.Name, + StartTime: item.StartTime, + EndTime: item.EndTime, + }) + } + + for _, item := range src.Status.PostDeploymentEvaluationTaskStatus { + dst.Status.PostDeploymentEvaluationTaskStatus = append(dst.Status.PostDeploymentEvaluationTaskStatus, ItemStatus{ + DefinitionName: item.DefinitionName, + Status: common.KeptnState(item.Status), + Name: item.Name, + StartTime: item.StartTime, + EndTime: item.EndTime, + }) + } + + dst.Status.PhaseTraceIDs = make(common.PhaseTraceID, len(src.Status.PhaseTraceIDs)) + for k, v := range src.Status.PhaseTraceIDs { + c := make(propagation.MapCarrier, len(v)) + for k1, v1 := range v { + c[k1] = v1 + } + dst.Status.PhaseTraceIDs[k] = c + } + + dst.Status.StartTime = src.Status.StartTime + dst.Status.EndTime = src.Status.EndTime + + return nil +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnappversion_conversion_test.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnappversion_conversion_test.go new file mode 100644 index 0000000000..91921458d3 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnappversion_conversion_test.go @@ -0,0 +1,629 @@ +//nolint:dupl +package v1beta1 + +import ( + "testing" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" + v1alpha3common "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3/common" + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/propagation" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v2 "sigs.k8s.io/controller-runtime/pkg/webhook/conversion/testdata/api/v2" +) + +func TestKeptnAppVersion_ConvertFrom(t *testing.T) { + tests := []struct { + name string + srcObj *v1alpha3.KeptnAppVersion + wantErr bool + wantObj *KeptnAppVersion + }{ + { + name: "Test that conversion from v1beta1 to v1alpha3 works", + srcObj: &v1alpha3.KeptnAppVersion{ + TypeMeta: v1.TypeMeta{ + Kind: "KeptnAppVersion", + APIVersion: "lifecycle.keptn.sh/v1beta1", + }, + ObjectMeta: v1.ObjectMeta{ + Name: "some-keptn-app-name", + Namespace: "", + Labels: map[string]string{ + "some-label": "some-label-value", + }, + Annotations: map[string]string{ + "some-annotation": "some-annotation-value", + }, + }, + Spec: v1alpha3.KeptnAppVersionSpec{ + KeptnAppSpec: v1alpha3.KeptnAppSpec{ + Version: "1.2.3", + Revision: 1, + Workloads: []v1alpha3.KeptnWorkloadRef{ + { + Name: "workload-1", + Version: "1.2.3", + }, + { + Name: "workload-2", + Version: "4.5.6", + }, + }, + PreDeploymentTasks: []string{ + "some-pre-deployment-task1", + }, + PostDeploymentTasks: []string{ + "some-post-deployment-task2", + }, + PreDeploymentEvaluations: []string{ + "some-pre-evaluation-task1", + }, + PostDeploymentEvaluations: []string{ + "some-pre-evaluation-task2", + }, + }, + AppName: "app", + PreviousVersion: "1.0", + TraceId: map[string]string{ + "key1": "value1", + "key2": "value2", + }, + }, + Status: v1alpha3.KeptnAppVersionStatus{ + PreDeploymentStatus: v1alpha3common.StateFailed, + PostDeploymentStatus: v1alpha3common.StateFailed, + PreDeploymentEvaluationStatus: v1alpha3common.StateFailed, + PostDeploymentEvaluationStatus: v1alpha3common.StateFailed, + WorkloadOverallStatus: v1alpha3common.StateFailed, + WorkloadStatus: []v1alpha3.WorkloadStatus{ + { + Workload: v1alpha3.KeptnWorkloadRef{ + Name: "name1", + Version: "1", + }, + Status: v1alpha3common.StateFailed, + }, + { + Workload: v1alpha3.KeptnWorkloadRef{ + Name: "name2", + Version: "2", + }, + Status: v1alpha3common.StateFailed, + }, + }, + CurrentPhase: "phase", + PreDeploymentTaskStatus: []v1alpha3.ItemStatus{ + { + DefinitionName: "def1", + Name: "name1", + Status: v1alpha3common.StateFailed, + }, + { + DefinitionName: "def12", + Name: "name12", + Status: v1alpha3common.StateFailed, + }, + }, + PostDeploymentTaskStatus: []v1alpha3.ItemStatus{ + { + DefinitionName: "def2", + Name: "name2", + Status: v1alpha3common.StateFailed, + }, + { + DefinitionName: "def22", + Name: "name22", + Status: v1alpha3common.StateFailed, + }, + }, + PreDeploymentEvaluationTaskStatus: []v1alpha3.ItemStatus{ + { + DefinitionName: "def3", + Name: "name3", + Status: v1alpha3common.StateFailed, + }, + { + DefinitionName: "def32", + Name: "name32", + Status: v1alpha3common.StateFailed, + }, + }, + PostDeploymentEvaluationTaskStatus: []v1alpha3.ItemStatus{ + { + DefinitionName: "def4", + Name: "name4", + Status: v1alpha3common.StateFailed, + }, + { + DefinitionName: "def42", + Name: "name42", + Status: v1alpha3common.StateFailed, + }, + }, + PhaseTraceIDs: v1alpha3common.PhaseTraceID{ + "key": propagation.MapCarrier{ + "key1": "value1", + "key2": "value2", + }, + "key22": propagation.MapCarrier{ + "key122": "value122", + "key222": "value222", + }, + }, + Status: v1alpha3common.StateFailed, + }, + }, + wantErr: false, + wantObj: &KeptnAppVersion{ + ObjectMeta: v1.ObjectMeta{ + Name: "some-keptn-app-name", + Namespace: "", + Labels: map[string]string{ + "some-label": "some-label-value", + }, + Annotations: map[string]string{ + "some-annotation": "some-annotation-value", + }, + }, + Spec: KeptnAppVersionSpec{ + KeptnAppSpec: KeptnAppSpec{ + Version: "1.2.3", + Revision: 1, + Workloads: []KeptnWorkloadRef{ + { + Name: "workload-1", + Version: "1.2.3", + }, + { + Name: "workload-2", + Version: "4.5.6", + }, + }, + PreDeploymentTasks: []string{ + "some-pre-deployment-task1", + }, + PostDeploymentTasks: []string{ + "some-post-deployment-task2", + }, + PreDeploymentEvaluations: []string{ + "some-pre-evaluation-task1", + }, + PostDeploymentEvaluations: []string{ + "some-pre-evaluation-task2", + }, + }, + AppName: "app", + PreviousVersion: "1.0", + TraceId: map[string]string{ + "key1": "value1", + "key2": "value2", + }, + }, + Status: KeptnAppVersionStatus{ + PreDeploymentStatus: common.StateFailed, + PostDeploymentStatus: common.StateFailed, + PreDeploymentEvaluationStatus: common.StateFailed, + PostDeploymentEvaluationStatus: common.StateFailed, + WorkloadOverallStatus: common.StateFailed, + WorkloadStatus: []WorkloadStatus{ + { + Workload: KeptnWorkloadRef{ + Name: "name1", + Version: "1", + }, + Status: common.StateFailed, + }, + { + Workload: KeptnWorkloadRef{ + Name: "name2", + Version: "2", + }, + Status: common.StateFailed, + }, + }, + CurrentPhase: "phase", + PreDeploymentTaskStatus: []ItemStatus{ + { + DefinitionName: "def1", + Name: "name1", + Status: common.StateFailed, + }, + { + DefinitionName: "def12", + Name: "name12", + Status: common.StateFailed, + }, + }, + PostDeploymentTaskStatus: []ItemStatus{ + { + DefinitionName: "def2", + Name: "name2", + Status: common.StateFailed, + }, + { + DefinitionName: "def22", + Name: "name22", + Status: common.StateFailed, + }, + }, + PreDeploymentEvaluationTaskStatus: []ItemStatus{ + { + DefinitionName: "def3", + Name: "name3", + Status: common.StateFailed, + }, + { + DefinitionName: "def32", + Name: "name32", + Status: common.StateFailed, + }, + }, + PostDeploymentEvaluationTaskStatus: []ItemStatus{ + { + DefinitionName: "def4", + Name: "name4", + Status: common.StateFailed, + }, + { + DefinitionName: "def42", + Name: "name42", + Status: common.StateFailed, + }, + }, + PhaseTraceIDs: common.PhaseTraceID{ + "key": propagation.MapCarrier{ + "key1": "value1", + "key2": "value2", + }, + "key22": propagation.MapCarrier{ + "key122": "value122", + "key222": "value222", + }, + }, + Status: common.StateFailed, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + dst := &KeptnAppVersion{ + TypeMeta: v1.TypeMeta{}, + ObjectMeta: v1.ObjectMeta{}, + Spec: KeptnAppVersionSpec{}, + Status: KeptnAppVersionStatus{}, + } + if err := dst.ConvertFrom(tt.srcObj); (err != nil) != tt.wantErr { + t.Errorf("ConvertFrom() error = %v, wantErr %v", err, tt.wantErr) + } + if tt.wantObj != nil { + require.Equal(t, tt.wantObj, dst, "Object was not converted correctly") + } + }) + } +} + +func TestKeptnAppVersion_ConvertTo(t *testing.T) { + tests := []struct { + name string + src *KeptnAppVersion + wantErr bool + wantObj *v1alpha3.KeptnAppVersion + }{ + { + name: "Test that conversion from v1beta1 to v1alpha3 works", + src: &KeptnAppVersion{ + TypeMeta: v1.TypeMeta{ + Kind: "KeptnAppVersion", + APIVersion: "lifecycle.keptn.sh/v1alpha3", + }, + ObjectMeta: v1.ObjectMeta{ + Name: "some-keptn-app-name", + Namespace: "", + Labels: map[string]string{ + "some-label": "some-label-value", + }, + Annotations: map[string]string{ + "some-annotation": "some-annotation-value", + }, + }, + Spec: KeptnAppVersionSpec{ + KeptnAppSpec: KeptnAppSpec{ + Version: "1.2.3", + Revision: 1, + Workloads: []KeptnWorkloadRef{ + { + Name: "workload-1", + Version: "1.2.3", + }, + { + Name: "workload-2", + Version: "4.5.6", + }, + }, + PreDeploymentTasks: []string{ + "some-pre-deployment-task1", + }, + PostDeploymentTasks: []string{ + "some-post-deployment-task2", + }, + PreDeploymentEvaluations: []string{ + "some-pre-evaluation-task1", + }, + PostDeploymentEvaluations: []string{ + "some-pre-evaluation-task2", + }, + }, + AppName: "app", + PreviousVersion: "1.0", + TraceId: map[string]string{ + "key1": "value1", + "key2": "value2", + }, + }, + Status: KeptnAppVersionStatus{ + PreDeploymentStatus: common.StateFailed, + PostDeploymentStatus: common.StateFailed, + PreDeploymentEvaluationStatus: common.StateFailed, + PostDeploymentEvaluationStatus: common.StateFailed, + WorkloadOverallStatus: common.StateFailed, + WorkloadStatus: []WorkloadStatus{ + { + Workload: KeptnWorkloadRef{ + Name: "name1", + Version: "1", + }, + Status: common.StateFailed, + }, + { + Workload: KeptnWorkloadRef{ + Name: "name2", + Version: "2", + }, + Status: common.StateFailed, + }, + }, + CurrentPhase: "phase", + PreDeploymentTaskStatus: []ItemStatus{ + { + DefinitionName: "def1", + Name: "name1", + Status: common.StateFailed, + }, + { + DefinitionName: "def12", + Name: "name12", + Status: common.StateFailed, + }, + }, + PostDeploymentTaskStatus: []ItemStatus{ + { + DefinitionName: "def2", + Name: "name2", + Status: common.StateFailed, + }, + { + DefinitionName: "def22", + Name: "name22", + Status: common.StateFailed, + }, + }, + PreDeploymentEvaluationTaskStatus: []ItemStatus{ + { + DefinitionName: "def3", + Name: "name3", + Status: common.StateFailed, + }, + { + DefinitionName: "def32", + Name: "name32", + Status: common.StateFailed, + }, + }, + PostDeploymentEvaluationTaskStatus: []ItemStatus{ + { + DefinitionName: "def4", + Name: "name4", + Status: common.StateFailed, + }, + { + DefinitionName: "def42", + Name: "name42", + Status: common.StateFailed, + }, + }, + PhaseTraceIDs: common.PhaseTraceID{ + "key": propagation.MapCarrier{ + "key1": "value1", + "key2": "value2", + }, + "key22": propagation.MapCarrier{ + "key122": "value122", + "key222": "value222", + }, + }, + Status: common.StateFailed, + }, + }, + wantErr: false, + wantObj: &v1alpha3.KeptnAppVersion{ + ObjectMeta: v1.ObjectMeta{ + Name: "some-keptn-app-name", + Namespace: "", + Labels: map[string]string{ + "some-label": "some-label-value", + }, + Annotations: map[string]string{ + "some-annotation": "some-annotation-value", + }, + }, + Spec: v1alpha3.KeptnAppVersionSpec{ + KeptnAppSpec: v1alpha3.KeptnAppSpec{ + Version: "1.2.3", + Revision: 1, + Workloads: []v1alpha3.KeptnWorkloadRef{ + { + Name: "workload-1", + Version: "1.2.3", + }, + { + Name: "workload-2", + Version: "4.5.6", + }, + }, + PreDeploymentTasks: []string{ + "some-pre-deployment-task1", + }, + PostDeploymentTasks: []string{ + "some-post-deployment-task2", + }, + PreDeploymentEvaluations: []string{ + "some-pre-evaluation-task1", + }, + PostDeploymentEvaluations: []string{ + "some-pre-evaluation-task2", + }, + }, + AppName: "app", + PreviousVersion: "1.0", + TraceId: map[string]string{ + "key1": "value1", + "key2": "value2", + }, + }, + Status: v1alpha3.KeptnAppVersionStatus{ + PreDeploymentStatus: v1alpha3common.StateFailed, + PostDeploymentStatus: v1alpha3common.StateFailed, + PreDeploymentEvaluationStatus: v1alpha3common.StateFailed, + PostDeploymentEvaluationStatus: v1alpha3common.StateFailed, + WorkloadOverallStatus: v1alpha3common.StateFailed, + WorkloadStatus: []v1alpha3.WorkloadStatus{ + { + Workload: v1alpha3.KeptnWorkloadRef{ + Name: "name1", + Version: "1", + }, + Status: v1alpha3common.StateFailed, + }, + { + Workload: v1alpha3.KeptnWorkloadRef{ + Name: "name2", + Version: "2", + }, + Status: v1alpha3common.StateFailed, + }, + }, + CurrentPhase: "phase", + PreDeploymentTaskStatus: []v1alpha3.ItemStatus{ + { + DefinitionName: "def1", + Name: "name1", + Status: v1alpha3common.StateFailed, + }, + { + DefinitionName: "def12", + Name: "name12", + Status: v1alpha3common.StateFailed, + }, + }, + PostDeploymentTaskStatus: []v1alpha3.ItemStatus{ + { + DefinitionName: "def2", + Name: "name2", + Status: v1alpha3common.StateFailed, + }, + { + DefinitionName: "def22", + Name: "name22", + Status: v1alpha3common.StateFailed, + }, + }, + PreDeploymentEvaluationTaskStatus: []v1alpha3.ItemStatus{ + { + DefinitionName: "def3", + Name: "name3", + Status: v1alpha3common.StateFailed, + }, + { + DefinitionName: "def32", + Name: "name32", + Status: v1alpha3common.StateFailed, + }, + }, + PostDeploymentEvaluationTaskStatus: []v1alpha3.ItemStatus{ + { + DefinitionName: "def4", + Name: "name4", + Status: v1alpha3common.StateFailed, + }, + { + DefinitionName: "def42", + Name: "name42", + Status: v1alpha3common.StateFailed, + }, + }, + PhaseTraceIDs: v1alpha3common.PhaseTraceID{ + "key": propagation.MapCarrier{ + "key1": "value1", + "key2": "value2", + }, + "key22": propagation.MapCarrier{ + "key122": "value122", + "key222": "value222", + }, + }, + Status: v1alpha3common.StateFailed, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + dst := v1alpha3.KeptnAppVersion{ + TypeMeta: v1.TypeMeta{}, + ObjectMeta: v1.ObjectMeta{}, + Spec: v1alpha3.KeptnAppVersionSpec{}, + Status: v1alpha3.KeptnAppVersionStatus{}, + } + if err := tt.src.ConvertTo(&dst); (err != nil) != tt.wantErr { + t.Errorf("ConvertTo() error = %v, wantErr %v", err, tt.wantErr) + } + if tt.wantObj != nil { + require.Equal(t, tt.wantObj, &dst, "Object was not converted correctly") + } + }) + } +} + +func TestKeptnAppVersion_ConvertFrom_Errorcase(t *testing.T) { + // A random different object is used here to simulate a different API version + testObj := v2.ExternalJob{} + + dst := &KeptnAppVersion{ + TypeMeta: v1.TypeMeta{}, + ObjectMeta: v1.ObjectMeta{}, + Spec: KeptnAppVersionSpec{}, + Status: KeptnAppVersionStatus{}, + } + + if err := dst.ConvertFrom(&testObj); err == nil { + t.Errorf("ConvertFrom() error = %v", err) + } else { + require.ErrorIs(t, err, common.ErrCannotCastKeptnAppVersion) + } +} + +func TestKeptnAppVersion_ConvertTo_Errorcase(t *testing.T) { + testObj := KeptnAppVersion{} + + // A random different object is used here to simulate a different API version + dst := v2.ExternalJob{} + + if err := testObj.ConvertTo(&dst); err == nil { + t.Errorf("ConvertTo() error = %v", err) + } else { + require.ErrorIs(t, err, common.ErrCannotCastKeptnAppVersion) + } +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnappversion_types.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnappversion_types.go new file mode 100644 index 0000000000..04ba0270a3 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnappversion_types.go @@ -0,0 +1,480 @@ +/* +Copyright 2023. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "fmt" + "time" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// KeptnAppVersionSpec defines the desired state of KeptnAppVersion +type KeptnAppVersionSpec struct { + KeptnAppSpec `json:",inline"` + // AppName is the name of the KeptnApp. + AppName string `json:"appName"` + // PreviousVersion is the version of the KeptnApp that has been deployed prior to this version. + // +optional + PreviousVersion string `json:"previousVersion,omitempty"` + // TraceId contains the OpenTelemetry trace ID. + // +optional + TraceId map[string]string `json:"traceId,omitempty"` +} + +// KeptnAppVersionStatus defines the observed state of KeptnAppVersion +type KeptnAppVersionStatus struct { + // PreDeploymentStatus indicates the current status of the KeptnAppVersion's PreDeployment phase. + // +kubebuilder:default:=Pending + // +optional + PreDeploymentStatus common.KeptnState `json:"preDeploymentStatus,omitempty"` + // PostDeploymentStatus indicates the current status of the KeptnAppVersion's PostDeployment phase. + // +kubebuilder:default:=Pending + // +optional + PostDeploymentStatus common.KeptnState `json:"postDeploymentStatus,omitempty"` + // PreDeploymentEvaluationStatus indicates the current status of the KeptnAppVersion's PreDeploymentEvaluation phase. + // +kubebuilder:default:=Pending + // +optional + PreDeploymentEvaluationStatus common.KeptnState `json:"preDeploymentEvaluationStatus,omitempty"` + // PostDeploymentEvaluationStatus indicates the current status of the KeptnAppVersion's PostDeploymentEvaluation phase. + // +kubebuilder:default:=Pending + // +optional + PostDeploymentEvaluationStatus common.KeptnState `json:"postDeploymentEvaluationStatus,omitempty"` + // WorkloadOverallStatus indicates the current status of the KeptnAppVersion's Workload deployment phase. + // +kubebuilder:default:=Pending + // +optional + WorkloadOverallStatus common.KeptnState `json:"workloadOverallStatus,omitempty"` + // WorkloadStatus contains the current status of each KeptnWorkload that is part of the KeptnAppVersion. + // +optional + WorkloadStatus []WorkloadStatus `json:"workloadStatus,omitempty"` + // CurrentPhase indicates the current phase of the KeptnAppVersion. + // +optional + CurrentPhase string `json:"currentPhase,omitempty"` + // PreDeploymentTaskStatus indicates the current state of each preDeploymentTask of the KeptnAppVersion. + // +optional + PreDeploymentTaskStatus []ItemStatus `json:"preDeploymentTaskStatus,omitempty"` + // PostDeploymentTaskStatus indicates the current state of each postDeploymentTask of the KeptnAppVersion. + // +optional + PostDeploymentTaskStatus []ItemStatus `json:"postDeploymentTaskStatus,omitempty"` + // PreDeploymentEvaluationTaskStatus indicates the current state of each preDeploymentEvaluation of the KeptnAppVersion. + // +optional + PreDeploymentEvaluationTaskStatus []ItemStatus `json:"preDeploymentEvaluationTaskStatus,omitempty"` + // PostDeploymentEvaluationTaskStatus indicates the current state of each postDeploymentEvaluation of the KeptnAppVersion. + // +optional + PostDeploymentEvaluationTaskStatus []ItemStatus `json:"postDeploymentEvaluationTaskStatus,omitempty"` + // PhaseTraceIDs contains the trace IDs of the OpenTelemetry spans of each phase of the KeptnAppVersion. + // +optional + PhaseTraceIDs common.PhaseTraceID `json:"phaseTraceIDs,omitempty"` + // Status represents the overall status of the KeptnAppVersion. + // +kubebuilder:default:=Pending + // +optional + Status common.KeptnState `json:"status,omitempty"` + + // StartTime represents the time at which the deployment of the KeptnAppVersion started. + // +optional + StartTime metav1.Time `json:"startTime,omitempty"` + // EndTime represents the time at which the deployment of the KeptnAppVersion finished. + // +optional + EndTime metav1.Time `json:"endTime,omitempty"` +} + +type WorkloadStatus struct { + // Workload refers to a KeptnWorkload that is part of the KeptnAppVersion. + // +optional + Workload KeptnWorkloadRef `json:"workload,omitempty"` + // Status indicates the current status of the KeptnWorkload. + // +kubebuilder:default:=Pending + // +optional + Status common.KeptnState `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=keptnappversions,shortName=kav +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.appName` +// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version` +// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.currentPhase` +// +kubebuilder:printcolumn:name="PreDeploymentStatus",priority=1,type=string,JSONPath=`.status.preDeploymentStatus` +// +kubebuilder:printcolumn:name="PreDeploymentEvaluationStatus",priority=1,type=string,JSONPath=`.status.preDeploymentEvaluationStatus` +// +kubebuilder:printcolumn:name="WorkloadOverallStatus",priority=1,type=string,JSONPath=`.status.workloadOverallStatus` +// +kubebuilder:printcolumn:name="PostDeploymentStatus",priority=1,type=string,JSONPath=`.status.postDeploymentStatus` +// +kubebuilder:printcolumn:name="PostDeploymentEvaluationStatus",priority=1,type=string,JSONPath=`.status.postDeploymentEvaluationStatus` + +// KeptnAppVersion is the Schema for the keptnappversions API +type KeptnAppVersion struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec describes the desired state of the KeptnAppVersion. + // +optional + Spec KeptnAppVersionSpec `json:"spec,omitempty"` + // Status describes the current state of the KeptnAppVersion. + // +optional + Status KeptnAppVersionStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// KeptnAppVersionList contains a list of KeptnAppVersion +type KeptnAppVersionList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []KeptnAppVersion `json:"items"` +} + +func (a KeptnAppVersionList) GetItems() []client.Object { + b := make([]client.Object, 0, len(a.Items)) + for i := 0; i < len(a.Items); i++ { + b = append(b, &a.Items[i]) + } + return b +} + +func (a *KeptnAppVersionList) RemoveDeprecated() { + b := make([]KeptnAppVersion, 0, len(a.Items)) + for i := 0; i < len(a.Items); i++ { + if a.Items[i].Status.Status != common.StateDeprecated { + b = append(b, a.Items[i]) + } + } + a.Items = b +} + +func init() { + SchemeBuilder.Register(&KeptnAppVersion{}, &KeptnAppVersionList{}) +} + +func (a KeptnAppVersion) IsPreDeploymentCompleted() bool { + return a.Status.PreDeploymentStatus.IsCompleted() +} + +func (a KeptnAppVersion) IsPreDeploymentEvaluationCompleted() bool { + return a.Status.PreDeploymentEvaluationStatus.IsCompleted() +} + +func (a KeptnAppVersion) IsPreDeploymentSucceeded() bool { + return a.Status.PreDeploymentStatus.IsSucceeded() +} + +func (a KeptnAppVersion) IsPreDeploymentFailed() bool { + return a.Status.PreDeploymentStatus.IsFailed() +} + +func (a KeptnAppVersion) IsPreDeploymentEvaluationSucceeded() bool { + return a.Status.PreDeploymentEvaluationStatus.IsSucceeded() +} + +func (a KeptnAppVersion) IsPreDeploymentEvaluationFailed() bool { + return a.Status.PreDeploymentEvaluationStatus.IsFailed() +} + +func (a KeptnAppVersion) IsPostDeploymentCompleted() bool { + return a.Status.PostDeploymentStatus.IsCompleted() +} + +func (a KeptnAppVersion) IsPostDeploymentEvaluationCompleted() bool { + return a.Status.PostDeploymentEvaluationStatus.IsCompleted() +} + +func (a KeptnAppVersion) IsPostDeploymentFailed() bool { + return a.Status.PostDeploymentStatus.IsFailed() +} + +func (a KeptnAppVersion) IsPostDeploymentEvaluationSucceeded() bool { + return a.Status.PostDeploymentEvaluationStatus.IsSucceeded() +} + +func (a KeptnAppVersion) IsPostDeploymentEvaluationFailed() bool { + return a.Status.PostDeploymentEvaluationStatus.IsFailed() +} + +func (a KeptnAppVersion) IsPostDeploymentSucceeded() bool { + return a.Status.PostDeploymentStatus.IsSucceeded() +} + +func (a KeptnAppVersion) AreWorkloadsCompleted() bool { + return a.Status.WorkloadOverallStatus.IsCompleted() +} + +func (a KeptnAppVersion) AreWorkloadsSucceeded() bool { + return a.Status.WorkloadOverallStatus.IsSucceeded() +} + +func (a KeptnAppVersion) AreWorkloadsFailed() bool { + return a.Status.WorkloadOverallStatus.IsFailed() +} + +func (a *KeptnAppVersion) SetStartTime() { + if a.Status.StartTime.IsZero() { + a.Status.StartTime = metav1.NewTime(time.Now().UTC()) + } +} + +func (a *KeptnAppVersion) SetEndTime() { + if a.Status.EndTime.IsZero() { + a.Status.EndTime = metav1.NewTime(time.Now().UTC()) + } +} + +func (a KeptnAppVersion) GetStartTime() time.Time { + return a.Status.StartTime.Time +} + +func (a KeptnAppVersion) GetEndTime() time.Time { + return a.Status.EndTime.Time +} + +func (a *KeptnAppVersion) IsStartTimeSet() bool { + return !a.Status.StartTime.IsZero() +} + +func (a *KeptnAppVersion) IsEndTimeSet() bool { + return !a.Status.EndTime.IsZero() +} + +func (a *KeptnAppVersion) Complete() { + a.SetEndTime() +} + +func (a KeptnAppVersion) GetActiveMetricsAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(a.Spec.AppName), + common.AppVersion.String(a.Spec.Version), + common.AppNamespace.String(a.Namespace), + } +} + +func (a KeptnAppVersion) GetMetricsAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(a.Spec.AppName), + common.AppVersion.String(a.Spec.Version), + common.AppNamespace.String(a.Namespace), + common.AppStatus.String(string(a.Status.Status)), + } +} + +func (a KeptnAppVersion) GetDurationMetricsAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(a.Spec.AppName), + common.AppVersion.String(a.Spec.Version), + common.AppPreviousVersion.String(a.Spec.PreviousVersion), + } +} + +func (a KeptnAppVersion) GetState() common.KeptnState { + return a.Status.Status +} + +func (a KeptnAppVersion) GetPreDeploymentTasks() []string { + return a.Spec.PreDeploymentTasks +} + +func (a KeptnAppVersion) GetPostDeploymentTasks() []string { + return a.Spec.PostDeploymentTasks +} + +func (a KeptnAppVersion) GetPreDeploymentTaskStatus() []ItemStatus { + return a.Status.PreDeploymentTaskStatus +} + +func (a KeptnAppVersion) GetPostDeploymentTaskStatus() []ItemStatus { + return a.Status.PostDeploymentTaskStatus +} + +func (a KeptnAppVersion) GetPreDeploymentEvaluations() []string { + return a.Spec.PreDeploymentEvaluations +} + +func (a KeptnAppVersion) GetPostDeploymentEvaluations() []string { + return a.Spec.PostDeploymentEvaluations +} + +func (a KeptnAppVersion) GetPreDeploymentEvaluationTaskStatus() []ItemStatus { + return a.Status.PreDeploymentEvaluationTaskStatus +} + +func (a KeptnAppVersion) GetPostDeploymentEvaluationTaskStatus() []ItemStatus { + return a.Status.PostDeploymentEvaluationTaskStatus +} + +func (a KeptnAppVersion) GetAppName() string { + return a.Spec.AppName +} + +func (a KeptnAppVersion) GetPreviousVersion() string { + return a.Spec.PreviousVersion +} + +func (a KeptnAppVersion) GetParentName() string { + return a.Spec.AppName +} + +func (a KeptnAppVersion) GetNamespace() string { + return a.Namespace +} + +func (a *KeptnAppVersion) SetState(state common.KeptnState) { + a.Status.Status = state +} + +func (a KeptnAppVersion) GetCurrentPhase() string { + return a.Status.CurrentPhase +} + +func (a *KeptnAppVersion) SetCurrentPhase(phase string) { + a.Status.CurrentPhase = phase +} + +func (a KeptnAppVersion) GetVersion() string { + return a.Spec.Version +} + +func (a KeptnAppVersion) GenerateTask(taskDefinition KeptnTaskDefinition, checkType common.CheckType) KeptnTask { + return KeptnTask{ + ObjectMeta: metav1.ObjectMeta{ + Name: common.GenerateTaskName(checkType, taskDefinition.Name), + Namespace: a.Namespace, + Labels: taskDefinition.Labels, + Annotations: taskDefinition.Annotations, + }, + Spec: KeptnTaskSpec{ + Context: TaskContext{ + AppName: a.GetParentName(), + AppVersion: a.GetVersion(), + TaskType: string(checkType), + ObjectType: "App", + }, + TaskDefinition: taskDefinition.Name, + Parameters: TaskParameters{}, + SecureParameters: SecureParameters{}, + Type: checkType, + Retries: taskDefinition.Spec.Retries, + Timeout: taskDefinition.Spec.Timeout, + }, + } +} + +func (a KeptnAppVersion) GenerateEvaluation(evaluationDefinition KeptnEvaluationDefinition, checkType common.CheckType) KeptnEvaluation { + return KeptnEvaluation{ + ObjectMeta: metav1.ObjectMeta{ + Name: common.GenerateEvaluationName(checkType, evaluationDefinition.Name), + Namespace: a.Namespace, + }, + Spec: KeptnEvaluationSpec{ + AppVersion: a.Spec.Version, + AppName: a.Spec.AppName, + EvaluationDefinition: evaluationDefinition.Name, + Type: checkType, + RetryInterval: metav1.Duration{ + Duration: 5 * time.Second, + }, + }, + } +} + +func (a KeptnAppVersion) GetSpanName(phase string) string { + if phase == "" { + return a.Name + } + return phase +} + +func (a KeptnAppVersion) GetSpanAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(a.Spec.AppName), + common.AppVersion.String(a.Spec.Version), + common.AppNamespace.String(a.Namespace), + } +} + +func (a KeptnAppVersion) SetSpanAttributes(span trace.Span) { + span.SetAttributes(a.GetSpanAttributes()...) +} + +func (a KeptnAppVersion) GetSpanKey(phase string) string { + return fmt.Sprintf("%s.%s.%s.%s", a.Spec.TraceId["traceparent"], a.Spec.AppName, a.Spec.Version, phase) +} + +func (v KeptnAppVersion) GetWorkloadNameOfApp(workloadName string) string { + return fmt.Sprintf("%s-%s", v.Spec.AppName, workloadName) +} + +//nolint:dupl +func (a *KeptnAppVersion) DeprecateRemainingPhases(phase common.KeptnPhaseType) { + // no need to deprecate anything when post-eval tasks fail + if phase == common.PhaseAppPostEvaluation { + return + } + // deprecate post evaluation when post tasks failed + if phase == common.PhaseAppPostDeployment { + a.Status.PostDeploymentEvaluationStatus = common.StateDeprecated + } + // deprecate post evaluation and tasks when app deployment failed + if phase == common.PhaseAppDeployment { + a.Status.PostDeploymentStatus = common.StateDeprecated + a.Status.PostDeploymentEvaluationStatus = common.StateDeprecated + } + // deprecate app deployment, post tasks and evaluations if app pre-eval failed + if phase == common.PhaseAppPreEvaluation { + a.Status.PostDeploymentStatus = common.StateDeprecated + a.Status.PostDeploymentEvaluationStatus = common.StateDeprecated + a.Status.WorkloadOverallStatus = common.StateDeprecated + } + // deprecate pre evaluations, app deployment and post tasks and evaluations when pre-tasks failed + if phase == common.PhaseAppPreDeployment { + a.Status.PostDeploymentStatus = common.StateDeprecated + a.Status.PostDeploymentEvaluationStatus = common.StateDeprecated + a.Status.WorkloadOverallStatus = common.StateDeprecated + a.Status.PreDeploymentEvaluationStatus = common.StateDeprecated + } + // deprecate completely everything + if phase == common.PhaseDeprecated { + a.Status.PostDeploymentStatus = common.StateDeprecated + a.Status.PostDeploymentEvaluationStatus = common.StateDeprecated + a.Status.WorkloadOverallStatus = common.StateDeprecated + a.Status.PreDeploymentEvaluationStatus = common.StateDeprecated + a.Status.PreDeploymentStatus = common.StateDeprecated + a.Status.Status = common.StateDeprecated + return + } + a.Status.Status = common.StateFailed +} + +func (a *KeptnAppVersion) SetPhaseTraceID(phase string, carrier propagation.MapCarrier) { + if a.Status.PhaseTraceIDs == nil { + a.Status.PhaseTraceIDs = common.PhaseTraceID{} + } + a.Status.PhaseTraceIDs[common.GetShortPhaseName(phase)] = carrier +} + +func (a KeptnAppVersion) GetEventAnnotations() map[string]string { + return map[string]string{ + "appName": a.Spec.AppName, + "appVersion": a.Spec.Version, + "appVersionName": a.Name, + } +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnappversion_types_test.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnappversion_types_test.go new file mode 100644 index 0000000000..6649899dbc --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnappversion_types_test.go @@ -0,0 +1,488 @@ +package v1beta1 + +import ( + "testing" + "time" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/propagation" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func TestKeptnAppVersion(t *testing.T) { + app := &KeptnAppVersion{ + ObjectMeta: metav1.ObjectMeta{ + Name: "app", + Namespace: "namespace", + }, + Status: KeptnAppVersionStatus{ + PreDeploymentStatus: common.StateFailed, + PreDeploymentEvaluationStatus: common.StateFailed, + PostDeploymentStatus: common.StateFailed, + PostDeploymentEvaluationStatus: common.StateFailed, + WorkloadOverallStatus: common.StateFailed, + Status: common.StateFailed, + PreDeploymentTaskStatus: []ItemStatus{ + { + DefinitionName: "defname", + Status: common.StateFailed, + Name: "taskname", + }, + }, + PostDeploymentTaskStatus: []ItemStatus{ + { + DefinitionName: "defname2", + Status: common.StateFailed, + Name: "taskname2", + }, + }, + PreDeploymentEvaluationTaskStatus: []ItemStatus{ + { + DefinitionName: "defname3", + Status: common.StateFailed, + Name: "taskname3", + }, + }, + PostDeploymentEvaluationTaskStatus: []ItemStatus{ + { + DefinitionName: "defname4", + Status: common.StateFailed, + Name: "taskname4", + }, + }, + CurrentPhase: common.PhaseAppDeployment.ShortName, + }, + Spec: KeptnAppVersionSpec{ + KeptnAppSpec: KeptnAppSpec{ + PreDeploymentTasks: []string{"task1", "task2"}, + PostDeploymentTasks: []string{"task3", "task4"}, + PreDeploymentEvaluations: []string{"task5", "task6"}, + PostDeploymentEvaluations: []string{"task7", "task8"}, + Version: "version", + }, + PreviousVersion: "prev", + AppName: "appname", + TraceId: map[string]string{"traceparent": "trace1"}, + }, + } + + require.True(t, app.IsPreDeploymentCompleted()) + require.False(t, app.IsPreDeploymentSucceeded()) + require.True(t, app.IsPreDeploymentFailed()) + + require.True(t, app.IsPreDeploymentEvaluationCompleted()) + require.False(t, app.IsPreDeploymentEvaluationSucceeded()) + require.True(t, app.IsPreDeploymentEvaluationFailed()) + + require.True(t, app.IsPostDeploymentCompleted()) + require.False(t, app.IsPostDeploymentSucceeded()) + require.True(t, app.IsPostDeploymentFailed()) + + require.True(t, app.IsPostDeploymentEvaluationCompleted()) + require.False(t, app.IsPostDeploymentEvaluationSucceeded()) + require.True(t, app.IsPostDeploymentEvaluationFailed()) + + require.True(t, app.AreWorkloadsCompleted()) + require.False(t, app.AreWorkloadsSucceeded()) + require.True(t, app.AreWorkloadsFailed()) + + require.False(t, app.IsEndTimeSet()) + require.False(t, app.IsStartTimeSet()) + + app.SetStartTime() + app.SetEndTime() + + require.True(t, app.IsEndTimeSet()) + require.True(t, app.IsStartTimeSet()) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("appname"), + common.AppVersion.String("version"), + common.AppNamespace.String("namespace"), + }, app.GetActiveMetricsAttributes()) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("appname"), + common.AppVersion.String("version"), + common.AppNamespace.String("namespace"), + common.AppStatus.String(string(common.StateFailed)), + }, app.GetMetricsAttributes()) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("appname"), + common.AppVersion.String("version"), + common.AppPreviousVersion.String("prev"), + }, app.GetDurationMetricsAttributes()) + + require.Equal(t, common.StateFailed, app.GetState()) + + require.Equal(t, []string{"task1", "task2"}, app.GetPreDeploymentTasks()) + require.Equal(t, []string{"task3", "task4"}, app.GetPostDeploymentTasks()) + require.Equal(t, []string{"task5", "task6"}, app.GetPreDeploymentEvaluations()) + require.Equal(t, []string{"task7", "task8"}, app.GetPostDeploymentEvaluations()) + + require.Equal(t, []ItemStatus{ + { + DefinitionName: "defname", + Status: common.StateFailed, + Name: "taskname", + }, + }, app.GetPreDeploymentTaskStatus()) + + require.Equal(t, []ItemStatus{ + { + DefinitionName: "defname2", + Status: common.StateFailed, + Name: "taskname2", + }, + }, app.GetPostDeploymentTaskStatus()) + + require.Equal(t, []ItemStatus{ + { + DefinitionName: "defname3", + Status: common.StateFailed, + Name: "taskname3", + }, + }, app.GetPreDeploymentEvaluationTaskStatus()) + + require.Equal(t, []ItemStatus{ + { + DefinitionName: "defname4", + Status: common.StateFailed, + Name: "taskname4", + }, + }, app.GetPostDeploymentEvaluationTaskStatus()) + + require.Equal(t, "appname", app.GetAppName()) + require.Equal(t, "prev", app.GetPreviousVersion()) + require.Equal(t, "appname", app.GetParentName()) + require.Equal(t, "namespace", app.GetNamespace()) + + app.SetState(common.StatePending) + require.Equal(t, common.StatePending, app.GetState()) + + require.True(t, !app.GetStartTime().IsZero()) + require.True(t, !app.GetEndTime().IsZero()) + + app.SetCurrentPhase(common.PhaseAppDeployment.LongName) + require.Equal(t, common.PhaseAppDeployment.LongName, app.GetCurrentPhase()) + + app.Status.EndTime = v1.Time{Time: time.Time{}} + app.Complete() + require.True(t, !app.GetEndTime().IsZero()) + + require.Equal(t, "version", app.GetVersion()) + + require.Equal(t, "trace1.appname.version.phase", app.GetSpanKey("phase")) + + retries := int32(5) + task := app.GenerateTask(KeptnTaskDefinition{ + ObjectMeta: v1.ObjectMeta{ + Name: "task-def", + Labels: map[string]string{ + "label1": "label2", + }, + Annotations: map[string]string{ + "annotation1": "annotation2", + }, + }, + Spec: KeptnTaskDefinitionSpec{ + Timeout: v1.Duration{ + Duration: 5 * time.Second, + }, + Retries: &retries, + }, + }, common.PostDeploymentCheckType) + require.Equal(t, KeptnTaskSpec{ + Context: TaskContext{ + AppName: app.GetParentName(), + AppVersion: app.GetVersion(), + TaskType: string(common.PostDeploymentCheckType), + ObjectType: "App", + }, + TaskDefinition: "task-def", + Parameters: TaskParameters{}, + SecureParameters: SecureParameters{}, + Type: common.PostDeploymentCheckType, + Timeout: v1.Duration{ + Duration: 5 * time.Second, + }, + Retries: &retries, + }, task.Spec) + + require.Equal(t, map[string]string{ + "label1": "label2", + }, task.Labels) + + require.Equal(t, map[string]string{ + "annotation1": "annotation2", + }, task.Annotations) + + evaluation := app.GenerateEvaluation(KeptnEvaluationDefinition{ + ObjectMeta: v1.ObjectMeta{ + Name: "eval-def", + }, + }, common.PostDeploymentCheckType) + require.Equal(t, KeptnEvaluationSpec{ + AppVersion: app.GetVersion(), + AppName: app.GetParentName(), + EvaluationDefinition: "eval-def", + Type: common.PostDeploymentCheckType, + RetryInterval: metav1.Duration{ + Duration: 5 * time.Second, + }, + }, evaluation.Spec) + + require.Equal(t, "phase", app.GetSpanName("phase")) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("appname"), + common.AppVersion.String("version"), + common.AppNamespace.String("namespace"), + }, app.GetSpanAttributes()) + + require.Equal(t, map[string]string{ + "appName": "appname", + "appVersion": "version", + "appVersionName": "app", + }, app.GetEventAnnotations()) +} + +func TestKeptnAppVersion_GetWorkloadNameOfApp(t *testing.T) { + type fields struct { + Spec KeptnAppVersionSpec + } + type args struct { + workloadName string + } + tests := []struct { + name string + fields fields + args args + want string + }{ + { + name: "", + fields: fields{ + Spec: KeptnAppVersionSpec{AppName: "my-app"}, + }, + args: args{ + workloadName: "my-workload", + }, + want: "my-app-my-workload", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := KeptnAppVersion{ + Spec: tt.fields.Spec, + } + if got := v.GetWorkloadNameOfApp(tt.args.workloadName); got != tt.want { + t.Errorf("GetWorkloadNameOfApp() = %v, want %v", got, tt.want) + } + }) + } +} + +//nolint:dupl +func TestKeptnAppVersion_DeprecateRemainingPhases(t *testing.T) { + app := KeptnAppVersion{ + Status: KeptnAppVersionStatus{ + PreDeploymentStatus: common.StatePending, + PreDeploymentEvaluationStatus: common.StatePending, + PostDeploymentStatus: common.StatePending, + PostDeploymentEvaluationStatus: common.StatePending, + WorkloadOverallStatus: common.StatePending, + Status: common.StatePending, + }, + } + + tests := []struct { + app KeptnAppVersion + phase common.KeptnPhaseType + want KeptnAppVersion + }{ + { + app: app, + phase: common.PhaseAppPostEvaluation, + want: KeptnAppVersion{ + Status: KeptnAppVersionStatus{ + PreDeploymentStatus: common.StatePending, + PreDeploymentEvaluationStatus: common.StatePending, + PostDeploymentStatus: common.StatePending, + PostDeploymentEvaluationStatus: common.StatePending, + WorkloadOverallStatus: common.StatePending, + Status: common.StatePending, + }, + }, + }, + { + app: app, + phase: common.PhaseAppPostDeployment, + want: KeptnAppVersion{ + Status: KeptnAppVersionStatus{ + PreDeploymentStatus: common.StatePending, + PreDeploymentEvaluationStatus: common.StatePending, + PostDeploymentStatus: common.StatePending, + PostDeploymentEvaluationStatus: common.StateDeprecated, + WorkloadOverallStatus: common.StatePending, + Status: common.StateFailed, + }, + }, + }, + { + app: app, + phase: common.PhaseAppDeployment, + want: KeptnAppVersion{ + Status: KeptnAppVersionStatus{ + PreDeploymentStatus: common.StatePending, + PreDeploymentEvaluationStatus: common.StatePending, + PostDeploymentStatus: common.StateDeprecated, + PostDeploymentEvaluationStatus: common.StateDeprecated, + WorkloadOverallStatus: common.StatePending, + Status: common.StateFailed, + }, + }, + }, + { + app: app, + phase: common.PhaseAppPreEvaluation, + want: KeptnAppVersion{ + Status: KeptnAppVersionStatus{ + PreDeploymentStatus: common.StatePending, + PreDeploymentEvaluationStatus: common.StatePending, + PostDeploymentStatus: common.StateDeprecated, + PostDeploymentEvaluationStatus: common.StateDeprecated, + WorkloadOverallStatus: common.StateDeprecated, + Status: common.StateFailed, + }, + }, + }, + { + app: app, + phase: common.PhaseAppPreDeployment, + want: KeptnAppVersion{ + Status: KeptnAppVersionStatus{ + PreDeploymentStatus: common.StatePending, + PreDeploymentEvaluationStatus: common.StateDeprecated, + PostDeploymentStatus: common.StateDeprecated, + PostDeploymentEvaluationStatus: common.StateDeprecated, + WorkloadOverallStatus: common.StateDeprecated, + Status: common.StateFailed, + }, + }, + }, + { + app: app, + phase: common.PhaseDeprecated, + want: KeptnAppVersion{ + Status: KeptnAppVersionStatus{ + PreDeploymentStatus: common.StateDeprecated, + PreDeploymentEvaluationStatus: common.StateDeprecated, + PostDeploymentStatus: common.StateDeprecated, + PostDeploymentEvaluationStatus: common.StateDeprecated, + WorkloadOverallStatus: common.StateDeprecated, + Status: common.StateDeprecated, + }, + }, + }, + { + app: app, + phase: common.PhaseWorkloadPreDeployment, + want: KeptnAppVersion{ + Status: KeptnAppVersionStatus{ + PreDeploymentStatus: common.StatePending, + PreDeploymentEvaluationStatus: common.StatePending, + PostDeploymentStatus: common.StatePending, + PostDeploymentEvaluationStatus: common.StatePending, + WorkloadOverallStatus: common.StatePending, + Status: common.StateFailed, + }, + }, + }, + } + + for _, tt := range tests { + t.Run("", func(t *testing.T) { + tt.app.DeprecateRemainingPhases(tt.phase) + require.Equal(t, tt.want, tt.app) + }) + } +} + +func TestKeptnAppVersion_SetPhaseTraceID(t *testing.T) { + app := KeptnAppVersion{ + Status: KeptnAppVersionStatus{}, + } + + app.SetPhaseTraceID(common.PhaseAppDeployment.ShortName, propagation.MapCarrier{ + "name3": "trace3", + }) + + require.Equal(t, KeptnAppVersion{ + Status: KeptnAppVersionStatus{ + PhaseTraceIDs: common.PhaseTraceID{ + common.PhaseAppDeployment.ShortName: propagation.MapCarrier{ + "name3": "trace3", + }, + }, + }, + }, app) + + app.SetPhaseTraceID(common.PhaseWorkloadDeployment.LongName, propagation.MapCarrier{ + "name2": "trace2", + }) + + require.Equal(t, KeptnAppVersion{ + Status: KeptnAppVersionStatus{ + PhaseTraceIDs: common.PhaseTraceID{ + common.PhaseAppDeployment.ShortName: propagation.MapCarrier{ + "name3": "trace3", + }, + common.PhaseWorkloadDeployment.ShortName: propagation.MapCarrier{ + "name2": "trace2", + }, + }, + }, + }, app) +} + +func TestKeptnAppVersionList(t *testing.T) { + list := KeptnAppVersionList{ + Items: []KeptnAppVersion{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "obj1", + }, + Status: KeptnAppVersionStatus{ + Status: common.StateSucceeded, + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "obj2", + }, + Status: KeptnAppVersionStatus{ + Status: common.StateDeprecated, + }, + }, + }, + } + + // fetch the list items + got := list.GetItems() + require.Len(t, got, 2) + + require.Equal(t, "obj1", list.Items[0].GetName()) + require.Equal(t, "obj2", list.Items[1].GetName()) + + // remove deprecated items from the list + list.RemoveDeprecated() + + // check that deprecated items are not present in the list anymore + got = list.GetItems() + require.Len(t, got, 1) +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnevaluation_types.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnevaluation_types.go new file mode 100644 index 0000000000..59df6e9bf3 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnevaluation_types.go @@ -0,0 +1,242 @@ +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "time" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// KeptnEvaluationSpec defines the desired state of KeptnEvaluation +type KeptnEvaluationSpec struct { + // Workload defines the KeptnWorkload for which the KeptnEvaluation is done. + // +optional + Workload string `json:"workload,omitempty"` + // WorkloadVersion defines the version of the KeptnWorkload for which the KeptnEvaluation is done. + WorkloadVersion string `json:"workloadVersion"` + // AppName defines the KeptnApp for which the KeptnEvaluation is done. + // +optional + AppName string `json:"appName,omitempty"` + // AppVersion defines the version of the KeptnApp for which the KeptnEvaluation is done. + // +optional + AppVersion string `json:"appVersion,omitempty"` + // EvaluationDefinition refers to the name of the KeptnEvaluationDefinition + // which includes the objectives for the KeptnEvaluation. + // The KeptnEvaluationDefinition can be + // located in the same namespace as the KeptnEvaluation, or in the Keptn namespace. + EvaluationDefinition string `json:"evaluationDefinition"` + // Retries indicates how many times the KeptnEvaluation can be attempted in the case of an error or + // missed evaluation objective, before considering the KeptnEvaluation to be failed. + // +kubebuilder:default:=10 + // +optional + Retries int `json:"retries,omitempty"` + // RetryInterval specifies the interval at which the KeptnEvaluation is retried in the case of an error + // or a missed objective. + // +optional + // +kubebuilder:default:="5s" + // +kubebuilder:validation:Pattern="^0|([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$" + // +kubebuilder:validation:Type:=string + // +optional + RetryInterval metav1.Duration `json:"retryInterval,omitempty"` + // +optional + FailAction string `json:"failAction,omitempty"` + // Type indicates whether the KeptnEvaluation is part of the pre- or postDeployment phase. + // +optional + Type common.CheckType `json:"checkType,omitempty"` +} + +// KeptnEvaluationStatus defines the observed state of KeptnEvaluation +type KeptnEvaluationStatus struct { + // RetryCount indicates how many times the KeptnEvaluation has been attempted already. + // +kubebuilder:default:=0 + RetryCount int `json:"retryCount"` + // EvaluationStatus describes the status of each objective of the KeptnEvaluationDefinition + // referenced by the KeptnEvaluation. + EvaluationStatus map[string]EvaluationStatusItem `json:"evaluationStatus"` + // OverallStatus describes the overall status of the KeptnEvaluation. The Overall status is derived + // from the status of the individual objectives of the KeptnEvaluationDefinition + // referenced by the KeptnEvaluation. + // +kubebuilder:default:=Pending + OverallStatus common.KeptnState `json:"overallStatus"` + // StartTime represents the time at which the KeptnEvaluation started. + // +optional + StartTime metav1.Time `json:"startTime,omitempty"` + // EndTime represents the time at which the KeptnEvaluation finished. + // +optional + EndTime metav1.Time `json:"endTime,omitempty"` +} + +type EvaluationStatusItem struct { + // Value represents the value of the KeptnMetric being evaluated. + Value string `json:"value"` + // Status indicates the status of the objective being evaluated. + Status common.KeptnState `json:"status"` + // Message contains additional information about the evaluation of an objective. + // This can include explanations about why an evaluation has failed (e.g. due to a missed objective), + // or if there was any error during the evaluation of the objective. + // +optional + Message string `json:"message,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:path=keptnevaluations,shortName=ke +// +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.appName` +// +kubebuilder:printcolumn:name="AppVersion",type=string,JSONPath=`.spec.appVersion` +// +kubebuilder:printcolumn:name="WorkloadName",type=string,JSONPath=`.spec.workload` +// +kubebuilder:printcolumn:name="WorkloadVersion",type=string,JSONPath=`.spec.workloadVersion` +// +kubebuilder:printcolumn:name="RetryCount",type=string,JSONPath=`.status.retryCount` +// +kubebuilder:printcolumn:name="EvaluationStatus",type=string,JSONPath=`.status.evaluationStatus` +// +kubebuilder:printcolumn:name="OverallStatus",type=string,JSONPath=`.status.overallStatus` + +// KeptnEvaluation is the Schema for the keptnevaluations API +type KeptnEvaluation struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec describes the desired state of the KeptnEvaluation. + // +optional + Spec KeptnEvaluationSpec `json:"spec,omitempty"` + // Status describes the current state of the KeptnEvaluation. + // +optional + Status KeptnEvaluationStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// KeptnEvaluationList contains a list of KeptnEvaluation +type KeptnEvaluationList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []KeptnEvaluation `json:"items"` +} + +func init() { + SchemeBuilder.Register(&KeptnEvaluation{}, &KeptnEvaluationList{}) +} + +func (e KeptnEvaluationList) GetItems() []client.Object { + var b []client.Object + for _, i := range e.Items { + b = append(b, &i) + } + return b +} + +func (e *KeptnEvaluation) SetStartTime() { + if e.Status.StartTime.IsZero() { + e.Status.StartTime = metav1.NewTime(time.Now().UTC()) + } +} + +func (e *KeptnEvaluation) SetEndTime() { + if e.Status.EndTime.IsZero() { + e.Status.EndTime = metav1.NewTime(time.Now().UTC()) + } +} + +func (e *KeptnEvaluation) IsStartTimeSet() bool { + return !e.Status.StartTime.IsZero() +} + +func (e *KeptnEvaluation) IsEndTimeSet() bool { + return !e.Status.EndTime.IsZero() +} + +func (e KeptnEvaluation) GetActiveMetricsAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(e.Spec.AppName), + common.AppVersion.String(e.Spec.AppVersion), + common.WorkloadName.String(e.Spec.Workload), + common.WorkloadVersion.String(e.Spec.WorkloadVersion), + common.EvaluationName.String(e.Name), + common.EvaluationType.String(string(e.Spec.Type)), + } +} + +func (e KeptnEvaluation) GetMetricsAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(e.Spec.AppName), + common.AppVersion.String(e.Spec.AppVersion), + common.WorkloadName.String(e.Spec.Workload), + common.WorkloadVersion.String(e.Spec.WorkloadVersion), + common.EvaluationName.String(e.Name), + common.EvaluationType.String(string(e.Spec.Type)), + common.EvaluationStatus.String(string(e.Status.OverallStatus)), + } +} + +func (e *KeptnEvaluation) AddEvaluationStatus(objective Objective) { + + evaluationStatusItem := EvaluationStatusItem{ + Status: common.StatePending, + } + if e.Status.EvaluationStatus == nil { + e.Status.EvaluationStatus = make(map[string]EvaluationStatusItem) + } + e.Status.EvaluationStatus[objective.KeptnMetricRef.Name] = evaluationStatusItem + +} + +func (e KeptnEvaluation) SetSpanAttributes(span trace.Span) { + span.SetAttributes(e.GetSpanAttributes()...) +} + +func (e KeptnEvaluation) GetSpanAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(e.Spec.AppName), + common.AppVersion.String(e.Spec.AppVersion), + common.WorkloadName.String(e.Spec.Workload), + common.WorkloadVersion.String(e.Spec.WorkloadVersion), + common.EvaluationName.String(e.Name), + common.EvaluationType.String(string(e.Spec.Type)), + } +} + +func (e *KeptnEvaluation) SetPhaseTraceID(phase string, carrier propagation.MapCarrier) { + // present due to SpanItem interface +} + +func (e KeptnEvaluation) GetSpanKey(phase string) string { + return e.Name +} + +func (e KeptnEvaluation) GetSpanName(phase string) string { + return e.Name +} + +func (e KeptnEvaluation) GetEventAnnotations() map[string]string { + return map[string]string{ + "appName": e.Spec.AppName, + "appVersion": e.Spec.AppVersion, + "workloadName": e.Spec.Workload, + "workloadVersion": e.Spec.WorkloadVersion, + "evaluationName": e.Name, + "evaluationDefinitionName": e.Spec.EvaluationDefinition, + } +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnevaluation_types_test.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnevaluation_types_test.go new file mode 100644 index 0000000000..4f96d5dd9f --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnevaluation_types_test.go @@ -0,0 +1,117 @@ +package v1beta1 + +import ( + "testing" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/attribute" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func TestKeptnEvaluation(t *testing.T) { + evaluation := &KeptnEvaluation{ + ObjectMeta: metav1.ObjectMeta{ + Name: "evaluation", + }, + Spec: KeptnEvaluationSpec{ + AppName: "app", + AppVersion: "appversion", + Type: common.PostDeploymentCheckType, + EvaluationDefinition: "def", + }, + Status: KeptnEvaluationStatus{ + OverallStatus: common.StateFailed, + }, + } + + evaluation.SetPhaseTraceID("", nil) + require.Equal(t, KeptnEvaluation{ + ObjectMeta: metav1.ObjectMeta{ + Name: "evaluation", + }, + Spec: KeptnEvaluationSpec{ + AppName: "app", + AppVersion: "appversion", + Type: common.PostDeploymentCheckType, + EvaluationDefinition: "def", + }, + Status: KeptnEvaluationStatus{ + OverallStatus: common.StateFailed, + }, + }, *evaluation) + + require.Equal(t, "evaluation", evaluation.GetSpanKey("")) + require.Equal(t, "evaluation", evaluation.GetSpanName("")) + + require.False(t, evaluation.IsEndTimeSet()) + require.False(t, evaluation.IsStartTimeSet()) + + evaluation.SetStartTime() + evaluation.SetEndTime() + + require.True(t, evaluation.IsEndTimeSet()) + require.True(t, evaluation.IsStartTimeSet()) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("app"), + common.AppVersion.String("appversion"), + common.WorkloadName.String(""), + common.WorkloadVersion.String(""), + common.EvaluationName.String("evaluation"), + common.EvaluationType.String(string(common.PostDeploymentCheckType)), + }, evaluation.GetActiveMetricsAttributes()) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("app"), + common.AppVersion.String("appversion"), + common.WorkloadName.String(""), + common.WorkloadVersion.String(""), + common.EvaluationName.String("evaluation"), + common.EvaluationType.String(string(common.PostDeploymentCheckType)), + common.EvaluationStatus.String(string(common.StateFailed)), + }, evaluation.GetMetricsAttributes()) + + evaluation.AddEvaluationStatus(Objective{KeptnMetricRef: KeptnMetricReference{Name: "objName"}}) + require.Equal(t, EvaluationStatusItem{ + Status: common.StatePending, + }, evaluation.Status.EvaluationStatus["objName"]) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("app"), + common.AppVersion.String("appversion"), + common.WorkloadName.String(""), + common.WorkloadVersion.String(""), + common.EvaluationName.String("evaluation"), + common.EvaluationType.String(string(common.PostDeploymentCheckType)), + }, evaluation.GetSpanAttributes()) + + require.Equal(t, map[string]string{ + "appName": "app", + "appVersion": "appversion", + "workloadName": "", + "workloadVersion": "", + "evaluationName": "evaluation", + "evaluationDefinitionName": "def", + }, evaluation.GetEventAnnotations()) +} + +func TestKeptnEvaluationList(t *testing.T) { + list := KeptnEvaluationList{ + Items: []KeptnEvaluation{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "obj1", + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "obj2", + }, + }, + }, + } + + got := list.GetItems() + require.Len(t, got, 2) +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnevaluationdefinition_types.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnevaluationdefinition_types.go new file mode 100644 index 0000000000..74614aa888 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnevaluationdefinition_types.go @@ -0,0 +1,79 @@ +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// KeptnEvaluationDefinitionSpec defines the desired state of KeptnEvaluationDefinition +type KeptnEvaluationDefinitionSpec struct { + // Objectives is a list of objectives that have to be met for a KeptnEvaluation referencing this + // KeptnEvaluationDefinition to be successful. + Objectives []Objective `json:"objectives"` +} + +type Objective struct { + // KeptnMetricRef references the KeptnMetric that should be evaluated. + KeptnMetricRef KeptnMetricReference `json:"keptnMetricRef"` + // EvaluationTarget specifies the target value for the references KeptnMetric. + // Needs to start with either '<' or '>', followed by the target value (e.g. '<10'). + EvaluationTarget string `json:"evaluationTarget"` +} + +type KeptnMetricReference struct { + // Name is the name of the referenced KeptnMetric. + Name string `json:"name"` + // Namespace is the namespace where the referenced KeptnMetric is located. + // +optional + Namespace string `json:"namespace,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:path=keptnevaluationdefinitions,shortName=ked + +// KeptnEvaluationDefinition is the Schema for the keptnevaluationdefinitions API +type KeptnEvaluationDefinition struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec describes the desired state of the KeptnEvaluationDefinition. + // +optional + Spec KeptnEvaluationDefinitionSpec `json:"spec,omitempty"` + // unused field + // +optional + Status string `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// KeptnEvaluationDefinitionList contains a list of KeptnEvaluationDefinition +type KeptnEvaluationDefinitionList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []KeptnEvaluationDefinition `json:"items"` +} + +func init() { + SchemeBuilder.Register(&KeptnEvaluationDefinition{}, &KeptnEvaluationDefinitionList{}) +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptntask_types.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptntask_types.go new file mode 100644 index 0000000000..e8feced65c --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptntask_types.go @@ -0,0 +1,277 @@ +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "time" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// KeptnTaskSpec defines the desired state of KeptnTask +type KeptnTaskSpec struct { + // TaskDefinition refers to the name of the KeptnTaskDefinition + // which includes the specification for the task to be performed. + // The KeptnTaskDefinition can be + // located in the same namespace as the KeptnTask, or in the Keptn namespace. + TaskDefinition string `json:"taskDefinition"` + // Context contains contextual information about the task execution. + // +optional + Context TaskContext `json:"context"` + // Parameters contains parameters that will be passed to the job that executes the task. + // +optional + Parameters TaskParameters `json:"parameters,omitempty"` + // SecureParameters contains secure parameters that will be passed to the job that executes the task. + // These will be stored and accessed as secrets in the cluster. + // +optional + SecureParameters SecureParameters `json:"secureParameters,omitempty"` + // Type indicates whether the KeptnTask is part of the pre- or postDeployment phase. + // +optional + Type common.CheckType `json:"checkType,omitempty"` + // Retries indicates how many times the KeptnTask can be attempted in the case of an error + // before considering the KeptnTask to be failed. + // +kubebuilder:default:=10 + // +optional + Retries *int32 `json:"retries,omitempty"` + // Timeout specifies the maximum time to wait for the task to be completed successfully. + // If the task does not complete successfully within this time frame, it will be + // considered to be failed. + // +optional + // +kubebuilder:default:="5m" + // +kubebuilder:validation:Pattern="^0|([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$" + // +kubebuilder:validation:Type:=string + // +optional + Timeout metav1.Duration `json:"timeout,omitempty"` +} + +type TaskContext struct { + // WorkloadName the name of the KeptnWorkload the KeptnTask is being executed for. + // +optional + WorkloadName string `json:"workloadName"` + // AppName the name of the KeptnApp the KeptnTask is being executed for. + // +optional + AppName string `json:"appName"` + // AppVersion the version of the KeptnApp the KeptnTask is being executed for. + // +optional + AppVersion string `json:"appVersion"` + // WorkloadVersion the version of the KeptnWorkload the KeptnTask is being executed for. + // +optional + WorkloadVersion string `json:"workloadVersion"` + // TaskType indicates whether the KeptnTask is part of the pre- or postDeployment phase. + // +optional + TaskType string `json:"taskType"` + // ObjectType indicates whether the KeptnTask is being executed for a KeptnApp or KeptnWorkload. + // +optional + ObjectType string `json:"objectType"` +} + +type TaskParameters struct { + // Inline contains the parameters that will be made available to the job + // executing the KeptnTask via the 'DATA' environment variable. + // The 'DATA' environment variable's content will be a json + // encoded string containing all properties of the map provided. + // +optional + Inline map[string]string `json:"map,omitempty"` +} + +type SecureParameters struct { + // Secret contains the parameters that will be made available to the job + // executing the KeptnTask via the 'SECRET_DATA' environment variable. + // The 'SECRET_DATA' environment variable's content will the same as value of the 'SECRET_DATA' + // key of the referenced secret. + // +optional + Secret string `json:"secret,omitempty"` +} + +// KeptnTaskStatus defines the observed state of KeptnTask +type KeptnTaskStatus struct { + // JobName is the name of the Job executing the Task. + // +optional + JobName string `json:"jobName,omitempty"` + // Status represents the overall state of the KeptnTask. + // +kubebuilder:default:=Pending + // +optional + Status common.KeptnState `json:"status,omitempty"` + // Message contains information about unexpected errors encountered during the execution of the KeptnTask. + // +optional + Message string `json:"message,omitempty"` + // StartTime represents the time at which the KeptnTask started. + // +optional + StartTime metav1.Time `json:"startTime,omitempty"` + // EndTime represents the time at which the KeptnTask finished. + // +optional + EndTime metav1.Time `json:"endTime,omitempty"` + // Reason contains more information about the reason for the last transition of the Job executing the KeptnTask. + // +optional + Reason string `json:"reason,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.app` +// +kubebuilder:printcolumn:name="AppVersion",type=string,JSONPath=`.spec.appVersion` +// +kubebuilder:printcolumn:name="WorkloadName",type=string,JSONPath=`.spec.workload` +// +kubebuilder:printcolumn:name="WorkloadVersion",type=string,JSONPath=`.spec.workloadVersion` +// +kubebuilder:printcolumn:name="Job Name",type=string,JSONPath=`.status.jobName` +// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.status` + +// KeptnTask is the Schema for the keptntasks API +type KeptnTask struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec describes the desired state of the KeptnTask. + // +optional + Spec KeptnTaskSpec `json:"spec,omitempty"` + // Status describes the current state of the KeptnTask. + // +optional + Status KeptnTaskStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// KeptnTaskList contains a list of KeptnTask +type KeptnTaskList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []KeptnTask `json:"items"` +} + +func init() { + SchemeBuilder.Register(&KeptnTask{}, &KeptnTaskList{}) +} + +func (t KeptnTaskList) GetItems() []client.Object { + var b []client.Object + for _, i := range t.Items { + b = append(b, &i) + } + return b +} + +func (t *KeptnTask) SetStartTime() { + if t.Status.StartTime.IsZero() { + t.Status.StartTime = metav1.NewTime(time.Now().UTC()) + } +} + +func (t *KeptnTask) SetEndTime() { + if t.Status.EndTime.IsZero() { + t.Status.EndTime = metav1.NewTime(time.Now().UTC()) + } +} + +func (t *KeptnTask) IsStartTimeSet() bool { + return !t.Status.StartTime.IsZero() +} + +func (t *KeptnTask) IsEndTimeSet() bool { + return !t.Status.EndTime.IsZero() +} + +func (t KeptnTask) GetActiveMetricsAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(t.Spec.Context.AppName), + common.AppVersion.String(t.Spec.Context.AppVersion), + common.WorkloadName.String(t.Spec.Context.WorkloadName), + common.WorkloadVersion.String(t.Spec.Context.WorkloadVersion), + common.TaskName.String(t.Name), + common.TaskType.String(string(t.Spec.Type)), + } +} + +func (t KeptnTask) GetMetricsAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(t.Spec.Context.AppName), + common.AppVersion.String(t.Spec.Context.AppVersion), + common.WorkloadName.String(t.Spec.Context.WorkloadName), + common.WorkloadVersion.String(t.Spec.Context.WorkloadVersion), + common.TaskName.String(t.Name), + common.TaskType.String(string(t.Spec.Type)), + common.TaskStatus.String(string(t.Status.Status)), + } +} + +func (t KeptnTask) SetSpanAttributes(span trace.Span) { + span.SetAttributes(t.GetSpanAttributes()...) +} + +func (t KeptnTask) CreateKeptnAnnotations() map[string]string { + if t.Spec.Context.WorkloadName != "" { + return common.MergeMaps(t.Annotations, map[string]string{ + common.AppAnnotation: t.Spec.Context.AppName, + common.WorkloadAnnotation: t.Spec.Context.WorkloadName, + common.VersionAnnotation: t.Spec.Context.WorkloadVersion, + common.TaskNameAnnotation: t.Name, + }) + } + return common.MergeMaps(t.Annotations, map[string]string{ + common.AppAnnotation: t.Spec.Context.AppName, + common.VersionAnnotation: t.Spec.Context.AppVersion, + common.TaskNameAnnotation: t.Name, + }) +} + +func (t KeptnTask) GetSpanAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(t.Spec.Context.AppName), + common.AppVersion.String(t.Spec.Context.AppVersion), + common.WorkloadName.String(t.Spec.Context.WorkloadName), + common.WorkloadVersion.String(t.Spec.Context.WorkloadVersion), + common.TaskName.String(t.Name), + common.TaskType.String(string(t.Spec.Type)), + } +} + +func (t *KeptnTask) SetPhaseTraceID(phase string, carrier propagation.MapCarrier) { + // present due to SpanItem interface +} + +func (t KeptnTask) GetSpanKey(phase string) string { + return t.Name +} + +func (t KeptnTask) GetSpanName(phase string) string { + return t.Name +} + +func (t KeptnTask) GetEventAnnotations() map[string]string { + return map[string]string{ + "appName": t.Spec.Context.AppName, + "appVersion": t.Spec.Context.AppVersion, + "workloadName": t.Spec.Context.WorkloadName, + "workloadVersion": t.Spec.Context.WorkloadVersion, + "taskName": t.Name, + "taskDefinitionName": t.Spec.TaskDefinition, + } +} + +func (t KeptnTask) GetActiveDeadlineSeconds() *int64 { + deadline, _ := time.ParseDuration(t.Spec.Timeout.Duration.String()) + seconds := int64(deadline.Seconds()) + return &seconds +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptntask_types_test.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptntask_types_test.go new file mode 100644 index 0000000000..a48c02e9ad --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptntask_types_test.go @@ -0,0 +1,156 @@ +package v1beta1 + +import ( + "testing" + "time" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/attribute" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func TestKeptnTask(t *testing.T) { + task := &KeptnTask{ + ObjectMeta: metav1.ObjectMeta{ + Name: "task", + Labels: map[string]string{ + "label1": "label2", + }, + Annotations: map[string]string{ + "annotation1": "annotation2", + }, + }, + Spec: KeptnTaskSpec{ + Context: TaskContext{ + AppName: "app", + AppVersion: "appversion", + }, + Type: common.PostDeploymentCheckType, + TaskDefinition: "def", + Timeout: metav1.Duration{ + Duration: time.Duration(5 * time.Minute), + }, + }, + Status: KeptnTaskStatus{ + Status: common.StateFailed, + }, + } + + task.SetPhaseTraceID("", nil) + require.Equal(t, KeptnTask{ + ObjectMeta: metav1.ObjectMeta{ + Name: "task", + Labels: map[string]string{ + "label1": "label2", + }, + Annotations: map[string]string{ + "annotation1": "annotation2", + }, + }, + Spec: KeptnTaskSpec{ + Context: TaskContext{ + AppName: "app", + AppVersion: "appversion", + }, + Type: common.PostDeploymentCheckType, + TaskDefinition: "def", + Timeout: metav1.Duration{ + Duration: time.Duration(5 * time.Minute), + }, + }, + Status: KeptnTaskStatus{ + Status: common.StateFailed, + }, + }, *task) + + require.Equal(t, "task", task.GetSpanKey("")) + require.Equal(t, "task", task.GetSpanName("")) + + require.False(t, task.IsEndTimeSet()) + require.False(t, task.IsStartTimeSet()) + + task.SetStartTime() + task.SetEndTime() + + require.True(t, task.IsEndTimeSet()) + require.True(t, task.IsStartTimeSet()) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("app"), + common.AppVersion.String("appversion"), + common.WorkloadName.String(""), + common.WorkloadVersion.String(""), + common.TaskName.String("task"), + common.TaskType.String(string(common.PostDeploymentCheckType)), + }, task.GetActiveMetricsAttributes()) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("app"), + common.AppVersion.String("appversion"), + common.WorkloadName.String(""), + common.WorkloadVersion.String(""), + common.TaskName.String("task"), + common.TaskType.String(string(common.PostDeploymentCheckType)), + common.TaskStatus.String(string(common.StateFailed)), + }, task.GetMetricsAttributes()) + + require.Equal(t, map[string]string{ + "keptn.sh/app": "app", + "keptn.sh/task-name": "task", + "keptn.sh/version": "appversion", + "annotation1": "annotation2", + }, task.CreateKeptnAnnotations()) + + task.Spec.Context.WorkloadName = "workload" + task.Spec.Context.WorkloadVersion = "workloadversion" + + require.Equal(t, map[string]string{ + "keptn.sh/app": "app", + "keptn.sh/workload": "workload", + "keptn.sh/task-name": "task", + "keptn.sh/version": "workloadversion", + "annotation1": "annotation2", + }, task.CreateKeptnAnnotations()) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("app"), + common.AppVersion.String("appversion"), + common.WorkloadName.String("workload"), + common.WorkloadVersion.String("workloadversion"), + common.TaskName.String("task"), + common.TaskType.String(string(common.PostDeploymentCheckType)), + }, task.GetSpanAttributes()) + + require.Equal(t, map[string]string{ + "appName": "app", + "appVersion": "appversion", + "workloadName": "workload", + "workloadVersion": "workloadversion", + "taskName": "task", + "taskDefinitionName": "def", + }, task.GetEventAnnotations()) + + require.Equal(t, int64(300), *task.GetActiveDeadlineSeconds()) + +} + +func TestKeptnTaskList(t *testing.T) { + list := KeptnTaskList{ + Items: []KeptnTask{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "obj1", + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "obj2", + }, + }, + }, + } + + got := list.GetItems() + require.Len(t, got, 2) +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptntaskdefinition_types.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptntaskdefinition_types.go new file mode 100644 index 0000000000..08fea1a512 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptntaskdefinition_types.go @@ -0,0 +1,197 @@ +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// KeptnTaskDefinitionSpec defines the desired state of KeptnTaskDefinition +type KeptnTaskDefinitionSpec struct { + // Deprecated + // Function contains the definition for the function that is to be executed in KeptnTasks based on + // the KeptnTaskDefinitions. + // +optional + Function *RuntimeSpec `json:"function,omitempty"` + // Python contains the definition for the python function that is to be executed in KeptnTasks based on + // the KeptnTaskDefinitions. + // +optional + Python *RuntimeSpec `json:"python,omitempty"` + // Deno contains the definition for the Deno function that is to be executed in KeptnTasks based on + // the KeptnTaskDefinitions. + // +optional + Deno *RuntimeSpec `json:"deno,omitempty"` + // Container contains the definition for the container that is to be used in Job based on + // the KeptnTaskDefinitions. + // +optional + Container *ContainerSpec `json:"container,omitempty"` + // Retries specifies how many times a job executing the KeptnTaskDefinition should be restarted in the case + // of an unsuccessful attempt. + // +kubebuilder:default:=10 + // +optional + Retries *int32 `json:"retries,omitempty"` + // Timeout specifies the maximum time to wait for the task to be completed successfully. + // If the task does not complete successfully within this time frame, it will be + // considered to be failed. + // +kubebuilder:default:="5m" + // +kubebuilder:validation:Pattern="^0|([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$" + // +kubebuilder:validation:Type:=string + // +optional + Timeout metav1.Duration `json:"timeout,omitempty"` + // ServiceAccount specifies the service account to be used in jobs to authenticate with the Kubernetes API and access cluster resources. + // +optional + ServiceAccount *ServiceAccountSpec `json:"serviceAccount,omitempty"` + // AutomountServiceAccountToken allows to enable K8s to assign cluster API credentials to a pod, if set to false + // the pod will decline the service account + // +optional + AutomountServiceAccountToken *AutomountServiceAccountTokenSpec `json:"automountServiceAccountToken,omitempty"` + // TTLSecondsAfterFinished controller makes a job eligible to be cleaned up after it is finished. + // The timer starts when the status shows up to be Complete or Failed. + // +kubebuilder:default:=300 + // +optional + TTLSecondsAfterFinished *int32 `json:"ttlSecondsAfterFinished,omitempty"` + // ImagePullSecrets is an optional field to specify the names of secrets to use for pulling container images + // +optional + ImagePullSecrets []v1.LocalObjectReference `json:"imagePullSecrets,omitempty"` +} + +type RuntimeSpec struct { + // FunctionReference allows to reference another KeptnTaskDefinition which contains the source code of the + // function to be executes for KeptnTasks based on this KeptnTaskDefinition. This can be useful when you have + // multiple KeptnTaskDefinitions that should execute the same logic, but each with different parameters. + // +optional + FunctionReference FunctionReference `json:"functionRef,omitempty"` + // Inline allows to specify the code that should be executed directly in the KeptnTaskDefinition, as a multi-line + // string. + // +optional + Inline Inline `json:"inline,omitempty"` + // HttpReference allows to point to an HTTP URL containing the code of the function. + // +optional + HttpReference HttpReference `json:"httpRef,omitempty"` + // ConfigMapReference allows to reference a ConfigMap containing the code of the function. + // When referencing a ConfigMap, the code of the function must be available as a value of the 'code' key + // of the referenced ConfigMap. + // +optional + ConfigMapReference ConfigMapReference `json:"configMapRef,omitempty"` + // Parameters contains parameters that will be passed to the job that executes the task as env variables. + // +optional + Parameters TaskParameters `json:"parameters,omitempty"` + // SecureParameters contains secure parameters that will be passed to the job that executes the task. + // These will be stored and accessed as secrets in the cluster. + // +optional + SecureParameters SecureParameters `json:"secureParameters,omitempty"` + // CmdParameters contains parameters that will be passed to the command + // +optional + CmdParameters string `json:"cmdParameters,omitempty"` +} + +type ConfigMapReference struct { + // Name is the name of the referenced ConfigMap. + // +optional + Name string `json:"name,omitempty"` +} + +type FunctionReference struct { + // Name is the name of the referenced KeptnTaskDefinition. + // +optional + Name string `json:"name,omitempty"` +} + +type Inline struct { + // Code contains the code of the function. + // +optional + Code string `json:"code,omitempty"` +} + +type HttpReference struct { + // Url is the URL containing the code of the function. + // +optional + Url string `json:"url,omitempty"` +} + +type ContainerSpec struct { + *v1.Container `json:",inline"` +} + +type AutomountServiceAccountTokenSpec struct { + Type *bool `json:"type"` +} +type ServiceAccountSpec struct { + Name string `json:"name"` +} + +// KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition +type KeptnTaskDefinitionStatus struct { + // Function contains status information of the function definition for the task. + // +optional + Function FunctionStatus `json:"function,omitempty"` +} + +type FunctionStatus struct { + // ConfigMap indicates the ConfigMap in which the function code is stored. + // +optional + ConfigMap string `json:"configMap,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status + +// KeptnTaskDefinition is the Schema for the keptntaskdefinitions API +type KeptnTaskDefinition struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec describes the desired state of the KeptnTaskDefinition. + // +optional + Spec KeptnTaskDefinitionSpec `json:"spec,omitempty"` + // Status describes the current state of the KeptnTaskDefinition. + // +optional + Status KeptnTaskDefinitionStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// KeptnTaskDefinitionList contains a list of KeptnTaskDefinition +type KeptnTaskDefinitionList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []KeptnTaskDefinition `json:"items"` +} + +func init() { + SchemeBuilder.Register(&KeptnTaskDefinition{}, &KeptnTaskDefinitionList{}) +} + +func (d *KeptnTaskDefinition) GetServiceAccount() string { + if d.Spec.ServiceAccount == nil { + return "" + } + return d.Spec.ServiceAccount.Name +} + +func (d *KeptnTaskDefinition) GetAutomountServiceAccountToken() *bool { + if d.Spec.AutomountServiceAccountToken == nil { + return nil + } + return d.Spec.AutomountServiceAccountToken.Type +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptntaskdefinition_types_test.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptntaskdefinition_types_test.go new file mode 100644 index 0000000000..635c59ec89 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptntaskdefinition_types_test.go @@ -0,0 +1,40 @@ +package v1beta1 + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestTaskDefinition_GetServiceAccountNoName(t *testing.T) { + d := &KeptnTaskDefinition{ + Spec: KeptnTaskDefinitionSpec{}, + } + svcAccname := d.GetServiceAccount() + require.Equal(t, svcAccname, "") +} + +func TestTaskDefinition_GetServiceAccountName(t *testing.T) { + sAName := "sva" + d := &KeptnTaskDefinition{ + Spec: KeptnTaskDefinitionSpec{ + ServiceAccount: &ServiceAccountSpec{ + Name: sAName, + }, + }, + } + svcAccname := d.GetServiceAccount() + require.Equal(t, svcAccname, sAName) +} + +func TestTaskDefinition_GetAutomountServiceAccountToken(t *testing.T) { + token := true + d := &KeptnTaskDefinition{ + Spec: KeptnTaskDefinitionSpec{ + AutomountServiceAccountToken: &AutomountServiceAccountTokenSpec{ + Type: &token, + }, + }, + } + require.True(t, *d.GetAutomountServiceAccountToken()) +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnworkload_types.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnworkload_types.go new file mode 100644 index 0000000000..a15d9c7ba6 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnworkload_types.go @@ -0,0 +1,135 @@ +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "fmt" + "strings" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// KeptnWorkloadSpec defines the desired state of KeptnWorkload +type KeptnWorkloadSpec struct { + // AppName is the name of the KeptnApp containing the KeptnWorkload. + AppName string `json:"app"` + // Version defines the version of the KeptnWorkload. + Version string `json:"version"` + // PreDeploymentTasks is a list of all tasks to be performed during the pre-deployment phase of the KeptnWorkload. + // The items of this list refer to the names of KeptnTaskDefinitions + // located in the same namespace as the KeptnApp, or in the Keptn namespace. + // +optional + PreDeploymentTasks []string `json:"preDeploymentTasks,omitempty"` + // PostDeploymentTasks is a list of all tasks to be performed during the post-deployment phase of the KeptnWorkload. + // The items of this list refer to the names of KeptnTaskDefinitions + // located in the same namespace as the KeptnWorkload, or in the Keptn namespace. + // +optional + PostDeploymentTasks []string `json:"postDeploymentTasks,omitempty"` + // PreDeploymentEvaluations is a list of all evaluations to be performed + // during the pre-deployment phase of the KeptnWorkload. + // The items of this list refer to the names of KeptnEvaluationDefinitions + // located in the same namespace as the KeptnWorkload, or in the Keptn namespace. + // +optional + PreDeploymentEvaluations []string `json:"preDeploymentEvaluations,omitempty"` + // PostDeploymentEvaluations is a list of all evaluations to be performed + // during the post-deployment phase of the KeptnWorkload. + // The items of this list refer to the names of KeptnEvaluationDefinitions + // located in the same namespace as the KeptnWorkload, or in the Keptn namespace. + // +optional + PostDeploymentEvaluations []string `json:"postDeploymentEvaluations,omitempty"` + // ResourceReference is a reference to the Kubernetes resource + // (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload is representing. + ResourceReference ResourceReference `json:"resourceReference"` +} + +// KeptnWorkloadStatus defines the observed state of KeptnWorkload +type KeptnWorkloadStatus struct { + // CurrentVersion indicates the version that is currently deployed or being reconciled. + // +optional + CurrentVersion string `json:"currentVersion,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.app` +// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version` + +// KeptnWorkload is the Schema for the keptnworkloads API +type KeptnWorkload struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec describes the desired state of the KeptnWorkload. + // +optional + Spec KeptnWorkloadSpec `json:"spec,omitempty"` + // Status describes the current state of the KeptnWorkload. + // +optional + Status KeptnWorkloadStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// KeptnWorkloadList contains a list of KeptnWorkload +type KeptnWorkloadList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []KeptnWorkload `json:"items"` +} + +// ResourceReference represents the parent resource of Workload +type ResourceReference struct { + UID types.UID `json:"uid"` + Kind string `json:"kind"` + Name string `json:"name"` +} + +func init() { + SchemeBuilder.Register(&KeptnWorkload{}, &KeptnWorkloadList{}) +} + +func (w KeptnWorkload) SetSpanAttributes(span trace.Span) { + span.SetAttributes(w.GetSpanAttributes()...) +} + +func (w KeptnWorkload) GetSpanAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(w.Spec.AppName), + common.WorkloadName.String(w.Name), + common.WorkloadVersion.String(w.Spec.Version), + } +} + +func (w KeptnWorkload) GetEventAnnotations() map[string]string { + return map[string]string{ + "appName": w.Spec.AppName, + "workloadName": w.Name, + "workloadVersion": w.Spec.Version, + } +} + +func (w KeptnWorkload) GetNameWithoutAppPrefix() string { + return strings.TrimPrefix(w.Name, fmt.Sprintf("%s-", w.Spec.AppName)) +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnworkload_types_test.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnworkload_types_test.go new file mode 100644 index 0000000000..9470b6f89d --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnworkload_types_test.go @@ -0,0 +1,72 @@ +package v1beta1 + +import ( + "testing" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/attribute" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func TestKeptnWorkload(t *testing.T) { + workload := &KeptnWorkload{ + ObjectMeta: metav1.ObjectMeta{ + Name: "workload", + Namespace: "namespace", + }, + Spec: KeptnWorkloadSpec{ + Version: "version", + AppName: "app", + }, + } + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("app"), + common.WorkloadName.String("workload"), + common.WorkloadVersion.String("version"), + }, workload.GetSpanAttributes()) + + require.Equal(t, map[string]string{ + "appName": "app", + "workloadName": "workload", + "workloadVersion": "version", + }, workload.GetEventAnnotations()) +} + +func TestKeptnWorkload_GetNameWithoutAppPrefix(t *testing.T) { + type fields struct { + ObjectMeta v1.ObjectMeta + Spec KeptnWorkloadSpec + } + tests := []struct { + name string + fields fields + want string + }{ + { + name: "remove app prefix", + fields: fields{ + ObjectMeta: v1.ObjectMeta{ + Name: "my-app-my-workload", + }, + Spec: KeptnWorkloadSpec{ + AppName: "my-app", + }, + }, + want: "my-workload", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + w := KeptnWorkload{ + ObjectMeta: tt.fields.ObjectMeta, + Spec: tt.fields.Spec, + } + got := w.GetNameWithoutAppPrefix() + + require.Equal(t, tt.want, got) + }) + } +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnworkloadversion_types.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnworkloadversion_types.go new file mode 100644 index 0000000000..7a44dfb058 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnworkloadversion_types.go @@ -0,0 +1,481 @@ +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "fmt" + "time" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +type ItemStatus struct { + // DefinitionName is the name of the EvaluationDefinition/TaskDefinition + // +optional + DefinitionName string `json:"definitionName,omitempty"` + // +kubebuilder:default:=Pending + // +optional + Status common.KeptnState `json:"status,omitempty"` + // Name is the name of the Evaluation/Task + // +optional + Name string `json:"name,omitempty"` + // StartTime represents the time at which the Item (Evaluation/Task) started. + // +optional + StartTime metav1.Time `json:"startTime,omitempty"` + // EndTime represents the time at which the Item (Evaluation/Task) started. + // +optional + EndTime metav1.Time `json:"endTime,omitempty"` +} + +// KeptnWorkloadVersionSpec defines the desired state of KeptnWorkloadVersion +type KeptnWorkloadVersionSpec struct { + KeptnWorkloadSpec `json:",inline"` + // WorkloadName is the name of the KeptnWorkload. + WorkloadName string `json:"workloadName"` + // PreviousVersion is the version of the KeptnWorkload that has been deployed prior to this version. + // +optional + PreviousVersion string `json:"previousVersion,omitempty"` + // TraceId contains the OpenTelemetry trace ID. + // +optional + TraceId map[string]string `json:"traceId,omitempty"` +} + +// KeptnWorkloadVersionStatus defines the observed state of KeptnWorkloadVersion +type KeptnWorkloadVersionStatus struct { + // PreDeploymentStatus indicates the current status of the KeptnWorkloadVersion's PreDeployment phase. + // +kubebuilder:default:=Pending + // +optional + PreDeploymentStatus common.KeptnState `json:"preDeploymentStatus,omitempty"` + // DeploymentStatus indicates the current status of the KeptnWorkloadVersion's Deployment phase. + // +kubebuilder:default:=Pending + // +optional + DeploymentStatus common.KeptnState `json:"deploymentStatus,omitempty"` + // PreDeploymentEvaluationStatus indicates the current status of the KeptnWorkloadVersion's PreDeploymentEvaluation phase. + // +kubebuilder:default:=Pending + // +optional + PreDeploymentEvaluationStatus common.KeptnState `json:"preDeploymentEvaluationStatus,omitempty"` + // PostDeploymentEvaluationStatus indicates the current status of the KeptnWorkloadVersion's PostDeploymentEvaluation phase. + // +kubebuilder:default:=Pending + // +optional + PostDeploymentEvaluationStatus common.KeptnState `json:"postDeploymentEvaluationStatus,omitempty"` + // PostDeploymentStatus indicates the current status of the KeptnWorkloadVersion's PostDeployment phase. + // +kubebuilder:default:=Pending + // +optional + PostDeploymentStatus common.KeptnState `json:"postDeploymentStatus,omitempty"` + // PreDeploymentTaskStatus indicates the current state of each preDeploymentTask of the KeptnWorkloadVersion. + // +optional + PreDeploymentTaskStatus []ItemStatus `json:"preDeploymentTaskStatus,omitempty"` + // PostDeploymentTaskStatus indicates the current state of each postDeploymentTask of the KeptnWorkloadVersion. + // +optional + PostDeploymentTaskStatus []ItemStatus `json:"postDeploymentTaskStatus,omitempty"` + // PreDeploymentEvaluationTaskStatus indicates the current state of each preDeploymentEvaluation of the KeptnWorkloadVersion. + // +optional + PreDeploymentEvaluationTaskStatus []ItemStatus `json:"preDeploymentEvaluationTaskStatus,omitempty"` + // PostDeploymentEvaluationTaskStatus indicates the current state of each postDeploymentEvaluation of the KeptnWorkloadVersion. + // +optional + PostDeploymentEvaluationTaskStatus []ItemStatus `json:"postDeploymentEvaluationTaskStatus,omitempty"` + // StartTime represents the time at which the deployment of the KeptnWorkloadVersion started. + // +optional + StartTime metav1.Time `json:"startTime,omitempty"` + // EndTime represents the time at which the deployment of the KeptnWorkloadVersion finished. + // +optional + EndTime metav1.Time `json:"endTime,omitempty"` + // CurrentPhase indicates the current phase of the KeptnWorkloadVersion. This can be: + // - PreDeploymentTasks + // - PreDeploymentEvaluations + // - Deployment + // - PostDeploymentTasks + // - PostDeploymentEvaluations + // +optional + CurrentPhase string `json:"currentPhase,omitempty"` + // PhaseTraceIDs contains the trace IDs of the OpenTelemetry spans of each phase of the KeptnWorkloadVersion + // +optional + PhaseTraceIDs common.PhaseTraceID `json:"phaseTraceIDs,omitempty"` + // Status represents the overall status of the KeptnWorkloadVersion. + // +kubebuilder:default:=Pending + // +optional + Status common.KeptnState `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=keptnworkloadversions,shortName=kwv +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.app` +// +kubebuilder:printcolumn:name="WorkloadName",type=string,JSONPath=`.spec.workloadName` +// +kubebuilder:printcolumn:name="WorkloadVersion",type=string,JSONPath=`.spec.version` +// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.currentPhase` +// +kubebuilder:printcolumn:name="PreDeploymentStatus",priority=1,type=string,JSONPath=`.status.preDeploymentStatus` +// +kubebuilder:printcolumn:name="PreDeploymentEvaluationStatus",priority=1,type=string,JSONPath=`.status.preDeploymentEvaluationStatus` +// +kubebuilder:printcolumn:name="DeploymentStatus",type=string,priority=1,JSONPath=`.status.deploymentStatus` +// +kubebuilder:printcolumn:name="PostDeploymentStatus",type=string,priority=1,JSONPath=`.status.postDeploymentStatus` +// +kubebuilder:printcolumn:name="PostDeploymentEvaluationStatus",priority=1,type=string,JSONPath=`.status.postDeploymentEvaluationStatus` + +// KeptnWorkloadVersion is the Schema for the keptnworkloadversions API +type KeptnWorkloadVersion struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec describes the desired state of the KeptnWorkloadVersion. + // +optional + Spec KeptnWorkloadVersionSpec `json:"spec,omitempty"` + // Status describes the current state of the KeptnWorkloadVersion. + // +optional + Status KeptnWorkloadVersionStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// KeptnWorkloadVersionList contains a list of KeptnWorkloadVersion +type KeptnWorkloadVersionList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + Items []KeptnWorkloadVersion `json:"items"` +} + +func init() { + SchemeBuilder.Register(&KeptnWorkloadVersion{}, &KeptnWorkloadVersionList{}) +} + +func (w KeptnWorkloadVersionList) GetItems() []client.Object { + var b []client.Object + for i := 0; i < len(w.Items); i++ { + b = append(b, &w.Items[i]) + } + return b +} + +func (w KeptnWorkloadVersion) IsPreDeploymentCompleted() bool { + return w.Status.PreDeploymentStatus.IsCompleted() +} + +func (w KeptnWorkloadVersion) IsPreDeploymentEvaluationCompleted() bool { + return w.Status.PreDeploymentEvaluationStatus.IsCompleted() +} + +func (w KeptnWorkloadVersion) IsPreDeploymentSucceeded() bool { + return w.Status.PreDeploymentStatus.IsSucceeded() +} + +func (w KeptnWorkloadVersion) IsPreDeploymentFailed() bool { + return w.Status.PreDeploymentStatus.IsFailed() +} + +func (w KeptnWorkloadVersion) IsPreDeploymentEvaluationSucceeded() bool { + return w.Status.PreDeploymentEvaluationStatus.IsSucceeded() +} + +func (w KeptnWorkloadVersion) IsPreDeploymentEvaluationFailed() bool { + return w.Status.PreDeploymentEvaluationStatus.IsFailed() +} + +func (w KeptnWorkloadVersion) IsPostDeploymentCompleted() bool { + return w.Status.PostDeploymentStatus.IsCompleted() +} + +func (w KeptnWorkloadVersion) IsPostDeploymentEvaluationCompleted() bool { + return w.Status.PostDeploymentEvaluationStatus.IsCompleted() +} + +func (w KeptnWorkloadVersion) IsPostDeploymentSucceeded() bool { + return w.Status.PostDeploymentStatus.IsSucceeded() +} + +func (w KeptnWorkloadVersion) IsPostDeploymentFailed() bool { + return w.Status.PostDeploymentStatus.IsFailed() +} + +func (w KeptnWorkloadVersion) IsPostDeploymentEvaluationSucceeded() bool { + return w.Status.PostDeploymentEvaluationStatus.IsSucceeded() +} + +func (w KeptnWorkloadVersion) IsPostDeploymentEvaluationFailed() bool { + return w.Status.PostDeploymentEvaluationStatus.IsFailed() +} + +func (w KeptnWorkloadVersion) IsDeploymentCompleted() bool { + return w.Status.DeploymentStatus.IsCompleted() +} + +func (w KeptnWorkloadVersion) IsDeploymentSucceeded() bool { + return w.Status.DeploymentStatus.IsSucceeded() +} + +func (w KeptnWorkloadVersion) IsDeploymentFailed() bool { + return w.Status.DeploymentStatus.IsFailed() +} + +func (w *KeptnWorkloadVersion) SetStartTime() { + if w.Status.StartTime.IsZero() { + w.Status.StartTime = metav1.NewTime(time.Now().UTC()) + } +} + +func (w *KeptnWorkloadVersion) SetEndTime() { + if w.Status.EndTime.IsZero() { + w.Status.EndTime = metav1.NewTime(time.Now().UTC()) + } +} + +func (w *KeptnWorkloadVersion) IsStartTimeSet() bool { + return !w.Status.StartTime.IsZero() +} + +func (w *KeptnWorkloadVersion) IsEndTimeSet() bool { + return !w.Status.EndTime.IsZero() +} + +func (w KeptnWorkloadVersion) GetStartTime() time.Time { + return w.Status.StartTime.Time +} + +func (w KeptnWorkloadVersion) GetEndTime() time.Time { + return w.Status.EndTime.Time +} + +func (w *KeptnWorkloadVersion) Complete() { + w.SetEndTime() +} + +func (w KeptnWorkloadVersion) GetActiveMetricsAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(w.Spec.AppName), + common.WorkloadName.String(w.Spec.WorkloadName), + common.WorkloadVersion.String(w.Spec.Version), + common.WorkloadNamespace.String(w.Namespace), + } +} + +func (w KeptnWorkloadVersion) GetMetricsAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(w.Spec.AppName), + common.WorkloadName.String(w.Spec.WorkloadName), + common.WorkloadVersion.String(w.Spec.Version), + common.WorkloadNamespace.String(w.Namespace), + common.WorkloadStatus.String(string(w.Status.Status)), + } +} + +func (w KeptnWorkloadVersion) GetDurationMetricsAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(w.Spec.AppName), + common.WorkloadName.String(w.Spec.WorkloadName), + common.WorkloadVersion.String(w.Spec.Version), + common.WorkloadPreviousVersion.String(w.Spec.PreviousVersion), + } +} + +func (w KeptnWorkloadVersion) GetState() common.KeptnState { + return w.Status.Status +} + +func (w KeptnWorkloadVersion) GetPreDeploymentTasks() []string { + return w.Spec.PreDeploymentTasks +} + +func (w KeptnWorkloadVersion) GetPostDeploymentTasks() []string { + return w.Spec.PostDeploymentTasks +} + +func (w KeptnWorkloadVersion) GetPreDeploymentTaskStatus() []ItemStatus { + return w.Status.PreDeploymentTaskStatus +} + +func (w KeptnWorkloadVersion) GetPostDeploymentTaskStatus() []ItemStatus { + return w.Status.PostDeploymentTaskStatus +} + +func (w KeptnWorkloadVersion) GetPreDeploymentEvaluations() []string { + return w.Spec.PreDeploymentEvaluations +} + +func (w KeptnWorkloadVersion) GetPostDeploymentEvaluations() []string { + return w.Spec.PostDeploymentEvaluations +} + +func (w KeptnWorkloadVersion) GetPreDeploymentEvaluationTaskStatus() []ItemStatus { + return w.Status.PreDeploymentEvaluationTaskStatus +} + +func (w KeptnWorkloadVersion) GetPostDeploymentEvaluationTaskStatus() []ItemStatus { + return w.Status.PostDeploymentEvaluationTaskStatus +} + +func (w KeptnWorkloadVersion) GetAppName() string { + return w.Spec.AppName +} + +func (w KeptnWorkloadVersion) GetPreviousVersion() string { + return w.Spec.PreviousVersion +} + +func (w KeptnWorkloadVersion) GetParentName() string { + return w.Spec.WorkloadName +} + +func (w KeptnWorkloadVersion) GetNamespace() string { + return w.Namespace +} + +func (w *KeptnWorkloadVersion) SetState(state common.KeptnState) { + w.Status.Status = state +} + +func (w KeptnWorkloadVersion) GetCurrentPhase() string { + return w.Status.CurrentPhase +} + +func (w *KeptnWorkloadVersion) SetCurrentPhase(phase string) { + w.Status.CurrentPhase = phase +} + +func (w KeptnWorkloadVersion) GetVersion() string { + return w.Spec.Version +} + +func (w KeptnWorkloadVersion) GenerateTask(taskDefinition KeptnTaskDefinition, checkType common.CheckType) KeptnTask { + return KeptnTask{ + ObjectMeta: metav1.ObjectMeta{ + Name: common.GenerateTaskName(checkType, taskDefinition.Name), + Namespace: w.Namespace, + Labels: taskDefinition.Labels, + Annotations: taskDefinition.Annotations, + }, + Spec: KeptnTaskSpec{ + Context: TaskContext{ + WorkloadName: w.GetParentName(), + AppName: w.GetAppName(), + WorkloadVersion: w.GetVersion(), + TaskType: string(checkType), + ObjectType: "Workload", + }, + TaskDefinition: taskDefinition.Name, + Parameters: TaskParameters{}, + SecureParameters: SecureParameters{}, + Type: checkType, + Retries: taskDefinition.Spec.Retries, + Timeout: taskDefinition.Spec.Timeout, + }, + } +} + +func (w KeptnWorkloadVersion) GenerateEvaluation(evaluationDefinition KeptnEvaluationDefinition, checkType common.CheckType) KeptnEvaluation { + return KeptnEvaluation{ + ObjectMeta: metav1.ObjectMeta{ + Name: common.GenerateEvaluationName(checkType, evaluationDefinition.Name), + Namespace: w.Namespace, + }, + Spec: KeptnEvaluationSpec{ + AppName: w.GetAppName(), + WorkloadVersion: w.GetVersion(), + Workload: w.GetParentName(), + EvaluationDefinition: evaluationDefinition.Name, + Type: checkType, + RetryInterval: metav1.Duration{ + Duration: 5 * time.Second, + }, + }, + } +} + +func (w KeptnWorkloadVersion) GetSpanAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ + common.AppName.String(w.Spec.AppName), + common.WorkloadName.String(w.Spec.WorkloadName), + common.WorkloadVersion.String(w.Spec.Version), + common.WorkloadNamespace.String(w.Namespace), + } +} + +func (w KeptnWorkloadVersion) GetSpanKey(phase string) string { + return fmt.Sprintf("%s.%s.%s.%s", w.Spec.TraceId["traceparent"], w.Spec.WorkloadName, w.Spec.Version, phase) +} + +func (w KeptnWorkloadVersion) GetSpanName(phase string) string { + if phase == "" { + return w.Name + } + return fmt.Sprintf("%s/%s", w.Spec.WorkloadName, phase) +} + +func (w KeptnWorkloadVersion) SetSpanAttributes(span trace.Span) { + span.SetAttributes(w.GetSpanAttributes()...) +} + +//nolint:dupl +func (w *KeptnWorkloadVersion) DeprecateRemainingPhases(phase common.KeptnPhaseType) { + // no need to deprecate anything when post-eval tasks fail + if phase == common.PhaseWorkloadPostEvaluation { + return + } + // deprecate post evaluation when post tasks failed + if phase == common.PhaseWorkloadPostDeployment { + w.Status.PostDeploymentEvaluationStatus = common.StateDeprecated + } + // deprecate post evaluation and tasks when app deployment failed + if phase == common.PhaseWorkloadDeployment { + w.Status.PostDeploymentStatus = common.StateDeprecated + w.Status.PostDeploymentEvaluationStatus = common.StateDeprecated + } + // deprecate app deployment, post tasks and evaluations if app pre-eval failed + if phase == common.PhaseWorkloadPreEvaluation { + w.Status.PostDeploymentStatus = common.StateDeprecated + w.Status.PostDeploymentEvaluationStatus = common.StateDeprecated + w.Status.DeploymentStatus = common.StateDeprecated + } + // deprecate pre evaluations, app deployment and post tasks and evaluations when pre-tasks failed + if phase == common.PhaseWorkloadPreDeployment { + w.Status.PostDeploymentStatus = common.StateDeprecated + w.Status.PostDeploymentEvaluationStatus = common.StateDeprecated + w.Status.DeploymentStatus = common.StateDeprecated + w.Status.PreDeploymentEvaluationStatus = common.StateDeprecated + } + // deprecate completely everything + if phase == common.PhaseDeprecated { + w.Status.PostDeploymentStatus = common.StateDeprecated + w.Status.PostDeploymentEvaluationStatus = common.StateDeprecated + w.Status.DeploymentStatus = common.StateDeprecated + w.Status.PreDeploymentEvaluationStatus = common.StateDeprecated + w.Status.PreDeploymentStatus = common.StateDeprecated + w.Status.Status = common.StateDeprecated + return + } + + w.Status.Status = common.StateFailed +} + +func (w *KeptnWorkloadVersion) SetPhaseTraceID(phase string, carrier propagation.MapCarrier) { + if w.Status.PhaseTraceIDs == nil { + w.Status.PhaseTraceIDs = common.PhaseTraceID{} + } + w.Status.PhaseTraceIDs[common.GetShortPhaseName(phase)] = carrier +} + +func (w KeptnWorkloadVersion) GetEventAnnotations() map[string]string { + return map[string]string{ + "appName": w.Spec.AppName, + "workloadName": w.Spec.WorkloadName, + "workloadVersion": w.Spec.Version, + "workloadVersionName": w.Name, + } +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/keptnworkloadversion_types_test.go b/lifecycle-operator/apis/lifecycle/v1beta1/keptnworkloadversion_types_test.go new file mode 100644 index 0000000000..4f72d801dd --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/keptnworkloadversion_types_test.go @@ -0,0 +1,447 @@ +package v1beta1 + +import ( + "testing" + "time" + + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/propagation" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func TestKeptnWorkloadVersion(t *testing.T) { + workload := &KeptnWorkloadVersion{ + ObjectMeta: metav1.ObjectMeta{ + Name: "workload", + Namespace: "namespace", + }, + Status: KeptnWorkloadVersionStatus{ + PreDeploymentStatus: common.StateFailed, + PreDeploymentEvaluationStatus: common.StateFailed, + PostDeploymentStatus: common.StateFailed, + PostDeploymentEvaluationStatus: common.StateFailed, + DeploymentStatus: common.StateFailed, + Status: common.StateFailed, + PreDeploymentTaskStatus: []ItemStatus{ + { + DefinitionName: "defname", + Status: common.StateFailed, + Name: "taskname", + }, + }, + PostDeploymentTaskStatus: []ItemStatus{ + { + DefinitionName: "defname2", + Status: common.StateFailed, + Name: "taskname2", + }, + }, + PreDeploymentEvaluationTaskStatus: []ItemStatus{ + { + DefinitionName: "defname3", + Status: common.StateFailed, + Name: "taskname3", + }, + }, + PostDeploymentEvaluationTaskStatus: []ItemStatus{ + { + DefinitionName: "defname4", + Status: common.StateFailed, + Name: "taskname4", + }, + }, + CurrentPhase: common.PhaseAppDeployment.ShortName, + }, + Spec: KeptnWorkloadVersionSpec{ + KeptnWorkloadSpec: KeptnWorkloadSpec{ + PreDeploymentTasks: []string{"task1", "task2"}, + PostDeploymentTasks: []string{"task3", "task4"}, + PreDeploymentEvaluations: []string{"task5", "task6"}, + PostDeploymentEvaluations: []string{"task7", "task8"}, + Version: "version", + AppName: "appname", + }, + PreviousVersion: "prev", + WorkloadName: "workloadname", + TraceId: map[string]string{"traceparent": "trace1"}, + }, + } + + require.True(t, workload.IsPreDeploymentCompleted()) + require.False(t, workload.IsPreDeploymentSucceeded()) + require.True(t, workload.IsPreDeploymentFailed()) + + require.True(t, workload.IsPreDeploymentEvaluationCompleted()) + require.False(t, workload.IsPreDeploymentEvaluationSucceeded()) + require.True(t, workload.IsPreDeploymentEvaluationFailed()) + + require.True(t, workload.IsPostDeploymentCompleted()) + require.False(t, workload.IsPostDeploymentSucceeded()) + require.True(t, workload.IsPostDeploymentFailed()) + + require.True(t, workload.IsPostDeploymentEvaluationCompleted()) + require.False(t, workload.IsPostDeploymentEvaluationSucceeded()) + require.True(t, workload.IsPostDeploymentEvaluationFailed()) + + require.True(t, workload.IsDeploymentCompleted()) + require.False(t, workload.IsDeploymentSucceeded()) + require.True(t, workload.IsDeploymentFailed()) + + require.False(t, workload.IsEndTimeSet()) + require.False(t, workload.IsStartTimeSet()) + + workload.SetStartTime() + workload.SetEndTime() + + require.True(t, workload.IsEndTimeSet()) + require.True(t, workload.IsStartTimeSet()) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("appname"), + common.WorkloadName.String("workloadname"), + common.WorkloadVersion.String("version"), + common.WorkloadNamespace.String("namespace"), + }, workload.GetActiveMetricsAttributes()) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("appname"), + common.WorkloadName.String("workloadname"), + common.WorkloadVersion.String("version"), + common.WorkloadNamespace.String("namespace"), + common.WorkloadStatus.String(string(common.StateFailed)), + }, workload.GetMetricsAttributes()) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("appname"), + common.WorkloadName.String("workloadname"), + common.WorkloadVersion.String("version"), + common.WorkloadPreviousVersion.String("prev"), + }, workload.GetDurationMetricsAttributes()) + + require.Equal(t, common.StateFailed, workload.GetState()) + + require.Equal(t, []string{"task1", "task2"}, workload.GetPreDeploymentTasks()) + require.Equal(t, []string{"task3", "task4"}, workload.GetPostDeploymentTasks()) + require.Equal(t, []string{"task5", "task6"}, workload.GetPreDeploymentEvaluations()) + require.Equal(t, []string{"task7", "task8"}, workload.GetPostDeploymentEvaluations()) + + require.Equal(t, []ItemStatus{ + { + DefinitionName: "defname", + Status: common.StateFailed, + Name: "taskname", + }, + }, workload.GetPreDeploymentTaskStatus()) + + require.Equal(t, []ItemStatus{ + { + DefinitionName: "defname2", + Status: common.StateFailed, + Name: "taskname2", + }, + }, workload.GetPostDeploymentTaskStatus()) + + require.Equal(t, []ItemStatus{ + { + DefinitionName: "defname3", + Status: common.StateFailed, + Name: "taskname3", + }, + }, workload.GetPreDeploymentEvaluationTaskStatus()) + + require.Equal(t, []ItemStatus{ + { + DefinitionName: "defname4", + Status: common.StateFailed, + Name: "taskname4", + }, + }, workload.GetPostDeploymentEvaluationTaskStatus()) + + require.Equal(t, "appname", workload.GetAppName()) + require.Equal(t, "prev", workload.GetPreviousVersion()) + require.Equal(t, "workloadname", workload.GetParentName()) + require.Equal(t, "namespace", workload.GetNamespace()) + + workload.SetState(common.StatePending) + require.Equal(t, common.StatePending, workload.GetState()) + + require.True(t, !workload.GetStartTime().IsZero()) + require.True(t, !workload.GetEndTime().IsZero()) + + workload.SetCurrentPhase(common.PhaseAppDeployment.LongName) + require.Equal(t, common.PhaseAppDeployment.LongName, workload.GetCurrentPhase()) + + workload.Status.EndTime = v1.Time{Time: time.Time{}} + workload.Complete() + require.True(t, !workload.GetEndTime().IsZero()) + + require.Equal(t, "version", workload.GetVersion()) + + require.Equal(t, "trace1.workloadname.version.phase", workload.GetSpanKey("phase")) + + retries := int32(5) + task := workload.GenerateTask(KeptnTaskDefinition{ + ObjectMeta: v1.ObjectMeta{ + Name: "task-def", + Labels: map[string]string{ + "label1": "label2", + }, + Annotations: map[string]string{ + "annotation1": "annotation2", + }, + }, + Spec: KeptnTaskDefinitionSpec{ + Timeout: v1.Duration{ + Duration: 5 * time.Second, + }, + Retries: &retries, + }, + }, common.PostDeploymentCheckType) + require.Equal(t, KeptnTaskSpec{ + Context: TaskContext{ + AppName: workload.GetAppName(), + WorkloadVersion: workload.GetVersion(), + WorkloadName: workload.GetParentName(), + TaskType: string(common.PostDeploymentCheckType), + ObjectType: "Workload", + }, + TaskDefinition: "task-def", + Parameters: TaskParameters{}, + SecureParameters: SecureParameters{}, + Type: common.PostDeploymentCheckType, + Timeout: v1.Duration{ + Duration: 5 * time.Second, + }, + Retries: &retries, + }, task.Spec) + + require.Equal(t, map[string]string{ + "label1": "label2", + }, task.Labels) + + require.Equal(t, map[string]string{ + "annotation1": "annotation2", + }, task.Annotations) + + evaluation := workload.GenerateEvaluation(KeptnEvaluationDefinition{ + ObjectMeta: v1.ObjectMeta{ + Name: "eval-def", + }, + }, common.PostDeploymentCheckType) + require.Equal(t, KeptnEvaluationSpec{ + AppName: workload.GetAppName(), + WorkloadVersion: workload.GetVersion(), + Workload: workload.GetParentName(), + EvaluationDefinition: "eval-def", + Type: common.PostDeploymentCheckType, + RetryInterval: metav1.Duration{ + Duration: 5 * time.Second, + }, + }, evaluation.Spec) + + require.Equal(t, "workload", workload.GetSpanName("")) + + require.Equal(t, "workloadname/phase", workload.GetSpanName("phase")) + + require.Equal(t, []attribute.KeyValue{ + common.AppName.String("appname"), + common.WorkloadName.String("workloadname"), + common.WorkloadVersion.String("version"), + common.WorkloadNamespace.String("namespace"), + }, workload.GetSpanAttributes()) + + require.Equal(t, map[string]string{ + "appName": "appname", + "workloadName": "workloadname", + "workloadVersion": "version", + "workloadVersionName": "workload", + }, workload.GetEventAnnotations()) +} + +//nolint:dupl +func TestKeptnWorkloadVersion_DeprecateRemainingPhases(t *testing.T) { + workloadVersion := KeptnWorkloadVersion{ + Status: KeptnWorkloadVersionStatus{ + PreDeploymentStatus: common.StatePending, + PreDeploymentEvaluationStatus: common.StatePending, + PostDeploymentStatus: common.StatePending, + PostDeploymentEvaluationStatus: common.StatePending, + DeploymentStatus: common.StatePending, + Status: common.StatePending, + }, + } + + tests := []struct { + workloadVersion KeptnWorkloadVersion + phase common.KeptnPhaseType + want KeptnWorkloadVersion + }{ + { + workloadVersion: workloadVersion, + phase: common.PhaseWorkloadPostEvaluation, + want: KeptnWorkloadVersion{ + Status: KeptnWorkloadVersionStatus{ + PreDeploymentStatus: common.StatePending, + PreDeploymentEvaluationStatus: common.StatePending, + PostDeploymentStatus: common.StatePending, + PostDeploymentEvaluationStatus: common.StatePending, + DeploymentStatus: common.StatePending, + Status: common.StatePending, + }, + }, + }, + { + workloadVersion: workloadVersion, + phase: common.PhaseWorkloadPostDeployment, + want: KeptnWorkloadVersion{ + Status: KeptnWorkloadVersionStatus{ + PreDeploymentStatus: common.StatePending, + PreDeploymentEvaluationStatus: common.StatePending, + PostDeploymentStatus: common.StatePending, + PostDeploymentEvaluationStatus: common.StateDeprecated, + DeploymentStatus: common.StatePending, + Status: common.StateFailed, + }, + }, + }, + { + workloadVersion: workloadVersion, + phase: common.PhaseWorkloadDeployment, + want: KeptnWorkloadVersion{ + Status: KeptnWorkloadVersionStatus{ + PreDeploymentStatus: common.StatePending, + PreDeploymentEvaluationStatus: common.StatePending, + PostDeploymentStatus: common.StateDeprecated, + PostDeploymentEvaluationStatus: common.StateDeprecated, + DeploymentStatus: common.StatePending, + Status: common.StateFailed, + }, + }, + }, + { + workloadVersion: workloadVersion, + phase: common.PhaseWorkloadPreEvaluation, + want: KeptnWorkloadVersion{ + Status: KeptnWorkloadVersionStatus{ + PreDeploymentStatus: common.StatePending, + PreDeploymentEvaluationStatus: common.StatePending, + PostDeploymentStatus: common.StateDeprecated, + PostDeploymentEvaluationStatus: common.StateDeprecated, + DeploymentStatus: common.StateDeprecated, + Status: common.StateFailed, + }, + }, + }, + { + workloadVersion: workloadVersion, + phase: common.PhaseWorkloadPreDeployment, + want: KeptnWorkloadVersion{ + Status: KeptnWorkloadVersionStatus{ + PreDeploymentStatus: common.StatePending, + PreDeploymentEvaluationStatus: common.StateDeprecated, + PostDeploymentStatus: common.StateDeprecated, + PostDeploymentEvaluationStatus: common.StateDeprecated, + DeploymentStatus: common.StateDeprecated, + Status: common.StateFailed, + }, + }, + }, + { + workloadVersion: workloadVersion, + phase: common.PhaseDeprecated, + want: KeptnWorkloadVersion{ + Status: KeptnWorkloadVersionStatus{ + PreDeploymentStatus: common.StateDeprecated, + PreDeploymentEvaluationStatus: common.StateDeprecated, + PostDeploymentStatus: common.StateDeprecated, + PostDeploymentEvaluationStatus: common.StateDeprecated, + DeploymentStatus: common.StateDeprecated, + Status: common.StateDeprecated, + }, + }, + }, + { + workloadVersion: workloadVersion, + phase: common.PhaseAppPreDeployment, + want: KeptnWorkloadVersion{ + Status: KeptnWorkloadVersionStatus{ + PreDeploymentStatus: common.StatePending, + PreDeploymentEvaluationStatus: common.StatePending, + PostDeploymentStatus: common.StatePending, + PostDeploymentEvaluationStatus: common.StatePending, + DeploymentStatus: common.StatePending, + Status: common.StateFailed, + }, + }, + }, + } + + for _, tt := range tests { + t.Run("", func(t *testing.T) { + tt.workloadVersion.DeprecateRemainingPhases(tt.phase) + require.Equal(t, tt.want, tt.workloadVersion) + }) + } +} + +func TestKeptnWorkloadVersion_SetPhaseTraceID(t *testing.T) { + app := KeptnWorkloadVersion{ + Status: KeptnWorkloadVersionStatus{}, + } + + app.SetPhaseTraceID(common.PhaseAppDeployment.ShortName, propagation.MapCarrier{ + "name3": "trace3", + }) + + require.Equal(t, KeptnWorkloadVersion{ + Status: KeptnWorkloadVersionStatus{ + PhaseTraceIDs: common.PhaseTraceID{ + common.PhaseAppDeployment.ShortName: propagation.MapCarrier{ + "name3": "trace3", + }, + }, + }, + }, app) + + app.SetPhaseTraceID(common.PhaseWorkloadDeployment.LongName, propagation.MapCarrier{ + "name2": "trace2", + }) + + require.Equal(t, KeptnWorkloadVersion{ + Status: KeptnWorkloadVersionStatus{ + PhaseTraceIDs: common.PhaseTraceID{ + common.PhaseAppDeployment.ShortName: propagation.MapCarrier{ + "name3": "trace3", + }, + common.PhaseWorkloadDeployment.ShortName: propagation.MapCarrier{ + "name2": "trace2", + }, + }, + }, + }, app) +} + +func TestKeptnWorkloadVersionList(t *testing.T) { + list := KeptnWorkloadVersionList{ + Items: []KeptnWorkloadVersion{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "obj1", + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "obj2", + }, + }, + }, + } + + got := list.GetItems() + require.Len(t, got, 2) + require.Equal(t, "obj1", got[0].GetName()) + require.Equal(t, "obj2", got[1].GetName()) +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/semconv/semconv.go b/lifecycle-operator/apis/lifecycle/v1beta1/semconv/semconv.go new file mode 100644 index 0000000000..8c3d352de2 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/semconv/semconv.go @@ -0,0 +1,12 @@ +package semconv + +import ( + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "go.opentelemetry.io/otel/trace" +) + +func AddAttributeFromAnnotations(s trace.Span, annotations map[string]string) { + s.SetAttributes(common.AppName.String(annotations[common.AppAnnotation])) + s.SetAttributes(common.WorkloadName.String(annotations[common.WorkloadAnnotation])) + s.SetAttributes(common.WorkloadVersion.String(annotations[common.VersionAnnotation])) +} diff --git a/lifecycle-operator/apis/lifecycle/v1beta1/zz_generated.deepcopy.go b/lifecycle-operator/apis/lifecycle/v1beta1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..d5802b22e4 --- /dev/null +++ b/lifecycle-operator/apis/lifecycle/v1beta1/zz_generated.deepcopy.go @@ -0,0 +1,1345 @@ +//go:build !ignore_autogenerated + +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1/common" + "go.opentelemetry.io/otel/propagation" + "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AutomountServiceAccountTokenSpec) DeepCopyInto(out *AutomountServiceAccountTokenSpec) { + *out = *in + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AutomountServiceAccountTokenSpec. +func (in *AutomountServiceAccountTokenSpec) DeepCopy() *AutomountServiceAccountTokenSpec { + if in == nil { + return nil + } + out := new(AutomountServiceAccountTokenSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConfigMapReference) DeepCopyInto(out *ConfigMapReference) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapReference. +func (in *ConfigMapReference) DeepCopy() *ConfigMapReference { + if in == nil { + return nil + } + out := new(ConfigMapReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerSpec) DeepCopyInto(out *ContainerSpec) { + *out = *in + if in.Container != nil { + in, out := &in.Container, &out.Container + *out = new(v1.Container) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerSpec. +func (in *ContainerSpec) DeepCopy() *ContainerSpec { + if in == nil { + return nil + } + out := new(ContainerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EvaluationStatusItem) DeepCopyInto(out *EvaluationStatusItem) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EvaluationStatusItem. +func (in *EvaluationStatusItem) DeepCopy() *EvaluationStatusItem { + if in == nil { + return nil + } + out := new(EvaluationStatusItem) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FunctionReference) DeepCopyInto(out *FunctionReference) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FunctionReference. +func (in *FunctionReference) DeepCopy() *FunctionReference { + if in == nil { + return nil + } + out := new(FunctionReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FunctionStatus) DeepCopyInto(out *FunctionStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FunctionStatus. +func (in *FunctionStatus) DeepCopy() *FunctionStatus { + if in == nil { + return nil + } + out := new(FunctionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HttpReference) DeepCopyInto(out *HttpReference) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HttpReference. +func (in *HttpReference) DeepCopy() *HttpReference { + if in == nil { + return nil + } + out := new(HttpReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Inline) DeepCopyInto(out *Inline) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Inline. +func (in *Inline) DeepCopy() *Inline { + if in == nil { + return nil + } + out := new(Inline) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ItemStatus) DeepCopyInto(out *ItemStatus) { + *out = *in + in.StartTime.DeepCopyInto(&out.StartTime) + in.EndTime.DeepCopyInto(&out.EndTime) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ItemStatus. +func (in *ItemStatus) DeepCopy() *ItemStatus { + if in == nil { + return nil + } + out := new(ItemStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnApp) DeepCopyInto(out *KeptnApp) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnApp. +func (in *KeptnApp) DeepCopy() *KeptnApp { + if in == nil { + return nil + } + out := new(KeptnApp) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnApp) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnAppCreationRequest) DeepCopyInto(out *KeptnAppCreationRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnAppCreationRequest. +func (in *KeptnAppCreationRequest) DeepCopy() *KeptnAppCreationRequest { + if in == nil { + return nil + } + out := new(KeptnAppCreationRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnAppCreationRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnAppCreationRequestList) DeepCopyInto(out *KeptnAppCreationRequestList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KeptnAppCreationRequest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnAppCreationRequestList. +func (in *KeptnAppCreationRequestList) DeepCopy() *KeptnAppCreationRequestList { + if in == nil { + return nil + } + out := new(KeptnAppCreationRequestList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnAppCreationRequestList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnAppCreationRequestSpec) DeepCopyInto(out *KeptnAppCreationRequestSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnAppCreationRequestSpec. +func (in *KeptnAppCreationRequestSpec) DeepCopy() *KeptnAppCreationRequestSpec { + if in == nil { + return nil + } + out := new(KeptnAppCreationRequestSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnAppList) DeepCopyInto(out *KeptnAppList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KeptnApp, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnAppList. +func (in *KeptnAppList) DeepCopy() *KeptnAppList { + if in == nil { + return nil + } + out := new(KeptnAppList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnAppList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnAppSpec) DeepCopyInto(out *KeptnAppSpec) { + *out = *in + if in.Workloads != nil { + in, out := &in.Workloads, &out.Workloads + *out = make([]KeptnWorkloadRef, len(*in)) + copy(*out, *in) + } + if in.PreDeploymentTasks != nil { + in, out := &in.PreDeploymentTasks, &out.PreDeploymentTasks + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PostDeploymentTasks != nil { + in, out := &in.PostDeploymentTasks, &out.PostDeploymentTasks + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PreDeploymentEvaluations != nil { + in, out := &in.PreDeploymentEvaluations, &out.PreDeploymentEvaluations + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PostDeploymentEvaluations != nil { + in, out := &in.PostDeploymentEvaluations, &out.PostDeploymentEvaluations + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnAppSpec. +func (in *KeptnAppSpec) DeepCopy() *KeptnAppSpec { + if in == nil { + return nil + } + out := new(KeptnAppSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnAppStatus) DeepCopyInto(out *KeptnAppStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnAppStatus. +func (in *KeptnAppStatus) DeepCopy() *KeptnAppStatus { + if in == nil { + return nil + } + out := new(KeptnAppStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnAppVersion) DeepCopyInto(out *KeptnAppVersion) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnAppVersion. +func (in *KeptnAppVersion) DeepCopy() *KeptnAppVersion { + if in == nil { + return nil + } + out := new(KeptnAppVersion) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnAppVersion) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnAppVersionList) DeepCopyInto(out *KeptnAppVersionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KeptnAppVersion, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnAppVersionList. +func (in *KeptnAppVersionList) DeepCopy() *KeptnAppVersionList { + if in == nil { + return nil + } + out := new(KeptnAppVersionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnAppVersionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnAppVersionSpec) DeepCopyInto(out *KeptnAppVersionSpec) { + *out = *in + in.KeptnAppSpec.DeepCopyInto(&out.KeptnAppSpec) + if in.TraceId != nil { + in, out := &in.TraceId, &out.TraceId + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnAppVersionSpec. +func (in *KeptnAppVersionSpec) DeepCopy() *KeptnAppVersionSpec { + if in == nil { + return nil + } + out := new(KeptnAppVersionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnAppVersionStatus) DeepCopyInto(out *KeptnAppVersionStatus) { + *out = *in + if in.WorkloadStatus != nil { + in, out := &in.WorkloadStatus, &out.WorkloadStatus + *out = make([]WorkloadStatus, len(*in)) + copy(*out, *in) + } + if in.PreDeploymentTaskStatus != nil { + in, out := &in.PreDeploymentTaskStatus, &out.PreDeploymentTaskStatus + *out = make([]ItemStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PostDeploymentTaskStatus != nil { + in, out := &in.PostDeploymentTaskStatus, &out.PostDeploymentTaskStatus + *out = make([]ItemStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PreDeploymentEvaluationTaskStatus != nil { + in, out := &in.PreDeploymentEvaluationTaskStatus, &out.PreDeploymentEvaluationTaskStatus + *out = make([]ItemStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PostDeploymentEvaluationTaskStatus != nil { + in, out := &in.PostDeploymentEvaluationTaskStatus, &out.PostDeploymentEvaluationTaskStatus + *out = make([]ItemStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PhaseTraceIDs != nil { + in, out := &in.PhaseTraceIDs, &out.PhaseTraceIDs + *out = make(common.PhaseTraceID, len(*in)) + for key, val := range *in { + var outVal map[string]string + if val == nil { + (*out)[key] = nil + } else { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = make(propagation.MapCarrier, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + (*out)[key] = outVal + } + } + in.StartTime.DeepCopyInto(&out.StartTime) + in.EndTime.DeepCopyInto(&out.EndTime) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnAppVersionStatus. +func (in *KeptnAppVersionStatus) DeepCopy() *KeptnAppVersionStatus { + if in == nil { + return nil + } + out := new(KeptnAppVersionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluation) DeepCopyInto(out *KeptnEvaluation) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluation. +func (in *KeptnEvaluation) DeepCopy() *KeptnEvaluation { + if in == nil { + return nil + } + out := new(KeptnEvaluation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnEvaluation) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluationDefinition) DeepCopyInto(out *KeptnEvaluationDefinition) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationDefinition. +func (in *KeptnEvaluationDefinition) DeepCopy() *KeptnEvaluationDefinition { + if in == nil { + return nil + } + out := new(KeptnEvaluationDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnEvaluationDefinition) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluationDefinitionList) DeepCopyInto(out *KeptnEvaluationDefinitionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KeptnEvaluationDefinition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationDefinitionList. +func (in *KeptnEvaluationDefinitionList) DeepCopy() *KeptnEvaluationDefinitionList { + if in == nil { + return nil + } + out := new(KeptnEvaluationDefinitionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnEvaluationDefinitionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluationDefinitionSpec) DeepCopyInto(out *KeptnEvaluationDefinitionSpec) { + *out = *in + if in.Objectives != nil { + in, out := &in.Objectives, &out.Objectives + *out = make([]Objective, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationDefinitionSpec. +func (in *KeptnEvaluationDefinitionSpec) DeepCopy() *KeptnEvaluationDefinitionSpec { + if in == nil { + return nil + } + out := new(KeptnEvaluationDefinitionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluationList) DeepCopyInto(out *KeptnEvaluationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KeptnEvaluation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationList. +func (in *KeptnEvaluationList) DeepCopy() *KeptnEvaluationList { + if in == nil { + return nil + } + out := new(KeptnEvaluationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnEvaluationList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluationSpec) DeepCopyInto(out *KeptnEvaluationSpec) { + *out = *in + out.RetryInterval = in.RetryInterval +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationSpec. +func (in *KeptnEvaluationSpec) DeepCopy() *KeptnEvaluationSpec { + if in == nil { + return nil + } + out := new(KeptnEvaluationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnEvaluationStatus) DeepCopyInto(out *KeptnEvaluationStatus) { + *out = *in + if in.EvaluationStatus != nil { + in, out := &in.EvaluationStatus, &out.EvaluationStatus + *out = make(map[string]EvaluationStatusItem, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + in.StartTime.DeepCopyInto(&out.StartTime) + in.EndTime.DeepCopyInto(&out.EndTime) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnEvaluationStatus. +func (in *KeptnEvaluationStatus) DeepCopy() *KeptnEvaluationStatus { + if in == nil { + return nil + } + out := new(KeptnEvaluationStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnMetricReference) DeepCopyInto(out *KeptnMetricReference) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnMetricReference. +func (in *KeptnMetricReference) DeepCopy() *KeptnMetricReference { + if in == nil { + return nil + } + out := new(KeptnMetricReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnTask) DeepCopyInto(out *KeptnTask) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnTask. +func (in *KeptnTask) DeepCopy() *KeptnTask { + if in == nil { + return nil + } + out := new(KeptnTask) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnTask) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnTaskDefinition) DeepCopyInto(out *KeptnTaskDefinition) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnTaskDefinition. +func (in *KeptnTaskDefinition) DeepCopy() *KeptnTaskDefinition { + if in == nil { + return nil + } + out := new(KeptnTaskDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnTaskDefinition) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnTaskDefinitionList) DeepCopyInto(out *KeptnTaskDefinitionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KeptnTaskDefinition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnTaskDefinitionList. +func (in *KeptnTaskDefinitionList) DeepCopy() *KeptnTaskDefinitionList { + if in == nil { + return nil + } + out := new(KeptnTaskDefinitionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnTaskDefinitionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnTaskDefinitionSpec) DeepCopyInto(out *KeptnTaskDefinitionSpec) { + *out = *in + if in.Function != nil { + in, out := &in.Function, &out.Function + *out = new(RuntimeSpec) + (*in).DeepCopyInto(*out) + } + if in.Python != nil { + in, out := &in.Python, &out.Python + *out = new(RuntimeSpec) + (*in).DeepCopyInto(*out) + } + if in.Deno != nil { + in, out := &in.Deno, &out.Deno + *out = new(RuntimeSpec) + (*in).DeepCopyInto(*out) + } + if in.Container != nil { + in, out := &in.Container, &out.Container + *out = new(ContainerSpec) + (*in).DeepCopyInto(*out) + } + if in.Retries != nil { + in, out := &in.Retries, &out.Retries + *out = new(int32) + **out = **in + } + out.Timeout = in.Timeout + if in.ServiceAccount != nil { + in, out := &in.ServiceAccount, &out.ServiceAccount + *out = new(ServiceAccountSpec) + **out = **in + } + if in.AutomountServiceAccountToken != nil { + in, out := &in.AutomountServiceAccountToken, &out.AutomountServiceAccountToken + *out = new(AutomountServiceAccountTokenSpec) + (*in).DeepCopyInto(*out) + } + if in.TTLSecondsAfterFinished != nil { + in, out := &in.TTLSecondsAfterFinished, &out.TTLSecondsAfterFinished + *out = new(int32) + **out = **in + } + if in.ImagePullSecrets != nil { + in, out := &in.ImagePullSecrets, &out.ImagePullSecrets + *out = make([]v1.LocalObjectReference, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnTaskDefinitionSpec. +func (in *KeptnTaskDefinitionSpec) DeepCopy() *KeptnTaskDefinitionSpec { + if in == nil { + return nil + } + out := new(KeptnTaskDefinitionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnTaskDefinitionStatus) DeepCopyInto(out *KeptnTaskDefinitionStatus) { + *out = *in + out.Function = in.Function +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnTaskDefinitionStatus. +func (in *KeptnTaskDefinitionStatus) DeepCopy() *KeptnTaskDefinitionStatus { + if in == nil { + return nil + } + out := new(KeptnTaskDefinitionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnTaskList) DeepCopyInto(out *KeptnTaskList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KeptnTask, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnTaskList. +func (in *KeptnTaskList) DeepCopy() *KeptnTaskList { + if in == nil { + return nil + } + out := new(KeptnTaskList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnTaskList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnTaskSpec) DeepCopyInto(out *KeptnTaskSpec) { + *out = *in + out.Context = in.Context + in.Parameters.DeepCopyInto(&out.Parameters) + out.SecureParameters = in.SecureParameters + if in.Retries != nil { + in, out := &in.Retries, &out.Retries + *out = new(int32) + **out = **in + } + out.Timeout = in.Timeout +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnTaskSpec. +func (in *KeptnTaskSpec) DeepCopy() *KeptnTaskSpec { + if in == nil { + return nil + } + out := new(KeptnTaskSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnTaskStatus) DeepCopyInto(out *KeptnTaskStatus) { + *out = *in + in.StartTime.DeepCopyInto(&out.StartTime) + in.EndTime.DeepCopyInto(&out.EndTime) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnTaskStatus. +func (in *KeptnTaskStatus) DeepCopy() *KeptnTaskStatus { + if in == nil { + return nil + } + out := new(KeptnTaskStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnWorkload) DeepCopyInto(out *KeptnWorkload) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnWorkload. +func (in *KeptnWorkload) DeepCopy() *KeptnWorkload { + if in == nil { + return nil + } + out := new(KeptnWorkload) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnWorkload) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnWorkloadList) DeepCopyInto(out *KeptnWorkloadList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KeptnWorkload, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnWorkloadList. +func (in *KeptnWorkloadList) DeepCopy() *KeptnWorkloadList { + if in == nil { + return nil + } + out := new(KeptnWorkloadList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnWorkloadList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnWorkloadRef) DeepCopyInto(out *KeptnWorkloadRef) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnWorkloadRef. +func (in *KeptnWorkloadRef) DeepCopy() *KeptnWorkloadRef { + if in == nil { + return nil + } + out := new(KeptnWorkloadRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnWorkloadSpec) DeepCopyInto(out *KeptnWorkloadSpec) { + *out = *in + if in.PreDeploymentTasks != nil { + in, out := &in.PreDeploymentTasks, &out.PreDeploymentTasks + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PostDeploymentTasks != nil { + in, out := &in.PostDeploymentTasks, &out.PostDeploymentTasks + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PreDeploymentEvaluations != nil { + in, out := &in.PreDeploymentEvaluations, &out.PreDeploymentEvaluations + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PostDeploymentEvaluations != nil { + in, out := &in.PostDeploymentEvaluations, &out.PostDeploymentEvaluations + *out = make([]string, len(*in)) + copy(*out, *in) + } + out.ResourceReference = in.ResourceReference +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnWorkloadSpec. +func (in *KeptnWorkloadSpec) DeepCopy() *KeptnWorkloadSpec { + if in == nil { + return nil + } + out := new(KeptnWorkloadSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnWorkloadStatus) DeepCopyInto(out *KeptnWorkloadStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnWorkloadStatus. +func (in *KeptnWorkloadStatus) DeepCopy() *KeptnWorkloadStatus { + if in == nil { + return nil + } + out := new(KeptnWorkloadStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnWorkloadVersion) DeepCopyInto(out *KeptnWorkloadVersion) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnWorkloadVersion. +func (in *KeptnWorkloadVersion) DeepCopy() *KeptnWorkloadVersion { + if in == nil { + return nil + } + out := new(KeptnWorkloadVersion) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnWorkloadVersion) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnWorkloadVersionList) DeepCopyInto(out *KeptnWorkloadVersionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KeptnWorkloadVersion, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnWorkloadVersionList. +func (in *KeptnWorkloadVersionList) DeepCopy() *KeptnWorkloadVersionList { + if in == nil { + return nil + } + out := new(KeptnWorkloadVersionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KeptnWorkloadVersionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnWorkloadVersionSpec) DeepCopyInto(out *KeptnWorkloadVersionSpec) { + *out = *in + in.KeptnWorkloadSpec.DeepCopyInto(&out.KeptnWorkloadSpec) + if in.TraceId != nil { + in, out := &in.TraceId, &out.TraceId + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnWorkloadVersionSpec. +func (in *KeptnWorkloadVersionSpec) DeepCopy() *KeptnWorkloadVersionSpec { + if in == nil { + return nil + } + out := new(KeptnWorkloadVersionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeptnWorkloadVersionStatus) DeepCopyInto(out *KeptnWorkloadVersionStatus) { + *out = *in + if in.PreDeploymentTaskStatus != nil { + in, out := &in.PreDeploymentTaskStatus, &out.PreDeploymentTaskStatus + *out = make([]ItemStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PostDeploymentTaskStatus != nil { + in, out := &in.PostDeploymentTaskStatus, &out.PostDeploymentTaskStatus + *out = make([]ItemStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PreDeploymentEvaluationTaskStatus != nil { + in, out := &in.PreDeploymentEvaluationTaskStatus, &out.PreDeploymentEvaluationTaskStatus + *out = make([]ItemStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PostDeploymentEvaluationTaskStatus != nil { + in, out := &in.PostDeploymentEvaluationTaskStatus, &out.PostDeploymentEvaluationTaskStatus + *out = make([]ItemStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.StartTime.DeepCopyInto(&out.StartTime) + in.EndTime.DeepCopyInto(&out.EndTime) + if in.PhaseTraceIDs != nil { + in, out := &in.PhaseTraceIDs, &out.PhaseTraceIDs + *out = make(common.PhaseTraceID, len(*in)) + for key, val := range *in { + var outVal map[string]string + if val == nil { + (*out)[key] = nil + } else { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = make(propagation.MapCarrier, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + (*out)[key] = outVal + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeptnWorkloadVersionStatus. +func (in *KeptnWorkloadVersionStatus) DeepCopy() *KeptnWorkloadVersionStatus { + if in == nil { + return nil + } + out := new(KeptnWorkloadVersionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Objective) DeepCopyInto(out *Objective) { + *out = *in + out.KeptnMetricRef = in.KeptnMetricRef +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Objective. +func (in *Objective) DeepCopy() *Objective { + if in == nil { + return nil + } + out := new(Objective) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceReference) DeepCopyInto(out *ResourceReference) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceReference. +func (in *ResourceReference) DeepCopy() *ResourceReference { + if in == nil { + return nil + } + out := new(ResourceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RuntimeSpec) DeepCopyInto(out *RuntimeSpec) { + *out = *in + out.FunctionReference = in.FunctionReference + out.Inline = in.Inline + out.HttpReference = in.HttpReference + out.ConfigMapReference = in.ConfigMapReference + in.Parameters.DeepCopyInto(&out.Parameters) + out.SecureParameters = in.SecureParameters +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuntimeSpec. +func (in *RuntimeSpec) DeepCopy() *RuntimeSpec { + if in == nil { + return nil + } + out := new(RuntimeSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecureParameters) DeepCopyInto(out *SecureParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecureParameters. +func (in *SecureParameters) DeepCopy() *SecureParameters { + if in == nil { + return nil + } + out := new(SecureParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceAccountSpec) DeepCopyInto(out *ServiceAccountSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceAccountSpec. +func (in *ServiceAccountSpec) DeepCopy() *ServiceAccountSpec { + if in == nil { + return nil + } + out := new(ServiceAccountSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskContext) DeepCopyInto(out *TaskContext) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskContext. +func (in *TaskContext) DeepCopy() *TaskContext { + if in == nil { + return nil + } + out := new(TaskContext) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskParameters) DeepCopyInto(out *TaskParameters) { + *out = *in + if in.Inline != nil { + in, out := &in.Inline, &out.Inline + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskParameters. +func (in *TaskParameters) DeepCopy() *TaskParameters { + if in == nil { + return nil + } + out := new(TaskParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadStatus) DeepCopyInto(out *WorkloadStatus) { + *out = *in + out.Workload = in.Workload +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadStatus. +func (in *WorkloadStatus) DeepCopy() *WorkloadStatus { + if in == nil { + return nil + } + out := new(WorkloadStatus) + in.DeepCopyInto(out) + return out +} diff --git a/lifecycle-operator/chart/templates/keptnapp-crd.yaml b/lifecycle-operator/chart/templates/keptnapp-crd.yaml index 2667cad9e6..90dafb2113 100644 --- a/lifecycle-operator/chart/templates/keptnapp-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnapp-crd.yaml @@ -256,5 +256,102 @@ spec: type: object served: true storage: true + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnApp is the Schema for the keptnapps API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnApp. + properties: + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + revision: + default: 1 + description: Revision can be modified to trigger another deployment + of a KeptnApp of the same version. This can be used for restarting + a KeptnApp which failed to deploy, e.g. due to a failed preDeploymentEvaluation/preDeploymentTask. + type: integer + version: + description: Version defines the version of the application. For automatically + created KeptnApps, the version is a function of all KeptnWorkloads + that are part of the KeptnApp. + type: string + workloads: + description: Workloads is a list of all KeptnWorkloads that are part + of the KeptnApp. + items: + description: KeptnWorkloadRef refers to a KeptnWorkload that is + part of a KeptnApp + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: array + required: + - version + type: object + status: + description: Status describes the current state of the KeptnApp. + properties: + currentVersion: + description: CurrentVersion indicates the version that is currently + deployed or being reconciled. + type: string + type: object + type: object + served: true + storage: false subresources: status: {} \ No newline at end of file diff --git a/lifecycle-operator/chart/templates/keptnappcreationrequest-crd.yaml b/lifecycle-operator/chart/templates/keptnappcreationrequest-crd.yaml index 607eb65dcc..77d411b33d 100644 --- a/lifecycle-operator/chart/templates/keptnappcreationrequest-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnappcreationrequest-crd.yaml @@ -54,5 +54,41 @@ spec: type: object served: true storage: true + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnAppCreationRequest is the Schema for the keptnappcreationrequests + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnAppCreationRequest. + properties: + appName: + description: AppName is the name of the KeptnApp the KeptnAppCreationRequest + should create if no user-defined object with that name is found. + type: string + required: + - appName + type: object + status: + description: Status describes the current state of the KeptnAppCreationRequest. + type: string + type: object + served: true + storage: false subresources: status: {} \ No newline at end of file diff --git a/lifecycle-operator/chart/templates/keptnappversion-crd.yaml b/lifecycle-operator/chart/templates/keptnappversion-crd.yaml index ca08c0c893..682fe4c75f 100644 --- a/lifecycle-operator/chart/templates/keptnappversion-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnappversion-crd.yaml @@ -810,5 +810,322 @@ spec: type: object served: true storage: true + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.appName + name: AppName + type: string + - jsonPath: .spec.version + name: Version + type: string + - jsonPath: .status.currentPhase + name: Phase + type: string + - jsonPath: .status.preDeploymentStatus + name: PreDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.preDeploymentEvaluationStatus + name: PreDeploymentEvaluationStatus + priority: 1 + type: string + - jsonPath: .status.workloadOverallStatus + name: WorkloadOverallStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentStatus + name: PostDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentEvaluationStatus + name: PostDeploymentEvaluationStatus + priority: 1 + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnAppVersion is the Schema for the keptnappversions API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnAppVersion. + properties: + appName: + description: AppName is the name of the KeptnApp. + type: string + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + previousVersion: + description: PreviousVersion is the version of the KeptnApp that has + been deployed prior to this version. + type: string + revision: + default: 1 + description: Revision can be modified to trigger another deployment + of a KeptnApp of the same version. This can be used for restarting + a KeptnApp which failed to deploy, e.g. due to a failed preDeploymentEvaluation/preDeploymentTask. + type: integer + traceId: + additionalProperties: + type: string + description: TraceId contains the OpenTelemetry trace ID. + type: object + version: + description: Version defines the version of the application. For automatically + created KeptnApps, the version is a function of all KeptnWorkloads + that are part of the KeptnApp. + type: string + workloads: + description: Workloads is a list of all KeptnWorkloads that are part + of the KeptnApp. + items: + description: KeptnWorkloadRef refers to a KeptnWorkload that is + part of a KeptnApp + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: array + required: + - appName + - version + type: object + status: + description: Status describes the current state of the KeptnAppVersion. + properties: + currentPhase: + description: CurrentPhase indicates the current phase of the KeptnAppVersion. + type: string + endTime: + description: EndTime represents the time at which the deployment of + the KeptnAppVersion finished. + format: date-time + type: string + phaseTraceIDs: + additionalProperties: + additionalProperties: + type: string + description: MapCarrier is a TextMapCarrier that uses a map held + in memory as a storage medium for propagated key-value pairs. + type: object + description: PhaseTraceIDs contains the trace IDs of the OpenTelemetry + spans of each phase of the KeptnAppVersion. + type: object + postDeploymentEvaluationStatus: + default: Pending + description: PostDeploymentEvaluationStatus indicates the current + status of the KeptnAppVersion's PostDeploymentEvaluation phase. + type: string + postDeploymentEvaluationTaskStatus: + description: PostDeploymentEvaluationTaskStatus indicates the current + state of each postDeploymentEvaluation of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + postDeploymentStatus: + default: Pending + description: PostDeploymentStatus indicates the current status of + the KeptnAppVersion's PostDeployment phase. + type: string + postDeploymentTaskStatus: + description: PostDeploymentTaskStatus indicates the current state + of each postDeploymentTask of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + preDeploymentEvaluationStatus: + default: Pending + description: PreDeploymentEvaluationStatus indicates the current status + of the KeptnAppVersion's PreDeploymentEvaluation phase. + type: string + preDeploymentEvaluationTaskStatus: + description: PreDeploymentEvaluationTaskStatus indicates the current + state of each preDeploymentEvaluation of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + preDeploymentStatus: + default: Pending + description: PreDeploymentStatus indicates the current status of the + KeptnAppVersion's PreDeployment phase. + type: string + preDeploymentTaskStatus: + description: PreDeploymentTaskStatus indicates the current state of + each preDeploymentTask of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + startTime: + description: StartTime represents the time at which the deployment + of the KeptnAppVersion started. + format: date-time + type: string + status: + default: Pending + description: Status represents the overall status of the KeptnAppVersion. + type: string + workloadOverallStatus: + default: Pending + description: WorkloadOverallStatus indicates the current status of + the KeptnAppVersion's Workload deployment phase. + type: string + workloadStatus: + description: WorkloadStatus contains the current status of each KeptnWorkload + that is part of the KeptnAppVersion. + items: + properties: + status: + default: Pending + description: Status indicates the current status of the KeptnWorkload. + type: string + workload: + description: Workload refers to a KeptnWorkload that is part + of the KeptnAppVersion. + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: object + type: array + type: object + type: object + served: true + storage: false subresources: status: {} \ No newline at end of file diff --git a/lifecycle-operator/chart/templates/keptnevaluation-crd.yaml b/lifecycle-operator/chart/templates/keptnevaluation-crd.yaml index e61574f4f6..b2c76a47f9 100644 --- a/lifecycle-operator/chart/templates/keptnevaluation-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnevaluation-crd.yaml @@ -376,5 +376,149 @@ spec: type: object served: true storage: true + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.appName + name: AppName + type: string + - jsonPath: .spec.appVersion + name: AppVersion + type: string + - jsonPath: .spec.workload + name: WorkloadName + type: string + - jsonPath: .spec.workloadVersion + name: WorkloadVersion + type: string + - jsonPath: .status.retryCount + name: RetryCount + type: string + - jsonPath: .status.evaluationStatus + name: EvaluationStatus + type: string + - jsonPath: .status.overallStatus + name: OverallStatus + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnEvaluation is the Schema for the keptnevaluations API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnEvaluation. + properties: + appName: + description: AppName defines the KeptnApp for which the KeptnEvaluation + is done. + type: string + appVersion: + description: AppVersion defines the version of the KeptnApp for which + the KeptnEvaluation is done. + type: string + checkType: + description: Type indicates whether the KeptnEvaluation is part of + the pre- or postDeployment phase. + type: string + evaluationDefinition: + description: EvaluationDefinition refers to the name of the KeptnEvaluationDefinition + which includes the objectives for the KeptnEvaluation. The KeptnEvaluationDefinition + can be located in the same namespace as the KeptnEvaluation, or + in the Keptn namespace. + type: string + failAction: + type: string + retries: + default: 10 + description: Retries indicates how many times the KeptnEvaluation + can be attempted in the case of an error or missed evaluation objective, + before considering the KeptnEvaluation to be failed. + type: integer + retryInterval: + default: 5s + description: RetryInterval specifies the interval at which the KeptnEvaluation + is retried in the case of an error or a missed objective. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + workload: + description: Workload defines the KeptnWorkload for which the KeptnEvaluation + is done. + type: string + workloadVersion: + description: WorkloadVersion defines the version of the KeptnWorkload + for which the KeptnEvaluation is done. + type: string + required: + - evaluationDefinition + - workloadVersion + type: object + status: + description: Status describes the current state of the KeptnEvaluation. + properties: + endTime: + description: EndTime represents the time at which the KeptnEvaluation + finished. + format: date-time + type: string + evaluationStatus: + additionalProperties: + properties: + message: + description: Message contains additional information about the + evaluation of an objective. This can include explanations + about why an evaluation has failed (e.g. due to a missed objective), + or if there was any error during the evaluation of the objective. + type: string + status: + description: Status indicates the status of the objective being + evaluated. + type: string + value: + description: Value represents the value of the KeptnMetric being + evaluated. + type: string + required: + - status + - value + type: object + description: EvaluationStatus describes the status of each objective + of the KeptnEvaluationDefinition referenced by the KeptnEvaluation. + type: object + overallStatus: + default: Pending + description: OverallStatus describes the overall status of the KeptnEvaluation. + The Overall status is derived from the status of the individual + objectives of the KeptnEvaluationDefinition referenced by the KeptnEvaluation. + type: string + retryCount: + default: 0 + description: RetryCount indicates how many times the KeptnEvaluation + has been attempted already. + type: integer + startTime: + description: StartTime represents the time at which the KeptnEvaluation + started. + format: date-time + type: string + required: + - evaluationStatus + - overallStatus + - retryCount + type: object + type: object + served: true + storage: false subresources: status: {} \ No newline at end of file diff --git a/lifecycle-operator/chart/templates/keptnevaluationdefinition-crd.yaml b/lifecycle-operator/chart/templates/keptnevaluationdefinition-crd.yaml index 6cdd53af53..7a73f68516 100644 --- a/lifecycle-operator/chart/templates/keptnevaluationdefinition-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnevaluationdefinition-crd.yaml @@ -184,5 +184,67 @@ spec: type: object served: true storage: true + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnEvaluationDefinition is the Schema for the keptnevaluationdefinitions + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnEvaluationDefinition. + properties: + objectives: + description: Objectives is a list of objectives that have to be met + for a KeptnEvaluation referencing this KeptnEvaluationDefinition + to be successful. + items: + properties: + evaluationTarget: + description: EvaluationTarget specifies the target value for + the references KeptnMetric. Needs to start with either '<' + or '>', followed by the target value (e.g. '<10'). + type: string + keptnMetricRef: + description: KeptnMetricRef references the KeptnMetric that + should be evaluated. + properties: + name: + description: Name is the name of the referenced KeptnMetric. + type: string + namespace: + description: Namespace is the namespace where the referenced + KeptnMetric is located. + type: string + required: + - name + type: object + required: + - evaluationTarget + - keptnMetricRef + type: object + type: array + required: + - objectives + type: object + status: + description: unused field + type: string + type: object + served: true + storage: false subresources: status: {} \ No newline at end of file diff --git a/lifecycle-operator/chart/templates/keptntask-crd.yaml b/lifecycle-operator/chart/templates/keptntask-crd.yaml index f8d32a92ec..58f15b6f19 100644 --- a/lifecycle-operator/chart/templates/keptntask-crd.yaml +++ b/lifecycle-operator/chart/templates/keptntask-crd.yaml @@ -404,5 +404,160 @@ spec: type: object served: true storage: true + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.appVersion + name: AppVersion + type: string + - jsonPath: .spec.workload + name: WorkloadName + type: string + - jsonPath: .spec.workloadVersion + name: WorkloadVersion + type: string + - jsonPath: .status.jobName + name: Job Name + type: string + - jsonPath: .status.status + name: Status + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnTask is the Schema for the keptntasks API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnTask. + properties: + checkType: + description: Type indicates whether the KeptnTask is part of the pre- + or postDeployment phase. + type: string + context: + description: Context contains contextual information about the task + execution. + properties: + appName: + description: AppName the name of the KeptnApp the KeptnTask is + being executed for. + type: string + appVersion: + description: AppVersion the version of the KeptnApp the KeptnTask + is being executed for. + type: string + objectType: + description: ObjectType indicates whether the KeptnTask is being + executed for a KeptnApp or KeptnWorkload. + type: string + taskType: + description: TaskType indicates whether the KeptnTask is part + of the pre- or postDeployment phase. + type: string + workloadName: + description: WorkloadName the name of the KeptnWorkload the KeptnTask + is being executed for. + type: string + workloadVersion: + description: WorkloadVersion the version of the KeptnWorkload + the KeptnTask is being executed for. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed to + the job that executes the task. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's content + will be a json encoded string containing all properties of the + map provided. + type: object + type: object + retries: + default: 10 + description: Retries indicates how many times the KeptnTask can be + attempted in the case of an error before considering the KeptnTask + to be failed. + format: int32 + type: integer + secureParameters: + description: SecureParameters contains secure parameters that will + be passed to the job that executes the task. These will be stored + and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key of the + referenced secret. + type: string + type: object + taskDefinition: + description: TaskDefinition refers to the name of the KeptnTaskDefinition + which includes the specification for the task to be performed. The + KeptnTaskDefinition can be located in the same namespace as the + KeptnTask, or in the Keptn namespace. + type: string + timeout: + default: 5m + description: Timeout specifies the maximum time to wait for the task + to be completed successfully. If the task does not complete successfully + within this time frame, it will be considered to be failed. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + required: + - taskDefinition + type: object + status: + description: Status describes the current state of the KeptnTask. + properties: + endTime: + description: EndTime represents the time at which the KeptnTask finished. + format: date-time + type: string + jobName: + description: JobName is the name of the Job executing the Task. + type: string + message: + description: Message contains information about unexpected errors + encountered during the execution of the KeptnTask. + type: string + reason: + description: Reason contains more information about the reason for + the last transition of the Job executing the KeptnTask. + type: string + startTime: + description: StartTime represents the time at which the KeptnTask + started. + format: date-time + type: string + status: + default: Pending + description: Status represents the overall state of the KeptnTask. + type: string + type: object + type: object + served: true + storage: false subresources: status: {} \ No newline at end of file diff --git a/lifecycle-operator/chart/templates/keptntaskdefinition-crd.yaml b/lifecycle-operator/chart/templates/keptntaskdefinition-crd.yaml index 97601c0d9c..71d892e7ee 100644 --- a/lifecycle-operator/chart/templates/keptntaskdefinition-crd.yaml +++ b/lifecycle-operator/chart/templates/keptntaskdefinition-crd.yaml @@ -1753,3 +1753,1582 @@ spec: storage: true subresources: status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnTaskDefinition. + properties: + automountServiceAccountToken: + description: automountServiceAccountToken allows to enable K8s to + assign cluster API credentials to a pod, if set to false the pod + will decline the serviceAccount + properties: + type: + type: boolean + required: + - type + type: object + container: + description: Container contains the definition for the container that + is to be used in Job based on the KeptnTaskDefinitions. + properties: + args: + description: 'Arguments to the entrypoint. The container image''s + CMD is used if this is not provided. Variable references $(VAR_NAME) + are expanded using the container''s environment. If a variable + cannot be resolved, the reference in the input string will be + unchanged. Double $$ are reduced to a single $, which allows + for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references + will never be expanded, regardless of whether the variable exists + or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + command: + description: 'Entrypoint array. Not executed within a shell. The + container image''s ENTRYPOINT is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container''s + environment. If a variable cannot be resolved, the reference + in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: + i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether + the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + env: + description: List of environment variables to set in the container. + Cannot be updated. + items: + description: EnvVar represents an environment variable present + in a Container. + properties: + name: + description: Name of the environment variable. Must be a + C_IDENTIFIER. + type: string + value: + description: 'Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in + the container and any service environment variables. If + a variable cannot be resolved, the reference in the input + string will be unchanged. Double $$ are reduced to a single + $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless + of whether the variable exists or not. Defaults to "".' + type: string + valueFrom: + description: Source for the environment variable's value. + Cannot be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the ConfigMap or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: 'Selects a field of the pod: supports metadata.name, + metadata.namespace, `metadata.labels['''']`, + `metadata.annotations['''']`, spec.nodeName, + spec.serviceAccountName, status.hostIP, status.podIP, + status.podIPs.' + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the + specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: 'Selects a resource of the container: only + resources limits and requests (limits.cpu, limits.memory, + limits.ephemeral-storage, requests.cpu, requests.memory + and requests.ephemeral-storage) are currently supported.' + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the + exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + description: List of sources to populate environment variables + in the container. The keys defined within a source must be a + C_IDENTIFIER. All invalid keys will be reported as an event + when the container is starting. When a key exists in multiple + sources, the value associated with the last source will take + precedence. Values defined by an Env with a duplicate key will + take precedence. Cannot be updated. + items: + description: EnvFromSource represents the source of a set of + ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend to each key + in the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the Secret must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + description: 'Container image name. More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config management + to default or override container images in workload controllers + like Deployments and StatefulSets.' + type: string + imagePullPolicy: + description: 'Image pull policy. One of Always, Never, IfNotPresent. + Defaults to Always if :latest tag is specified, or IfNotPresent + otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images' + type: string + lifecycle: + description: Actions that the management system should take in + response to container lifecycle events. Cannot be updated. + properties: + postStart: + description: 'PostStart is called immediately after a container + is created. If the handler fails, the container is terminated + and restarted according to its restart policy. Other management + of the container blocks until the hook completes. More info: + https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute + inside the container, the working directory for + the command is root ('/') in the container's filesystem. + The command is simply exec'd, it is not run inside + a shell, so traditional shell instructions ('|', + etc) won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is treated + as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to + the pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: The header field name. This will + be canonicalized upon output, so case-variant + names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported as + a LifecycleHandler and kept for the backward compatibility. + There are no validation of this field and lifecycle + hooks will fail in runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + description: 'PreStop is called immediately before a container + is terminated due to an API request or management event + such as liveness/startup probe failure, preemption, resource + contention, etc. The handler is not called if the container + crashes or exits. The Pod''s termination grace period countdown + begins before the PreStop hook is executed. Regardless of + the outcome of the handler, the container will eventually + terminate within the Pod''s termination grace period (unless + delayed by finalizers). Other management of the container + blocks until the hook completes or until the termination + grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute + inside the container, the working directory for + the command is root ('/') in the container's filesystem. + The command is simply exec'd, it is not run inside + a shell, so traditional shell instructions ('|', + etc) won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is treated + as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to + the pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: The header field name. This will + be canonicalized upon output, so case-variant + names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported as + a LifecycleHandler and kept for the backward compatibility. + There are no validation of this field and lifecycle + hooks will fail in runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + description: 'Periodic probe of container liveness. Container + will be restarted if the probe fails. Cannot be updated. More + info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + name: + description: Name of the container specified as a DNS_LABEL. Each + container in a pod must have a unique name (DNS_LABEL). Cannot + be updated. + type: string + ports: + description: List of ports to expose from the container. Not specifying + a port here DOES NOT prevent that port from being exposed. Any + port which is listening on the default "0.0.0.0" address inside + a container will be accessible from the network. Modifying this + array with strategic merge patch may corrupt the data. For more + information See https://github.com/kubernetes/kubernetes/issues/108255. + Cannot be updated. + items: + description: ContainerPort represents a network port in a single + container. + properties: + containerPort: + description: Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. + format: int32 + type: integer + hostIP: + description: What host IP to bind the external port to. + type: string + hostPort: + description: Number of port to expose on the host. If specified, + this must be a valid port number, 0 < x < 65536. If HostNetwork + is specified, this must match ContainerPort. Most containers + do not need this. + format: int32 + type: integer + name: + description: If specified, this must be an IANA_SVC_NAME + and unique within the pod. Each named port in a pod must + have a unique name. Name for the port that can be referred + to by services. + type: string + protocol: + default: TCP + description: Protocol for port. Must be UDP, TCP, or SCTP. + Defaults to "TCP". + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + description: 'Periodic probe of container service readiness. Container + will be removed from service endpoints if the probe fails. Cannot + be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + resizePolicy: + description: Resources resize policy for the container. + items: + description: ContainerResizePolicy represents resource resize + policy for the container. + properties: + resourceName: + description: 'Name of the resource to which this resource + resize policy applies. Supported values: cpu, memory.' + type: string + restartPolicy: + description: Restart policy to apply when specified resource + is resized. If not specified, it defaults to NotRequired. + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + description: 'Compute Resources required by this container. Cannot + be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only be + set for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in + pod.spec.resourceClaims of the Pod where this field + is used. It makes that resource available inside a + container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. Requests cannot exceed + Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object + restartPolicy: + description: 'RestartPolicy defines the restart behavior of individual + containers in a pod. This field may only be set for init containers, + and the only allowed value is "Always". For non-init containers + or when this field is not specified, the restart behavior is + defined by the Pod''s restart policy and the container type. + Setting the RestartPolicy as "Always" for the init container + will have the following effect: this init container will be + continually restarted on exit until all regular containers have + terminated. Once all regular containers have completed, all + init containers with restartPolicy "Always" will be shut down. + This lifecycle differs from normal init containers and is often + referred to as a "sidecar" container. Although this init container + still starts in the init container sequence, it does not wait + for the container to complete before proceeding to the next + init container. Instead, the next init container starts immediately + after this init container is started, or after any startupProbe + has successfully completed.' + type: string + securityContext: + description: 'SecurityContext defines the security options the + container should be run with. If set, the fields of SecurityContext + override the equivalent fields of PodSecurityContext. More info: + https://kubernetes.io/docs/tasks/configure-pod-container/security-context/' + properties: + allowPrivilegeEscalation: + description: 'AllowPrivilegeEscalation controls whether a + process can gain more privileges than its parent process. + This bool directly controls if the no_new_privs flag will + be set on the container process. AllowPrivilegeEscalation + is true always when the container is: 1) run as Privileged + 2) has CAP_SYS_ADMIN Note that this field cannot be set + when spec.os.name is windows.' + type: boolean + capabilities: + description: The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the + container runtime. Note that this field cannot be set when + spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + type: object + privileged: + description: Run container in privileged mode. Processes in + privileged containers are essentially equivalent to root + on the host. Defaults to false. Note that this field cannot + be set when spec.os.name is windows. + type: boolean + procMount: + description: procMount denotes the type of proc mount to use + for the containers. The default is DefaultProcMount which + uses the container runtime defaults for readonly paths and + masked paths. This requires the ProcMountType feature flag + to be enabled. Note that this field cannot be set when spec.os.name + is windows. + type: string + readOnlyRootFilesystem: + description: Whether this container has a read-only root filesystem. + Default is false. Note that this field cannot be set when + spec.os.name is windows. + type: boolean + runAsGroup: + description: The GID to run the entrypoint of the container + process. Uses runtime default if unset. May also be set + in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. Note that this field cannot be set when + spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: Indicates that the container must run as a non-root + user. If true, the Kubelet will validate the image at runtime + to ensure that it does not run as UID 0 (root) and fail + to start the container if it does. If unset or false, no + such validation will be performed. May also be set in PodSecurityContext. If + set in both SecurityContext and PodSecurityContext, the + value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: The UID to run the entrypoint of the container + process. Defaults to user specified in image metadata if + unspecified. May also be set in PodSecurityContext. If + set in both SecurityContext and PodSecurityContext, the + value specified in SecurityContext takes precedence. Note + that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random + SELinux context for each container. May also be set in + PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. Note that this field cannot be set when + spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies + to the container. + type: string + role: + description: Role is a SELinux role label that applies + to the container. + type: string + type: + description: Type is a SELinux type label that applies + to the container. + type: string + user: + description: User is a SELinux user label that applies + to the container. + type: string + type: object + seccompProfile: + description: The seccomp options to use by this container. + If seccomp options are provided at both the pod & container + level, the container options override the pod options. Note + that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: localhostProfile indicates a profile defined + in a file on the node should be used. The profile must + be preconfigured on the node to work. Must be a descending + path, relative to the kubelet's configured seccomp profile + location. Must be set if type is "Localhost". Must NOT + be set for any other type. + type: string + type: + description: "type indicates which kind of seccomp profile + will be applied. Valid options are: \n Localhost - a + profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile + should be used. Unconfined - no profile should be applied." + type: string + required: + - type + type: object + windowsOptions: + description: The Windows specific settings applied to all + containers. If unspecified, the options from the PodSecurityContext + will be used. If set in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is + linux. + properties: + gmsaCredentialSpec: + description: GMSACredentialSpec is where the GMSA admission + webhook (https://github.com/kubernetes-sigs/windows-gmsa) + inlines the contents of the GMSA credential spec named + by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the + GMSA credential spec to use. + type: string + hostProcess: + description: HostProcess determines if a container should + be run as a 'Host Process' container. All of a Pod's + containers must have the same effective HostProcess + value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, + if HostProcess is true then HostNetwork must also be + set to true. + type: boolean + runAsUserName: + description: The UserName in Windows to run the entrypoint + of the container process. Defaults to the user specified + in image metadata if unspecified. May also be set in + PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. + type: string + type: object + type: object + startupProbe: + description: 'StartupProbe indicates that the Pod has successfully + initialized. If specified, no other probes are executed until + this completes successfully. If this probe fails, the Pod will + be restarted, just as if the livenessProbe failed. This can + be used to provide different probe parameters at the beginning + of a Pod''s lifecycle, when it might take a long time to load + data or warm a cache, than during steady-state operation. This + cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + stdin: + description: Whether this container should allocate a buffer for + stdin in the container runtime. If this is not set, reads from + stdin in the container will always result in EOF. Default is + false. + type: boolean + stdinOnce: + description: Whether the container runtime should close the stdin + channel after it has been opened by a single attach. When stdin + is true the stdin stream will remain open across multiple attach + sessions. If stdinOnce is set to true, stdin is opened on container + start, is empty until the first client attaches to stdin, and + then remains open and accepts data until the client disconnects, + at which time stdin is closed and remains closed until the container + is restarted. If this flag is false, a container processes that + reads from stdin will never receive an EOF. Default is false + type: boolean + terminationMessagePath: + description: 'Optional: Path at which the file to which the container''s + termination message will be written is mounted into the container''s + filesystem. Message written is intended to be brief final status, + such as an assertion failure message. Will be truncated by the + node if greater than 4096 bytes. The total message length across + all containers will be limited to 12kb. Defaults to /dev/termination-log. + Cannot be updated.' + type: string + terminationMessagePolicy: + description: Indicate how the termination message should be populated. + File will use the contents of terminationMessagePath to populate + the container status message on both success and failure. FallbackToLogsOnError + will use the last chunk of container log output if the termination + message file is empty and the container exited with an error. + The log output is limited to 2048 bytes or 80 lines, whichever + is smaller. Defaults to File. Cannot be updated. + type: string + tty: + description: Whether this container should allocate a TTY for + itself, also requires 'stdin' to be true. Default is false. + type: boolean + volumeDevices: + description: volumeDevices is the list of block devices to be + used by the container. + items: + description: volumeDevice describes a mapping of a raw block + device within a container. + properties: + devicePath: + description: devicePath is the path inside of the container + that the device will be mapped to. + type: string + name: + description: name must match the name of a persistentVolumeClaim + in the pod + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + description: Pod volumes to mount into the container's filesystem. + Cannot be updated. + items: + description: VolumeMount describes a mounting of a Volume within + a container. + properties: + mountPath: + description: Path within the container at which the volume + should be mounted. Must not contain ':'. + type: string + mountPropagation: + description: mountPropagation determines how mounts are + propagated from the host to container and the other way + around. When not set, MountPropagationNone is used. This + field is beta in 1.10. + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: Mounted read-only if true, read-write otherwise + (false or unspecified). Defaults to false. + type: boolean + subPath: + description: Path within the volume from which the container's + volume should be mounted. Defaults to "" (volume's root). + type: string + subPathExpr: + description: Expanded path within the volume from which + the container's volume should be mounted. Behaves similarly + to SubPath but environment variable references $(VAR_NAME) + are expanded using the container's environment. Defaults + to "" (volume's root). SubPathExpr and SubPath are mutually + exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + description: Container's working directory. If not specified, + the container runtime's default will be used, which might be + configured in the container image. Cannot be updated. + type: string + required: + - name + type: object + deno: + description: Deno contains the definition for the Deno function that + is to be executed in KeptnTasks based on the KeptnTaskDefinitions. + properties: + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command + type: string + configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. + properties: + name: + description: Name is the name of the referenced ConfigMap. + type: string + type: object + functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. + properties: + name: + description: Name is the name of the referenced KeptnTaskDefinition. + type: string + type: object + httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. + properties: + url: + description: Url is the URL containing the code of the function. + type: string + type: object + inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. + properties: + code: + description: Code contains the code of the function. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. + type: object + type: object + secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. + type: string + type: object + type: object + function: + description: Deprecated Function contains the definition for the function + that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. + properties: + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command + type: string + configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. + properties: + name: + description: Name is the name of the referenced ConfigMap. + type: string + type: object + functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. + properties: + name: + description: Name is the name of the referenced KeptnTaskDefinition. + type: string + type: object + httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. + properties: + url: + description: Url is the URL containing the code of the function. + type: string + type: object + inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. + properties: + code: + description: Code contains the code of the function. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. + type: object + type: object + secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. + type: string + type: object + type: object + python: + description: Python contains the definition for the python function + that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. + properties: + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command + type: string + configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. + properties: + name: + description: Name is the name of the referenced ConfigMap. + type: string + type: object + functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. + properties: + name: + description: Name is the name of the referenced KeptnTaskDefinition. + type: string + type: object + httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. + properties: + url: + description: Url is the URL containing the code of the function. + type: string + type: object + inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. + properties: + code: + description: Code contains the code of the function. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. + type: object + type: object + secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. + type: string + type: object + type: object + retries: + default: 10 + description: Retries specifies how many times a job executing the + KeptnTaskDefinition should be restarted in the case of an unsuccessful + attempt. + format: int32 + type: integer + serviceAccount: + description: Service Account to be used in jobs to authenticate with + the Kubernetes API and access cluster resources. + properties: + name: + type: string + required: + - name + type: object + timeout: + default: 5m + description: Timeout specifies the maximum time to wait for the task + to be completed successfully. If the task does not complete successfully + within this time frame, it will be considered to be failed. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + ttlSecondsAfterFinished: + default: 300 + description: TTLSecondsAfterFinished controller makes a job eligible + to be cleaned up after it is finished. The timer starts when the + status shows up to be Complete or Failed. + format: int32 + type: integer + imagePullSecrets: + description: ImagePullSecrets is an optional field to specify the + names of secrets to use for pulling container images + items: + description: LocalObjectReference contains enough information to + let you locate the referenced object inside the same namespace. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + type: array + type: object + status: + description: Status describes the current state of the KeptnTaskDefinition. + properties: + function: + description: Function contains status information of the function + definition for the task. + properties: + configMap: + description: ConfigMap indicates the ConfigMap in which the function + code is stored. + type: string + type: object + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/lifecycle-operator/chart/templates/keptnworkload-crd.yaml b/lifecycle-operator/chart/templates/keptnworkload-crd.yaml index d1e71d9172..a076bb7397 100644 --- a/lifecycle-operator/chart/templates/keptnworkload-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnworkload-crd.yaml @@ -283,5 +283,110 @@ spec: type: object served: true storage: true + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnWorkload is the Schema for the keptnworkloads API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnWorkload. + properties: + app: + description: AppName is the name of the KeptnApp containing the KeptnWorkload. + type: string + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnWorkload, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + resourceReference: + description: ResourceReference is a reference to the Kubernetes resource + (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload + is representing. + properties: + kind: + type: string + name: + type: string + uid: + description: UID is a type that holds unique ID values, including + UUIDs. Because we don't ONLY use UUIDs, this is an alias to + string. Being a type captures intent and helps make sure that + UIDs and names do not get conflated. + type: string + required: + - kind + - name + - uid + type: object + version: + description: Version defines the version of the KeptnWorkload. + type: string + required: + - app + - resourceReference + - version + type: object + status: + description: Status describes the current state of the KeptnWorkload. + properties: + currentVersion: + description: CurrentVersion indicates the version that is currently + deployed or being reconciled. + type: string + type: object + type: object + served: true + storage: false subresources: status: {} \ No newline at end of file diff --git a/lifecycle-operator/chart/templates/keptnworkloadversion-crd.yaml b/lifecycle-operator/chart/templates/keptnworkloadversion-crd.yaml index 1754d8631c..0e408dcdf4 100644 --- a/lifecycle-operator/chart/templates/keptnworkloadversion-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnworkloadversion-crd.yaml @@ -321,3 +321,302 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.workloadName + name: WorkloadName + type: string + - jsonPath: .spec.version + name: WorkloadVersion + type: string + - jsonPath: .status.currentPhase + name: Phase + type: string + - jsonPath: .status.preDeploymentStatus + name: PreDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.preDeploymentEvaluationStatus + name: PreDeploymentEvaluationStatus + priority: 1 + type: string + - jsonPath: .status.deploymentStatus + name: DeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentStatus + name: PostDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentEvaluationStatus + name: PostDeploymentEvaluationStatus + priority: 1 + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnWorkloadVersion is the Schema for the keptnworkloadversions + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnWorkloadVersion. + properties: + app: + description: AppName is the name of the KeptnApp containing the KeptnWorkload. + type: string + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnWorkload, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + previousVersion: + description: PreviousVersion is the version of the KeptnWorkload that + has been deployed prior to this version. + type: string + resourceReference: + description: ResourceReference is a reference to the Kubernetes resource + (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload + is representing. + properties: + kind: + type: string + name: + type: string + uid: + description: UID is a type that holds unique ID values, including + UUIDs. Because we don't ONLY use UUIDs, this is an alias to + string. Being a type captures intent and helps make sure that + UIDs and names do not get conflated. + type: string + required: + - kind + - name + - uid + type: object + traceId: + additionalProperties: + type: string + description: TraceId contains the OpenTelemetry trace ID. + type: object + version: + description: Version defines the version of the KeptnWorkload. + type: string + workloadName: + description: WorkloadName is the name of the KeptnWorkload. + type: string + required: + - app + - resourceReference + - version + - workloadName + type: object + status: + description: Status describes the current state of the KeptnWorkloadVersion. + properties: + currentPhase: + description: 'CurrentPhase indicates the current phase of the KeptnWorkloadVersion. + This can be: - PreDeploymentTasks - PreDeploymentEvaluations - Deployment + - PostDeploymentTasks - PostDeploymentEvaluations' + type: string + deploymentStatus: + default: Pending + description: DeploymentStatus indicates the current status of the + KeptnWorkloadVersion's Deployment phase. + type: string + endTime: + description: EndTime represents the time at which the deployment of + the KeptnWorkloadVersion finished. + format: date-time + type: string + phaseTraceIDs: + additionalProperties: + additionalProperties: + type: string + description: MapCarrier is a TextMapCarrier that uses a map held + in memory as a storage medium for propagated key-value pairs. + type: object + description: PhaseTraceIDs contains the trace IDs of the OpenTelemetry + spans of each phase of the KeptnWorkloadVersion + type: object + postDeploymentEvaluationStatus: + default: Pending + description: PostDeploymentEvaluationStatus indicates the current + status of the KeptnWorkloadVersion's PostDeploymentEvaluation phase. + type: string + postDeploymentEvaluationTaskStatus: + description: PostDeploymentEvaluationTaskStatus indicates the current + state of each postDeploymentEvaluation of the KeptnWorkloadVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + postDeploymentStatus: + default: Pending + description: PostDeploymentStatus indicates the current status of + the KeptnWorkloadVersion's PostDeployment phase. + type: string + postDeploymentTaskStatus: + description: PostDeploymentTaskStatus indicates the current state + of each postDeploymentTask of the KeptnWorkloadVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + preDeploymentEvaluationStatus: + default: Pending + description: PreDeploymentEvaluationStatus indicates the current status + of the KeptnWorkloadVersion's PreDeploymentEvaluation phase. + type: string + preDeploymentEvaluationTaskStatus: + description: PreDeploymentEvaluationTaskStatus indicates the current + state of each preDeploymentEvaluation of the KeptnWorkloadVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + preDeploymentStatus: + default: Pending + description: PreDeploymentStatus indicates the current status of the + KeptnWorkloadVersion's PreDeployment phase. + type: string + preDeploymentTaskStatus: + description: PreDeploymentTaskStatus indicates the current state of + each preDeploymentTask of the KeptnWorkloadVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + type: string + type: object + type: array + startTime: + description: StartTime represents the time at which the deployment + of the KeptnWorkloadVersion started. + format: date-time + type: string + status: + default: Pending + description: Status represents the overall status of the KeptnWorkloadVersion. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnappcreationrequests.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnappcreationrequests.yaml index 0ef35c2108..58988e3643 100644 --- a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnappcreationrequests.yaml +++ b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnappcreationrequests.yaml @@ -50,3 +50,39 @@ spec: storage: true subresources: status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnAppCreationRequest is the Schema for the keptnappcreationrequests + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnAppCreationRequest. + properties: + appName: + description: AppName is the name of the KeptnApp the KeptnAppCreationRequest + should create if no user-defined object with that name is found. + type: string + required: + - appName + type: object + status: + description: Status describes the current state of the KeptnAppCreationRequest. + type: string + type: object + served: true + storage: false + subresources: + status: {} diff --git a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnapps.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnapps.yaml index b8de981dfd..f8dd62f8ec 100644 --- a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnapps.yaml +++ b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnapps.yaml @@ -242,3 +242,100 @@ spec: storage: true subresources: status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnApp is the Schema for the keptnapps API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnApp. + properties: + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + revision: + default: 1 + description: Revision can be modified to trigger another deployment + of a KeptnApp of the same version. This can be used for restarting + a KeptnApp which failed to deploy, e.g. due to a failed preDeploymentEvaluation/preDeploymentTask. + type: integer + version: + description: Version defines the version of the application. For automatically + created KeptnApps, the version is a function of all KeptnWorkloads + that are part of the KeptnApp. + type: string + workloads: + description: Workloads is a list of all KeptnWorkloads that are part + of the KeptnApp. + items: + description: KeptnWorkloadRef refers to a KeptnWorkload that is + part of a KeptnApp + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: array + required: + - version + type: object + status: + description: Status describes the current state of the KeptnApp. + properties: + currentVersion: + description: CurrentVersion indicates the version that is currently + deployed or being reconciled. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnappversions.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnappversions.yaml index e01ee6a19f..a1ca58549c 100644 --- a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnappversions.yaml +++ b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnappversions.yaml @@ -836,3 +836,328 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.appName + name: AppName + type: string + - jsonPath: .spec.version + name: Version + type: string + - jsonPath: .status.currentPhase + name: Phase + type: string + - jsonPath: .status.preDeploymentStatus + name: PreDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.preDeploymentEvaluationStatus + name: PreDeploymentEvaluationStatus + priority: 1 + type: string + - jsonPath: .status.workloadOverallStatus + name: WorkloadOverallStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentStatus + name: PostDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentEvaluationStatus + name: PostDeploymentEvaluationStatus + priority: 1 + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnAppVersion is the Schema for the keptnappversions API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnAppVersion. + properties: + appName: + description: AppName is the name of the KeptnApp. + type: string + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnApp. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnApp. The items of this + list refer to the names of KeptnTaskDefinitions located in the same + namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + previousVersion: + description: PreviousVersion is the version of the KeptnApp that has + been deployed prior to this version. + type: string + revision: + default: 1 + description: Revision can be modified to trigger another deployment + of a KeptnApp of the same version. This can be used for restarting + a KeptnApp which failed to deploy, e.g. due to a failed preDeploymentEvaluation/preDeploymentTask. + type: integer + traceId: + additionalProperties: + type: string + description: TraceId contains the OpenTelemetry trace ID. + type: object + version: + description: Version defines the version of the application. For automatically + created KeptnApps, the version is a function of all KeptnWorkloads + that are part of the KeptnApp. + type: string + workloads: + description: Workloads is a list of all KeptnWorkloads that are part + of the KeptnApp. + items: + description: KeptnWorkloadRef refers to a KeptnWorkload that is + part of a KeptnApp + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: array + required: + - appName + - version + type: object + status: + description: Status describes the current state of the KeptnAppVersion. + properties: + currentPhase: + description: CurrentPhase indicates the current phase of the KeptnAppVersion. + type: string + endTime: + description: EndTime represents the time at which the deployment of + the KeptnAppVersion finished. + format: date-time + type: string + phaseTraceIDs: + additionalProperties: + additionalProperties: + type: string + description: MapCarrier is a TextMapCarrier that uses a map held + in memory as a storage medium for propagated key-value pairs. + type: object + description: PhaseTraceIDs contains the trace IDs of the OpenTelemetry + spans of each phase of the KeptnAppVersion. + type: object + postDeploymentEvaluationStatus: + default: Pending + description: PostDeploymentEvaluationStatus indicates the current + status of the KeptnAppVersion's PostDeploymentEvaluation phase. + type: string + postDeploymentEvaluationTaskStatus: + description: PostDeploymentEvaluationTaskStatus indicates the current + state of each postDeploymentEvaluation of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + description: KeptnState is a string containing current Phase + state (Progressing/Succeeded/Failed/Unknown/Pending/Cancelled) + type: string + type: object + type: array + postDeploymentStatus: + default: Pending + description: PostDeploymentStatus indicates the current status of + the KeptnAppVersion's PostDeployment phase. + type: string + postDeploymentTaskStatus: + description: PostDeploymentTaskStatus indicates the current state + of each postDeploymentTask of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + description: KeptnState is a string containing current Phase + state (Progressing/Succeeded/Failed/Unknown/Pending/Cancelled) + type: string + type: object + type: array + preDeploymentEvaluationStatus: + default: Pending + description: PreDeploymentEvaluationStatus indicates the current status + of the KeptnAppVersion's PreDeploymentEvaluation phase. + type: string + preDeploymentEvaluationTaskStatus: + description: PreDeploymentEvaluationTaskStatus indicates the current + state of each preDeploymentEvaluation of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + description: KeptnState is a string containing current Phase + state (Progressing/Succeeded/Failed/Unknown/Pending/Cancelled) + type: string + type: object + type: array + preDeploymentStatus: + default: Pending + description: PreDeploymentStatus indicates the current status of the + KeptnAppVersion's PreDeployment phase. + type: string + preDeploymentTaskStatus: + description: PreDeploymentTaskStatus indicates the current state of + each preDeploymentTask of the KeptnAppVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + description: KeptnState is a string containing current Phase + state (Progressing/Succeeded/Failed/Unknown/Pending/Cancelled) + type: string + type: object + type: array + startTime: + description: StartTime represents the time at which the deployment + of the KeptnAppVersion started. + format: date-time + type: string + status: + default: Pending + description: Status represents the overall status of the KeptnAppVersion. + type: string + workloadOverallStatus: + default: Pending + description: WorkloadOverallStatus indicates the current status of + the KeptnAppVersion's Workload deployment phase. + type: string + workloadStatus: + description: WorkloadStatus contains the current status of each KeptnWorkload + that is part of the KeptnAppVersion. + items: + properties: + status: + default: Pending + description: Status indicates the current status of the KeptnWorkload. + type: string + workload: + description: Workload refers to a KeptnWorkload that is part + of the KeptnAppVersion. + properties: + name: + description: Name is the name of the KeptnWorkload. + type: string + version: + description: Version is the version of the KeptnWorkload. + type: string + required: + - name + - version + type: object + type: object + type: array + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationdefinitions.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationdefinitions.yaml index 3f0b741d29..bad28c6b02 100644 --- a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationdefinitions.yaml +++ b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluationdefinitions.yaml @@ -180,3 +180,65 @@ spec: storage: true subresources: status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnEvaluationDefinition is the Schema for the keptnevaluationdefinitions + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnEvaluationDefinition. + properties: + objectives: + description: Objectives is a list of objectives that have to be met + for a KeptnEvaluation referencing this KeptnEvaluationDefinition + to be successful. + items: + properties: + evaluationTarget: + description: EvaluationTarget specifies the target value for + the references KeptnMetric. Needs to start with either '<' + or '>', followed by the target value (e.g. '<10'). + type: string + keptnMetricRef: + description: KeptnMetricRef references the KeptnMetric that + should be evaluated. + properties: + name: + description: Name is the name of the referenced KeptnMetric. + type: string + namespace: + description: Namespace is the namespace where the referenced + KeptnMetric is located. + type: string + required: + - name + type: object + required: + - evaluationTarget + - keptnMetricRef + type: object + type: array + required: + - objectives + type: object + status: + description: unused field + type: string + type: object + served: true + storage: false + subresources: + status: {} diff --git a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluations.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluations.yaml index fabba87082..b078d5f32a 100644 --- a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluations.yaml +++ b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnevaluations.yaml @@ -378,3 +378,147 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.appName + name: AppName + type: string + - jsonPath: .spec.appVersion + name: AppVersion + type: string + - jsonPath: .spec.workload + name: WorkloadName + type: string + - jsonPath: .spec.workloadVersion + name: WorkloadVersion + type: string + - jsonPath: .status.retryCount + name: RetryCount + type: string + - jsonPath: .status.evaluationStatus + name: EvaluationStatus + type: string + - jsonPath: .status.overallStatus + name: OverallStatus + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnEvaluation is the Schema for the keptnevaluations API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnEvaluation. + properties: + appName: + description: AppName defines the KeptnApp for which the KeptnEvaluation + is done. + type: string + appVersion: + description: AppVersion defines the version of the KeptnApp for which + the KeptnEvaluation is done. + type: string + checkType: + description: Type indicates whether the KeptnEvaluation is part of + the pre- or postDeployment phase. + type: string + evaluationDefinition: + description: EvaluationDefinition refers to the name of the KeptnEvaluationDefinition + which includes the objectives for the KeptnEvaluation. The KeptnEvaluationDefinition + can be located in the same namespace as the KeptnEvaluation, or + in the Keptn namespace. + type: string + failAction: + type: string + retries: + default: 10 + description: Retries indicates how many times the KeptnEvaluation + can be attempted in the case of an error or missed evaluation objective, + before considering the KeptnEvaluation to be failed. + type: integer + retryInterval: + default: 5s + description: RetryInterval specifies the interval at which the KeptnEvaluation + is retried in the case of an error or a missed objective. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + workload: + description: Workload defines the KeptnWorkload for which the KeptnEvaluation + is done. + type: string + workloadVersion: + description: WorkloadVersion defines the version of the KeptnWorkload + for which the KeptnEvaluation is done. + type: string + required: + - evaluationDefinition + - workloadVersion + type: object + status: + description: Status describes the current state of the KeptnEvaluation. + properties: + endTime: + description: EndTime represents the time at which the KeptnEvaluation + finished. + format: date-time + type: string + evaluationStatus: + additionalProperties: + properties: + message: + description: Message contains additional information about the + evaluation of an objective. This can include explanations + about why an evaluation has failed (e.g. due to a missed objective), + or if there was any error during the evaluation of the objective. + type: string + status: + description: Status indicates the status of the objective being + evaluated. + type: string + value: + description: Value represents the value of the KeptnMetric being + evaluated. + type: string + required: + - status + - value + type: object + description: EvaluationStatus describes the status of each objective + of the KeptnEvaluationDefinition referenced by the KeptnEvaluation. + type: object + overallStatus: + default: Pending + description: OverallStatus describes the overall status of the KeptnEvaluation. + The Overall status is derived from the status of the individual + objectives of the KeptnEvaluationDefinition referenced by the KeptnEvaluation. + type: string + retryCount: + default: 0 + description: RetryCount indicates how many times the KeptnEvaluation + has been attempted already. + type: integer + startTime: + description: StartTime represents the time at which the KeptnEvaluation + started. + format: date-time + type: string + required: + - evaluationStatus + - overallStatus + - retryCount + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptntaskdefinitions.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptntaskdefinitions.yaml index 288ac912d1..96c74f3cb2 100644 --- a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptntaskdefinitions.yaml +++ b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptntaskdefinitions.yaml @@ -75,14 +75,8 @@ spec: description: KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition properties: function: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed state - of cluster Important: Run "make" to regenerate code after modifying - this file' properties: configMap: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed - state of cluster Important: Run "make" to regenerate code after - modifying this file' type: string type: object type: object @@ -152,14 +146,8 @@ spec: description: KeptnTaskDefinitionStatus defines the observed state of KeptnTaskDefinition properties: function: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed state - of cluster Important: Run "make" to regenerate code after modifying - this file' properties: configMap: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed - state of cluster Important: Run "make" to regenerate code after - modifying this file' type: string type: object type: object @@ -1748,3 +1736,1583 @@ spec: storage: true subresources: status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnTaskDefinition is the Schema for the keptntaskdefinitions + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnTaskDefinition. + properties: + automountServiceAccountToken: + description: AutomountServiceAccountToken allows to enable K8s to + assign cluster API credentials to a pod, if set to false the pod + will decline the service account + properties: + type: + type: boolean + required: + - type + type: object + container: + description: Container contains the definition for the container that + is to be used in Job based on the KeptnTaskDefinitions. + properties: + args: + description: 'Arguments to the entrypoint. The container image''s + CMD is used if this is not provided. Variable references $(VAR_NAME) + are expanded using the container''s environment. If a variable + cannot be resolved, the reference in the input string will be + unchanged. Double $$ are reduced to a single $, which allows + for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references + will never be expanded, regardless of whether the variable exists + or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + command: + description: 'Entrypoint array. Not executed within a shell. The + container image''s ENTRYPOINT is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container''s + environment. If a variable cannot be resolved, the reference + in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: + i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether + the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + items: + type: string + type: array + env: + description: List of environment variables to set in the container. + Cannot be updated. + items: + description: EnvVar represents an environment variable present + in a Container. + properties: + name: + description: Name of the environment variable. Must be a + C_IDENTIFIER. + type: string + value: + description: 'Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in + the container and any service environment variables. If + a variable cannot be resolved, the reference in the input + string will be unchanged. Double $$ are reduced to a single + $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless + of whether the variable exists or not. Defaults to "".' + type: string + valueFrom: + description: Source for the environment variable's value. + Cannot be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the ConfigMap or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: 'Selects a field of the pod: supports metadata.name, + metadata.namespace, `metadata.labels['''']`, + `metadata.annotations['''']`, spec.nodeName, + spec.serviceAccountName, status.hostIP, status.podIP, + status.podIPs.' + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the + specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: 'Selects a resource of the container: only + resources limits and requests (limits.cpu, limits.memory, + limits.ephemeral-storage, requests.cpu, requests.memory + and requests.ephemeral-storage) are currently supported.' + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the + exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, + uid?' + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + description: List of sources to populate environment variables + in the container. The keys defined within a source must be a + C_IDENTIFIER. All invalid keys will be reported as an event + when the container is starting. When a key exists in multiple + sources, the value associated with the last source will take + precedence. Values defined by an Env with a duplicate key will + take precedence. Cannot be updated. + items: + description: EnvFromSource represents the source of a set of + ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend to each key + in the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the Secret must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + description: 'Container image name. More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config management + to default or override container images in workload controllers + like Deployments and StatefulSets.' + type: string + imagePullPolicy: + description: 'Image pull policy. One of Always, Never, IfNotPresent. + Defaults to Always if :latest tag is specified, or IfNotPresent + otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images' + type: string + lifecycle: + description: Actions that the management system should take in + response to container lifecycle events. Cannot be updated. + properties: + postStart: + description: 'PostStart is called immediately after a container + is created. If the handler fails, the container is terminated + and restarted according to its restart policy. Other management + of the container blocks until the hook completes. More info: + https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute + inside the container, the working directory for + the command is root ('/') in the container's filesystem. + The command is simply exec'd, it is not run inside + a shell, so traditional shell instructions ('|', + etc) won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is treated + as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to + the pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: The header field name. This will + be canonicalized upon output, so case-variant + names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported as + a LifecycleHandler and kept for the backward compatibility. + There are no validation of this field and lifecycle + hooks will fail in runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + description: 'PreStop is called immediately before a container + is terminated due to an API request or management event + such as liveness/startup probe failure, preemption, resource + contention, etc. The handler is not called if the container + crashes or exits. The Pod''s termination grace period countdown + begins before the PreStop hook is executed. Regardless of + the outcome of the handler, the container will eventually + terminate within the Pod''s termination grace period (unless + delayed by finalizers). Other management of the container + blocks until the hook completes or until the termination + grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute + inside the container, the working directory for + the command is root ('/') in the container's filesystem. + The command is simply exec'd, it is not run inside + a shell, so traditional shell instructions ('|', + etc) won't work. To use a shell, you need to explicitly + call out to that shell. Exit status of 0 is treated + as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to + the pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: The header field name. This will + be canonicalized upon output, so case-variant + names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: Deprecated. TCPSocket is NOT supported as + a LifecycleHandler and kept for the backward compatibility. + There are no validation of this field and lifecycle + hooks will fail in runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access + on the container. Number must be in the range 1 + to 65535. Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + description: 'Periodic probe of container liveness. Container + will be restarted if the probe fails. Cannot be updated. More + info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + name: + description: Name of the container specified as a DNS_LABEL. Each + container in a pod must have a unique name (DNS_LABEL). Cannot + be updated. + type: string + ports: + description: List of ports to expose from the container. Not specifying + a port here DOES NOT prevent that port from being exposed. Any + port which is listening on the default "0.0.0.0" address inside + a container will be accessible from the network. Modifying this + array with strategic merge patch may corrupt the data. For more + information See https://github.com/kubernetes/kubernetes/issues/108255. + Cannot be updated. + items: + description: ContainerPort represents a network port in a single + container. + properties: + containerPort: + description: Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. + format: int32 + type: integer + hostIP: + description: What host IP to bind the external port to. + type: string + hostPort: + description: Number of port to expose on the host. If specified, + this must be a valid port number, 0 < x < 65536. If HostNetwork + is specified, this must match ContainerPort. Most containers + do not need this. + format: int32 + type: integer + name: + description: If specified, this must be an IANA_SVC_NAME + and unique within the pod. Each named port in a pod must + have a unique name. Name for the port that can be referred + to by services. + type: string + protocol: + default: TCP + description: Protocol for port. Must be UDP, TCP, or SCTP. + Defaults to "TCP". + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + description: 'Periodic probe of container service readiness. Container + will be removed from service endpoints if the probe fails. Cannot + be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + resizePolicy: + description: Resources resize policy for the container. + items: + description: ContainerResizePolicy represents resource resize + policy for the container. + properties: + resourceName: + description: 'Name of the resource to which this resource + resize policy applies. Supported values: cpu, memory.' + type: string + restartPolicy: + description: Restart policy to apply when specified resource + is resized. If not specified, it defaults to NotRequired. + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + description: 'Compute Resources required by this container. Cannot + be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + properties: + claims: + description: "Claims lists the names of resources, defined + in spec.resourceClaims, that are used by this container. + \n This is an alpha field and requires enabling the DynamicResourceAllocation + feature gate. \n This field is immutable. It can only be + set for containers." + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: Name must match the name of one entry in + pod.spec.resourceClaims of the Pod where this field + is used. It makes that resource available inside a + container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute + resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. Requests cannot exceed + Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object + restartPolicy: + description: 'RestartPolicy defines the restart behavior of individual + containers in a pod. This field may only be set for init containers, + and the only allowed value is "Always". For non-init containers + or when this field is not specified, the restart behavior is + defined by the Pod''s restart policy and the container type. + Setting the RestartPolicy as "Always" for the init container + will have the following effect: this init container will be + continually restarted on exit until all regular containers have + terminated. Once all regular containers have completed, all + init containers with restartPolicy "Always" will be shut down. + This lifecycle differs from normal init containers and is often + referred to as a "sidecar" container. Although this init container + still starts in the init container sequence, it does not wait + for the container to complete before proceeding to the next + init container. Instead, the next init container starts immediately + after this init container is started, or after any startupProbe + has successfully completed.' + type: string + securityContext: + description: 'SecurityContext defines the security options the + container should be run with. If set, the fields of SecurityContext + override the equivalent fields of PodSecurityContext. More info: + https://kubernetes.io/docs/tasks/configure-pod-container/security-context/' + properties: + allowPrivilegeEscalation: + description: 'AllowPrivilegeEscalation controls whether a + process can gain more privileges than its parent process. + This bool directly controls if the no_new_privs flag will + be set on the container process. AllowPrivilegeEscalation + is true always when the container is: 1) run as Privileged + 2) has CAP_SYS_ADMIN Note that this field cannot be set + when spec.os.name is windows.' + type: boolean + capabilities: + description: The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the + container runtime. Note that this field cannot be set when + spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + type: object + privileged: + description: Run container in privileged mode. Processes in + privileged containers are essentially equivalent to root + on the host. Defaults to false. Note that this field cannot + be set when spec.os.name is windows. + type: boolean + procMount: + description: procMount denotes the type of proc mount to use + for the containers. The default is DefaultProcMount which + uses the container runtime defaults for readonly paths and + masked paths. This requires the ProcMountType feature flag + to be enabled. Note that this field cannot be set when spec.os.name + is windows. + type: string + readOnlyRootFilesystem: + description: Whether this container has a read-only root filesystem. + Default is false. Note that this field cannot be set when + spec.os.name is windows. + type: boolean + runAsGroup: + description: The GID to run the entrypoint of the container + process. Uses runtime default if unset. May also be set + in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. Note that this field cannot be set when + spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: Indicates that the container must run as a non-root + user. If true, the Kubelet will validate the image at runtime + to ensure that it does not run as UID 0 (root) and fail + to start the container if it does. If unset or false, no + such validation will be performed. May also be set in PodSecurityContext. If + set in both SecurityContext and PodSecurityContext, the + value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: The UID to run the entrypoint of the container + process. Defaults to user specified in image metadata if + unspecified. May also be set in PodSecurityContext. If + set in both SecurityContext and PodSecurityContext, the + value specified in SecurityContext takes precedence. Note + that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random + SELinux context for each container. May also be set in + PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. Note that this field cannot be set when + spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies + to the container. + type: string + role: + description: Role is a SELinux role label that applies + to the container. + type: string + type: + description: Type is a SELinux type label that applies + to the container. + type: string + user: + description: User is a SELinux user label that applies + to the container. + type: string + type: object + seccompProfile: + description: The seccomp options to use by this container. + If seccomp options are provided at both the pod & container + level, the container options override the pod options. Note + that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: localhostProfile indicates a profile defined + in a file on the node should be used. The profile must + be preconfigured on the node to work. Must be a descending + path, relative to the kubelet's configured seccomp profile + location. Must be set if type is "Localhost". Must NOT + be set for any other type. + type: string + type: + description: "type indicates which kind of seccomp profile + will be applied. Valid options are: \n Localhost - a + profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile + should be used. Unconfined - no profile should be applied." + type: string + required: + - type + type: object + windowsOptions: + description: The Windows specific settings applied to all + containers. If unspecified, the options from the PodSecurityContext + will be used. If set in both SecurityContext and PodSecurityContext, + the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is + linux. + properties: + gmsaCredentialSpec: + description: GMSACredentialSpec is where the GMSA admission + webhook (https://github.com/kubernetes-sigs/windows-gmsa) + inlines the contents of the GMSA credential spec named + by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the + GMSA credential spec to use. + type: string + hostProcess: + description: HostProcess determines if a container should + be run as a 'Host Process' container. All of a Pod's + containers must have the same effective HostProcess + value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, + if HostProcess is true then HostNetwork must also be + set to true. + type: boolean + runAsUserName: + description: The UserName in Windows to run the entrypoint + of the container process. Defaults to the user specified + in image metadata if unspecified. May also be set in + PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext + takes precedence. + type: string + type: object + type: object + startupProbe: + description: 'StartupProbe indicates that the Pod has successfully + initialized. If specified, no other probes are executed until + this completes successfully. If this probe fails, the Pod will + be restarted, just as if the livenessProbe failed. This can + be used to provide different probe parameters at the beginning + of a Pod''s lifecycle, when it might take a long time to load + data or warm a cache, than during steady-state operation. This + cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: Command is the command line to execute inside + the container, the working directory for the command is + root ('/') in the container's filesystem. The command + is simply exec'd, it is not run inside a shell, so traditional + shell instructions ('|', etc) won't work. To use a shell, + you need to explicitly call out to that shell. Exit + status of 0 is treated as live/healthy and non-zero + is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: Minimum consecutive failures for the probe to + be considered failed after having succeeded. Defaults to + 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: GRPC specifies an action involving a GRPC port. + properties: + port: + description: Port number of the gRPC service. Number must + be in the range 1 to 65535. + format: int32 + type: integer + service: + description: "Service is the name of the service to place + in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + \n If this is not specified, the default behavior is + defined by gRPC." + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: Host name to connect to, defaults to the + pod IP. You probably want to set "Host" in httpHeaders + instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header to + be used in HTTP probes + properties: + name: + description: The header field name. This will be + canonicalized upon output, so case-variant names + will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: Name or number of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: 'Number of seconds after the container has started + before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + periodSeconds: + description: How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to + be considered successful after having failed. Defaults to + 1. Must be 1 for liveness and startup. Minimum value is + 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: Number or name of the port to access on the + container. Number must be in the range 1 to 65535. Name + must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period + is the duration in seconds after the processes running in + the pod are sent a termination signal and the time when + the processes are forcibly halted with a kill signal. Set + this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds + will be used. Otherwise, this value overrides the value + provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal + (no opportunity to shut down). This is a beta field and + requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. + format: int64 + type: integer + timeoutSeconds: + description: 'Number of seconds after which the probe times + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer + type: object + stdin: + description: Whether this container should allocate a buffer for + stdin in the container runtime. If this is not set, reads from + stdin in the container will always result in EOF. Default is + false. + type: boolean + stdinOnce: + description: Whether the container runtime should close the stdin + channel after it has been opened by a single attach. When stdin + is true the stdin stream will remain open across multiple attach + sessions. If stdinOnce is set to true, stdin is opened on container + start, is empty until the first client attaches to stdin, and + then remains open and accepts data until the client disconnects, + at which time stdin is closed and remains closed until the container + is restarted. If this flag is false, a container processes that + reads from stdin will never receive an EOF. Default is false + type: boolean + terminationMessagePath: + description: 'Optional: Path at which the file to which the container''s + termination message will be written is mounted into the container''s + filesystem. Message written is intended to be brief final status, + such as an assertion failure message. Will be truncated by the + node if greater than 4096 bytes. The total message length across + all containers will be limited to 12kb. Defaults to /dev/termination-log. + Cannot be updated.' + type: string + terminationMessagePolicy: + description: Indicate how the termination message should be populated. + File will use the contents of terminationMessagePath to populate + the container status message on both success and failure. FallbackToLogsOnError + will use the last chunk of container log output if the termination + message file is empty and the container exited with an error. + The log output is limited to 2048 bytes or 80 lines, whichever + is smaller. Defaults to File. Cannot be updated. + type: string + tty: + description: Whether this container should allocate a TTY for + itself, also requires 'stdin' to be true. Default is false. + type: boolean + volumeDevices: + description: volumeDevices is the list of block devices to be + used by the container. + items: + description: volumeDevice describes a mapping of a raw block + device within a container. + properties: + devicePath: + description: devicePath is the path inside of the container + that the device will be mapped to. + type: string + name: + description: name must match the name of a persistentVolumeClaim + in the pod + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + description: Pod volumes to mount into the container's filesystem. + Cannot be updated. + items: + description: VolumeMount describes a mounting of a Volume within + a container. + properties: + mountPath: + description: Path within the container at which the volume + should be mounted. Must not contain ':'. + type: string + mountPropagation: + description: mountPropagation determines how mounts are + propagated from the host to container and the other way + around. When not set, MountPropagationNone is used. This + field is beta in 1.10. + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: Mounted read-only if true, read-write otherwise + (false or unspecified). Defaults to false. + type: boolean + subPath: + description: Path within the volume from which the container's + volume should be mounted. Defaults to "" (volume's root). + type: string + subPathExpr: + description: Expanded path within the volume from which + the container's volume should be mounted. Behaves similarly + to SubPath but environment variable references $(VAR_NAME) + are expanded using the container's environment. Defaults + to "" (volume's root). SubPathExpr and SubPath are mutually + exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + description: Container's working directory. If not specified, + the container runtime's default will be used, which might be + configured in the container image. Cannot be updated. + type: string + required: + - name + type: object + deno: + description: Deno contains the definition for the Deno function that + is to be executed in KeptnTasks based on the KeptnTaskDefinitions. + properties: + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command + type: string + configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. + properties: + name: + description: Name is the name of the referenced ConfigMap. + type: string + type: object + functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. + properties: + name: + description: Name is the name of the referenced KeptnTaskDefinition. + type: string + type: object + httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. + properties: + url: + description: Url is the URL containing the code of the function. + type: string + type: object + inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. + properties: + code: + description: Code contains the code of the function. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. + type: object + type: object + secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. + type: string + type: object + type: object + function: + description: Deprecated Function contains the definition for the function + that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. + properties: + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command + type: string + configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. + properties: + name: + description: Name is the name of the referenced ConfigMap. + type: string + type: object + functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. + properties: + name: + description: Name is the name of the referenced KeptnTaskDefinition. + type: string + type: object + httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. + properties: + url: + description: Url is the URL containing the code of the function. + type: string + type: object + inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. + properties: + code: + description: Code contains the code of the function. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. + type: object + type: object + secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. + type: string + type: object + type: object + imagePullSecrets: + description: ImagePullSecrets is an optional field to specify the + names of secrets to use for pulling container images + items: + description: LocalObjectReference contains enough information to + let you locate the referenced object inside the same namespace. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + x-kubernetes-map-type: atomic + type: array + python: + description: Python contains the definition for the python function + that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. + properties: + cmdParameters: + description: CmdParameters contains parameters that will be passed + to the command + type: string + configMapRef: + description: ConfigMapReference allows to reference a ConfigMap + containing the code of the function. When referencing a ConfigMap, + the code of the function must be available as a value of the + 'code' key of the referenced ConfigMap. + properties: + name: + description: Name is the name of the referenced ConfigMap. + type: string + type: object + functionRef: + description: FunctionReference allows to reference another KeptnTaskDefinition + which contains the source code of the function to be executes + for KeptnTasks based on this KeptnTaskDefinition. This can be + useful when you have multiple KeptnTaskDefinitions that should + execute the same logic, but each with different parameters. + properties: + name: + description: Name is the name of the referenced KeptnTaskDefinition. + type: string + type: object + httpRef: + description: HttpReference allows to point to an HTTP URL containing + the code of the function. + properties: + url: + description: Url is the URL containing the code of the function. + type: string + type: object + inline: + description: Inline allows to specify the code that should be + executed directly in the KeptnTaskDefinition, as a multi-line + string. + properties: + code: + description: Code contains the code of the function. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed + to the job that executes the task as env variables. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's + content will be a json encoded string containing all properties + of the map provided. + type: object + type: object + secureParameters: + description: SecureParameters contains secure parameters that + will be passed to the job that executes the task. These will + be stored and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key + of the referenced secret. + type: string + type: object + type: object + retries: + default: 10 + description: Retries specifies how many times a job executing the + KeptnTaskDefinition should be restarted in the case of an unsuccessful + attempt. + format: int32 + type: integer + serviceAccount: + description: ServiceAccount specifies the service account to be used + in jobs to authenticate with the Kubernetes API and access cluster + resources. + properties: + name: + type: string + required: + - name + type: object + timeout: + default: 5m + description: Timeout specifies the maximum time to wait for the task + to be completed successfully. If the task does not complete successfully + within this time frame, it will be considered to be failed. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + ttlSecondsAfterFinished: + default: 300 + description: TTLSecondsAfterFinished controller makes a job eligible + to be cleaned up after it is finished. The timer starts when the + status shows up to be Complete or Failed. + format: int32 + type: integer + type: object + status: + description: Status describes the current state of the KeptnTaskDefinition. + properties: + function: + description: Function contains status information of the function + definition for the task. + properties: + configMap: + description: ConfigMap indicates the ConfigMap in which the function + code is stored. + type: string + type: object + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptntasks.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptntasks.yaml index f6ad51f270..095a2b38ab 100644 --- a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptntasks.yaml +++ b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptntasks.yaml @@ -401,3 +401,158 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.appVersion + name: AppVersion + type: string + - jsonPath: .spec.workload + name: WorkloadName + type: string + - jsonPath: .spec.workloadVersion + name: WorkloadVersion + type: string + - jsonPath: .status.jobName + name: Job Name + type: string + - jsonPath: .status.status + name: Status + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnTask is the Schema for the keptntasks API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnTask. + properties: + checkType: + description: Type indicates whether the KeptnTask is part of the pre- + or postDeployment phase. + type: string + context: + description: Context contains contextual information about the task + execution. + properties: + appName: + description: AppName the name of the KeptnApp the KeptnTask is + being executed for. + type: string + appVersion: + description: AppVersion the version of the KeptnApp the KeptnTask + is being executed for. + type: string + objectType: + description: ObjectType indicates whether the KeptnTask is being + executed for a KeptnApp or KeptnWorkload. + type: string + taskType: + description: TaskType indicates whether the KeptnTask is part + of the pre- or postDeployment phase. + type: string + workloadName: + description: WorkloadName the name of the KeptnWorkload the KeptnTask + is being executed for. + type: string + workloadVersion: + description: WorkloadVersion the version of the KeptnWorkload + the KeptnTask is being executed for. + type: string + type: object + parameters: + description: Parameters contains parameters that will be passed to + the job that executes the task. + properties: + map: + additionalProperties: + type: string + description: Inline contains the parameters that will be made + available to the job executing the KeptnTask via the 'DATA' + environment variable. The 'DATA' environment variable's content + will be a json encoded string containing all properties of the + map provided. + type: object + type: object + retries: + default: 10 + description: Retries indicates how many times the KeptnTask can be + attempted in the case of an error before considering the KeptnTask + to be failed. + format: int32 + type: integer + secureParameters: + description: SecureParameters contains secure parameters that will + be passed to the job that executes the task. These will be stored + and accessed as secrets in the cluster. + properties: + secret: + description: Secret contains the parameters that will be made + available to the job executing the KeptnTask via the 'SECRET_DATA' + environment variable. The 'SECRET_DATA' environment variable's + content will the same as value of the 'SECRET_DATA' key of the + referenced secret. + type: string + type: object + taskDefinition: + description: TaskDefinition refers to the name of the KeptnTaskDefinition + which includes the specification for the task to be performed. The + KeptnTaskDefinition can be located in the same namespace as the + KeptnTask, or in the Keptn namespace. + type: string + timeout: + default: 5m + description: Timeout specifies the maximum time to wait for the task + to be completed successfully. If the task does not complete successfully + within this time frame, it will be considered to be failed. + pattern: ^0|([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$ + type: string + required: + - taskDefinition + type: object + status: + description: Status describes the current state of the KeptnTask. + properties: + endTime: + description: EndTime represents the time at which the KeptnTask finished. + format: date-time + type: string + jobName: + description: JobName is the name of the Job executing the Task. + type: string + message: + description: Message contains information about unexpected errors + encountered during the execution of the KeptnTask. + type: string + reason: + description: Reason contains more information about the reason for + the last transition of the Job executing the KeptnTask. + type: string + startTime: + description: StartTime represents the time at which the KeptnTask + started. + format: date-time + type: string + status: + default: Pending + description: Status represents the overall state of the KeptnTask. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloads.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloads.yaml index c7096100ac..e4319ecaed 100644 --- a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloads.yaml +++ b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloads.yaml @@ -279,3 +279,108 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnWorkload is the Schema for the keptnworkloads API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnWorkload. + properties: + app: + description: AppName is the name of the KeptnApp containing the KeptnWorkload. + type: string + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnWorkload, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + resourceReference: + description: ResourceReference is a reference to the Kubernetes resource + (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload + is representing. + properties: + kind: + type: string + name: + type: string + uid: + description: UID is a type that holds unique ID values, including + UUIDs. Because we don't ONLY use UUIDs, this is an alias to + string. Being a type captures intent and helps make sure that + UIDs and names do not get conflated. + type: string + required: + - kind + - name + - uid + type: object + version: + description: Version defines the version of the KeptnWorkload. + type: string + required: + - app + - resourceReference + - version + type: object + status: + description: Status describes the current state of the KeptnWorkload. + properties: + currentVersion: + description: CurrentVersion indicates the version that is currently + deployed or being reconciled. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloadversions.yaml b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloadversions.yaml index 4f324340ed..cbed1c0c0f 100644 --- a/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloadversions.yaml +++ b/lifecycle-operator/config/crd/bases/lifecycle.keptn.sh_keptnworkloadversions.yaml @@ -323,3 +323,310 @@ spec: storage: true subresources: status: {} + - additionalPrinterColumns: + - jsonPath: .spec.app + name: AppName + type: string + - jsonPath: .spec.workloadName + name: WorkloadName + type: string + - jsonPath: .spec.version + name: WorkloadVersion + type: string + - jsonPath: .status.currentPhase + name: Phase + type: string + - jsonPath: .status.preDeploymentStatus + name: PreDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.preDeploymentEvaluationStatus + name: PreDeploymentEvaluationStatus + priority: 1 + type: string + - jsonPath: .status.deploymentStatus + name: DeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentStatus + name: PostDeploymentStatus + priority: 1 + type: string + - jsonPath: .status.postDeploymentEvaluationStatus + name: PostDeploymentEvaluationStatus + priority: 1 + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: KeptnWorkloadVersion is the Schema for the keptnworkloadversions + API + 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: + type: object + spec: + description: Spec describes the desired state of the KeptnWorkloadVersion. + properties: + app: + description: AppName is the name of the KeptnApp containing the KeptnWorkload. + type: string + postDeploymentEvaluations: + description: PostDeploymentEvaluations is a list of all evaluations + to be performed during the post-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. + items: + type: string + type: array + postDeploymentTasks: + description: PostDeploymentTasks is a list of all tasks to be performed + during the post-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnWorkload, or in the Keptn namespace. + items: + type: string + type: array + preDeploymentEvaluations: + description: PreDeploymentEvaluations is a list of all evaluations + to be performed during the pre-deployment phase of the KeptnWorkload. + The items of this list refer to the names of KeptnEvaluationDefinitions + located in the same namespace as the KeptnWorkload, or in the Keptn + namespace. + items: + type: string + type: array + preDeploymentTasks: + description: PreDeploymentTasks is a list of all tasks to be performed + during the pre-deployment phase of the KeptnWorkload. The items + of this list refer to the names of KeptnTaskDefinitions located + in the same namespace as the KeptnApp, or in the Keptn namespace. + items: + type: string + type: array + previousVersion: + description: PreviousVersion is the version of the KeptnWorkload that + has been deployed prior to this version. + type: string + resourceReference: + description: ResourceReference is a reference to the Kubernetes resource + (Deployment, DaemonSet, StatefulSet or ReplicaSet) the KeptnWorkload + is representing. + properties: + kind: + type: string + name: + type: string + uid: + description: UID is a type that holds unique ID values, including + UUIDs. Because we don't ONLY use UUIDs, this is an alias to + string. Being a type captures intent and helps make sure that + UIDs and names do not get conflated. + type: string + required: + - kind + - name + - uid + type: object + traceId: + additionalProperties: + type: string + description: TraceId contains the OpenTelemetry trace ID. + type: object + version: + description: Version defines the version of the KeptnWorkload. + type: string + workloadName: + description: WorkloadName is the name of the KeptnWorkload. + type: string + required: + - app + - resourceReference + - version + - workloadName + type: object + status: + description: Status describes the current state of the KeptnWorkloadVersion. + properties: + currentPhase: + description: 'CurrentPhase indicates the current phase of the KeptnWorkloadVersion. + This can be: - PreDeploymentTasks - PreDeploymentEvaluations - Deployment + - PostDeploymentTasks - PostDeploymentEvaluations' + type: string + deploymentStatus: + default: Pending + description: DeploymentStatus indicates the current status of the + KeptnWorkloadVersion's Deployment phase. + type: string + endTime: + description: EndTime represents the time at which the deployment of + the KeptnWorkloadVersion finished. + format: date-time + type: string + phaseTraceIDs: + additionalProperties: + additionalProperties: + type: string + description: MapCarrier is a TextMapCarrier that uses a map held + in memory as a storage medium for propagated key-value pairs. + type: object + description: PhaseTraceIDs contains the trace IDs of the OpenTelemetry + spans of each phase of the KeptnWorkloadVersion + type: object + postDeploymentEvaluationStatus: + default: Pending + description: PostDeploymentEvaluationStatus indicates the current + status of the KeptnWorkloadVersion's PostDeploymentEvaluation phase. + type: string + postDeploymentEvaluationTaskStatus: + description: PostDeploymentEvaluationTaskStatus indicates the current + state of each postDeploymentEvaluation of the KeptnWorkloadVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + description: KeptnState is a string containing current Phase + state (Progressing/Succeeded/Failed/Unknown/Pending/Cancelled) + type: string + type: object + type: array + postDeploymentStatus: + default: Pending + description: PostDeploymentStatus indicates the current status of + the KeptnWorkloadVersion's PostDeployment phase. + type: string + postDeploymentTaskStatus: + description: PostDeploymentTaskStatus indicates the current state + of each postDeploymentTask of the KeptnWorkloadVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + description: KeptnState is a string containing current Phase + state (Progressing/Succeeded/Failed/Unknown/Pending/Cancelled) + type: string + type: object + type: array + preDeploymentEvaluationStatus: + default: Pending + description: PreDeploymentEvaluationStatus indicates the current status + of the KeptnWorkloadVersion's PreDeploymentEvaluation phase. + type: string + preDeploymentEvaluationTaskStatus: + description: PreDeploymentEvaluationTaskStatus indicates the current + state of each preDeploymentEvaluation of the KeptnWorkloadVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + description: KeptnState is a string containing current Phase + state (Progressing/Succeeded/Failed/Unknown/Pending/Cancelled) + type: string + type: object + type: array + preDeploymentStatus: + default: Pending + description: PreDeploymentStatus indicates the current status of the + KeptnWorkloadVersion's PreDeployment phase. + type: string + preDeploymentTaskStatus: + description: PreDeploymentTaskStatus indicates the current state of + each preDeploymentTask of the KeptnWorkloadVersion. + items: + properties: + definitionName: + description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition + type: string + endTime: + description: EndTime represents the time at which the Item (Evaluation/Task) + started. + format: date-time + type: string + name: + description: Name is the name of the Evaluation/Task + type: string + startTime: + description: StartTime represents the time at which the Item + (Evaluation/Task) started. + format: date-time + type: string + status: + default: Pending + description: KeptnState is a string containing current Phase + state (Progressing/Succeeded/Failed/Unknown/Pending/Cancelled) + type: string + type: object + type: array + startTime: + description: StartTime represents the time at which the deployment + of the KeptnWorkloadVersion started. + format: date-time + type: string + status: + default: Pending + description: Status represents the overall status of the KeptnWorkloadVersion. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnapp.yaml b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnapp.yaml new file mode 100644 index 0000000000..ff2dbf62b2 --- /dev/null +++ b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnapp.yaml @@ -0,0 +1,11 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnApp +metadata: + name: keptnapp-sample +spec: + version: "1.3" + workloads: + - name: podtato-head-entry + version: 0.1.0 + postDeploymentEvaluations: + - available-cpus diff --git a/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnappcreationrequest.yaml b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnappcreationrequest.yaml new file mode 100644 index 0000000000..eee28fab0e --- /dev/null +++ b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnappcreationrequest.yaml @@ -0,0 +1,6 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnAppCreationRequest +metadata: + name: keptnappcreationrequest-sample +spec: + appName: my-app diff --git a/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnappversion.yaml b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnappversion.yaml new file mode 100644 index 0000000000..23793589c6 --- /dev/null +++ b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnappversion.yaml @@ -0,0 +1,14 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnAppVersion +metadata: + name: keptnappversion-sample +spec: + appName: podtato-head + preDeploymentTasks: + - pre-deployment-task + preDeploymentEvaluations: + - pre-deployment-evaluation + postDeploymentTasks: + - post-deployment-task + postDeploymentEvaluations: + - post-deployment-evaluation diff --git a/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnevaluation.yaml b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnevaluation.yaml new file mode 100644 index 0000000000..ef26efe494 --- /dev/null +++ b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnevaluation.yaml @@ -0,0 +1,11 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnEvaluation +metadata: + name: keptnevaluation-sample +spec: + appName: my-app + workload: new-workload + workloadVersion: "1.0.0" + evaluationDefinition: my-app-evaluation +status: + retryCount: 2 diff --git a/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnevaluationdefinition.yaml b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnevaluationdefinition.yaml new file mode 100644 index 0000000000..b47939c067 --- /dev/null +++ b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnevaluationdefinition.yaml @@ -0,0 +1,10 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnEvaluationDefinition +metadata: + name: keptnevaluationdefinition-sample +spec: + source: prometheus + objectives: + - name: prometheus + query: "sum(prometheus_engine_query_duration_seconds_count)" + evaluationTarget: ">1000" # string: can only be starting with < or > diff --git a/lifecycle-operator/config/samples/lifecycle_v1beta1_keptntask.yaml b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptntask.yaml new file mode 100644 index 0000000000..ff6fd766eb --- /dev/null +++ b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptntask.yaml @@ -0,0 +1,16 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnTask +metadata: + name: keptntask-sample +spec: + context: + appName: podtato-head + appVersion: '1.3' + taskType: pre + retries: 2 + taskDefinition: pre-task-retries + timeout: 5m0s +status: + message: Job has reached the specified backoff limit + reason: BackoffLimitExceeded + status: Failed diff --git a/lifecycle-operator/config/samples/lifecycle_v1beta1_keptntaskdefinition_container.yaml b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptntaskdefinition_container.yaml new file mode 100644 index 0000000000..c19de7355e --- /dev/null +++ b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptntaskdefinition_container.yaml @@ -0,0 +1,19 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnTaskDefinition +metadata: + name: keptntaskdefinition-sample-container +spec: + container: + name: testy-test + image: busybox:1.36.0 + resources: + limits: + memory: "200Mi" + command: + - 'echo' + - 'Hello World!' + - '>' + - '/cache/log.txt' + volumeMounts: + - mountPath: /cache + name: logger diff --git a/lifecycle-operator/config/samples/lifecycle_v1beta1_keptntaskdefinition_js.yaml b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptntaskdefinition_js.yaml new file mode 100644 index 0000000000..ecd0830984 --- /dev/null +++ b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptntaskdefinition_js.yaml @@ -0,0 +1,10 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnTaskDefinition +metadata: + name: keptntaskdefinition-sample-js +spec: + function: + inline: + code: | + console.log('hello'); + retries: 2 diff --git a/lifecycle-operator/config/samples/lifecycle_v1beta1_keptntaskdefinition_python.yaml b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptntaskdefinition_python.yaml new file mode 100644 index 0000000000..faa5c9e290 --- /dev/null +++ b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptntaskdefinition_python.yaml @@ -0,0 +1,10 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnTaskDefinition +metadata: + name: keptntaskdefinition-sample-py +spec: + function: + inline: + code: | + print("hello"); + retries: 2 diff --git a/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnworkload.yaml b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnworkload.yaml new file mode 100644 index 0000000000..f655625285 --- /dev/null +++ b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnworkload.yaml @@ -0,0 +1,19 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnWorkload +metadata: + name: keptnworkload-sample +spec: + app: "some-keptn-app2" + version: "0.2.7" + preDeploymentTasks: + - pre-deployment-task + preDeploymentEvaluations: + - pre-deployment-evaluation + postDeploymentTasks: + - post-deployment-task + postDeploymentEvaluations: + - post-deployment-evaluation + resourceReference: + kind: ReplicaSet + name: my-replica-set + uid: 957f825e-4025-4ea8-ad22-9292877ff7eb diff --git a/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnworkloadversion.yaml b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnworkloadversion.yaml new file mode 100644 index 0000000000..16cac85886 --- /dev/null +++ b/lifecycle-operator/config/samples/lifecycle_v1beta1_keptnworkloadversion.yaml @@ -0,0 +1,24 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnWorkloadVersion +metadata: + annotations: + traceparent: my-trace-parent + name: some-keptn-workload-version +spec: + app: podtato-head + resourceReference: + kind: ReplicaSet + name: my-replica-set + uid: 957f825e-4025-4ea8-ad22-9292877ff7eb + traceId: + traceparent: my-trace-parent + version: 0.2.7 + preDeploymentTasks: + - pre-deployment-task + preDeploymentEvaluations: + - pre-deployment-evaluation + postDeploymentTasks: + - post-deployment-task + postDeploymentEvaluations: + - post-deployment-evaluation + workloadName: some-keptn-workload-instance-2 diff --git a/lifecycle-operator/main.go b/lifecycle-operator/main.go index 315147e93a..3560dc1938 100644 --- a/lifecycle-operator/main.go +++ b/lifecycle-operator/main.go @@ -34,6 +34,7 @@ import ( lifecyclev1alpha2 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha2" lifecyclev1alpha3 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3" lifecyclev1alpha4 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha4" + lifecyclev1beta1 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1" optionsv1alpha1 "github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/options/v1alpha1" "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/config" "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/evaluation" @@ -82,6 +83,7 @@ func init() { utilruntime.Must(lifecyclev1alpha3.AddToScheme(scheme)) utilruntime.Must(argov1alpha1.AddToScheme(scheme)) utilruntime.Must(lifecyclev1alpha4.AddToScheme(scheme)) + utilruntime.Must(lifecyclev1beta1.AddToScheme(scheme)) // +kubebuilder:scaffold:scheme } diff --git a/test/integration/api-conversion-v1alpha-to-v1beta1/00-assert.yaml b/test/integration/api-conversion-v1alpha-to-v1beta1/00-assert.yaml new file mode 100644 index 0000000000..ee470de210 --- /dev/null +++ b/test/integration/api-conversion-v1alpha-to-v1beta1/00-assert.yaml @@ -0,0 +1,111 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnApp +metadata: + name: "some-keptn-app2" +spec: + version: "1.2.3" + revision: 123 +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnAppVersion +metadata: + name: "some-keptn-app-version-2" +spec: + appName: podtato-head + preDeploymentTasks: + - pre-deployment-task + postDeploymentTasks: + - post-deployment-task + traceId: + traceparent: my-trace-parent + version: 0.1.0 + workloads: + - name: some-keptn-app2 + version: 0.2.7 +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnWorkload +metadata: + name: some-keptn-app2 +spec: + app: podtato-head + version: 0.1.0 + preDeploymentTasks: + - pre-deployment-task + postDeploymentTasks: + - post-deployment-task + resourceReference: + kind: ReplicaSet + name: my-replica-set + uid: 957f825e-4025-4ea8-ad22-9292877ff7eb +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnWorkloadVersion +metadata: + name: some-keptn-app-2-0.1.0 +spec: + app: some-keptn-app2 + version: 0.1.0 + preDeploymentTasks: + - pre-deployment-task + postDeploymentTasks: + - post-deployment-task + traceId: + traceparent: my-trace-parent + workloadName: some-keptn-app2 + resourceReference: + kind: ReplicaSet + name: my-replica-set + uid: 957f825e-4025-4ea8-ad22-9292877ff7eb +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnAppCreationRequest +metadata: + name: some-keptn-app2 +spec: + appName: podtato-head +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnTaskDefinition +metadata: + name: some-keptn-app-version-2-task +spec: + function: + inline: + code: | + console.log("Okay") +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnTask +metadata: + name: some-keptn-app-version-2 +spec: + taskDefinition: some-keptn-app-version-2-task + context: + appName: "some-keptn-app2" + appVersion: "1.2.3" + objectType: "" + taskType: "" + workloadName: "some-keptn-app2" + workloadVersion: "0.2.7" +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnEvaluationDefinition +metadata: + name: some-keptn-app-version-2 +spec: + objectives: + - evaluationTarget: ">1000" + keptnMetricRef: + name: available-cpus +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnEvaluation +metadata: + name: some-keptn-app-version-2 +spec: + workload: "some-keptn-app2" + workloadVersion: "0.2.7" + appName: "some-keptn-app2" + appVersion: "1.2.3" + evaluationDefinition: "some-keptn-app-version-2" diff --git a/test/integration/api-conversion-v1alpha-to-v1beta1/00-install.yaml b/test/integration/api-conversion-v1alpha-to-v1beta1/00-install.yaml new file mode 100644 index 0000000000..284e98d39c --- /dev/null +++ b/test/integration/api-conversion-v1alpha-to-v1beta1/00-install.yaml @@ -0,0 +1,112 @@ +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnApp +metadata: + name: "some-keptn-app2" +spec: + version: "1.2.3" + revision: 123 +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnAppVersion +metadata: + name: "some-keptn-app-version-2" +spec: + appName: podtato-head + revision: 1 + preDeploymentTasks: + - pre-deployment-task + postDeploymentTasks: + - post-deployment-task + traceId: + traceparent: my-trace-parent + version: 0.1.0 + workloads: + - name: some-keptn-app2 + version: 0.2.7 +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnWorkload +metadata: + name: some-keptn-app2 +spec: + app: podtato-head + version: 0.1.0 + preDeploymentTasks: + - pre-deployment-task + postDeploymentTasks: + - post-deployment-task + resourceReference: + kind: ReplicaSet + name: my-replica-set + uid: 957f825e-4025-4ea8-ad22-9292877ff7eb +--- +apiVersion: lifecycle.keptn.sh/v1alpha4 +kind: KeptnWorkloadVersion +metadata: + name: some-keptn-app-2-0.1.0 +spec: + app: some-keptn-app2 + version: 0.1.0 + preDeploymentTasks: + - pre-deployment-task + postDeploymentTasks: + - post-deployment-task + traceId: + traceparent: my-trace-parent + workloadName: some-keptn-app2 + resourceReference: + kind: ReplicaSet + name: my-replica-set + uid: 957f825e-4025-4ea8-ad22-9292877ff7eb +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnAppCreationRequest +metadata: + name: some-keptn-app2 +spec: + appName: podtato-head +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnTaskDefinition +metadata: + name: some-keptn-app-version-2-task +spec: + function: + inline: + code: | + console.log("Okay") +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnTask +metadata: + name: some-keptn-app-version-2 +spec: + taskDefinition: some-keptn-app-version-2-task + context: + appName: "some-keptn-app2" + appVersion: "1.2.3" + objectType: "" + taskType: "" + workloadName: "some-keptn-app2" + workloadVersion: "0.2.7" +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnEvaluationDefinition +metadata: + name: some-keptn-app-version-2 +spec: + objectives: + - evaluationTarget: ">1000" + keptnMetricRef: + name: available-cpus +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnEvaluation +metadata: + name: some-keptn-app-version-2 +spec: + workload: "some-keptn-app2" + workloadVersion: "0.2.7" + appName: "some-keptn-app2" + appVersion: "1.2.3" + evaluationDefinition: "some-keptn-app-version-2" diff --git a/test/integration/api-conversion-v1beta1-to-v1alpha/00-assert.yaml b/test/integration/api-conversion-v1beta1-to-v1alpha/00-assert.yaml new file mode 100644 index 0000000000..284e98d39c --- /dev/null +++ b/test/integration/api-conversion-v1beta1-to-v1alpha/00-assert.yaml @@ -0,0 +1,112 @@ +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnApp +metadata: + name: "some-keptn-app2" +spec: + version: "1.2.3" + revision: 123 +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnAppVersion +metadata: + name: "some-keptn-app-version-2" +spec: + appName: podtato-head + revision: 1 + preDeploymentTasks: + - pre-deployment-task + postDeploymentTasks: + - post-deployment-task + traceId: + traceparent: my-trace-parent + version: 0.1.0 + workloads: + - name: some-keptn-app2 + version: 0.2.7 +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnWorkload +metadata: + name: some-keptn-app2 +spec: + app: podtato-head + version: 0.1.0 + preDeploymentTasks: + - pre-deployment-task + postDeploymentTasks: + - post-deployment-task + resourceReference: + kind: ReplicaSet + name: my-replica-set + uid: 957f825e-4025-4ea8-ad22-9292877ff7eb +--- +apiVersion: lifecycle.keptn.sh/v1alpha4 +kind: KeptnWorkloadVersion +metadata: + name: some-keptn-app-2-0.1.0 +spec: + app: some-keptn-app2 + version: 0.1.0 + preDeploymentTasks: + - pre-deployment-task + postDeploymentTasks: + - post-deployment-task + traceId: + traceparent: my-trace-parent + workloadName: some-keptn-app2 + resourceReference: + kind: ReplicaSet + name: my-replica-set + uid: 957f825e-4025-4ea8-ad22-9292877ff7eb +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnAppCreationRequest +metadata: + name: some-keptn-app2 +spec: + appName: podtato-head +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnTaskDefinition +metadata: + name: some-keptn-app-version-2-task +spec: + function: + inline: + code: | + console.log("Okay") +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnTask +metadata: + name: some-keptn-app-version-2 +spec: + taskDefinition: some-keptn-app-version-2-task + context: + appName: "some-keptn-app2" + appVersion: "1.2.3" + objectType: "" + taskType: "" + workloadName: "some-keptn-app2" + workloadVersion: "0.2.7" +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnEvaluationDefinition +metadata: + name: some-keptn-app-version-2 +spec: + objectives: + - evaluationTarget: ">1000" + keptnMetricRef: + name: available-cpus +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnEvaluation +metadata: + name: some-keptn-app-version-2 +spec: + workload: "some-keptn-app2" + workloadVersion: "0.2.7" + appName: "some-keptn-app2" + appVersion: "1.2.3" + evaluationDefinition: "some-keptn-app-version-2" diff --git a/test/integration/api-conversion-v1beta1-to-v1alpha/00-install.yaml b/test/integration/api-conversion-v1beta1-to-v1alpha/00-install.yaml new file mode 100644 index 0000000000..ee470de210 --- /dev/null +++ b/test/integration/api-conversion-v1beta1-to-v1alpha/00-install.yaml @@ -0,0 +1,111 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnApp +metadata: + name: "some-keptn-app2" +spec: + version: "1.2.3" + revision: 123 +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnAppVersion +metadata: + name: "some-keptn-app-version-2" +spec: + appName: podtato-head + preDeploymentTasks: + - pre-deployment-task + postDeploymentTasks: + - post-deployment-task + traceId: + traceparent: my-trace-parent + version: 0.1.0 + workloads: + - name: some-keptn-app2 + version: 0.2.7 +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnWorkload +metadata: + name: some-keptn-app2 +spec: + app: podtato-head + version: 0.1.0 + preDeploymentTasks: + - pre-deployment-task + postDeploymentTasks: + - post-deployment-task + resourceReference: + kind: ReplicaSet + name: my-replica-set + uid: 957f825e-4025-4ea8-ad22-9292877ff7eb +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnWorkloadVersion +metadata: + name: some-keptn-app-2-0.1.0 +spec: + app: some-keptn-app2 + version: 0.1.0 + preDeploymentTasks: + - pre-deployment-task + postDeploymentTasks: + - post-deployment-task + traceId: + traceparent: my-trace-parent + workloadName: some-keptn-app2 + resourceReference: + kind: ReplicaSet + name: my-replica-set + uid: 957f825e-4025-4ea8-ad22-9292877ff7eb +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnAppCreationRequest +metadata: + name: some-keptn-app2 +spec: + appName: podtato-head +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnTaskDefinition +metadata: + name: some-keptn-app-version-2-task +spec: + function: + inline: + code: | + console.log("Okay") +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnTask +metadata: + name: some-keptn-app-version-2 +spec: + taskDefinition: some-keptn-app-version-2-task + context: + appName: "some-keptn-app2" + appVersion: "1.2.3" + objectType: "" + taskType: "" + workloadName: "some-keptn-app2" + workloadVersion: "0.2.7" +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnEvaluationDefinition +metadata: + name: some-keptn-app-version-2 +spec: + objectives: + - evaluationTarget: ">1000" + keptnMetricRef: + name: available-cpus +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnEvaluation +metadata: + name: some-keptn-app-version-2 +spec: + workload: "some-keptn-app2" + workloadVersion: "0.2.7" + appName: "some-keptn-app2" + appVersion: "1.2.3" + evaluationDefinition: "some-keptn-app-version-2"