Skip to content

Commit

Permalink
Remove operatorCondition lastTransitionTime
Browse files Browse the repository at this point in the history
Problem: The OperatorCondition CRD has a requirement that the
spec.overrides[*].lastTransitionTime is provided, which makes this API
difficult for humans to use.

Solution: Use yq to remove the requirement on the
opeatorCondition.spec.overrides[*].lastTransitionTime field.
  • Loading branch information
awgreene committed Dec 14, 2020
1 parent 0f2bc27 commit cfe3c8d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ manifests: controller-gen ## Generate manifests e.g. CRD, RBAC etc
@# Preserve fields for embedded metadata fields
$(Q)$(YQ) w --inplace ./crds/operators.coreos.com_clusterserviceversions.yaml spec.versions[0].schema.openAPIV3Schema.properties.spec.properties.install.properties.spec.properties.deployments.items.properties.spec.properties.template.properties.metadata.x-kubernetes-preserve-unknown-fields true

@# Remove OperatorCondition.spec.overrides[*].lastTransitionTime requirement
$(Q)$(YQ) delete --inplace ./crds/operators.coreos.com_operatorconditions.yaml 'spec.versions[*].schema.openAPIV3Schema.properties.spec.properties.overrides.items.required(.==lastTransitionTime)'

@# Remove status subresource from the CRD manifests to ensure server-side apply works
$(Q)for f in ./crds/*.yaml ; do $(YQ) d --inplace $$f status; done

Expand Down
1 change: 0 additions & 1 deletion crds/operators.coreos.com_operatorconditions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ spec:
description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
type: object
required:
- lastTransitionTime
- message
- reason
- status
Expand Down
Loading

0 comments on commit cfe3c8d

Please sign in to comment.