Skip to content

Commit

Permalink
Merge pull request #218 from fluxcd/port-pkg-runtime
Browse files Browse the repository at this point in the history
Port to new pkg/runtime helpers
  • Loading branch information
squaremo committed Sep 20, 2021
2 parents 55b55c6 + 57d4043 commit 486c6cf
Show file tree
Hide file tree
Showing 11 changed files with 195 additions and 207 deletions.
4 changes: 2 additions & 2 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/fluxcd/image-automation-controller/api
go 1.16

require (
github.com/fluxcd/pkg/apis/meta v0.10.0
github.com/fluxcd/source-controller/api v0.15.4
github.com/fluxcd/pkg/apis/meta v0.11.0-rc.1
github.com/fluxcd/source-controller/api v0.15.4-0.20210812121231-7c95db88f781
k8s.io/apimachinery v0.21.3
sigs.k8s.io/controller-runtime v0.9.5
)
60 changes: 52 additions & 8 deletions api/go.sum

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions api/v1alpha1/imageupdateautomation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ const (
NoStrategyReason = "MissingUpdateStrategy"
)

// SetImageUpdateAutomationReadiness sets the ready condition with the given status, reason and message.
func SetImageUpdateAutomationReadiness(auto *ImageUpdateAutomation, status metav1.ConditionStatus, reason, message string) {
auto.Status.ObservedGeneration = auto.ObjectMeta.Generation
meta.SetResourceCondition(auto, meta.ReadyCondition, status, reason, message)
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Last run",type=string,JSONPath=`.status.lastAutomationRunTime`
Expand Down
6 changes: 0 additions & 6 deletions api/v1alpha2/imageupdateautomation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,6 @@ const (
NoStrategyReason = "MissingUpdateStrategy"
)

// SetImageUpdateAutomationReadiness sets the ready condition with the given status, reason and message.
func SetImageUpdateAutomationReadiness(auto *ImageUpdateAutomation, status metav1.ConditionStatus, reason, message string) {
auto.Status.ObservedGeneration = auto.ObjectMeta.Generation
meta.SetResourceCondition(auto, meta.ReadyCondition, status, reason, message)
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="Last run",type=string,JSONPath=`.status.lastAutomationRunTime`
Expand Down
22 changes: 16 additions & 6 deletions api/v1beta1/imageupdateautomation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,6 @@ const (
NoStrategyReason = "MissingUpdateStrategy"
)

// SetImageUpdateAutomationReadiness sets the ready condition with the given status, reason and message.
func SetImageUpdateAutomationReadiness(auto *ImageUpdateAutomation, status metav1.ConditionStatus, reason, message string) {
auto.Status.ObservedGeneration = auto.ObjectMeta.Generation
meta.SetResourceCondition(auto, meta.ReadyCondition, status, reason, message)
}

//+kubebuilder:storageversion
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
Expand All @@ -133,6 +127,22 @@ type ImageUpdateAutomation struct {
Status ImageUpdateAutomationStatus `json:"status,omitempty"`
}

// GetConditions gets the slice of conditions from the receiver. The
// intended pattern is that methods for mutating the conditions will
// use GetConditions to see the current values, construct a new set of
// conditions based on those, then SetConditions to apply the result.
func (obj ImageUpdateAutomation) GetConditions() []metav1.Condition {
return obj.Status.Conditions
}

// SetConditions sets the slice of condition on the receiver.
func (obj *ImageUpdateAutomation) SetConditions(conditions []metav1.Condition) {
obj.Status.Conditions = conditions
}

// GetStatusConditions returns a pointer to the object's conditions so
// they can be mutated. Deprecated: use GetConditions and
// SetConditions instead.
func (auto *ImageUpdateAutomation) GetStatusConditions() *[]metav1.Condition {
return &auto.Status.Conditions
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
description: GitRepositoryRef refers to the resource giving access details to a git repository to update files in.
properties:
name:
description: Name of the referent
description: Name of the referent.
type: string
required:
- name
Expand Down Expand Up @@ -74,7 +74,7 @@ spec:
description: SecretRef holds the name to a secret that contains a 'git.asc' key corresponding to the ASCII Armored file containing the GPG signing keypair as the value. It must be in the same namespace as the ImageUpdateAutomation.
properties:
name:
description: Name of the referent
description: Name of the referent.
type: string
required:
- name
Expand Down Expand Up @@ -172,7 +172,7 @@ spec:
format: date-time
type: string
lastHandledReconcileAt:
description: LastHandledReconcileAt holds the value of the most recent reconcile request value, so a change can be detected.
description: LastHandledReconcileAt holds the value of the most recent reconcile request value, so a change of the annotation value can be detected.
type: string
lastPushCommit:
description: LastPushCommit records the SHA1 of the last commit made by the controller, for this automation object
Expand Down Expand Up @@ -261,7 +261,7 @@ spec:
description: SecretRef holds the name to a secret that contains a 'git.asc' key corresponding to the ASCII Armored file containing the GPG signing keypair as the value. It must be in the same namespace as the ImageUpdateAutomation.
properties:
name:
description: Name of the referent
description: Name of the referent.
type: string
required:
- name
Expand Down Expand Up @@ -379,7 +379,7 @@ spec:
format: date-time
type: string
lastHandledReconcileAt:
description: LastHandledReconcileAt holds the value of the most recent reconcile request value, so a change can be detected.
description: LastHandledReconcileAt holds the value of the most recent reconcile request value, so a change of the annotation value can be detected.
type: string
lastPushCommit:
description: LastPushCommit records the SHA1 of the last commit made by the controller, for this automation object
Expand Down Expand Up @@ -468,7 +468,7 @@ spec:
description: SecretRef holds the name to a secret that contains a 'git.asc' key corresponding to the ASCII Armored file containing the GPG signing keypair as the value. It must be in the same namespace as the ImageUpdateAutomation.
properties:
name:
description: Name of the referent
description: Name of the referent.
type: string
required:
- name
Expand Down Expand Up @@ -586,7 +586,7 @@ spec:
format: date-time
type: string
lastHandledReconcileAt:
description: LastHandledReconcileAt holds the value of the most recent reconcile request value, so a change can be detected.
description: LastHandledReconcileAt holds the value of the most recent reconcile request value, so a change of the annotation value can be detected.
type: string
lastPushCommit:
description: LastPushCommit records the SHA1 of the last commit made by the controller, for this automation object
Expand Down
Loading

0 comments on commit 486c6cf

Please sign in to comment.