Skip to content

Commit f2e3761

Browse files
committed
Do not split apiVersion into group/verson
1 parent fcc6386 commit f2e3761

2 files changed

Lines changed: 30 additions & 51 deletions

File tree

‎openshift/manifests-summary.yaml‎

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,55 @@
11
default:
2-
- group: rbac.authorization.k8s.io
2+
- apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
44
name: capa-manager-role
5-
version: v1
6-
- group: rbac.authorization.k8s.io
5+
- apiVersion: rbac.authorization.k8s.io/v1
76
kind: ClusterRoleBinding
87
name: capa-manager-rolebinding
9-
version: v1
10-
- group: apiextensions.k8s.io
8+
- apiVersion: apiextensions.k8s.io/v1
119
kind: CustomResourceDefinition
1210
name: awsclustercontrolleridentities.infrastructure.cluster.x-k8s.io
13-
version: v1
14-
- group: apiextensions.k8s.io
11+
- apiVersion: apiextensions.k8s.io/v1
1512
kind: CustomResourceDefinition
1613
name: awsclusters.infrastructure.cluster.x-k8s.io
17-
version: v1
18-
- group: apiextensions.k8s.io
14+
- apiVersion: apiextensions.k8s.io/v1
1915
kind: CustomResourceDefinition
2016
name: awsmachines.infrastructure.cluster.x-k8s.io
21-
version: v1
22-
- group: apiextensions.k8s.io
17+
- apiVersion: apiextensions.k8s.io/v1
2318
kind: CustomResourceDefinition
2419
name: awsmachinetemplates.infrastructure.cluster.x-k8s.io
25-
version: v1
26-
- group: apps
20+
- apiVersion: apps/v1
2721
kind: Deployment
2822
name: capa-controller-manager
2923
namespace: openshift-cluster-api
30-
version: v1
31-
- group: admissionregistration.k8s.io
24+
- apiVersion: admissionregistration.k8s.io/v1
3225
kind: MutatingWebhookConfiguration
3326
name: capa-mutating-webhook-configuration
34-
version: v1
35-
- group: rbac.authorization.k8s.io
27+
- apiVersion: rbac.authorization.k8s.io/v1
3628
kind: Role
3729
name: capa-leader-elect-role
3830
namespace: openshift-cluster-api
39-
version: v1
40-
- group: rbac.authorization.k8s.io
31+
- apiVersion: rbac.authorization.k8s.io/v1
4132
kind: RoleBinding
4233
name: capa-leader-elect-rolebinding
4334
namespace: openshift-cluster-api
44-
version: v1
45-
- kind: Service
35+
- apiVersion: v1
36+
kind: Service
4637
name: capa-metrics-service
4738
namespace: openshift-cluster-api
48-
version: v1
49-
- kind: Service
39+
- apiVersion: v1
40+
kind: Service
5041
name: capa-webhook-service
5142
namespace: openshift-cluster-api
52-
version: v1
53-
- kind: ServiceAccount
43+
- apiVersion: v1
44+
kind: ServiceAccount
5445
name: capa-controller-manager
5546
namespace: openshift-cluster-api
56-
version: v1
57-
- group: admissionregistration.k8s.io
47+
- apiVersion: admissionregistration.k8s.io/v1
5848
kind: ValidatingAdmissionPolicy
5949
name: openshift-cluster-api-protect-awscluster
60-
version: v1
61-
- group: admissionregistration.k8s.io
50+
- apiVersion: admissionregistration.k8s.io/v1
6251
kind: ValidatingAdmissionPolicyBinding
6352
name: openshift-cluster-api-protect-awscluster
64-
version: v1
65-
- group: admissionregistration.k8s.io
53+
- apiVersion: admissionregistration.k8s.io/v1
6654
kind: ValidatingWebhookConfiguration
6755
name: capa-validating-webhook-configuration
68-
version: v1

‎openshift/tools/generate-manifests-summary/main.go‎

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ import (
1616

1717
// ManifestMetadata represents extracted metadata from a Kubernetes manifest.
1818
type ManifestMetadata struct {
19-
Kind string `json:"kind,omitempty"`
20-
Group string `json:"group,omitempty"`
21-
Version string `json:"version,omitempty"`
22-
Name string `json:"name,omitempty"`
23-
Namespace string `json:"namespace,omitempty"`
19+
Kind string `json:"kind,omitempty"`
20+
APIVersion string `json:"apiVersion,omitempty"`
21+
Name string `json:"name,omitempty"`
22+
Namespace string `json:"namespace,omitempty"`
2423
}
2524

2625
// ManifestsSummary maps profile names to their manifest metadata lists.
@@ -50,15 +49,11 @@ func parseDocument(obj *metav1.PartialObjectMetadata, docIndex int) (*ManifestMe
5049
return nil, fmt.Errorf("manifest at document %d has empty metadata.name", docIndex)
5150
}
5251

53-
// Parse APIVersion
54-
group, version := parseAPIVersion(obj.APIVersion)
55-
5652
return &ManifestMetadata{
57-
Kind: obj.Kind,
58-
Group: group,
59-
Version: version,
60-
Name: obj.Name,
61-
Namespace: obj.Namespace,
53+
Kind: obj.Kind,
54+
APIVersion: obj.APIVersion,
55+
Name: obj.Name,
56+
Namespace: obj.Namespace,
6257
}, nil
6358
}
6459

@@ -141,16 +136,13 @@ func readExistingSummary(outputPath string) (ManifestsSummary, error) {
141136

142137
// updateSummary updates the summary with new manifests for the given profile.
143138
func updateSummary(existingSummary ManifestsSummary, manifests []ManifestMetadata, profileName string) ManifestsSummary {
144-
// Sort manifests by kind, group, version, namespace, name
139+
// Sort manifests by kind, apiVersion, namespace, name
145140
sort.Slice(manifests, func(i, j int) bool {
146141
if manifests[i].Kind != manifests[j].Kind {
147142
return manifests[i].Kind < manifests[j].Kind
148143
}
149-
if manifests[i].Group != manifests[j].Group {
150-
return manifests[i].Group < manifests[j].Group
151-
}
152-
if manifests[i].Version != manifests[j].Version {
153-
return manifests[i].Version < manifests[j].Version
144+
if manifests[i].APIVersion != manifests[j].APIVersion {
145+
return manifests[i].APIVersion < manifests[j].APIVersion
154146
}
155147
if manifests[i].Namespace != manifests[j].Namespace {
156148
return manifests[i].Namespace < manifests[j].Namespace

0 commit comments

Comments
 (0)