Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new CR: podnetworkconnectivitychecks.controlplane.operator.openshift.io/v1alpha1 #639

Merged
merged 3 commits into from Jun 5, 2020

Conversation

sanchezl
Copy link
Contributor

@sanchezl sanchezl commented May 4, 2020

Define CRD in support of openshift/enhancements#289.

@openshift-ci-robot openshift-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels May 4, 2020
@sanchezl sanchezl changed the title Add PodNetworkConnectivityCheck CRD WIP: add PodNetworkConnectivityCheck CRD May 4, 2020
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 4, 2020
@sanchezl sanchezl marked this pull request as draft May 4, 2020 18:42
@sanchezl sanchezl changed the title WIP: add PodNetworkConnectivityCheck CRD add PodNetworkConnectivityCheck CRD May 4, 2020
@sanchezl sanchezl marked this pull request as ready for review May 4, 2020 18:46
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 4, 2020
@sanchezl sanchezl marked this pull request as draft May 4, 2020 18:46
@@ -23,6 +23,7 @@ network/v1 \
oauth/v1 \
openshiftcontrolplane/v1 \
operator/v1 \
operatorcontrolplane/v1alpha1 \
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the rational of this group name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@sttts sttts May 11, 2020

Choose a reason for hiding this comment

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

operator.openshift.io as suggested by @deads2k is fine. Who says this will only be used in control plane operator?

@@ -0,0 +1,163 @@
apiVersion: apiextensions.k8s.io/v1beta1
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we support v1 now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did try it initially, but the crd codegen seemed to ignore it and insisted on creating the v1beta1 version instead. I can look into it later (plus i would like to clean up those scripts anyway)

Copy link
Contributor

Choose a reason for hiding this comment

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

@damemi this should work, shouldn't it?

Copy link

Choose a reason for hiding this comment

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

which codegen are you using, controller-gen? Our CRD gen doesn't touch this setting that I'm aware of (just the openapi spec) so I'm wondering what tool could be causing this

Copy link

Choose a reason for hiding this comment

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

controller-gen has a crdVersions flag, which defaults to v1beta1: https://github.com/kubernetes-sigs/controller-tools/blob/master/pkg/crd/gen.go#L63-L71

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sttts, @damemi
The version of controller-gen we are using (github.com/openshift/kubernetes-sigs-controller-tools v0.2.1-37-ga3cca5d) seems to be hard coded to use v1beta1 when generating CRDs.
https://github.com/openshift/kubernetes-sigs-controller-tools/blob/a3cca5d66f230ea5ca3554aef7e130750b841825/pkg/crd/spec.go#L25

Copy link
Contributor

Choose a reason for hiding this comment

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

@sanchezl I see. No blocker here. @damemi we should rebase controller-gen

// be resolved. Specify an IP address for host to bypass DNS name lookup.
// +kubebuilder:validation:Required
// +required
TargetEndpoint string `json:"targetEndpoint"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't see an appropriate format (e.g. host:port), so I will use a pattern instead:

// +kubebuilder:validation:Pattern=^\S+:\d*$

(one or more non-whitespace + ':' + port number )

Copy link
Contributor

Choose a reason for hiding this comment

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

looks fine

Copy link
Contributor

Choose a reason for hiding this comment

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

am not fluent in regexes enough: \S includes numbers and other chars allowed in hosts?

Copy link
Contributor

Choose a reason for hiding this comment

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

\S is non-whitespace. So the regex means anything-non-whitespace, colon, digits.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sttts The regex isn't perfect, I started to write a more thorough one, but didn't see the point if it wasn't going to be perfect as it would have to handle hostnames, ipv4, ipv6 (which has :, and %, and brackets, etc..) simultaneously.

// SourcePod names the pod from which the condition will be checked
// +kubebuilder:validation:Required
// +required
SourcePod string `json:"sourcePod"`
Copy link
Contributor

Choose a reason for hiding this comment

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

set the allowed values

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a Pattern.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe you have to put ^$ around

Copy link
Contributor

Choose a reason for hiding this comment

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

still open

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

// SourcePod names the pod from which the condition will be checked
// +kubebuilder:validation:Required
// +required
SourcePod string `json:"sourcePod"`
Copy link
Contributor

Choose a reason for hiding this comment

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

This is really just documentation, isn't it? It won't magically add another tester sidecar. Would document that here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. The sidecar is added by the operator.
  2. The PodNetworkConnectivityCheck resources also created by operator: one per pod, per endpoint.
  3. The sidecar uses this field to find the endpoints it needs to test, and updates the status with results.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is really just documentation, isn't it? It won't magically add another tester sidecar. Would document that here.

the container looks up it's own pod name to figure out what to try to contact

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, ok. So in theory one could change that. Just a new object won't have any effect without a sidecar being deployed for a matching pod.

type PodNetworkConnectivityCheckStatus struct {
// Successes contains logs successful check actions
// +optional
Successes []LogEntry `json:"successes"`
Copy link
Contributor

Choose a reason for hiding this comment

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

the last n? who defines n?

Copy link
Contributor

Choose a reason for hiding this comment

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

the last n? who defines n?

the binary itself. let's say 10 in that binary to start. We do similar sorts of things for our operator revisions.

// LogEntry records events
type LogEntry struct {
// Start time of check action.
Start metav1.Time `json:"time,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this not required?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.


// Latency records how long the action mentioned in the entry took.
// +optional
Latency metav1.Duration `json:"latency"`
Copy link
Contributor

Choose a reason for hiding this comment

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

this must be nullable because Duration has a custom marshaller.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.


// End of outage detected
// +kubebuilder:validation:Required
// +optional
Copy link
Contributor

Choose a reason for hiding this comment

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

optional or required?

Copy link
Contributor

Choose a reason for hiding this comment

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

optional or required?

optional, not every outage has ended.

DNSResolve LogEntryReason = "DNSResolve"
DNSError LogEntryReason = "DNSError"
TCPConnect LogEntryReason = "TCPConnect"
TCPConnectError LogEntryReason = "TCPConnectError"
Copy link
Contributor

Choose a reason for hiding this comment

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

timeout?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Error is not always timeout, for example no route to host.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I wanted to say that I miss a timeout value.

@sanchezl sanchezl force-pushed the point-to-point branch 4 times, most recently from 4eaed47 to 3214cbb Compare May 8, 2020 19:40

// Status contains the observed status of the connectivity check
// +optional
Status PodNetworkConnectivityCheckStatus `json:"status,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

omitempty has no effect on non-pointers.

@sanchezl sanchezl force-pushed the point-to-point branch 3 times, most recently from ba05d83 to 7f5b916 Compare May 15, 2020 01:56
@sanchezl sanchezl force-pushed the point-to-point branch 2 times, most recently from 4841bc9 to c4f5eb1 Compare May 18, 2020 14:44
@sanchezl sanchezl marked this pull request as ready for review May 18, 2020 14:46
@sttts
Copy link
Contributor

sttts commented May 18, 2020

/approve
/lgtm

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 18, 2020

// +kubebuilder:validation:Optional
// +groupName=controlplane.operator.openshift.io
package v1alpha1
Copy link
Contributor

Choose a reason for hiding this comment

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

fix the PR description to alpha.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this fixed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sttts done

@sanchezl sanchezl changed the title add PodNetworkConnectivityCheck CRD add PodNetworkConnectivityCheck/v1alpha1 CRD May 18, 2020
@sanchezl sanchezl changed the title add PodNetworkConnectivityCheck/v1alpha1 CRD add CR (Alpha): podnetworkconnectivitychecks.controlplane.operator.openshift.io/v1alpha1 May 29, 2020
@sanchezl sanchezl changed the title add CR (Alpha): podnetworkconnectivitychecks.controlplane.operator.openshift.io/v1alpha1 new CR: podnetworkconnectivitychecks.controlplane.operator.openshift.io/v1alpha1 May 29, 2020
@sanchezl
Copy link
Contributor Author

sanchezl commented Jun 5, 2020

/retest

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jun 5, 2020
// Success indicates if the log entry indicates a success or failure.
// +kubebuilder:validation:Required
// +required
Success bool `json:"success"`
Copy link
Contributor

Choose a reason for hiding this comment

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

followup: string. nothing is a bool.

@deads2k
Copy link
Contributor

deads2k commented Jun 5, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 5, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, sanchezl, sttts

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

The pull request process is described here

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

@openshift-merge-robot openshift-merge-robot merged commit fb2a6ca into openshift:master Jun 5, 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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants