Skip to content
This repository was archived by the owner on Jun 4, 2021. It is now read-only.
Merged
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
2 changes: 2 additions & 0 deletions config/crds/sources_v1alpha1_containersource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ spec:
kind: ContainerSource
plural: containersources
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down
2 changes: 2 additions & 0 deletions config/crds/sources_v1alpha1_gcppubsubsource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ spec:
kind: GcpPubSubSource
plural: gcppubsubsources
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down
2 changes: 2 additions & 0 deletions config/crds/sources_v1alpha1_githubsource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ spec:
kind: GitHubSource
plural: githubsources
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down
2 changes: 2 additions & 0 deletions config/crds/sources_v1alpha1_kuberneteseventsource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ spec:
kind: KubernetesEventSource
plural: kuberneteseventsources
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down
8 changes: 8 additions & 0 deletions config/default-gcppubsub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ spec:
kind: ContainerSource
plural: containersources
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down Expand Up @@ -100,6 +102,8 @@ spec:
kind: GcpPubSubSource
plural: gcppubsubsources
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down Expand Up @@ -172,6 +176,8 @@ spec:
kind: GitHubSource
plural: githubsources
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down Expand Up @@ -297,6 +303,8 @@ spec:
kind: KubernetesEventSource
plural: kuberneteseventsources
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down
6 changes: 6 additions & 0 deletions config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ spec:
kind: ContainerSource
plural: containersources
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down Expand Up @@ -100,6 +102,8 @@ spec:
kind: GitHubSource
plural: githubsources
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down Expand Up @@ -225,6 +229,8 @@ spec:
kind: KubernetesEventSource
plural: kuberneteseventsources
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/sources/v1alpha1/containersource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func (s *ContainerSourceStatus) MarkNotDeployed(reason, messageFormat string, me

// ContainerSource is the Schema for the containersources API
// +k8s:openapi-gen=true
// +kubebuilder:subresource:status
// +kubebuilder:categories=all,knative,eventing,sources
type ContainerSource struct {
metav1.TypeMeta `json:",inline"`
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/sources/v1alpha1/gcp_pubsub_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (

// GcpPubSubSource is the Schema for the gcppubsubsources API.
// +k8s:openapi-gen=true
// +kubebuilder:subresource:status
// +kubebuilder:categories=all,knative,eventing,sources
type GcpPubSubSource struct {
metav1.TypeMeta `json:",inline"`
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/sources/v1alpha1/githubsource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func (s *GitHubSourceStatus) MarkNoSink(reason, messageFormat string, messageA .

// GitHubSource is the Schema for the githubsources API
// +k8s:openapi-gen=true
// +kubebuilder:subresource:status
// +kubebuilder:categories=all,knative,eventing,sources
type GitHubSource struct {
metav1.TypeMeta `json:",inline"`
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/sources/v1alpha1/kuberneteseventsource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func (s *KubernetesEventSourceStatus) MarkUnready(reason, messageFormat string,

// KubernetesEventSource is the Schema for the kuberneteseventsources API
// +k8s:openapi-gen=true
// +kubebuilder:subresource:status
// +kubebuilder:categories=all,knative,eventing,sources
type KubernetesEventSource struct {
metav1.TypeMeta `json:",inline"`
Expand Down
6 changes: 1 addition & 5 deletions pkg/controller/kuberneteseventsource/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,7 @@ func (r *reconciler) update(ctx context.Context, u *sourcesv1alpha1.KubernetesEv

if !equality.Semantic.DeepEqual(current.Status, u.Status) {
current.Status = u.Status
// Until #38113 is merged, we must use Update instead of UpdateStatus to
// update the Status block of the Feed resource. UpdateStatus will not
// allow changes to the Spec of the resource, which is ideal for ensuring
// nothing other than resource status has been updated.
return r.Update(ctx, current)
return r.Status().Update(ctx, current)
}

return nil
Expand Down
7 changes: 3 additions & 4 deletions pkg/controller/sdk/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,9 @@ func (r *Reconciler) update(ctx context.Context, request reconcile.Request, obje
}
freshFinalizers.SetFinalizers(orgFinalizers.GetFinalizers())

// Until #38113 is merged, we must use Update instead of UpdateStatus to
// update the Status block of the Source resource. UpdateStatus will not
// allow changes to the Spec of the resource, which is ideal for ensuring
// nothing other than resource status has been updated.
// We could use the status subresource here, but since there may be an update
// to finalizers also, we have to update the entire object.
//TODO(grantr): use status subresource if finalizers did not change
if err := r.client.Update(ctx, freshObj); err != nil {
return nil, err
}
Expand Down