Skip to content

apps: add missing consts and vars#89

Merged
openshift-merge-robot merged 1 commit into
openshift:masterfrom
mfojtik:add-template-annotations
Aug 30, 2018
Merged

apps: add missing consts and vars#89
openshift-merge-robot merged 1 commit into
openshift:masterfrom
mfojtik:add-template-annotations

Conversation

@mfojtik
Copy link
Copy Markdown
Contributor

@mfojtik mfojtik commented Aug 23, 2018

This adds missing consts and vars. The name of consts are harmonized to match the values.

/cc @openshift/api-review

@openshift-ci-robot openshift-ci-robot requested a review from a team August 23, 2018 08:24
@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 23, 2018
Comment thread apps/v1/consts.go Outdated
DeployerPodStartedAtAnnotation = "openshift.io/deployer-pod.started-at"
DeployerPodCompletedAtAnnotation = "openshift.io/deployer-pod.completed-at"
DeploymentReplicasAnnotation = "openshift.io/deployment.replicas"
DesiredReplicasAnnotation = "kubectl.kubernetes.io/desired-replicas"
Copy link
Copy Markdown
Contributor

@tnozicka tnozicka Aug 23, 2018

Choose a reason for hiding this comment

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

I don't think are openshift API is a good match for this prefix

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

?

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.

I don't think are API is a good match for this prefix

I assumed that this is an indication of what is, not what will be. I would like a code reference though. I thought this was only done by/for the rollout command.

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.

defining kubectl.kubernetes.io in openshift API

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.

There's nothing wrong with defining the constant here. The point of a constant is that you can copy them anywhere, because they have to be constant.

Comment thread apps/v1/consts.go Outdated
DeployerPodCreatedAtAnnotation = "openshift.io/deployer-pod.created-at"
DeployerPodStartedAtAnnotation = "openshift.io/deployer-pod.started-at"
DeployerPodCompletedAtAnnotation = "openshift.io/deployer-pod.completed-at"
DeploymentReplicasAnnotation = "openshift.io/deployment.replicas"
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.

This one seems internal, I am not even sure from the top of my head why we have it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

well, I don't see it used by anything ;-)

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.

I see it being set, not used

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.

I see it being set, not used

Set where? Leave it out of this pull for now then.

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.

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.

Wow, isn't that set incorrectly?

Add a TODO to revisit its meaning.

Copy link
Copy Markdown
Contributor

@tnozicka tnozicka Aug 29, 2018

Choose a reason for hiding this comment

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

I don't think we need that annotation at all, nor should upstream (they are actively using similar one). If there is a change and you see the DC template and the RC it seems pretty straight forward to distinguish a scale update from config update.

Don't add it, I am gonna drop its occurrences.

Comment thread apps/v1/types.go Outdated
From corev1.ObjectReference `json:"from" protobuf:"bytes,1,opt,name=from"`
}

type DeploymentStatus string
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.

we were usually keeping those close to the enum definition, is this a new pattern in opeshift/api?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it is types vs. const I don't feel strong about where this definition will live

Copy link
Copy Markdown
Contributor

@tnozicka tnozicka Aug 23, 2018

Choose a reason for hiding this comment

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

These two parts form an enum in Go. Defining an enum in 2 files seems weird to me; maybe that's by my notion of enums from stronger types languages like C++.

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.

it is types vs. const I don't feel strong about where this definition will live

I think @tnozicka is correct. We consistently place it here to help those without IDEs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No problem, I will move it

Comment thread apps/v1/consts.go
@@ -0,0 +1,71 @@
package v1

const (
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.

@mfojtik can you break these out into which objects they're placed on and see about some doc? Something like "this set of annotations are set on a replicationcontroller created by the DC controller".

It will help us know which are inputs and which are outputs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure, it will take some time to do that investigation, but I guess it is worth

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@deads2k done. added comments for each const and also brief desc of what sets it and what consume it.

@mfojtik mfojtik force-pushed the add-template-annotations branch from 6f6f8c6 to 1a3901b Compare August 30, 2018 10:30
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 30, 2018
Comment thread apps/v1/consts.go Outdated
// records the time in RFC3339 format of when the deployer pod for this particular
// deployment was started.
// This is set by deployer controller, but not consumed by any command or internally.
DeployerPodStartedAtAnnotation = "openshift.io/deployer-pod.started-at"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tnozicka @deads2k candidate for removal

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.

why? or you just want to move it to appsutil?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tnozicka I think these are providing "future" value for us, not for users or anyone integrating with OpenShift... I think the intention here was to improve the deployer process by knowing the times here so we can calculate the timeouts better. That to me is an internal thing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tnozicka yes, appsutil

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.

+1, appsutil only since it's internal

Comment thread apps/v1/consts.go Outdated
// records the time in RFC3339 format of when the deployer pod for this particular
// deployment was created.
// This is set by deployer controller, but not consumed by any command or internally.
DeployerPodCreatedAtAnnotation = "openshift.io/deployer-pod.created-at"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tnozicka @deads2k candidate to removal

Comment thread apps/v1/consts.go Outdated

// DeployerPodCompletedAtAnnotation is an annotation on deployment that records
// the time in RFC3339 format of when the deployer pod finished.
// This is set by deployer controller, but not consumed by any command or internally.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tnozicka @deads2k candidate for removal

Comment thread apps/v1/consts.go Outdated
// DesiredReplicasAnnotation represents the desired number of replicas for a
// new deployment.
// This is set by deployer controller, but not consumed by any command or internally.
DesiredReplicasAnnotation = "kubectl.kubernetes.io/desired-replicas"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tnozicka @deads2k candidate for removal

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.

+1, I'd remove it from the whole code base

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tnozicka will make PR

Comment thread apps/v1/consts.go Outdated
const (
// DeploymentStatusReasonAnnotation represents the reason for deployment being in a given state
// Used for specifying the reason for cancellation or failure of a deployment
// This is set by deployer controller and consumed in retry and history commands.
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.

I am slightly afraid such comments get outdated over time

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

they are for review only ;-) i will remove them before merge

Comment thread apps/v1/consts.go Outdated
// DeploymentAnnotation is an annotation on a deployer Pod. The annotation value is the name
// of the deployment (a ReplicationController) on which the deployer Pod acts.
// This is set by deployer controller and consumed internally and in oc adm top command.
DeploymentAnnotation = "openshift.io/deployment.name"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is really a replication controller name annotation inside deployer pod... We already have ownerRef there so I vote for removing this from api and replacing the origin code to use ownerRefs over this annotation.

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.

This is really a replication controller name annotation inside deployer pod... We already have ownerRef there so I vote for removing this from api and replacing the origin code to use ownerRefs over this annotation.

Deprecate this one too.

Comment thread apps/v1/consts.go
// DeploymentConfigAnnotation is an annotation name used to correlate a deployment with the
// DeploymentConfig on which the deployment is based.
// This is set by deployer controller and consumed internally and in oc adm prune command.
DeploymentConfigAnnotation = "openshift.io/deployment-config.name"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I suspect this one will be the same as above...

Comment thread apps/v1/consts.go Outdated

// DeploymentCancelledAnnotation indicates that the deployment has been cancelled
// The annotation value does not matter and its mere presence indicates cancellation.
// This is set by deployment config controller or oc rollout cancel command.
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.

set on an RC or a DC?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

RC, I will write it there

@mfojtik mfojtik force-pushed the add-template-annotations branch from 1a3901b to bab084e Compare August 30, 2018 12:31
@deads2k
Copy link
Copy Markdown
Contributor

deads2k commented Aug 30, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 30, 2018
@openshift-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, mfojtik

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 30, 2018
@openshift-merge-robot openshift-merge-robot merged commit 6dc9c18 into openshift:master Aug 30, 2018
@mfojtik mfojtik deleted the add-template-annotations branch September 5, 2018 21:10
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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants