Skip to content

Add domain and realm CRDs#12

Merged
knative-prow-robot merged 15 commits intoknative:masterfrom
andrew-su:ingress/crds
Jun 23, 2020
Merged

Add domain and realm CRDs#12
knative-prow-robot merged 15 commits intoknative:masterfrom
andrew-su:ingress/crds

Conversation

@andrew-su
Copy link
Copy Markdown
Contributor

Issue: knative/serving#8184

This adds the CRDs for Realm and Domain.

/cc @shashwathi

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jun 9, 2020
@knative-prow-robot knative-prow-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jun 9, 2020
@googlebot
Copy link
Copy Markdown

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: no Indicates the PR's author has not signed the CLA. and removed cla: yes Indicates the PR's author has signed the CLA. labels Jun 9, 2020
@shashwathi
Copy link
Copy Markdown
Contributor

@googlebot I consent.

@googlebot
Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes Indicates the PR's author has signed the CLA. and removed cla: no Indicates the PR's author has not signed the CLA. labels Jun 9, 2020
@shashwathi
Copy link
Copy Markdown
Contributor

/assign @tcnghia

Comment on lines +26 to +28
func (i *Domain) SetDefaults(ctx context.Context) {
i.Spec.SetDefaults(apis.WithinSpec(ctx))
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (i *Domain) SetDefaults(ctx context.Context) {
i.Spec.SetDefaults(apis.WithinSpec(ctx))
}
func (d *Domain) SetDefaults(ctx context.Context) {
d.Spec.SetDefaults(apis.WithinSpec(ctx))
}

}

// GetGroupVersionKind returns SchemeGroupVersion of an Ingress
func (i *Domain) GetGroupVersionKind() schema.GroupVersionKind {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (i *Domain) GetGroupVersionKind() schema.GroupVersionKind {
func (*Domain) GetGroupVersionKind() schema.GroupVersionKind {

// Istio Gateways associated with this Domain. This could be a reference of a ConfigMap
// owned by the implementation as well.
// +optional
Config []map[string]string `json:"config,omitempty"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some people think we should not use maps in the apis
/cc @mattmoor

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @dprotaso can you please suggest the best practice to represent maps here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an array of maps - is that intended?

best practice to represent maps here?

Maybe a few criteria to think about

Patching

Although, CRDs don't support strategic merge patches the different types help reason about the different patch strategies that could open up in the future (although it's been shut down a bunch of times)

https://pkg.go.dev/k8s.io/kube-openapi/pkg/idl?tab=doc#ListType
https://pkg.go.dev/k8s.io/kube-openapi/pkg/idl?tab=doc#MapType
https://pkg.go.dev/k8s.io/kube-openapi/pkg/idl?tab=doc#StructType

JSON Patch & JSON Merge Patch are applicable to CRDs.

Future extensibility

Right now using an array with maps above don't let you add new typed fields - this may be fine but something to consider.

ie. knative/serving#7373 (comment)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For conditions there's also
kubernetes/community#4521 (comment)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for detailed explanation @dprotaso. Updated the type to use array.

Comment on lines +25 to +28
// SetDefaults populates default values in Ingress
func (i *Realm) SetDefaults(ctx context.Context) {
i.Spec.SetDefaults(apis.WithinSpec(ctx))
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// SetDefaults populates default values in Ingress
func (i *Realm) SetDefaults(ctx context.Context) {
i.Spec.SetDefaults(apis.WithinSpec(ctx))
}
// SetDefaults populates default values in Ingress
func (r *Realm) SetDefaults(ctx context.Context) {
r.Spec.SetDefaults(apis.WithinSpec(ctx))
}

@tcnghia
Copy link
Copy Markdown
Contributor

tcnghia commented Jun 11, 2020

/assign @dprotaso
who can provide more guidance on API _types.go best practices here

Comment thread config/300-domain.yaml Outdated
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apiextensions.k8s.io/v1beta1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use v1 CRD API now please

// associated with this Domain. This is used in automatic DNS provisioning like
// configuration of magic DNS or creating ExternalName services for cluster-local
// access.
LoadBalancers []LoadBalancerIngressStatus `json:"loadBalancers"`
Copy link
Copy Markdown
Member

@dprotaso dprotaso Jun 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird to see a type named *Status in the spec - make a copy?

// Istio Gateways associated with this Domain. This could be a reference of a ConfigMap
// owned by the implementation as well.
// +optional
Config []map[string]string `json:"config,omitempty"`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an array of maps - is that intended?

best practice to represent maps here?

Maybe a few criteria to think about

Patching

Although, CRDs don't support strategic merge patches the different types help reason about the different patch strategies that could open up in the future (although it's been shut down a bunch of times)

https://pkg.go.dev/k8s.io/kube-openapi/pkg/idl?tab=doc#ListType
https://pkg.go.dev/k8s.io/kube-openapi/pkg/idl?tab=doc#MapType
https://pkg.go.dev/k8s.io/kube-openapi/pkg/idl?tab=doc#StructType

JSON Patch & JSON Merge Patch are applicable to CRDs.

Future extensibility

Right now using an array with maps above don't let you add new typed fields - this may be fine but something to consider.

ie. knative/serving#7373 (comment)

@knative-prow-robot knative-prow-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 16, 2020
@googlebot
Copy link
Copy Markdown

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: no Indicates the PR's author has not signed the CLA. and removed cla: yes Indicates the PR's author has signed the CLA. labels Jun 16, 2020
@shashwathi
Copy link
Copy Markdown
Contributor

@googlebot I consent

@knative-prow-robot knative-prow-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 16, 2020
@googlebot
Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot removed the cla: no Indicates the PR's author has not signed the CLA. label Jun 16, 2020
@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 16, 2020
@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 16, 2020
@tcnghia
Copy link
Copy Markdown
Contributor

tcnghia commented Jun 23, 2020

/approve

@knative-prow-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrew-su, tcnghia

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 23, 2020
@dprotaso
Copy link
Copy Markdown
Member

/hold cancel

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 23, 2020
andrew-su and others added 15 commits June 23, 2020 14:08
Signed-off-by: Shash Reddy <shashwathireddy@gmail.com>
Signed-off-by: Shash Reddy <shashwathireddy@gmail.com>
Signed-off-by: Andrew Su <andrew.su.01@gmail.com>
Signed-off-by: Andrew Su <andrew.su.01@gmail.com>
Signed-off-by: Andrew Su <andrew.su.01@gmail.com>
Signed-off-by: Andrew Su <andrew.su.01@gmail.com>
Signed-off-by: Shash Reddy <shashwathireddy@gmail.com>
Signed-off-by: Shash Reddy <shashwathireddy@gmail.com>
Signed-off-by: Shash Reddy <shashwathireddy@gmail.com>
Signed-off-by: Shash Reddy <shashwathireddy@gmail.com>
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Jun 23, 2020
@knative-metrics-robot
Copy link
Copy Markdown

The following is the coverage report on the affected files.
Say /test pull-knative-networking-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/networking/v1alpha1/domain_defaults.go Do not exist 100.0%
pkg/apis/networking/v1alpha1/domain_lifecycle.go Do not exist 100.0%
pkg/apis/networking/v1alpha1/domain_types.go Do not exist 100.0%
pkg/apis/networking/v1alpha1/domain_validation.go Do not exist 100.0%
pkg/apis/networking/v1alpha1/realm_defaults.go Do not exist 100.0%
pkg/apis/networking/v1alpha1/realm_lifecycle.go Do not exist 100.0%
pkg/apis/networking/v1alpha1/realm_types.go Do not exist 100.0%
pkg/apis/networking/v1alpha1/realm_validation.go Do not exist 100.0%

@tcnghia
Copy link
Copy Markdown
Contributor

tcnghia commented Jun 23, 2020

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 23, 2020
@knative-prow-robot knative-prow-robot merged commit 53e376c into knative:master Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants