-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cr group kind fixes #879
Cr group kind fixes #879
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test fixes are just to deal with the fact that Custom Resources are now represented by $kind.$group
, not just kind
.
@@ -74,7 +74,7 @@ def predeploy_sequence | |||
Pod | |||
).map { |r| [r, default_group] } | |||
|
|||
crs = cluster_resource_discoverer.crds.select(&:predeployed?).map { |cr| [cr.kind, { group: cr.group }] } | |||
crs = cluster_resource_discoverer.crds.select(&:predeployed?).map { |cr| [cr.group_kind, { group: cr.group }] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the redundancy of duplicating group information makes this fix much easier to implement, and is really just an internal consideration, anyway, so it felt like it was worth it.
@@ -241,7 +241,7 @@ def discover_resources | |||
crds_by_group_kind = cluster_resource_discoverer.crds.group_by(&:group_kind) | |||
@template_sets.with_resource_definitions(current_sha: @current_sha, bindings: @bindings) do |r_def| | |||
group, kind = group_kind_for_r_def(r_def) | |||
crd = crds_by_group_kind[group + "/" + kind]&.first | |||
crd = crds_by_group_kind["#{kind}.#{group}"]&.first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've adopted the convention of displaying group-kind information as $KIND.$GROUP
, which mirrors how tools like kubectl, etc. work. e.g. deployments.apps
@@ -96,6 +96,7 @@ def test_cr_instance_fails_validation_when_rollout_conditions_for_crd_invalid | |||
logger: @logger, statsd_tags: @statsd_tags, crd: crd, | |||
definition: { | |||
"kind" => "UnitTest", | |||
"apiVersion" => "stable.example.io/v1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apiVersion
is required of any k8s resource, so it makes more sense to add it here than try to code around its absence
2c7fafd
into
grouping_cluster_resources_by_group_and_kind
What are you trying to accomplish with this PR?
Fixes the problem whereby custom resources can not discriminate between the same kind in different groups. This actually involved changes to
#predeploy_sequence
andCustomResource(Definition)
Note this doesn't solve the wider problem of multiple kinds among different standard API groups: that will require more changes than what's here