Skip to content

Commit d5acf1c

Browse files
committed
fix: manual changes
Signed-off-by: Alex Pana <[email protected]>
1 parent ffe8777 commit d5acf1c

File tree

7 files changed

+160
-200
lines changed

7 files changed

+160
-200
lines changed

apis/netapp/v1alpha1/backupvault_types.go

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,33 @@
1515
package v1alpha1
1616

1717
import (
18+
commonv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/apis/common/v1alpha1"
1819
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/apis/k8s/v1alpha1"
1920
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2021
)
2122

2223
var NetAppBackupVaultGVK = GroupVersion.WithKind("NetAppBackupVault")
2324

24-
// NetAppBackupVaultSpec defines the desired state of NetAppBackupVault
25+
// BackupVaultSpec defines the desired state of NetAppBackupVault
2526
// +kcc:proto=google.cloud.netapp.v1.BackupVault
26-
type NetAppBackupVaultSpec struct {
27-
// The NetAppBackupVault name. If not given, the metadata.name will be used.
28-
ResourceID *string `json:"resourceID,omitempty"`
27+
type BackupVaultSpec struct {
28+
commonv1alpha1.CommonSpec `json:",inline"`
29+
30+
// +required
31+
Location string `json:"location"`
32+
33+
// Description of the backup vault.
34+
// +kcc:proto:field=google.cloud.netapp.v1.BackupVault.description
35+
Description *string `json:"description,omitempty"`
36+
37+
// NOT YET
38+
// // Resource labels to represent user provided metadata.
39+
// // +kcc:proto:field=google.cloud.netapp.v1.BackupVault.labels
40+
// Labels map[string]string `json:"labels,omitempty"`
2941
}
3042

31-
// NetAppBackupVaultStatus defines the config connector machine state of NetAppBackupVault
32-
type NetAppBackupVaultStatus struct {
43+
// BackupVaultStatus defines the config connector machine state of NetAppBackupVault
44+
type BackupVaultStatus struct {
3345
/* Conditions represent the latest available observations of the
3446
object's current state. */
3547
Conditions []v1alpha1.Condition `json:"conditions,omitempty"`
@@ -41,17 +53,23 @@ type NetAppBackupVaultStatus struct {
4153
ExternalRef *string `json:"externalRef,omitempty"`
4254

4355
// ObservedState is the state of the resource as most recently observed in GCP.
44-
ObservedState *NetAppBackupVaultObservedState `json:"observedState,omitempty"`
56+
ObservedState *BackupVaultObservedState `json:"observedState,omitempty"`
4557
}
4658

4759
// NetAppBackupVaultObservedState is the state of the NetAppBackupVault resource as most recently observed in GCP.
48-
// +kcc:proto=google.cloud.netapp.v1.BackupVault
49-
type NetAppBackupVaultObservedState struct {
60+
// +kcc:proto=google.cloud.netapp.v1.BackupVault// +kcc:proto=google.cloud.netapp.v1.BackupVault
61+
type BackupVaultObservedState struct {
62+
// Output only. The backup vault state.
63+
// +kcc:proto:field=google.cloud.netapp.v1.BackupVault.state
64+
State *string `json:"state,omitempty"`
65+
66+
// Output only. Create time of the backup vault.
67+
// +kcc:proto:field=google.cloud.netapp.v1.BackupVault.create_time
68+
CreateTime *string `json:"createTime,omitempty"`
5069
}
5170

5271
// +genclient
5372
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
54-
// TODO(user): make sure the pluralizaiton below is correct
5573
// +kubebuilder:resource:categories=gcp,shortName=gcpnetappbackupvault;gcpnetappbackupvaults
5674
// +kubebuilder:subresource:status
5775
// +kubebuilder:metadata:labels="cnrm.cloud.google.com/managed-by-kcc=true";"cnrm.cloud.google.com/system=true"
@@ -67,8 +85,8 @@ type NetAppBackupVault struct {
6785
metav1.ObjectMeta `json:"metadata,omitempty"`
6886

6987
// +required
70-
Spec NetAppBackupVaultSpec `json:"spec,omitempty"`
71-
Status NetAppBackupVaultStatus `json:"status,omitempty"`
88+
Spec BackupVaultSpec `json:"spec,omitempty"`
89+
Status BackupVaultStatus `json:"status,omitempty"`
7290
}
7391

7492
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

apis/netapp/v1alpha1/types.generated.go

Lines changed: 0 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/netapp/v1alpha1/zz_generated.deepcopy.go

Lines changed: 56 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_netappbackupvaults.netapp.cnrm.cloud.google.com.yaml

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,56 @@ spec:
5757
metadata:
5858
type: object
5959
spec:
60-
description: NetAppBackupVaultSpec defines the desired state of NetAppBackupVault
60+
description: BackupVaultSpec defines the desired state of NetAppBackupVault
6161
properties:
62+
description:
63+
description: Description of the backup vault.
64+
type: string
65+
location:
66+
type: string
67+
projectRef:
68+
description: The Project that this resource belongs to.
69+
oneOf:
70+
- not:
71+
required:
72+
- external
73+
required:
74+
- name
75+
- not:
76+
anyOf:
77+
- required:
78+
- name
79+
- required:
80+
- namespace
81+
required:
82+
- external
83+
properties:
84+
external:
85+
description: The `projectID` field of a project, when not managed
86+
by Config Connector.
87+
type: string
88+
kind:
89+
description: The kind of the Project resource; optional but must
90+
be `Project` if provided.
91+
type: string
92+
name:
93+
description: The `name` field of a `Project` resource.
94+
type: string
95+
namespace:
96+
description: The `namespace` field of a `Project` resource.
97+
type: string
98+
type: object
6299
resourceID:
63-
description: The NetAppBackupVault name. If not given, the metadata.name
100+
description: The GCP resource identifier. If not given, the metadata.name
64101
will be used.
65102
type: string
103+
required:
104+
- location
105+
- projectRef
66106
type: object
67107
status:
68-
description: NetAppBackupVaultStatus defines the config connector machine
69-
state of NetAppBackupVault
108+
description: BackupVaultStatus defines the config connector machine state
109+
of NetAppBackupVault
70110
properties:
71111
conditions:
72112
description: Conditions represent the latest available observations
@@ -109,6 +149,13 @@ spec:
109149
observedState:
110150
description: ObservedState is the state of the resource as most recently
111151
observed in GCP.
152+
properties:
153+
createTime:
154+
description: Output only. Create time of the backup vault.
155+
type: string
156+
state:
157+
description: Output only. The backup vault state.
158+
type: string
112159
type: object
113160
type: object
114161
required:

pkg/controller/direct/netapp/backupvault_fuzzer.go

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -29,57 +29,17 @@ func init() {
2929

3030
func netAppBackupVaultFuzzer() fuzztesting.KRMFuzzer {
3131
f := fuzztesting.NewKRMTypedFuzzer(&pb.BackupVault{},
32-
netAppBackupVaultSpecFromProto, netAppBackupVaultSpecToProto,
33-
netAppBackupVaultObservedStateFromProto, netAppBackupVaultObservedStateToProto,
32+
BackupVault_FromProto, BackupVault_ToProto,
33+
BackupVaultObservedState_FromProto, BackupVaultObservedState_ToProto,
3434
)
3535

3636
f.SpecFields.Insert(".description")
37-
f.SpecFields.Insert(".labels")
3837

3938
f.StatusFields.Insert(".state")
4039
f.StatusFields.Insert(".create_time")
4140

4241
f.UnimplementedFields.Insert(".name")
42+
f.UnimplementedFields.Insert(".labels")
4343

4444
return f
4545
}
46-
47-
func netAppBackupVaultSpecFromProto(mapCtx *direct.MapContext, in *pb.BackupVault) *krm.NetAppBackupVaultSpec {
48-
if in == nil {
49-
return nil
50-
}
51-
out := &krm.NetAppBackupVaultSpec{}
52-
out.Description = direct.LazyPtr(in.GetDescription())
53-
out.Labels = in.Labels
54-
return out
55-
}
56-
57-
func netAppBackupVaultSpecToProto(mapCtx *direct.MapContext, in *krm.NetAppBackupVaultSpec) *pb.BackupVault {
58-
if in == nil {
59-
return nil
60-
}
61-
out := &pb.BackupVault{}
62-
out.Description = direct.ValueOf(in.Description)
63-
out.Labels = in.Labels
64-
return out
65-
}
66-
67-
func netAppBackupVaultObservedStateFromProto(mapCtx *direct.MapContext, in *pb.BackupVault) *krm.NetAppBackupVaultObservedState {
68-
if in == nil {
69-
return nil
70-
}
71-
out := &krm.NetAppBackupVaultObservedState{}
72-
out.State = direct.Enum_FromProto(mapCtx, in.GetState())
73-
out.CreateTime = direct.StringTimestamp_FromProto(mapCtx, in.GetCreateTime())
74-
return out
75-
}
76-
77-
func netAppBackupVaultObservedStateToProto(mapCtx *direct.MapContext, in *krm.NetAppBackupVaultObservedState) *pb.BackupVault {
78-
if in == nil {
79-
return nil
80-
}
81-
out := &pb.BackupVault{}
82-
out.State = direct.Enum_ToProto[pb.BackupVault_State](mapCtx, in.State)
83-
out.CreateTime = direct.StringTimestamp_ToProto(mapCtx, in.CreateTime)
84-
return out
85-
}

0 commit comments

Comments
 (0)