Skip to content

Commit 2b63756

Browse files
Merge pull request #596 from erikgb/use-upstream-meta-condition
Use upstream metav1.Condition instead of our own BundleCondition
2 parents addd9d0 + d5d2916 commit 2b63756

File tree

10 files changed

+102
-160
lines changed

10 files changed

+102
-160
lines changed

deploy/charts/trust-manager/templates/crd-trust.cert-manager.io_bundles.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -371,54 +371,54 @@ spec:
371371
List of status conditions to indicate the status of the Bundle.
372372
Known condition types are `Bundle`.
373373
items:
374-
description: BundleCondition contains condition information for a Bundle.
374+
description: Condition contains details for one aspect of the current state of this API Resource.
375375
properties:
376376
lastTransitionTime:
377377
description: |-
378-
LastTransitionTime is the timestamp corresponding to the last status
379-
change of this condition.
378+
lastTransitionTime is the last time the condition transitioned from one status to another.
379+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
380380
format: date-time
381381
type: string
382382
message:
383383
description: |-
384-
Message is a human-readable description of the details of the last
385-
transition, complementing reason.
384+
message is a human readable message indicating details about the transition.
385+
This may be an empty string.
386386
maxLength: 32768
387387
type: string
388388
observedGeneration:
389389
description: |-
390-
If set, this represents the .metadata.generation that the condition was
391-
set based upon.
392-
For instance, if .metadata.generation is currently 12, but the
393-
.status.condition[x].observedGeneration is 9, the condition is out of date
394-
with respect to the current state of the Bundle.
390+
observedGeneration represents the .metadata.generation that the condition was set based upon.
391+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
392+
with respect to the current state of the instance.
395393
format: int64
396394
minimum: 0
397395
type: integer
398396
reason:
399397
description: |-
400-
Reason is a brief machine-readable explanation for the condition's last
401-
transition.
398+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
399+
Producers of specific condition types may define expected values and meanings for this field,
400+
and whether the values are considered a guaranteed API.
402401
The value should be a CamelCase string.
403402
This field may not be empty.
404403
maxLength: 1024
405404
minLength: 1
406405
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
407406
type: string
408407
status:
409-
description: Status of the condition, one of True, False, Unknown.
408+
description: status of the condition, one of True, False, Unknown.
410409
enum:
411410
- "True"
412411
- "False"
413412
- Unknown
414413
type: string
415414
type:
416-
description: Type of the condition, known values are (`Synced`).
415+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
417416
maxLength: 316
418417
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])$
419418
type: string
420419
required:
421420
- lastTransitionTime
421+
- message
422422
- reason
423423
- status
424424
- type

deploy/crds/trust.cert-manager.io_bundles.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -383,55 +383,55 @@ spec:
383383
List of status conditions to indicate the status of the Bundle.
384384
Known condition types are `Bundle`.
385385
items:
386-
description: BundleCondition contains condition information for
387-
a Bundle.
386+
description: Condition contains details for one aspect of the current
387+
state of this API Resource.
388388
properties:
389389
lastTransitionTime:
390390
description: |-
391-
LastTransitionTime is the timestamp corresponding to the last status
392-
change of this condition.
391+
lastTransitionTime is the last time the condition transitioned from one status to another.
392+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
393393
format: date-time
394394
type: string
395395
message:
396396
description: |-
397-
Message is a human-readable description of the details of the last
398-
transition, complementing reason.
397+
message is a human readable message indicating details about the transition.
398+
This may be an empty string.
399399
maxLength: 32768
400400
type: string
401401
observedGeneration:
402402
description: |-
403-
If set, this represents the .metadata.generation that the condition was
404-
set based upon.
405-
For instance, if .metadata.generation is currently 12, but the
406-
.status.condition[x].observedGeneration is 9, the condition is out of date
407-
with respect to the current state of the Bundle.
403+
observedGeneration represents the .metadata.generation that the condition was set based upon.
404+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
405+
with respect to the current state of the instance.
408406
format: int64
409407
minimum: 0
410408
type: integer
411409
reason:
412410
description: |-
413-
Reason is a brief machine-readable explanation for the condition's last
414-
transition.
411+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
412+
Producers of specific condition types may define expected values and meanings for this field,
413+
and whether the values are considered a guaranteed API.
415414
The value should be a CamelCase string.
416415
This field may not be empty.
417416
maxLength: 1024
418417
minLength: 1
419418
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
420419
type: string
421420
status:
422-
description: Status of the condition, one of True, False, Unknown.
421+
description: status of the condition, one of True, False, Unknown.
423422
enum:
424423
- "True"
425424
- "False"
426425
- Unknown
427426
type: string
428427
type:
429-
description: Type of the condition, known values are (`Synced`).
428+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
430429
maxLength: 316
431430
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])$
432431
type: string
433432
required:
434433
- lastTransitionTime
434+
- message
435435
- reason
436436
- status
437437
- type

pkg/apis/trust/v1alpha1/types_bundle.go

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ type BundleStatus struct {
226226
// +listType=map
227227
// +listMapKey=type
228228
// +optional
229-
Conditions []BundleCondition `json:"conditions,omitempty"`
229+
Conditions []metav1.Condition `json:"conditions,omitempty"`
230230

231231
// DefaultCAPackageVersion, if set and non-empty, indicates the version information
232232
// which was retrieved when the set of default CAs was requested in the bundle
@@ -236,48 +236,6 @@ type BundleStatus struct {
236236
DefaultCAPackageVersion *string `json:"defaultCAVersion,omitempty"`
237237
}
238238

239-
// BundleCondition contains condition information for a Bundle.
240-
type BundleCondition struct {
241-
// Type of the condition, known values are (`Synced`).
242-
// +kubebuilder:validation: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])$`
243-
// +kubebuilder:validation:MaxLength=316
244-
Type string `json:"type"`
245-
246-
// Status of the condition, one of True, False, Unknown.
247-
// +kubebuilder:validation:Enum=True;False;Unknown
248-
Status metav1.ConditionStatus `json:"status"`
249-
250-
// LastTransitionTime is the timestamp corresponding to the last status
251-
// change of this condition.
252-
// +kubebuilder:validation:Type=string
253-
// +kubebuilder:validation:Format=date-time
254-
LastTransitionTime metav1.Time `json:"lastTransitionTime"`
255-
256-
// Reason is a brief machine-readable explanation for the condition's last
257-
// transition.
258-
// The value should be a CamelCase string.
259-
// This field may not be empty.
260-
// +kubebuilder:validation:MaxLength=1024
261-
// +kubebuilder:validation:MinLength=1
262-
// +kubebuilder:validation:Pattern=`^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$`
263-
Reason string `json:"reason"`
264-
265-
// Message is a human-readable description of the details of the last
266-
// transition, complementing reason.
267-
// +optional
268-
// +kubebuilder:validation:MaxLength=32768
269-
Message string `json:"message,omitempty"`
270-
271-
// If set, this represents the .metadata.generation that the condition was
272-
// set based upon.
273-
// For instance, if .metadata.generation is currently 12, but the
274-
// .status.condition[x].observedGeneration is 9, the condition is out of date
275-
// with respect to the current state of the Bundle.
276-
// +optional
277-
// +kubebuilder:validation:Minimum=0
278-
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
279-
}
280-
281239
const (
282240
// DefaultJKSPassword is the default password that Java uses; it's a Java convention to use this exact password.
283241
// Since we're not storing anything secret in the JKS files we generate, this password is not a meaningful security measure

pkg/apis/trust/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/bundle/bundle.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func (b *bundle) reconcileBundle(ctx context.Context, req ctrl.Request) (result
141141
b.setBundleCondition(
142142
bundle.Status.Conditions,
143143
&statusPatch.Conditions,
144-
trustapi.BundleCondition{
144+
metav1.Condition{
145145
Type: trustapi.BundleConditionSynced,
146146
Status: metav1.ConditionFalse,
147147
Reason: "SourceNotFound",
@@ -170,7 +170,7 @@ func (b *bundle) reconcileBundle(ctx context.Context, req ctrl.Request) (result
170170
b.setBundleCondition(
171171
bundle.Status.Conditions,
172172
&statusPatch.Conditions,
173-
trustapi.BundleCondition{
173+
metav1.Condition{
174174
Type: trustapi.BundleConditionSynced,
175175
Status: metav1.ConditionFalse,
176176
Reason: "SecretTargetsDisabled",
@@ -289,7 +289,7 @@ func (b *bundle) reconcileBundle(ctx context.Context, req ctrl.Request) (result
289289
b.setBundleCondition(
290290
bundle.Status.Conditions,
291291
&statusPatch.Conditions,
292-
trustapi.BundleCondition{
292+
metav1.Condition{
293293
Type: trustapi.BundleConditionSynced,
294294
Status: metav1.ConditionFalse,
295295
Reason: fmt.Sprintf("Sync%sTargetFailed", t.Kind),
@@ -316,7 +316,7 @@ func (b *bundle) reconcileBundle(ctx context.Context, req ctrl.Request) (result
316316
message = fmt.Sprintf("Successfully synced Bundle to namespaces that match this label selector: %s", namespaceSelector)
317317
}
318318

319-
syncedCondition := trustapi.BundleCondition{
319+
syncedCondition := metav1.Condition{
320320
Type: trustapi.BundleConditionSynced,
321321
Status: metav1.ConditionTrue,
322322
Reason: "Synced",

0 commit comments

Comments
 (0)