community
community copied to clipboard
Missing package metav1 in zz_conversions.go
Describe the bug
The package metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
is not imported in zz_conversions.go, when the dependent fields are manually added through the generator-config.yaml.
This concerns the fields with the struct time.Time
(in AWS SKD) that are converted to the struct metav1.Time
.
I came across this behavior while working on crossplane controllers for the Glue
API.
The resources Connection
and Crawler
have output fields that are missing in the CRDs StatusFields collection.
Example:
The resource Connection
has the field CreationTime
of type *time.Time
that we can observe through GetConnectionOutput.Connection.
To get that field added to ConnectionObservation
, I add the following to the generator-config.yaml:
resources:
Connection:
fields:
CreationTime:
is_read_only: true
from:
operation: GetConnection
path: Connection.CreationTime
After the generation the field appears as expected in zz_connection.go: CreationTime *metav1.Time
Also in zz_conversions.go the field is handled as expected in GenerateConnection()
:
if resp.Connection.CreationTime != nil {
cr.Status.AtProvider.CreationTime = &metav1.Time{*resp.Connection.CreationTime}
} else {
cr.Status.AtProvider.CreationTime = nil
}
Only the package metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
is not imported and thus the code is not compiling.
As a workaround i add this to CreationTime
in the generator-config.yaml:
set:
- methode: ReadOne
ignore: true
so that I can simply set the value manually to the field in postObserve()
.
While playing around with this, I noticed that, when in setup.go the package metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
is imported, the generator manages to correctly import it in zz_conversions.go too (after undoing the workaround in generator-config.yaml) ...
However that is only a considerable workaround as long as I need the package in setup.go for something else.
Steps to reproduce See above.
Tried another quick test with the same result for resource Broker
(service: mq
) when adding the field Created
.
- add field in generator-config.yaml (service:
mq
) like this:
resources:
Broker:
fields:
Created:
is_read_only: true
from:
operation: DescribeBroker
path: Created
- run
make services SERVICES=mq
- => no
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
import in zz_conversions.go
Expected outcome
I would expect the package correctly imported like this in zz_conversions.go:
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Environment
- Crossplane Provider-AWS
- Kubernetes version N/A
- Using EKS (yes/no), if so version? no
- AWS service targeted (S3, RDS, etc.) Glue, MQ
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
Provide feedback via https://github.com/aws-controllers-k8s/community.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
.
Provide feedback via https://github.com/aws-controllers-k8s/community.
/lifecycle rotten
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen
.
Provide feedback via https://github.com/aws-controllers-k8s/community.
/close
@ack-bot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity. Reopen the issue with
/reopen
. Provide feedback via https://github.com/aws-controllers-k8s/community. /close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
/reopen
@haarchri: You can't reopen an issue/PR unless you authored it or you are a collaborator.
In response to this:
/reopen
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
/reopen