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

chore: controller refactor #3373

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions api/jsonschema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1669,6 +1669,14 @@
"type": "array",
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge"
},
"lastUpdated": {
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time"
},
"observedGeneration": {
"description": "The generation observed by the controller.",
"format": "int64",
"type": "integer"
}
},
"type": "object"
Expand Down Expand Up @@ -3913,6 +3921,14 @@
"type": "array",
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge"
},
"lastUpdated": {
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time"
},
"observedGeneration": {
"description": "The generation observed by the controller.",
"format": "int64",
"type": "integer"
}
},
"type": "object"
Expand Down
16 changes: 16 additions & 0 deletions api/openapi-spec/swagger.json

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

70 changes: 70 additions & 0 deletions docs/APIs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8252,6 +8252,41 @@ Status </a> </em>

</tr>

<tr>

<td>

<code>lastUpdated</code></br> <em>
<a href="https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#time-v1-meta">
Kubernetes meta/v1.Time </a> </em>
</td>

<td>

<em>(Optional)</em>
</td>

</tr>

<tr>

<td>

<code>observedGeneration</code></br> <em> int64 </em>
</td>

<td>

<em>(Optional)</em>
<p>

The generation observed by the controller.
</p>

</td>

</tr>

</tbody>

</table>
Expand Down Expand Up @@ -18461,6 +18496,41 @@ Status </a> </em>

</tr>

<tr>

<td>

<code>lastUpdated</code></br> <em>
<a href="https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#time-v1-meta">
Kubernetes meta/v1.Time </a> </em>
</td>

<td>

<em>(Optional)</em>
</td>

</tr>

<tr>

<td>

<code>observedGeneration</code></br> <em> int64 </em>
</td>

<td>

<em>(Optional)</em>
<p>

The generation observed by the controller.
</p>

</td>

</tr>

</tbody>

</table>
Expand Down
22 changes: 22 additions & 0 deletions pkg/apis/events/v1alpha1/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ import (
corev1 "k8s.io/api/core/v1"
)

const (
Project = "argo-events"

KeyComponent = "app.kubernetes.io/component"
KeyPartOf = "app.kubernetes.io/part-of"
KeyManagedBy = "app.kubernetes.io/managed-by"
KeyAppName = "app.kubernetes.io/name"
KeyHash = "events.argoproj.io/hash" // hash of the object
KeyEventSourceName = "events.argoproj.io/eventsource-name"
KeySensorName = "events.argoproj.io/sensor-name"

// controllers
ControllerEventBus = "eventbus-controller"
ControllerEventSource = "eventsource-controller"
ControllerSensor = "sensor-controller"

// components
ComponentEventBus = "eventbus"
ComponentEventSource = "eventsourcd"
ComponentSensor = "sensor"
)

// EventSourceType is the type of event source
type EventSourceType string

Expand Down
20 changes: 20 additions & 0 deletions pkg/apis/events/v1alpha1/eventsource_types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package v1alpha1

import (
"fmt"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -122,6 +124,14 @@ func (e EventSourceSpec) GetReplicas() int32 {
return replicas
}

func (es EventSource) GetDeploymentName() string {
return fmt.Sprintf("%s-es", es.Name)
}

func (es EventSource) GetServiceName() string {
return fmt.Sprintf("%s-es-svc", es.Name)
}

// Service holds the service information eventsource exposes
type Service struct {
// Metadata sets the pods's metadata, i.e. annotations and labels
Expand Down Expand Up @@ -1497,6 +1507,11 @@ const (
// EventSourceStatus holds the status of the event-source resource
type EventSourceStatus struct {
Status `json:",inline" protobuf:"bytes,1,opt,name=status"`
// +optional
LastUpdated metav1.Time `json:"lastUpdated,omitempty" protobuf:"bytes,2,opt,name=lastUpdated"`
// The generation observed by the controller.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`
}

// InitConditions sets conditions to Unknown state.
Expand All @@ -1523,3 +1538,8 @@ func (es *EventSourceStatus) MarkDeployed() {
func (es *EventSourceStatus) MarkDeployFailed(reason, message string) {
es.MarkFalse(EventSourceConditionDeployed, reason, message)
}

// SetObservedGeneration sets the Status ObservedGeneration
func (pls *EventSourceStatus) SetObservedGeneration(value int64) {
pls.ObservedGeneration = value
}
Loading
Loading