community icon indicating copy to clipboard operation
community copied to clipboard

Pluralise FieldExport into many rather than one mapping

Open danielloader opened this issue 10 months ago • 1 comments

Is your feature request related to a problem?

Currently I need to have multiple field exports for objects created by ACK, and resources created with more usable and pertinent data fields incur even more field exports.

apiVersion: services.k8s.aws/v1alpha1
kind: FieldExport
metadata:
  name: export-user-data-bucket
spec:  
  to:
    name: application-user-data-cm # Matches the ConfigMap we created above
    kind: configmap
  from:
    path: ".status.location"
    resource:
      group: s3.services.k8s.aws
      kind: Bucket
      name: application-user-data

Describe the solution you'd like

Allow FieldExport to take an array of field exports to minimise the object count. Either an array top level on the .spec or nested under .spec.exports should the need to add additional configuration come up. Could extrapolate the .spec.to.name and .spec.to.kind to a shared key in the spec and only denote only the .spec.to.key spec per field export, but that may be over optimisation.

apiVersion: services.k8s.aws/v1alpha2
kind: FieldExport
metadata:
  name: export-user-data-bucket
spec:  
  - to:
      name: application-user-data-cm # Matches the ConfigMap we created above
      kind: configmap
      key: region
    from:
      path: ".status.location"
      resource:
        group: s3.services.k8s.aws
        kind: Bucket
        name: application-user-data
  - to:
      name: application-user-data-cm # Matches the ConfigMap we created above
      kind: configmap
      key: name
    from:
      path: ".spec.name"
      resource:
        group: s3.services.k8s.aws
        kind: Bucket
        name: application-user-data
apiVersion: services.k8s.aws/v1alpha2
kind: FieldExport
metadata:
  name: export-user-data-bucket
spec:  
  fields:
    - to:
        name: application-user-data-cm # Matches the ConfigMap we created above
        kind: configmap
        key: region
      from:
        path: ".status.location"
        resource:
          group: s3.services.k8s.aws
          kind: Bucket
          name: application-user-data
    - to:
        name: application-user-data-cm # Matches the ConfigMap we created above
        kind: configmap
        key: name
      from:
        path: ".spec.name"
        resource:
          group: s3.services.k8s.aws
          kind: Bucket
          name: application-user-data

Describe alternatives you've considered Multiple FieldExports for objects with multiple fields I wish to map to a configmap/secret.

danielloader avatar Sep 02 '23 09:09 danielloader