You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Object: map[string]interface{}{
// +operator-builder:resource:field=certProvider,value="letsencrypt-staging",include"apiVersion": "cert-manager.io/v1",
"kind": "ClusterIssuer",
"metadata": map[string]interface{}{
"name": "letsencrypt-staging",
"creationTimestamp": nil,
"annotations": map[string]interface{}{
// controlled by field: certProvider// +kubebuilder:validation:Enum=letsencrypt-staging;letsencrypt-production// Certificate provider to use. Use one of: letsencrypt-staging or letsencrypt-production."cert-provider": "my-provider",
},
},
This could be from a user who copied a YAML directly from another Kubernetes cluster. In this situation, the creationTimestamp field is directly controlled by the Kubernetes controllers. This is fine for applying to the cluster, but if we are comparing the desired state, we should ignore these fields.
Additionally, the ignoring of these fields should come at creation time, not during reconciliation. This means that we should do one of the following:
Error out during creation of resources and explain to user to fix their YAML
Forcefully strip out known "uncontrollable" fields and generate YAML that way
During discussion with @lander2k2 we decided it is best to implement the following:
Error out during creation of resources
Notify user that they can provide a --remove-fields flag or a --keep-fields flag that will either remove the known problem fields or keep the known problem fields. This would be up to user discretion to make the choice
Fields to ignore, for first pass, should be the following:
Consider the following input YAML manifest:
Which produces the following go structure:
This could be from a user who copied a YAML directly from another Kubernetes cluster. In this situation, the
creationTimestamp
field is directly controlled by the Kubernetes controllers. This is fine for applying to the cluster, but if we are comparing the desired state, we should ignore these fields.Additionally, the ignoring of these fields should come at creation time, not during reconciliation. This means that we should do one of the following:
During discussion with @lander2k2 we decided it is best to implement the following:
--remove-fields
flag or a--keep-fields
flag that will either remove the known problem fields or keep the known problem fields. This would be up to user discretion to make the choiceFields to ignore, for first pass, should be the following:
.status
.metadata.creationTimestamp
.metadata.ownerReferences
.metadata.generation
.metadata.resourceVersion
.metadata.annotations['deployment.kubernetes.io/revision']
.metadata.annotations['kubectl.kubernetes.io/last-applied-configuration']
These fields should exist with in a library and be expected to grow over time.
The text was updated successfully, but these errors were encountered: