Skip to content

Commit

Permalink
[FEATURE] - Resource Count Delection Skipping (#1194)
Browse files Browse the repository at this point in the history
* [FEATURE] - Resource Count Delection Skipping

When then configuration has not provisioned any ressources, we can skip the deletion job

* fix: adding the suggested amendments

* chore: adding a fake dummy module, that does nothing
  • Loading branch information
gambol99 committed Jan 19, 2024
1 parent 91e36ee commit 2f5bd63
Show file tree
Hide file tree
Showing 18 changed files with 1,656 additions and 438 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ me.yaml
tmp/
TODO
TODO.md
main.tf

# Terraform Related
terraform.tfstate
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

55 changes: 44 additions & 11 deletions charts/terranetes-controller/crds/terraform.appvia.io_contexts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
controller-gen.kubebuilder.io/version: v0.14.0
name: contexts.terraform.appvia.io
spec:
group: terraform.appvia.io
Expand All @@ -25,10 +25,19 @@ spec:
description: Context is the schema for the context type
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'
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'
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
Expand All @@ -39,7 +48,10 @@ spec:
additionalProperties:
type: object
x-kubernetes-preserve-unknown-fields: true
description: Variables is a list of variables which can be used globally by Context resources. The structure of the variables is a map of key/value pairs, which MUST have both a description and a value.
description: |-
Variables is a list of variables which can be used globally by Context resources.
The structure of the variables is a map of key/value pairs, which MUST have both
a description and a value.
type: object
required:
- variables
Expand All @@ -53,27 +65,41 @@ spec:
description: Condition is the current observed condition of some aspect of a resource
properties:
detail:
description: Detail is any additional human-readable detail to understand this condition, for example, the full underlying error which caused an issue
description: |-
Detail is any additional human-readable detail to understand this condition, for example,
the full underlying error which caused an issue
type: string
lastTransitionTime:
description: LastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
description: |-
LastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: Message is a human readable message indicating details about the transition. This may be an empty string.
description: |-
Message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
name:
description: Name is a human-readable name for this condition.
minLength: 1
type: string
observedGeneration:
description: ObservedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.
description: |-
ObservedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: Reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
description: |-
Reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
Expand All @@ -86,7 +112,12 @@ spec:
- Unknown
type: string
type:
description: Type of condition in CamelCase or in foo.example.com/CamelCase. --- Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
description: |-
Type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
Expand All @@ -113,7 +144,9 @@ spec:
type: string
type: object
lastSuccess:
description: LastSuccess descibes the generation and time of the last reconciliation which resulted in a Success status
description: |-
LastSuccess descibes the generation and time of the last reconciliation which resulted in
a Success status
properties:
generation:
description: Generation is the generation reconciled on the last reconciliation
Expand Down
50 changes: 40 additions & 10 deletions charts/terranetes-controller/crds/terraform.appvia.io_plans.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
controller-gen.kubebuilder.io/version: v0.14.0
name: plans.terraform.appvia.io
spec:
group: terraform.appvia.io
Expand All @@ -28,10 +28,19 @@ spec:
description: Plan is the schema for the plan type
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'
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'
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
Expand Down Expand Up @@ -64,27 +73,41 @@ spec:
description: Condition is the current observed condition of some aspect of a resource
properties:
detail:
description: Detail is any additional human-readable detail to understand this condition, for example, the full underlying error which caused an issue
description: |-
Detail is any additional human-readable detail to understand this condition, for example,
the full underlying error which caused an issue
type: string
lastTransitionTime:
description: LastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
description: |-
LastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: Message is a human readable message indicating details about the transition. This may be an empty string.
description: |-
Message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
name:
description: Name is a human-readable name for this condition.
minLength: 1
type: string
observedGeneration:
description: ObservedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.
description: |-
ObservedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: Reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
description: |-
Reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
Expand All @@ -97,7 +120,12 @@ spec:
- Unknown
type: string
type:
description: Type of condition in CamelCase or in foo.example.com/CamelCase. --- Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
description: |-
Type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
Expand All @@ -124,7 +152,9 @@ spec:
type: string
type: object
lastSuccess:
description: LastSuccess descibes the generation and time of the last reconciliation which resulted in a Success status
description: |-
LastSuccess descibes the generation and time of the last reconciliation which resulted in
a Success status
properties:
generation:
description: Generation is the generation reconciled on the last reconciliation
Expand Down
Loading

0 comments on commit 2f5bd63

Please sign in to comment.