From 234fc37c9d2c581cdbeb1d9f2b9fe6edc1e14f76 Mon Sep 17 00:00:00 2001 From: Barni S Date: Fri, 31 May 2024 19:38:34 -0400 Subject: [PATCH] Rename Getter (getter expander config crd) to GetterConfiguration - regenerate proto bufs with latest lib to fix build failures --- experiments/compositions/composition/PROJECT | 2 +- .../composition/api/v1alpha1/getter_types.go | 30 +++---- .../api/v1alpha1/zz_generated.deepcopy.go | 38 ++++---- .../compositions/composition/cmd/main.go | 4 +- ...tion.google.com_getterconfigurations.yaml} | 18 ++-- .../composition/config/crd/kustomization.yaml | 6 +- .../config/expanders/expander_versions.yaml | 2 +- ...l => getterconfiguration_editor_role.yaml} | 10 +-- ...l => getterconfiguration_viewer_role.yaml} | 10 +-- .../composition/config/rbac/role.yaml | 6 +- ...osition_v1alpha1_getterconfiguration.yaml} | 2 +- .../config/samples/kustomization.yaml | 2 +- .../composition/expanders/getter/main.go | 6 +- .../composition/expanders/getter/main_test.go | 90 +++++++++---------- experiments/compositions/composition/go.mod | 16 ++-- experiments/compositions/composition/go.sum | 36 ++++---- .../internal/controller/getter_controller.go | 22 ++--- .../controller/getter_controller_test.go | 14 +-- .../composition/proto/expander_grpc.pb.go | 12 +-- .../input.yaml | 2 +- 20 files changed, 166 insertions(+), 162 deletions(-) rename experiments/compositions/composition/config/crd/bases/{composition.google.com_getters.yaml => composition.google.com_getterconfigurations.yaml} (92%) rename experiments/compositions/composition/config/rbac/{getter_editor_role.yaml => getterconfiguration_editor_role.yaml} (83%) rename experiments/compositions/composition/config/rbac/{getter_viewer_role.yaml => getterconfiguration_viewer_role.yaml} (82%) rename experiments/compositions/composition/config/samples/{composition_v1alpha1_getter.yaml => composition_v1alpha1_getterconfiguration.yaml} (97%) diff --git a/experiments/compositions/composition/PROJECT b/experiments/compositions/composition/PROJECT index ea273d896c..7c3b031edd 100644 --- a/experiments/compositions/composition/PROJECT +++ b/experiments/compositions/composition/PROJECT @@ -59,7 +59,7 @@ resources: controller: true domain: google.com group: composition - kind: Getter + kind: GetterConfiguration path: google.com/composition/api/v1alpha1 version: v1alpha1 version: "3" diff --git a/experiments/compositions/composition/api/v1alpha1/getter_types.go b/experiments/compositions/composition/api/v1alpha1/getter_types.go index 4dbc0c7461..122fc7319f 100644 --- a/experiments/compositions/composition/api/v1alpha1/getter_types.go +++ b/experiments/compositions/composition/api/v1alpha1/getter_types.go @@ -50,44 +50,44 @@ type ValuesFrom struct { FieldRef []FieldRef `json:"fieldRef"` } -// GetterSpec defines the desired state of Getter -type GetterSpec struct { +// GetterConfigurationSpec defines the desired state of GetterConfiguration +type GetterConfigurationSpec struct { ValuesFrom []ValuesFrom `json:"valuesFrom,omitempty"` } -// GetterStatus defines the observed state of Getter -type GetterStatus struct { +// GetterConfigurationStatus defines the observed state of GetterConfiguration +type GetterConfigurationStatus struct { Conditions []metav1.Condition `json:"conditions,omitempty"` } //+kubebuilder:object:root=true //+kubebuilder:subresource:status -// Getter is the Schema for the getters API -type Getter struct { +// GetterConfiguration is the Schema for the getters API +type GetterConfiguration struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec GetterSpec `json:"spec,omitempty"` - Status GetterStatus `json:"status,omitempty"` + Spec GetterConfigurationSpec `json:"spec,omitempty"` + Status GetterConfigurationStatus `json:"status,omitempty"` } //+kubebuilder:object:root=true -// GetterList contains a list of Getter -type GetterList struct { +// GetterConfigurationList contains a list of GetterConfiguration +type GetterConfigurationList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []Getter `json:"items"` + Items []GetterConfiguration `json:"items"` } // Status helpers -func (g *GetterStatus) ClearCondition(condition ConditionType) { +func (g *GetterConfigurationStatus) ClearCondition(condition ConditionType) { meta.RemoveStatusCondition(&g.Conditions, string(condition)) } // Validation -func (g *Getter) Validate() bool { +func (g *GetterConfiguration) Validate() bool { // Several of these validations should br CEL rules on the composition CRD // However for now they help me shape the controller. g.Status.ClearCondition(ValidationFailed) @@ -102,7 +102,7 @@ func (g *Getter) Validate() bool { g.Status.Conditions = append(g.Status.Conditions, metav1.Condition{ LastTransitionTime: metav1.Now(), Message: message, - Reason: "GetterValidationFailed", + Reason: "GetterConfigurationValidationFailed", Type: string(ValidationFailed), Status: metav1.ConditionTrue, }) @@ -112,5 +112,5 @@ func (g *Getter) Validate() bool { } func init() { - SchemeBuilder.Register(&Getter{}, &GetterList{}) + SchemeBuilder.Register(&GetterConfiguration{}, &GetterConfigurationList{}) } diff --git a/experiments/compositions/composition/api/v1alpha1/zz_generated.deepcopy.go b/experiments/compositions/composition/api/v1alpha1/zz_generated.deepcopy.go index fcf089d197..6de80a55e7 100644 --- a/experiments/compositions/composition/api/v1alpha1/zz_generated.deepcopy.go +++ b/experiments/compositions/composition/api/v1alpha1/zz_generated.deepcopy.go @@ -513,7 +513,7 @@ func (in *FieldRef) DeepCopy() *FieldRef { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Getter) DeepCopyInto(out *Getter) { +func (in *GetterConfiguration) DeepCopyInto(out *GetterConfiguration) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -521,18 +521,18 @@ func (in *Getter) DeepCopyInto(out *Getter) { in.Status.DeepCopyInto(&out.Status) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Getter. -func (in *Getter) DeepCopy() *Getter { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GetterConfiguration. +func (in *GetterConfiguration) DeepCopy() *GetterConfiguration { if in == nil { return nil } - out := new(Getter) + out := new(GetterConfiguration) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Getter) DeepCopyObject() runtime.Object { +func (in *GetterConfiguration) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -540,31 +540,31 @@ func (in *Getter) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GetterList) DeepCopyInto(out *GetterList) { +func (in *GetterConfigurationList) DeepCopyInto(out *GetterConfigurationList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]Getter, len(*in)) + *out = make([]GetterConfiguration, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GetterList. -func (in *GetterList) DeepCopy() *GetterList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GetterConfigurationList. +func (in *GetterConfigurationList) DeepCopy() *GetterConfigurationList { if in == nil { return nil } - out := new(GetterList) + out := new(GetterConfigurationList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *GetterList) DeepCopyObject() runtime.Object { +func (in *GetterConfigurationList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -572,7 +572,7 @@ func (in *GetterList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GetterSpec) DeepCopyInto(out *GetterSpec) { +func (in *GetterConfigurationSpec) DeepCopyInto(out *GetterConfigurationSpec) { *out = *in if in.ValuesFrom != nil { in, out := &in.ValuesFrom, &out.ValuesFrom @@ -583,18 +583,18 @@ func (in *GetterSpec) DeepCopyInto(out *GetterSpec) { } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GetterSpec. -func (in *GetterSpec) DeepCopy() *GetterSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GetterConfigurationSpec. +func (in *GetterConfigurationSpec) DeepCopy() *GetterConfigurationSpec { if in == nil { return nil } - out := new(GetterSpec) + out := new(GetterConfigurationSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GetterStatus) DeepCopyInto(out *GetterStatus) { +func (in *GetterConfigurationStatus) DeepCopyInto(out *GetterConfigurationStatus) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions @@ -605,12 +605,12 @@ func (in *GetterStatus) DeepCopyInto(out *GetterStatus) { } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GetterStatus. -func (in *GetterStatus) DeepCopy() *GetterStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GetterConfigurationStatus. +func (in *GetterConfigurationStatus) DeepCopy() *GetterConfigurationStatus { if in == nil { return nil } - out := new(GetterStatus) + out := new(GetterConfigurationStatus) in.DeepCopyInto(out) return out } diff --git a/experiments/compositions/composition/cmd/main.go b/experiments/compositions/composition/cmd/main.go index 92a90131ee..ea75a9e028 100644 --- a/experiments/compositions/composition/cmd/main.go +++ b/experiments/compositions/composition/cmd/main.go @@ -131,11 +131,11 @@ func main() { setupLog.Error(err, "unable to create controller", "controller", "ExpanderVersion") os.Exit(1) } - if err = (&controller.GetterReconciler{ + if err = (&controller.GetterConfigurationReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Getter") + setupLog.Error(err, "unable to create controller", "controller", "GetterConfiguration") os.Exit(1) } //+kubebuilder:scaffold:builder diff --git a/experiments/compositions/composition/config/crd/bases/composition.google.com_getters.yaml b/experiments/compositions/composition/config/crd/bases/composition.google.com_getterconfigurations.yaml similarity index 92% rename from experiments/compositions/composition/config/crd/bases/composition.google.com_getters.yaml rename to experiments/compositions/composition/config/crd/bases/composition.google.com_getterconfigurations.yaml index f7aa83e0cf..80ca54c073 100644 --- a/experiments/compositions/composition/config/crd/bases/composition.google.com_getters.yaml +++ b/experiments/compositions/composition/config/crd/bases/composition.google.com_getterconfigurations.yaml @@ -18,20 +18,20 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 - name: getters.composition.google.com + name: getterconfigurations.composition.google.com spec: group: composition.google.com names: - kind: Getter - listKind: GetterList - plural: getters - singular: getter + kind: GetterConfiguration + listKind: GetterConfigurationList + plural: getterconfigurations + singular: getterconfiguration scope: Namespaced versions: - name: v1alpha1 schema: openAPIV3Schema: - description: Getter is the Schema for the getters API + description: GetterConfiguration is the Schema for the getters API properties: apiVersion: description: |- @@ -51,7 +51,7 @@ spec: metadata: type: object spec: - description: GetterSpec defines the desired state of Getter + description: GetterConfigurationSpec defines the desired state of GetterConfiguration properties: valuesFrom: items: @@ -78,6 +78,8 @@ spec: kind: type: string name: + description: OneOf validation needed for Name and NameSuffix + in CRD Definition type: string nameSuffix: type: string @@ -97,7 +99,7 @@ spec: type: array type: object status: - description: GetterStatus defines the observed state of Getter + description: GetterConfigurationStatus defines the observed state of GetterConfiguration properties: conditions: items: diff --git a/experiments/compositions/composition/config/crd/kustomization.yaml b/experiments/compositions/composition/config/crd/kustomization.yaml index 90dc7285a6..904d50d10e 100644 --- a/experiments/compositions/composition/config/crd/kustomization.yaml +++ b/experiments/compositions/composition/config/crd/kustomization.yaml @@ -21,7 +21,7 @@ resources: - bases/composition.google.com_plans.yaml - bases/composition.google.com_facades.yaml - bases/composition.google.com_expanderversions.yaml -- bases/composition.google.com_getters.yaml +- bases/composition.google.com_getterconfigurations.yaml #+kubebuilder:scaffold:crdkustomizeresource patches: @@ -31,7 +31,7 @@ patches: #- path: patches/webhook_in_contexts.yaml #- path: patches/webhook_in_plans.yaml #- path: patches/webhook_in_facades.yaml -#- path: patches/webhook_in_getters.yaml +#- path: patches/webhook_in_getterconfigurations.yaml #+kubebuilder:scaffold:crdkustomizewebhookpatch # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. @@ -41,7 +41,7 @@ patches: #- path: patches/cainjection_in_plans.yaml #- path: patches/cainjection_in_facades.yaml #- path: patches/cainjection_in_expanderversions.yaml -#- path: patches/cainjection_in_getters.yaml +#- path: patches/cainjection_in_getterconfigurations.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # [WEBHOOK] To enable webhook, uncomment the following section diff --git a/experiments/compositions/composition/config/expanders/expander_versions.yaml b/experiments/compositions/composition/config/expanders/expander_versions.yaml index 77a0114b44..871b8f7a77 100644 --- a/experiments/compositions/composition/config/expanders/expander_versions.yaml +++ b/experiments/compositions/composition/config/expanders/expander_versions.yaml @@ -51,4 +51,4 @@ spec: config: group: composition.google.com version: v1alpha1 - kind: Getter \ No newline at end of file + kind: GetterConfiguration \ No newline at end of file diff --git a/experiments/compositions/composition/config/rbac/getter_editor_role.yaml b/experiments/compositions/composition/config/rbac/getterconfiguration_editor_role.yaml similarity index 83% rename from experiments/compositions/composition/config/rbac/getter_editor_role.yaml rename to experiments/compositions/composition/config/rbac/getterconfiguration_editor_role.yaml index ed7a07b206..b38fca5706 100644 --- a/experiments/compositions/composition/config/rbac/getter_editor_role.yaml +++ b/experiments/compositions/composition/config/rbac/getterconfiguration_editor_role.yaml @@ -12,23 +12,23 @@ # See the License for the specific language governing permissions and # limitations under the License. -# permissions for end users to edit getters. +# permissions for end users to edit getterconfigurations. apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: app.kubernetes.io/name: clusterrole - app.kubernetes.io/instance: getter-editor-role + app.kubernetes.io/instance: getterconfiguration-editor-role app.kubernetes.io/component: rbac app.kubernetes.io/created-by: composition app.kubernetes.io/part-of: composition app.kubernetes.io/managed-by: kustomize - name: getter-editor-role + name: getterconfiguration-editor-role rules: - apiGroups: - composition.google.com resources: - - getters + - getterconfigurations verbs: - create - delete @@ -40,6 +40,6 @@ rules: - apiGroups: - composition.google.com resources: - - getters/status + - getterconfigurations/status verbs: - get diff --git a/experiments/compositions/composition/config/rbac/getter_viewer_role.yaml b/experiments/compositions/composition/config/rbac/getterconfiguration_viewer_role.yaml similarity index 82% rename from experiments/compositions/composition/config/rbac/getter_viewer_role.yaml rename to experiments/compositions/composition/config/rbac/getterconfiguration_viewer_role.yaml index b439675175..1f939bbc47 100644 --- a/experiments/compositions/composition/config/rbac/getter_viewer_role.yaml +++ b/experiments/compositions/composition/config/rbac/getterconfiguration_viewer_role.yaml @@ -12,23 +12,23 @@ # See the License for the specific language governing permissions and # limitations under the License. -# permissions for end users to view getters. +# permissions for end users to view getterconfigurations. apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: app.kubernetes.io/name: clusterrole - app.kubernetes.io/instance: getter-viewer-role + app.kubernetes.io/instance: getterconfiguration-viewer-role app.kubernetes.io/component: rbac app.kubernetes.io/created-by: composition app.kubernetes.io/part-of: composition app.kubernetes.io/managed-by: kustomize - name: getter-viewer-role + name: getterconfiguration-viewer-role rules: - apiGroups: - composition.google.com resources: - - getters + - getterconfigurations verbs: - get - list @@ -36,6 +36,6 @@ rules: - apiGroups: - composition.google.com resources: - - getters/status + - getterconfigurations/status verbs: - get diff --git a/experiments/compositions/composition/config/rbac/role.yaml b/experiments/compositions/composition/config/rbac/role.yaml index 7f2122cf7e..a87a55bee0 100644 --- a/experiments/compositions/composition/config/rbac/role.yaml +++ b/experiments/compositions/composition/config/rbac/role.yaml @@ -160,7 +160,7 @@ rules: - apiGroups: - composition.google.com resources: - - getters + - getterconfigurations verbs: - create - delete @@ -172,13 +172,13 @@ rules: - apiGroups: - composition.google.com resources: - - getters/finalizers + - getterconfigurations/finalizers verbs: - update - apiGroups: - composition.google.com resources: - - getters/status + - getterconfigurations/status verbs: - get - patch diff --git a/experiments/compositions/composition/config/samples/composition_v1alpha1_getter.yaml b/experiments/compositions/composition/config/samples/composition_v1alpha1_getterconfiguration.yaml similarity index 97% rename from experiments/compositions/composition/config/samples/composition_v1alpha1_getter.yaml rename to experiments/compositions/composition/config/samples/composition_v1alpha1_getterconfiguration.yaml index 33a0c47d5a..8471ce4b70 100644 --- a/experiments/compositions/composition/config/samples/composition_v1alpha1_getter.yaml +++ b/experiments/compositions/composition/config/samples/composition_v1alpha1_getterconfiguration.yaml @@ -13,7 +13,7 @@ # limitations under the License. apiVersion: composition.google.com/v1alpha1 -kind: Getter +kind: GetterConfiguration metadata: labels: app.kubernetes.io/name: getter diff --git a/experiments/compositions/composition/config/samples/kustomization.yaml b/experiments/compositions/composition/config/samples/kustomization.yaml index e276519aad..d5ebc24e94 100644 --- a/experiments/compositions/composition/config/samples/kustomization.yaml +++ b/experiments/compositions/composition/config/samples/kustomization.yaml @@ -19,5 +19,5 @@ resources: - composition_v1alpha1_plan.yaml - composition_v1alpha1_facade.yaml - composition_v1alpha1_expanderversion.yaml -- composition_v1alpha1_getter.yaml +- composition_v1alpha1_getterconfigurations.yaml #+kubebuilder:scaffold:manifestskustomizesamples diff --git a/experiments/compositions/composition/expanders/getter/main.go b/experiments/compositions/composition/expanders/getter/main.go index f85c8da460..4695738587 100644 --- a/experiments/compositions/composition/expanders/getter/main.go +++ b/experiments/compositions/composition/expanders/getter/main.go @@ -41,7 +41,7 @@ var ( type Getter struct { req *pb.EvaluateRequest facade *unstructured.Unstructured - getter *compositionv1alpha1.Getter + getter *compositionv1alpha1.GetterConfiguration ctx context.Context client dynamic.Interface values map[string]interface{} @@ -57,11 +57,11 @@ func NewGetter(ctx context.Context, client dynamic.Interface, req *pb.EvaluateRe } func (g *Getter) LoadInputs() error { - g.getter = &compositionv1alpha1.Getter{} + g.getter = &compositionv1alpha1.GetterConfiguration{} if string(g.req.Config) != "" { err := json.Unmarshal(g.req.Config, g.getter) if err != nil { - return fmt.Errorf("error unmarshalling req.Config into GetterSpec{}: %w", err) + return fmt.Errorf("error unmarshalling req.Config into GetterConfiguration{}: %w", err) } } else { g.getter.Spec.ValuesFrom = []compositionv1alpha1.ValuesFrom{} diff --git a/experiments/compositions/composition/expanders/getter/main_test.go b/experiments/compositions/composition/expanders/getter/main_test.go index 368dfa5684..250d75503a 100644 --- a/experiments/compositions/composition/expanders/getter/main_test.go +++ b/experiments/compositions/composition/expanders/getter/main_test.go @@ -48,18 +48,18 @@ var ( } // Marshalled values - sampleFacade []byte - emptyGetter []byte + sampleFacade []byte + emptyGetterConfiguration []byte // getter objects - emptyGetterObj *compositionv1alpha1.Getter = &compositionv1alpha1.Getter{ - Spec: compositionv1alpha1.GetterSpec{ + emptyGetterConfigurationObj *compositionv1alpha1.GetterConfiguration = &compositionv1alpha1.GetterConfiguration{ + Spec: compositionv1alpha1.GetterConfigurationSpec{ ValuesFrom: []compositionv1alpha1.ValuesFrom{}, }, } // Evaluate results - emptyGetterEvaluateResult = "{}" + emptyGetterConfigurationEvaluateResult = "{}" ) // TestMain - umbrella test that runs all test cases @@ -82,10 +82,10 @@ func TestMain(m *testing.M) { facade.SetNamespace("composition-system") sampleFacade, _ = json.Marshal(facade.Object) - // Marshall Getter config for test values - emptyGetter, err = json.Marshal(emptyGetterObj) + // Marshall GetterConfiguration config for test values + emptyGetterConfiguration, err = json.Marshal(emptyGetterConfigurationObj) if err != nil { - log.Fatalf("unable to marshall emptyGetter: %v", err) + log.Fatalf("unable to marshall emptyGetterConfiguration: %v", err) } exitCode := m.Run() @@ -128,7 +128,7 @@ func TestEvaluateEmptyConfig(t *testing.T) { func TestEvaluateEmptyContext(t *testing.T) { r, err := expanderClient.Evaluate(context.Background(), &pb.EvaluateRequest{ - Config: emptyGetter, + Config: emptyGetterConfiguration, Resource: "sqls", Context: []byte{}, Facade: sampleFacade, @@ -138,15 +138,15 @@ func TestEvaluateEmptyContext(t *testing.T) { t.Fatalf("expected no error. got: %v", err) } - if string(r.Values) != emptyGetterEvaluateResult { - t.Fatalf("\nexpected: %s\n got: %s", emptyGetterEvaluateResult, r.Values) + if string(r.Values) != emptyGetterConfigurationEvaluateResult { + t.Fatalf("\nexpected: %s\n got: %s", emptyGetterConfigurationEvaluateResult, r.Values) } } func TestEvaluateEmptyResourceString(t *testing.T) { r, err := expanderClient.Evaluate(context.Background(), &pb.EvaluateRequest{ - Config: emptyGetter, + Config: emptyGetterConfiguration, Context: []byte{}, Facade: sampleFacade, Value: []byte("{\"key\": \"val\"}"), @@ -155,15 +155,15 @@ func TestEvaluateEmptyResourceString(t *testing.T) { t.Fatalf("expected no error. got: %v", err) } - if string(r.Values) != emptyGetterEvaluateResult { - t.Fatalf("\nexpected: %s\n got: %s", emptyGetterEvaluateResult, r.Values) + if string(r.Values) != emptyGetterConfigurationEvaluateResult { + t.Fatalf("\nexpected: %s\n got: %s", emptyGetterConfigurationEvaluateResult, r.Values) } } func TestEvaluateEmptyFacade(t *testing.T) { r, err := expanderClient.Evaluate(context.Background(), &pb.EvaluateRequest{ - Config: emptyGetter, + Config: emptyGetterConfiguration, Resource: "sqls", Context: []byte("{\"key\": \"val\"}"), Facade: []byte{}, @@ -177,10 +177,10 @@ func TestEvaluateEmptyFacade(t *testing.T) { } } -func TestEvaluateGetterMissingObjectGroup(t *testing.T) { - // Marshall Getter config - getter, err := json.Marshal(&compositionv1alpha1.Getter{ - Spec: compositionv1alpha1.GetterSpec{ +func TestEvaluateGetterConfigurationMissingObjectGroup(t *testing.T) { + // Marshall GetterConfiguration config + getter, err := json.Marshal(&compositionv1alpha1.GetterConfiguration{ + Spec: compositionv1alpha1.GetterConfigurationSpec{ ValuesFrom: []compositionv1alpha1.ValuesFrom{ { Name: "missinggroup", @@ -220,10 +220,10 @@ func TestEvaluateGetterMissingObjectGroup(t *testing.T) { } } -func TestEvaluateGetterMissingObjectResource(t *testing.T) { - // Marshall Getter config - getter, err := json.Marshal(&compositionv1alpha1.Getter{ - Spec: compositionv1alpha1.GetterSpec{ +func TestEvaluateGetterConfigurationMissingObjectResource(t *testing.T) { + // Marshall GetterConfiguration config + getter, err := json.Marshal(&compositionv1alpha1.GetterConfiguration{ + Spec: compositionv1alpha1.GetterConfigurationSpec{ ValuesFrom: []compositionv1alpha1.ValuesFrom{ { Name: "missingresource", @@ -263,10 +263,10 @@ func TestEvaluateGetterMissingObjectResource(t *testing.T) { } } -func TestEvaluateGetterMissingObject(t *testing.T) { - // Marshall Getter config - getter, err := json.Marshal(&compositionv1alpha1.Getter{ - Spec: compositionv1alpha1.GetterSpec{ +func TestEvaluateGetterConfigurationMissingObject(t *testing.T) { + // Marshall GetterConfiguration config + getter, err := json.Marshal(&compositionv1alpha1.GetterConfiguration{ + Spec: compositionv1alpha1.GetterConfigurationSpec{ ValuesFrom: []compositionv1alpha1.ValuesFrom{ { Name: "missing", @@ -306,10 +306,10 @@ func TestEvaluateGetterMissingObject(t *testing.T) { } } -func TestEvaluateGetterValidObjectNoFieldRef(t *testing.T) { - // Marshall Getter config - getter, err := json.Marshal(&compositionv1alpha1.Getter{ - Spec: compositionv1alpha1.GetterSpec{ +func TestEvaluateGetterConfigurationValidObjectNoFieldRef(t *testing.T) { + // Marshall GetterConfiguration config + getter, err := json.Marshal(&compositionv1alpha1.GetterConfiguration{ + Spec: compositionv1alpha1.GetterConfigurationSpec{ ValuesFrom: []compositionv1alpha1.ValuesFrom{ { Name: "missing", @@ -343,15 +343,15 @@ func TestEvaluateGetterValidObjectNoFieldRef(t *testing.T) { t.Fatalf("\nexpected: SUCCESS \n got: %s", r) } - if string(r.Values) != emptyGetterEvaluateResult { - t.Fatalf("\nexpected: %s\n got: %s", emptyGetterEvaluateResult, r.Values) + if string(r.Values) != emptyGetterConfigurationEvaluateResult { + t.Fatalf("\nexpected: %s\n got: %s", emptyGetterConfigurationEvaluateResult, r.Values) } } -func TestEvaluateGetterValidObjectWithMissingField(t *testing.T) { - // Marshall Getter config - getter, err := json.Marshal(&compositionv1alpha1.Getter{ - Spec: compositionv1alpha1.GetterSpec{ +func TestEvaluateGetterConfigurationValidObjectWithMissingField(t *testing.T) { + // Marshall GetterConfiguration config + getter, err := json.Marshal(&compositionv1alpha1.GetterConfiguration{ + Spec: compositionv1alpha1.GetterConfigurationSpec{ ValuesFrom: []compositionv1alpha1.ValuesFrom{ { Name: "missing", @@ -396,11 +396,11 @@ func TestEvaluateGetterValidObjectWithMissingField(t *testing.T) { } } -func TestEvaluateGetterValidObjectWithValidField(t *testing.T) { +func TestEvaluateGetterConfigurationValidObjectWithValidField(t *testing.T) { resultValues := "{\"manager\":{\"replicas\":1}}" - // Marshall Getter config - getter, err := json.Marshal(&compositionv1alpha1.Getter{ - Spec: compositionv1alpha1.GetterSpec{ + // Marshall GetterConfiguration config + getter, err := json.Marshal(&compositionv1alpha1.GetterConfiguration{ + Spec: compositionv1alpha1.GetterConfigurationSpec{ ValuesFrom: []compositionv1alpha1.ValuesFrom{ { Name: "manager", @@ -444,11 +444,11 @@ func TestEvaluateGetterValidObjectWithValidField(t *testing.T) { } } -func TestEvaluateGetterValidObjectWithMultipleFields(t *testing.T) { +func TestEvaluateGetterConfigurationValidObjectWithMultipleFields(t *testing.T) { resultValues := "{\"manager\":{\"deadline\":600,\"replicas\":1}}" - // Marshall Getter config - getter, err := json.Marshal(&compositionv1alpha1.Getter{ - Spec: compositionv1alpha1.GetterSpec{ + // Marshall GetterConfiguration config + getter, err := json.Marshal(&compositionv1alpha1.GetterConfiguration{ + Spec: compositionv1alpha1.GetterConfigurationSpec{ ValuesFrom: []compositionv1alpha1.ValuesFrom{ { Name: "manager", diff --git a/experiments/compositions/composition/go.mod b/experiments/compositions/composition/go.mod index a5e325da54..9e4a208961 100644 --- a/experiments/compositions/composition/go.mod +++ b/experiments/compositions/composition/go.mod @@ -11,8 +11,9 @@ require ( github.com/google/go-cmp v0.6.0 github.com/onsi/ginkgo/v2 v2.13.0 github.com/onsi/gomega v1.29.0 - google.golang.org/grpc v1.58.3 - google.golang.org/protobuf v1.33.0 + golang.org/x/time v0.5.0 + google.golang.org/grpc v1.63.2 + google.golang.org/protobuf v1.34.0 k8s.io/api v0.29.1 k8s.io/apiextensions-apiserver v0.29.1 k8s.io/apimachinery v0.29.1 @@ -47,12 +48,12 @@ require ( github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/cel-go v0.17.7 // indirect github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect - github.com/google/uuid v1.5.0 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -80,17 +81,16 @@ require ( go.uber.org/zap v1.26.0 // indirect golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect golang.org/x/net v0.23.0 // indirect - golang.org/x/oauth2 v0.16.0 // indirect + golang.org/x/oauth2 v0.17.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.17.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/experiments/compositions/composition/go.sum b/experiments/compositions/composition/go.sum index 842ef611f1..aba46eb83f 100644 --- a/experiments/compositions/composition/go.sum +++ b/experiments/compositions/composition/go.sum @@ -142,8 +142,8 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= +github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= +github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -157,8 +157,8 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= @@ -184,8 +184,8 @@ github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJY github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= -github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.3.1/go.mod h1:on+2t9HRStVgn95RSsFWFz+6Q0Snyqv1awfrALZdbtU= @@ -420,8 +420,8 @@ golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ= -golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o= +golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= +golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -511,20 +511,20 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= -google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e h1:z3vDksarJxsAKM5dmEGv0GHwE2hKJ096wZra71Vs4sw= -google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= +google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= +google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4= +google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/experiments/compositions/composition/internal/controller/getter_controller.go b/experiments/compositions/composition/internal/controller/getter_controller.go index 8c29877526..223d15baab 100644 --- a/experiments/compositions/composition/internal/controller/getter_controller.go +++ b/experiments/compositions/composition/internal/controller/getter_controller.go @@ -31,33 +31,33 @@ import ( compositionv1alpha1 "google.com/composition/api/v1alpha1" ) -// GetterReconciler reconciles a Getter object -type GetterReconciler struct { +// GetterConfigurationReconciler reconciles a GetterConfiguration object +type GetterConfigurationReconciler struct { client.Client Scheme *runtime.Scheme } -//+kubebuilder:rbac:groups=composition.google.com,resources=getters,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=composition.google.com,resources=getters/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=composition.google.com,resources=getters/finalizers,verbs=update +//+kubebuilder:rbac:groups=composition.google.com,resources=getterconfigurations,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=composition.google.com,resources=getterconfigurations/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=composition.google.com,resources=getterconfigurations/finalizers,verbs=update // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. // TODO(user): Modify the Reconcile function to compare the state specified by -// the Getter object against the actual cluster state, and then +// the GetterConfiguration object against the actual cluster state, and then // perform operations to make the cluster state reflect the state specified by // the user. // // For more details, check Reconcile and its Result here: // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.17.0/pkg/reconcile -func (r *GetterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { +func (r *GetterConfigurationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { logger := log.FromContext(ctx) logger.Info("Got a new request!", "request", req) - var obj compositionv1alpha1.Getter + var obj compositionv1alpha1.GetterConfiguration if err := r.Client.Get(ctx, req.NamespacedName, &obj); err != nil { - logger.Error(err, "unable to fetch Getter") + logger.Error(err, "unable to fetch GetterConfiguration") // we'll ignore not-found errors, since they can't be fixed by an immediate // requeue (we'll need to wait for a new notification), and we can get them // on deleted requests. @@ -98,8 +98,8 @@ func (r *GetterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr } // SetupWithManager sets up the controller with the Manager. -func (r *GetterReconciler) SetupWithManager(mgr ctrl.Manager) error { +func (r *GetterConfigurationReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&compositionv1alpha1.Getter{}). + For(&compositionv1alpha1.GetterConfiguration{}). Complete(r) } diff --git a/experiments/compositions/composition/internal/controller/getter_controller_test.go b/experiments/compositions/composition/internal/controller/getter_controller_test.go index 1795eab005..0cc49d127a 100644 --- a/experiments/compositions/composition/internal/controller/getter_controller_test.go +++ b/experiments/compositions/composition/internal/controller/getter_controller_test.go @@ -30,7 +30,7 @@ import ( compositionv1alpha1 "google.com/composition/api/v1alpha1" ) -var _ = Describe("Getter Controller", func() { +var _ = Describe("GetterConfiguration Controller", func() { Context("When reconciling a resource", func() { const resourceName = "test-resource" @@ -40,13 +40,13 @@ var _ = Describe("Getter Controller", func() { Name: resourceName, Namespace: "default", // TODO(user):Modify as needed } - getter := &compositionv1alpha1.Getter{} + getter := &compositionv1alpha1.GetterConfiguration{} BeforeEach(func() { - By("creating the custom resource for the Kind Getter") + By("creating the custom resource for the Kind GetterConfiguration") err := k8sClient.Get(ctx, typeNamespacedName, getter) if err != nil && errors.IsNotFound(err) { - resource := &compositionv1alpha1.Getter{ + resource := &compositionv1alpha1.GetterConfiguration{ ObjectMeta: metav1.ObjectMeta{ Name: resourceName, Namespace: "default", @@ -59,16 +59,16 @@ var _ = Describe("Getter Controller", func() { AfterEach(func() { // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &compositionv1alpha1.Getter{} + resource := &compositionv1alpha1.GetterConfiguration{} err := k8sClient.Get(ctx, typeNamespacedName, resource) Expect(err).NotTo(HaveOccurred()) - By("Cleanup the specific resource instance Getter") + By("Cleanup the specific resource instance GetterConfiguration") Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) }) It("should successfully reconcile the resource", func() { By("Reconciling the created resource") - controllerReconciler := &GetterReconciler{ + controllerReconciler := &GetterConfigurationReconciler{ Client: k8sClient, Scheme: k8sClient.Scheme(), } diff --git a/experiments/compositions/composition/proto/expander_grpc.pb.go b/experiments/compositions/composition/proto/expander_grpc.pb.go index 3f0e972f10..b7fc1b226a 100644 --- a/experiments/compositions/composition/proto/expander_grpc.pb.go +++ b/experiments/compositions/composition/proto/expander_grpc.pb.go @@ -16,7 +16,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.4.0 // - protoc v3.21.12 // source: proto/expander.proto @@ -31,8 +31,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.62.0 or later. +const _ = grpc.SupportPackageIsVersion8 const ( Expander_Validate_FullMethodName = "/expander_grpc.Expander/Validate" @@ -58,8 +58,9 @@ func NewExpanderClient(cc grpc.ClientConnInterface) ExpanderClient { } func (c *expanderClient) Validate(ctx context.Context, in *ValidateRequest, opts ...grpc.CallOption) (*ValidateResult, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ValidateResult) - err := c.cc.Invoke(ctx, Expander_Validate_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Expander_Validate_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -67,8 +68,9 @@ func (c *expanderClient) Validate(ctx context.Context, in *ValidateRequest, opts } func (c *expanderClient) Evaluate(ctx context.Context, in *EvaluateRequest, opts ...grpc.CallOption) (*EvaluateResult, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(EvaluateResult) - err := c.cc.Invoke(ctx, Expander_Evaluate_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Expander_Evaluate_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } diff --git a/experiments/compositions/composition/tests/data/TestSimplePlanStatusWaitingForValues/input.yaml b/experiments/compositions/composition/tests/data/TestSimplePlanStatusWaitingForValues/input.yaml index 4a71b68349..bbf4950993 100644 --- a/experiments/compositions/composition/tests/data/TestSimplePlanStatusWaitingForValues/input.yaml +++ b/experiments/compositions/composition/tests/data/TestSimplePlanStatusWaitingForValues/input.yaml @@ -98,7 +98,7 @@ subjects: namespace: composition-system --- apiVersion: composition.google.com/v1alpha1 -kind: Getter +kind: GetterConfiguration metadata: name: projectvalues namespace: default