Skip to content

Commit

Permalink
Merge pull request #1921 from barney-s/getter-config-rename
Browse files Browse the repository at this point in the history
Rename Getter CRD to GetterConfiguration
  • Loading branch information
google-oss-prow[bot] authored Jun 2, 2024
2 parents 3c79ef9 + 234fc37 commit 76fe1d7
Show file tree
Hide file tree
Showing 20 changed files with 166 additions and 162 deletions.
2 changes: 1 addition & 1 deletion experiments/compositions/composition/PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -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"
30 changes: 15 additions & 15 deletions experiments/compositions/composition/api/v1alpha1/getter_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
})
Expand All @@ -112,5 +112,5 @@ func (g *Getter) Validate() bool {
}

func init() {
SchemeBuilder.Register(&Getter{}, &GetterList{})
SchemeBuilder.Register(&GetterConfiguration{}, &GetterConfigurationList{})
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions experiments/compositions/composition/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ spec:
config:
group: composition.google.com
version: v1alpha1
kind: Getter
kind: GetterConfiguration
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -40,6 +40,6 @@ rules:
- apiGroups:
- composition.google.com
resources:
- getters/status
- getterconfigurations/status
verbs:
- get
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,30 @@
# 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
- watch
- apiGroups:
- composition.google.com
resources:
- getters/status
- getterconfigurations/status
verbs:
- get
Loading

0 comments on commit 76fe1d7

Please sign in to comment.