Refactor to adopt k8s standardized Condition type
Updates to use metav1.Condition type and removes references for deprecated corev1.Condition* constants and uses the new k8s api/meta helpers in place of the old pkg/apis/meta types. Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
This commit is contained in:
parent
35c6fd7884
commit
00bb853d0e
|
@ -3,7 +3,7 @@ module github.com/fluxcd/source-controller/api
|
||||||
go 1.15
|
go 1.15
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/fluxcd/pkg/apis/meta v0.2.0
|
github.com/fluxcd/pkg/apis/meta v0.3.0
|
||||||
k8s.io/api v0.19.3
|
k8s.io/api v0.19.3
|
||||||
k8s.io/apimachinery v0.19.3
|
k8s.io/apimachinery v0.19.3
|
||||||
sigs.k8s.io/controller-runtime v0.6.3
|
sigs.k8s.io/controller-runtime v0.6.3
|
||||||
|
|
|
@ -63,6 +63,8 @@ github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
github.com/fluxcd/pkg/apis/meta v0.2.0 h1:bxoFQtZM6OLLj0+n3h6ga7IEWUtGEDJPc65OWiXSMvY=
|
github.com/fluxcd/pkg/apis/meta v0.2.0 h1:bxoFQtZM6OLLj0+n3h6ga7IEWUtGEDJPc65OWiXSMvY=
|
||||||
github.com/fluxcd/pkg/apis/meta v0.2.0/go.mod h1:50RLLSfqM4LlQrh/+5LiJVf7Hjdthee8WDdXBvpjBdA=
|
github.com/fluxcd/pkg/apis/meta v0.2.0/go.mod h1:50RLLSfqM4LlQrh/+5LiJVf7Hjdthee8WDdXBvpjBdA=
|
||||||
|
github.com/fluxcd/pkg/apis/meta v0.3.0 h1:o2YkfGgf0j8sKeZs8cBmmmMKLA7kEoS1qYViOial1Ds=
|
||||||
|
github.com/fluxcd/pkg/apis/meta v0.3.0/go.mod h1:wOzQQx8CdtUQCGaLzqGu4QgnNxYkI6/wvdvlovxWhF0=
|
||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||||
|
|
|
@ -19,6 +19,7 @@ package v1beta1
|
||||||
import (
|
import (
|
||||||
"github.com/fluxcd/pkg/apis/meta"
|
"github.com/fluxcd/pkg/apis/meta"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ type BucketStatus struct {
|
||||||
|
|
||||||
// Conditions holds the conditions for the Bucket.
|
// Conditions holds the conditions for the Bucket.
|
||||||
// +optional
|
// +optional
|
||||||
Conditions []meta.Condition `json:"conditions,omitempty"`
|
Conditions []metav1.Condition `json:"conditions,omitempty"`
|
||||||
|
|
||||||
// URL is the download link for the artifact output of the last Bucket sync.
|
// URL is the download link for the artifact output of the last Bucket sync.
|
||||||
// +optional
|
// +optional
|
||||||
|
@ -106,22 +107,22 @@ const (
|
||||||
BucketOperationFailedReason string = "BucketOperationFailed"
|
BucketOperationFailedReason string = "BucketOperationFailed"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BucketProgressing resets the conditions of the Bucket to meta.Condition of
|
// BucketProgressing resets the conditions of the Bucket to metav1.Condition of
|
||||||
// type meta.ReadyCondition with status 'Unknown' and meta.ProgressingReason
|
// type meta.ReadyCondition with status 'Unknown' and meta.ProgressingReason
|
||||||
// reason and message. It returns the modified Bucket.
|
// reason and message. It returns the modified Bucket.
|
||||||
func BucketProgressing(bucket Bucket) Bucket {
|
func BucketProgressing(bucket Bucket) Bucket {
|
||||||
bucket.Status.ObservedGeneration = bucket.Generation
|
bucket.Status.ObservedGeneration = bucket.Generation
|
||||||
bucket.Status.URL = ""
|
bucket.Status.URL = ""
|
||||||
bucket.Status.Conditions = []meta.Condition{}
|
bucket.Status.Conditions = []metav1.Condition{}
|
||||||
SetBucketCondition(&bucket, meta.ReadyCondition, corev1.ConditionUnknown, meta.ProgressingReason, "reconciliation in progress")
|
SetBucketCondition(&bucket, meta.ReadyCondition, metav1.ConditionUnknown, meta.ProgressingReason, "reconciliation in progress")
|
||||||
return bucket
|
return bucket
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBucketCondition sets the given condition with the given status, reason and
|
// SetBucketCondition sets the given condition with the given status, reason and
|
||||||
// message on the Bucket.
|
// message on the Bucket.
|
||||||
func SetBucketCondition(bucket *Bucket, conditionType string, status corev1.ConditionStatus, reason, message string) {
|
func SetBucketCondition(bucket *Bucket, conditionType string, status metav1.ConditionStatus, reason, message string) {
|
||||||
bucket.Status.Conditions = meta.FilterOutCondition(bucket.Status.Conditions, conditionType)
|
bucket.Status.Conditions = meta.FilterOutCondition(bucket.Status.Conditions, conditionType)
|
||||||
bucket.Status.Conditions = append(bucket.Status.Conditions, meta.Condition{
|
bucket.Status.Conditions = append(bucket.Status.Conditions, metav1.Condition{
|
||||||
Type: conditionType,
|
Type: conditionType,
|
||||||
Status: status,
|
Status: status,
|
||||||
LastTransitionTime: metav1.Now(),
|
LastTransitionTime: metav1.Now(),
|
||||||
|
@ -136,22 +137,22 @@ func SetBucketCondition(bucket *Bucket, conditionType string, status corev1.Cond
|
||||||
func BucketReady(bucket Bucket, artifact Artifact, url, reason, message string) Bucket {
|
func BucketReady(bucket Bucket, artifact Artifact, url, reason, message string) Bucket {
|
||||||
bucket.Status.Artifact = &artifact
|
bucket.Status.Artifact = &artifact
|
||||||
bucket.Status.URL = url
|
bucket.Status.URL = url
|
||||||
SetBucketCondition(&bucket, meta.ReadyCondition, corev1.ConditionTrue, reason, message)
|
SetBucketCondition(&bucket, meta.ReadyCondition, metav1.ConditionTrue, reason, message)
|
||||||
return bucket
|
return bucket
|
||||||
}
|
}
|
||||||
|
|
||||||
// BucketNotReady sets the meta.ReadyCondition on the Bucket to 'False', with
|
// BucketNotReady sets the meta.ReadyCondition on the Bucket to 'False', with
|
||||||
// the given reason and message. It returns the modified Bucket.
|
// the given reason and message. It returns the modified Bucket.
|
||||||
func BucketNotReady(bucket Bucket, reason, message string) Bucket {
|
func BucketNotReady(bucket Bucket, reason, message string) Bucket {
|
||||||
SetBucketCondition(&bucket, meta.ReadyCondition, corev1.ConditionFalse, reason, message)
|
SetBucketCondition(&bucket, meta.ReadyCondition, metav1.ConditionFalse, reason, message)
|
||||||
return bucket
|
return bucket
|
||||||
}
|
}
|
||||||
|
|
||||||
// BucketReadyMessage returns the message of the meta.Condition of type
|
// BucketReadyMessage returns the message of the metav1.Condition of type
|
||||||
// meta.ReadyCondition with status 'True' if present, or an empty string.
|
// meta.ReadyCondition with status 'True' if present, or an empty string.
|
||||||
func BucketReadyMessage(bucket Bucket) string {
|
func BucketReadyMessage(bucket Bucket) string {
|
||||||
if c := meta.GetCondition(bucket.Status.Conditions, meta.ReadyCondition); c != nil {
|
if c := apimeta.FindStatusCondition(bucket.Status.Conditions, meta.ReadyCondition); c != nil {
|
||||||
if c.Status == corev1.ConditionTrue {
|
if c.Status == metav1.ConditionTrue {
|
||||||
return c.Message
|
return c.Message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ package v1beta1
|
||||||
import (
|
import (
|
||||||
"github.com/fluxcd/pkg/apis/meta"
|
"github.com/fluxcd/pkg/apis/meta"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ type GitRepositoryStatus struct {
|
||||||
|
|
||||||
// Conditions holds the conditions for the GitRepository.
|
// Conditions holds the conditions for the GitRepository.
|
||||||
// +optional
|
// +optional
|
||||||
Conditions []meta.Condition `json:"conditions,omitempty"`
|
Conditions []metav1.Condition `json:"conditions,omitempty"`
|
||||||
|
|
||||||
// URL is the download link for the artifact output of the last repository
|
// URL is the download link for the artifact output of the last repository
|
||||||
// sync.
|
// sync.
|
||||||
|
@ -128,22 +129,22 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// GitRepositoryProgressing resets the conditions of the GitRepository to
|
// GitRepositoryProgressing resets the conditions of the GitRepository to
|
||||||
// meta.Condition of type meta.ReadyCondition with status 'Unknown' and
|
// metav1.Condition of type meta.ReadyCondition with status 'Unknown' and
|
||||||
// meta.ProgressingReason reason and message. It returns the modified
|
// meta.ProgressingReason reason and message. It returns the modified
|
||||||
// GitRepository.
|
// GitRepository.
|
||||||
func GitRepositoryProgressing(repository GitRepository) GitRepository {
|
func GitRepositoryProgressing(repository GitRepository) GitRepository {
|
||||||
repository.Status.ObservedGeneration = repository.Generation
|
repository.Status.ObservedGeneration = repository.Generation
|
||||||
repository.Status.URL = ""
|
repository.Status.URL = ""
|
||||||
repository.Status.Conditions = []meta.Condition{}
|
repository.Status.Conditions = []metav1.Condition{}
|
||||||
SetGitRepositoryCondition(&repository, meta.ReadyCondition, corev1.ConditionUnknown, meta.ProgressingReason, "reconciliation in progress")
|
SetGitRepositoryCondition(&repository, meta.ReadyCondition, metav1.ConditionUnknown, meta.ProgressingReason, "reconciliation in progress")
|
||||||
return repository
|
return repository
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetGitRepositoryCondition sets the given condition with the given status,
|
// SetGitRepositoryCondition sets the given condition with the given status,
|
||||||
// reason and message on the GitRepository.
|
// reason and message on the GitRepository.
|
||||||
func SetGitRepositoryCondition(repository *GitRepository, condition string, status corev1.ConditionStatus, reason, message string) {
|
func SetGitRepositoryCondition(repository *GitRepository, condition string, status metav1.ConditionStatus, reason, message string) {
|
||||||
repository.Status.Conditions = meta.FilterOutCondition(repository.Status.Conditions, condition)
|
repository.Status.Conditions = meta.FilterOutCondition(repository.Status.Conditions, condition)
|
||||||
repository.Status.Conditions = append(repository.Status.Conditions, meta.Condition{
|
repository.Status.Conditions = append(repository.Status.Conditions, metav1.Condition{
|
||||||
Type: condition,
|
Type: condition,
|
||||||
Status: status,
|
Status: status,
|
||||||
LastTransitionTime: metav1.Now(),
|
LastTransitionTime: metav1.Now(),
|
||||||
|
@ -158,7 +159,7 @@ func SetGitRepositoryCondition(repository *GitRepository, condition string, stat
|
||||||
func GitRepositoryReady(repository GitRepository, artifact Artifact, url, reason, message string) GitRepository {
|
func GitRepositoryReady(repository GitRepository, artifact Artifact, url, reason, message string) GitRepository {
|
||||||
repository.Status.Artifact = &artifact
|
repository.Status.Artifact = &artifact
|
||||||
repository.Status.URL = url
|
repository.Status.URL = url
|
||||||
SetGitRepositoryCondition(&repository, meta.ReadyCondition, corev1.ConditionTrue, reason, message)
|
SetGitRepositoryCondition(&repository, meta.ReadyCondition, metav1.ConditionTrue, reason, message)
|
||||||
return repository
|
return repository
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,15 +167,15 @@ func GitRepositoryReady(repository GitRepository, artifact Artifact, url, reason
|
||||||
// to 'False', with the given reason and message. It returns the modified
|
// to 'False', with the given reason and message. It returns the modified
|
||||||
// GitRepository.
|
// GitRepository.
|
||||||
func GitRepositoryNotReady(repository GitRepository, reason, message string) GitRepository {
|
func GitRepositoryNotReady(repository GitRepository, reason, message string) GitRepository {
|
||||||
SetGitRepositoryCondition(&repository, meta.ReadyCondition, corev1.ConditionFalse, reason, message)
|
SetGitRepositoryCondition(&repository, meta.ReadyCondition, metav1.ConditionFalse, reason, message)
|
||||||
return repository
|
return repository
|
||||||
}
|
}
|
||||||
|
|
||||||
// GitRepositoryReadyMessage returns the message of the meta.Condition of type
|
// GitRepositoryReadyMessage returns the message of the metav1.Condition of type
|
||||||
// meta.ReadyCondition with status 'True' if present, or an empty string.
|
// meta.ReadyCondition with status 'True' if present, or an empty string.
|
||||||
func GitRepositoryReadyMessage(repository GitRepository) string {
|
func GitRepositoryReadyMessage(repository GitRepository) string {
|
||||||
if c := meta.GetCondition(repository.Status.Conditions, meta.ReadyCondition); c != nil {
|
if c := apimeta.FindStatusCondition(repository.Status.Conditions, meta.ReadyCondition); c != nil {
|
||||||
if c.Status == corev1.ConditionTrue {
|
if c.Status == metav1.ConditionTrue {
|
||||||
return c.Message
|
return c.Message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/fluxcd/pkg/apis/meta"
|
"github.com/fluxcd/pkg/apis/meta"
|
||||||
corev1 "k8s.io/api/core/v1"
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ type HelmChartStatus struct {
|
||||||
|
|
||||||
// Conditions holds the conditions for the HelmChart.
|
// Conditions holds the conditions for the HelmChart.
|
||||||
// +optional
|
// +optional
|
||||||
Conditions []meta.Condition `json:"conditions,omitempty"`
|
Conditions []metav1.Condition `json:"conditions,omitempty"`
|
||||||
|
|
||||||
// URL is the download link for the last chart pulled.
|
// URL is the download link for the last chart pulled.
|
||||||
// +optional
|
// +optional
|
||||||
|
@ -112,16 +112,16 @@ const (
|
||||||
func HelmChartProgressing(chart HelmChart) HelmChart {
|
func HelmChartProgressing(chart HelmChart) HelmChart {
|
||||||
chart.Status.ObservedGeneration = chart.Generation
|
chart.Status.ObservedGeneration = chart.Generation
|
||||||
chart.Status.URL = ""
|
chart.Status.URL = ""
|
||||||
chart.Status.Conditions = []meta.Condition{}
|
chart.Status.Conditions = []metav1.Condition{}
|
||||||
SetHelmChartCondition(&chart, meta.ReadyCondition, corev1.ConditionUnknown, meta.ProgressingReason, "reconciliation in progress")
|
SetHelmChartCondition(&chart, meta.ReadyCondition, metav1.ConditionUnknown, meta.ProgressingReason, "reconciliation in progress")
|
||||||
return chart
|
return chart
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetHelmChartCondition sets the given condition with the given status, reason
|
// SetHelmChartCondition sets the given condition with the given status, reason
|
||||||
// and message on the HelmChart.
|
// and message on the HelmChart.
|
||||||
func SetHelmChartCondition(chart *HelmChart, condition string, status corev1.ConditionStatus, reason, message string) {
|
func SetHelmChartCondition(chart *HelmChart, condition string, status metav1.ConditionStatus, reason, message string) {
|
||||||
chart.Status.Conditions = meta.FilterOutCondition(chart.Status.Conditions, condition)
|
chart.Status.Conditions = meta.FilterOutCondition(chart.Status.Conditions, condition)
|
||||||
chart.Status.Conditions = append(chart.Status.Conditions, meta.Condition{
|
chart.Status.Conditions = append(chart.Status.Conditions, metav1.Condition{
|
||||||
Type: condition,
|
Type: condition,
|
||||||
Status: status,
|
Status: status,
|
||||||
LastTransitionTime: metav1.Now(),
|
LastTransitionTime: metav1.Now(),
|
||||||
|
@ -136,7 +136,7 @@ func SetHelmChartCondition(chart *HelmChart, condition string, status corev1.Con
|
||||||
func HelmChartReady(chart HelmChart, artifact Artifact, url, reason, message string) HelmChart {
|
func HelmChartReady(chart HelmChart, artifact Artifact, url, reason, message string) HelmChart {
|
||||||
chart.Status.Artifact = &artifact
|
chart.Status.Artifact = &artifact
|
||||||
chart.Status.URL = url
|
chart.Status.URL = url
|
||||||
SetHelmChartCondition(&chart, meta.ReadyCondition, corev1.ConditionTrue, reason, message)
|
SetHelmChartCondition(&chart, meta.ReadyCondition, metav1.ConditionTrue, reason, message)
|
||||||
return chart
|
return chart
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,15 +144,15 @@ func HelmChartReady(chart HelmChart, artifact Artifact, url, reason, message str
|
||||||
// 'False', with the given reason and message. It returns the modified
|
// 'False', with the given reason and message. It returns the modified
|
||||||
// HelmChart.
|
// HelmChart.
|
||||||
func HelmChartNotReady(chart HelmChart, reason, message string) HelmChart {
|
func HelmChartNotReady(chart HelmChart, reason, message string) HelmChart {
|
||||||
SetHelmChartCondition(&chart, meta.ReadyCondition, corev1.ConditionFalse, reason, message)
|
SetHelmChartCondition(&chart, meta.ReadyCondition, metav1.ConditionFalse, reason, message)
|
||||||
return chart
|
return chart
|
||||||
}
|
}
|
||||||
|
|
||||||
// HelmChartReadyMessage returns the message of the meta.ReadyCondition with
|
// HelmChartReadyMessage returns the message of the meta.ReadyCondition with
|
||||||
// status 'True', or an empty string.
|
// status 'True', or an empty string.
|
||||||
func HelmChartReadyMessage(chart HelmChart) string {
|
func HelmChartReadyMessage(chart HelmChart) string {
|
||||||
if c := meta.GetCondition(chart.Status.Conditions, meta.ReadyCondition); c != nil {
|
if c := apimeta.FindStatusCondition(chart.Status.Conditions, meta.ReadyCondition); c != nil {
|
||||||
if c.Status == corev1.ConditionTrue {
|
if c.Status == metav1.ConditionTrue {
|
||||||
return c.Message
|
return c.Message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ package v1beta1
|
||||||
import (
|
import (
|
||||||
"github.com/fluxcd/pkg/apis/meta"
|
"github.com/fluxcd/pkg/apis/meta"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ type HelmRepositoryStatus struct {
|
||||||
|
|
||||||
// Conditions holds the conditions for the HelmRepository.
|
// Conditions holds the conditions for the HelmRepository.
|
||||||
// +optional
|
// +optional
|
||||||
Conditions []meta.Condition `json:"conditions,omitempty"`
|
Conditions []metav1.Condition `json:"conditions,omitempty"`
|
||||||
|
|
||||||
// URL is the download link for the last index fetched.
|
// URL is the download link for the last index fetched.
|
||||||
// +optional
|
// +optional
|
||||||
|
@ -85,22 +86,22 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// HelmRepositoryProgressing resets the conditions of the HelmRepository to
|
// HelmRepositoryProgressing resets the conditions of the HelmRepository to
|
||||||
// meta.Condition of type meta.ReadyCondition with status 'Unknown' and
|
// metav1.Condition of type meta.ReadyCondition with status 'Unknown' and
|
||||||
// meta.ProgressingReason reason and message. It returns the modified
|
// meta.ProgressingReason reason and message. It returns the modified
|
||||||
// HelmRepository.
|
// HelmRepository.
|
||||||
func HelmRepositoryProgressing(repository HelmRepository) HelmRepository {
|
func HelmRepositoryProgressing(repository HelmRepository) HelmRepository {
|
||||||
repository.Status.ObservedGeneration = repository.Generation
|
repository.Status.ObservedGeneration = repository.Generation
|
||||||
repository.Status.URL = ""
|
repository.Status.URL = ""
|
||||||
repository.Status.Conditions = []meta.Condition{}
|
repository.Status.Conditions = []metav1.Condition{}
|
||||||
SetHelmRepositoryCondition(&repository, meta.ReadyCondition, corev1.ConditionUnknown, meta.ProgressingReason, "reconciliation in progress")
|
SetHelmRepositoryCondition(&repository, meta.ReadyCondition, metav1.ConditionUnknown, meta.ProgressingReason, "reconciliation in progress")
|
||||||
return repository
|
return repository
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetHelmRepositoryCondition sets the given condition with the given status,
|
// SetHelmRepositoryCondition sets the given condition with the given status,
|
||||||
// reason and message on the HelmRepository.
|
// reason and message on the HelmRepository.
|
||||||
func SetHelmRepositoryCondition(repository *HelmRepository, condition string, status corev1.ConditionStatus, reason, message string) {
|
func SetHelmRepositoryCondition(repository *HelmRepository, condition string, status metav1.ConditionStatus, reason, message string) {
|
||||||
repository.Status.Conditions = meta.FilterOutCondition(repository.Status.Conditions, condition)
|
repository.Status.Conditions = meta.FilterOutCondition(repository.Status.Conditions, condition)
|
||||||
repository.Status.Conditions = append(repository.Status.Conditions, meta.Condition{
|
repository.Status.Conditions = append(repository.Status.Conditions, metav1.Condition{
|
||||||
Type: condition,
|
Type: condition,
|
||||||
Status: status,
|
Status: status,
|
||||||
LastTransitionTime: metav1.Now(),
|
LastTransitionTime: metav1.Now(),
|
||||||
|
@ -115,7 +116,7 @@ func SetHelmRepositoryCondition(repository *HelmRepository, condition string, st
|
||||||
func HelmRepositoryReady(repository HelmRepository, artifact Artifact, url, reason, message string) HelmRepository {
|
func HelmRepositoryReady(repository HelmRepository, artifact Artifact, url, reason, message string) HelmRepository {
|
||||||
repository.Status.Artifact = &artifact
|
repository.Status.Artifact = &artifact
|
||||||
repository.Status.URL = url
|
repository.Status.URL = url
|
||||||
SetHelmRepositoryCondition(&repository, meta.ReadyCondition, corev1.ConditionTrue, reason, message)
|
SetHelmRepositoryCondition(&repository, meta.ReadyCondition, metav1.ConditionTrue, reason, message)
|
||||||
return repository
|
return repository
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,15 +124,15 @@ func HelmRepositoryReady(repository HelmRepository, artifact Artifact, url, reas
|
||||||
// HelmRepository to 'False', with the given reason and message. It returns the
|
// HelmRepository to 'False', with the given reason and message. It returns the
|
||||||
// modified HelmRepository.
|
// modified HelmRepository.
|
||||||
func HelmRepositoryNotReady(repository HelmRepository, reason, message string) HelmRepository {
|
func HelmRepositoryNotReady(repository HelmRepository, reason, message string) HelmRepository {
|
||||||
SetHelmRepositoryCondition(&repository, meta.ReadyCondition, corev1.ConditionFalse, reason, message)
|
SetHelmRepositoryCondition(&repository, meta.ReadyCondition, metav1.ConditionFalse, reason, message)
|
||||||
return repository
|
return repository
|
||||||
}
|
}
|
||||||
|
|
||||||
// HelmRepositoryReadyMessage returns the message of the meta.Condition of type
|
// HelmRepositoryReadyMessage returns the message of the metav1.Condition of type
|
||||||
// meta.ReadyCondition with status 'True' if present, or an empty string.
|
// meta.ReadyCondition with status 'True' if present, or an empty string.
|
||||||
func HelmRepositoryReadyMessage(repository HelmRepository) string {
|
func HelmRepositoryReadyMessage(repository HelmRepository) string {
|
||||||
if c := meta.GetCondition(repository.Status.Conditions, meta.ReadyCondition); c != nil {
|
if c := apimeta.FindStatusCondition(repository.Status.Conditions, meta.ReadyCondition); c != nil {
|
||||||
if c.Status == corev1.ConditionTrue {
|
if c.Status == metav1.ConditionTrue {
|
||||||
return c.Message
|
return c.Message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ limitations under the License.
|
||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/fluxcd/pkg/apis/meta"
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
@ -138,7 +137,7 @@ func (in *BucketStatus) DeepCopyInto(out *BucketStatus) {
|
||||||
*out = *in
|
*out = *in
|
||||||
if in.Conditions != nil {
|
if in.Conditions != nil {
|
||||||
in, out := &in.Conditions, &out.Conditions
|
in, out := &in.Conditions, &out.Conditions
|
||||||
*out = make([]meta.Condition, len(*in))
|
*out = make([]metav1.Condition, len(*in))
|
||||||
for i := range *in {
|
for i := range *in {
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
|
@ -280,7 +279,7 @@ func (in *GitRepositoryStatus) DeepCopyInto(out *GitRepositoryStatus) {
|
||||||
*out = *in
|
*out = *in
|
||||||
if in.Conditions != nil {
|
if in.Conditions != nil {
|
||||||
in, out := &in.Conditions, &out.Conditions
|
in, out := &in.Conditions, &out.Conditions
|
||||||
*out = make([]meta.Condition, len(*in))
|
*out = make([]metav1.Condition, len(*in))
|
||||||
for i := range *in {
|
for i := range *in {
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
|
@ -399,7 +398,7 @@ func (in *HelmChartStatus) DeepCopyInto(out *HelmChartStatus) {
|
||||||
*out = *in
|
*out = *in
|
||||||
if in.Conditions != nil {
|
if in.Conditions != nil {
|
||||||
in, out := &in.Conditions, &out.Conditions
|
in, out := &in.Conditions, &out.Conditions
|
||||||
*out = make([]meta.Condition, len(*in))
|
*out = make([]metav1.Condition, len(*in))
|
||||||
for i := range *in {
|
for i := range *in {
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
|
@ -511,7 +510,7 @@ func (in *HelmRepositoryStatus) DeepCopyInto(out *HelmRepositoryStatus) {
|
||||||
*out = *in
|
*out = *in
|
||||||
if in.Conditions != nil {
|
if in.Conditions != nil {
|
||||||
in, out := &in.Conditions, &out.Conditions
|
in, out := &in.Conditions, &out.Conditions
|
||||||
*out = make([]meta.Condition, len(*in))
|
*out = make([]metav1.Condition, len(*in))
|
||||||
for i := range *in {
|
for i := range *in {
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,30 +129,69 @@ spec:
|
||||||
conditions:
|
conditions:
|
||||||
description: Conditions holds the conditions for the Bucket.
|
description: Conditions holds the conditions for the Bucket.
|
||||||
items:
|
items:
|
||||||
description: Condition contains condition information of a toolkit
|
description: "Condition contains details for one aspect of the current
|
||||||
resource.
|
state of this API Resource. --- This struct is intended for direct
|
||||||
|
use as an array at the field path .status.conditions. For example,
|
||||||
|
type FooStatus struct{ // Represents the observations of a
|
||||||
|
foo's current state. // Known .status.conditions.type are:
|
||||||
|
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
|
||||||
|
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
|
||||||
|
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
|
||||||
|
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
|
||||||
|
\n // other fields }"
|
||||||
properties:
|
properties:
|
||||||
lastTransitionTime:
|
lastTransitionTime:
|
||||||
description: LastTransitionTime is the timestamp corresponding
|
description: lastTransitionTime is the last time the condition
|
||||||
to the last status change of this condition.
|
transitioned from one status to another. This should be when
|
||||||
|
the underlying condition changed. If that is not known, then
|
||||||
|
using the time when the API field changed is acceptable.
|
||||||
format: date-time
|
format: date-time
|
||||||
type: string
|
type: string
|
||||||
message:
|
message:
|
||||||
description: Message is a human readable description of the
|
description: message is a human readable message indicating
|
||||||
details of the last transition, complementing reason.
|
details about the transition. This may be an empty string.
|
||||||
|
maxLength: 32768
|
||||||
type: string
|
type: string
|
||||||
|
observedGeneration:
|
||||||
|
description: observedGeneration represents the .metadata.generation
|
||||||
|
that the condition was set based upon. For instance, if .metadata.generation
|
||||||
|
is currently 12, but the .status.conditions[x].observedGeneration
|
||||||
|
is 9, the condition is out of date with respect to the current
|
||||||
|
state of the instance.
|
||||||
|
format: int64
|
||||||
|
minimum: 0
|
||||||
|
type: integer
|
||||||
reason:
|
reason:
|
||||||
description: Reason is a brief machine readable explanation
|
description: reason contains a programmatic identifier indicating
|
||||||
for the condition's last transition.
|
the reason for the condition's last transition. Producers
|
||||||
|
of specific condition types may define expected values and
|
||||||
|
meanings for this field, and whether the values are considered
|
||||||
|
a guaranteed API. The value should be a CamelCase string.
|
||||||
|
This field may not be empty.
|
||||||
|
maxLength: 1024
|
||||||
|
minLength: 1
|
||||||
|
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
|
||||||
type: string
|
type: string
|
||||||
status:
|
status:
|
||||||
description: Status of the condition, one of ('True', 'False',
|
description: status of the condition, one of True, False, Unknown.
|
||||||
'Unknown').
|
enum:
|
||||||
|
- "True"
|
||||||
|
- "False"
|
||||||
|
- Unknown
|
||||||
type: string
|
type: string
|
||||||
type:
|
type:
|
||||||
description: Type of the condition.
|
description: type of condition in CamelCase or in foo.example.com/CamelCase.
|
||||||
|
--- Many .condition.type values are consistent across resources
|
||||||
|
like Available, but because arbitrary conditions can be useful
|
||||||
|
(see .node.status.conditions), the ability to deconflict is
|
||||||
|
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
|
||||||
|
maxLength: 316
|
||||||
|
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
|
- lastTransitionTime
|
||||||
|
- message
|
||||||
|
- reason
|
||||||
- status
|
- status
|
||||||
- type
|
- type
|
||||||
type: object
|
type: object
|
||||||
|
|
|
@ -157,30 +157,69 @@ spec:
|
||||||
conditions:
|
conditions:
|
||||||
description: Conditions holds the conditions for the GitRepository.
|
description: Conditions holds the conditions for the GitRepository.
|
||||||
items:
|
items:
|
||||||
description: Condition contains condition information of a toolkit
|
description: "Condition contains details for one aspect of the current
|
||||||
resource.
|
state of this API Resource. --- This struct is intended for direct
|
||||||
|
use as an array at the field path .status.conditions. For example,
|
||||||
|
type FooStatus struct{ // Represents the observations of a
|
||||||
|
foo's current state. // Known .status.conditions.type are:
|
||||||
|
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
|
||||||
|
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
|
||||||
|
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
|
||||||
|
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
|
||||||
|
\n // other fields }"
|
||||||
properties:
|
properties:
|
||||||
lastTransitionTime:
|
lastTransitionTime:
|
||||||
description: LastTransitionTime is the timestamp corresponding
|
description: lastTransitionTime is the last time the condition
|
||||||
to the last status change of this condition.
|
transitioned from one status to another. This should be when
|
||||||
|
the underlying condition changed. If that is not known, then
|
||||||
|
using the time when the API field changed is acceptable.
|
||||||
format: date-time
|
format: date-time
|
||||||
type: string
|
type: string
|
||||||
message:
|
message:
|
||||||
description: Message is a human readable description of the
|
description: message is a human readable message indicating
|
||||||
details of the last transition, complementing reason.
|
details about the transition. This may be an empty string.
|
||||||
|
maxLength: 32768
|
||||||
type: string
|
type: string
|
||||||
|
observedGeneration:
|
||||||
|
description: observedGeneration represents the .metadata.generation
|
||||||
|
that the condition was set based upon. For instance, if .metadata.generation
|
||||||
|
is currently 12, but the .status.conditions[x].observedGeneration
|
||||||
|
is 9, the condition is out of date with respect to the current
|
||||||
|
state of the instance.
|
||||||
|
format: int64
|
||||||
|
minimum: 0
|
||||||
|
type: integer
|
||||||
reason:
|
reason:
|
||||||
description: Reason is a brief machine readable explanation
|
description: reason contains a programmatic identifier indicating
|
||||||
for the condition's last transition.
|
the reason for the condition's last transition. Producers
|
||||||
|
of specific condition types may define expected values and
|
||||||
|
meanings for this field, and whether the values are considered
|
||||||
|
a guaranteed API. The value should be a CamelCase string.
|
||||||
|
This field may not be empty.
|
||||||
|
maxLength: 1024
|
||||||
|
minLength: 1
|
||||||
|
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
|
||||||
type: string
|
type: string
|
||||||
status:
|
status:
|
||||||
description: Status of the condition, one of ('True', 'False',
|
description: status of the condition, one of True, False, Unknown.
|
||||||
'Unknown').
|
enum:
|
||||||
|
- "True"
|
||||||
|
- "False"
|
||||||
|
- Unknown
|
||||||
type: string
|
type: string
|
||||||
type:
|
type:
|
||||||
description: Type of the condition.
|
description: type of condition in CamelCase or in foo.example.com/CamelCase.
|
||||||
|
--- Many .condition.type values are consistent across resources
|
||||||
|
like Available, but because arbitrary conditions can be useful
|
||||||
|
(see .node.status.conditions), the ability to deconflict is
|
||||||
|
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
|
||||||
|
maxLength: 316
|
||||||
|
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
|
- lastTransitionTime
|
||||||
|
- message
|
||||||
|
- reason
|
||||||
- status
|
- status
|
||||||
- type
|
- type
|
||||||
type: object
|
type: object
|
||||||
|
|
|
@ -133,30 +133,69 @@ spec:
|
||||||
conditions:
|
conditions:
|
||||||
description: Conditions holds the conditions for the HelmChart.
|
description: Conditions holds the conditions for the HelmChart.
|
||||||
items:
|
items:
|
||||||
description: Condition contains condition information of a toolkit
|
description: "Condition contains details for one aspect of the current
|
||||||
resource.
|
state of this API Resource. --- This struct is intended for direct
|
||||||
|
use as an array at the field path .status.conditions. For example,
|
||||||
|
type FooStatus struct{ // Represents the observations of a
|
||||||
|
foo's current state. // Known .status.conditions.type are:
|
||||||
|
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
|
||||||
|
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
|
||||||
|
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
|
||||||
|
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
|
||||||
|
\n // other fields }"
|
||||||
properties:
|
properties:
|
||||||
lastTransitionTime:
|
lastTransitionTime:
|
||||||
description: LastTransitionTime is the timestamp corresponding
|
description: lastTransitionTime is the last time the condition
|
||||||
to the last status change of this condition.
|
transitioned from one status to another. This should be when
|
||||||
|
the underlying condition changed. If that is not known, then
|
||||||
|
using the time when the API field changed is acceptable.
|
||||||
format: date-time
|
format: date-time
|
||||||
type: string
|
type: string
|
||||||
message:
|
message:
|
||||||
description: Message is a human readable description of the
|
description: message is a human readable message indicating
|
||||||
details of the last transition, complementing reason.
|
details about the transition. This may be an empty string.
|
||||||
|
maxLength: 32768
|
||||||
type: string
|
type: string
|
||||||
|
observedGeneration:
|
||||||
|
description: observedGeneration represents the .metadata.generation
|
||||||
|
that the condition was set based upon. For instance, if .metadata.generation
|
||||||
|
is currently 12, but the .status.conditions[x].observedGeneration
|
||||||
|
is 9, the condition is out of date with respect to the current
|
||||||
|
state of the instance.
|
||||||
|
format: int64
|
||||||
|
minimum: 0
|
||||||
|
type: integer
|
||||||
reason:
|
reason:
|
||||||
description: Reason is a brief machine readable explanation
|
description: reason contains a programmatic identifier indicating
|
||||||
for the condition's last transition.
|
the reason for the condition's last transition. Producers
|
||||||
|
of specific condition types may define expected values and
|
||||||
|
meanings for this field, and whether the values are considered
|
||||||
|
a guaranteed API. The value should be a CamelCase string.
|
||||||
|
This field may not be empty.
|
||||||
|
maxLength: 1024
|
||||||
|
minLength: 1
|
||||||
|
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
|
||||||
type: string
|
type: string
|
||||||
status:
|
status:
|
||||||
description: Status of the condition, one of ('True', 'False',
|
description: status of the condition, one of True, False, Unknown.
|
||||||
'Unknown').
|
enum:
|
||||||
|
- "True"
|
||||||
|
- "False"
|
||||||
|
- Unknown
|
||||||
type: string
|
type: string
|
||||||
type:
|
type:
|
||||||
description: Type of the condition.
|
description: type of condition in CamelCase or in foo.example.com/CamelCase.
|
||||||
|
--- Many .condition.type values are consistent across resources
|
||||||
|
like Available, but because arbitrary conditions can be useful
|
||||||
|
(see .node.status.conditions), the ability to deconflict is
|
||||||
|
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
|
||||||
|
maxLength: 316
|
||||||
|
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
|
- lastTransitionTime
|
||||||
|
- message
|
||||||
|
- reason
|
||||||
- status
|
- status
|
||||||
- type
|
- type
|
||||||
type: object
|
type: object
|
||||||
|
|
|
@ -108,30 +108,69 @@ spec:
|
||||||
conditions:
|
conditions:
|
||||||
description: Conditions holds the conditions for the HelmRepository.
|
description: Conditions holds the conditions for the HelmRepository.
|
||||||
items:
|
items:
|
||||||
description: Condition contains condition information of a toolkit
|
description: "Condition contains details for one aspect of the current
|
||||||
resource.
|
state of this API Resource. --- This struct is intended for direct
|
||||||
|
use as an array at the field path .status.conditions. For example,
|
||||||
|
type FooStatus struct{ // Represents the observations of a
|
||||||
|
foo's current state. // Known .status.conditions.type are:
|
||||||
|
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
|
||||||
|
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
|
||||||
|
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
|
||||||
|
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
|
||||||
|
\n // other fields }"
|
||||||
properties:
|
properties:
|
||||||
lastTransitionTime:
|
lastTransitionTime:
|
||||||
description: LastTransitionTime is the timestamp corresponding
|
description: lastTransitionTime is the last time the condition
|
||||||
to the last status change of this condition.
|
transitioned from one status to another. This should be when
|
||||||
|
the underlying condition changed. If that is not known, then
|
||||||
|
using the time when the API field changed is acceptable.
|
||||||
format: date-time
|
format: date-time
|
||||||
type: string
|
type: string
|
||||||
message:
|
message:
|
||||||
description: Message is a human readable description of the
|
description: message is a human readable message indicating
|
||||||
details of the last transition, complementing reason.
|
details about the transition. This may be an empty string.
|
||||||
|
maxLength: 32768
|
||||||
type: string
|
type: string
|
||||||
|
observedGeneration:
|
||||||
|
description: observedGeneration represents the .metadata.generation
|
||||||
|
that the condition was set based upon. For instance, if .metadata.generation
|
||||||
|
is currently 12, but the .status.conditions[x].observedGeneration
|
||||||
|
is 9, the condition is out of date with respect to the current
|
||||||
|
state of the instance.
|
||||||
|
format: int64
|
||||||
|
minimum: 0
|
||||||
|
type: integer
|
||||||
reason:
|
reason:
|
||||||
description: Reason is a brief machine readable explanation
|
description: reason contains a programmatic identifier indicating
|
||||||
for the condition's last transition.
|
the reason for the condition's last transition. Producers
|
||||||
|
of specific condition types may define expected values and
|
||||||
|
meanings for this field, and whether the values are considered
|
||||||
|
a guaranteed API. The value should be a CamelCase string.
|
||||||
|
This field may not be empty.
|
||||||
|
maxLength: 1024
|
||||||
|
minLength: 1
|
||||||
|
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
|
||||||
type: string
|
type: string
|
||||||
status:
|
status:
|
||||||
description: Status of the condition, one of ('True', 'False',
|
description: status of the condition, one of True, False, Unknown.
|
||||||
'Unknown').
|
enum:
|
||||||
|
- "True"
|
||||||
|
- "False"
|
||||||
|
- Unknown
|
||||||
type: string
|
type: string
|
||||||
type:
|
type:
|
||||||
description: Type of the condition.
|
description: type of condition in CamelCase or in foo.example.com/CamelCase.
|
||||||
|
--- Many .condition.type values are consistent across resources
|
||||||
|
like Available, but because arbitrary conditions can be useful
|
||||||
|
(see .node.status.conditions), the ability to deconflict is
|
||||||
|
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
|
||||||
|
maxLength: 316
|
||||||
|
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
|
- lastTransitionTime
|
||||||
|
- message
|
||||||
|
- reason
|
||||||
- status
|
- status
|
||||||
- type
|
- type
|
||||||
type: object
|
type: object
|
||||||
|
|
|
@ -31,6 +31,8 @@ import (
|
||||||
"github.com/minio/minio-go/v7"
|
"github.com/minio/minio-go/v7"
|
||||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
kuberecorder "k8s.io/client-go/tools/record"
|
kuberecorder "k8s.io/client-go/tools/record"
|
||||||
|
@ -211,7 +213,7 @@ func (r *BucketReconciler) reconcile(ctx context.Context, bucket sourcev1.Bucket
|
||||||
|
|
||||||
// return early on unchanged revision
|
// return early on unchanged revision
|
||||||
artifact := r.Storage.NewArtifactFor(bucket.Kind, bucket.GetObjectMeta(), revision, fmt.Sprintf("%s.tar.gz", revision))
|
artifact := r.Storage.NewArtifactFor(bucket.Kind, bucket.GetObjectMeta(), revision, fmt.Sprintf("%s.tar.gz", revision))
|
||||||
if meta.HasReadyCondition(bucket.Status.Conditions) && bucket.GetArtifact().HasRevision(artifact.Revision) {
|
if meta.InReadyCondition(bucket.Status.Conditions) && bucket.GetArtifact().HasRevision(artifact.Revision) {
|
||||||
if artifact.URL != bucket.GetArtifact().URL {
|
if artifact.URL != bucket.GetArtifact().URL {
|
||||||
r.Storage.SetArtifactURL(bucket.GetArtifact())
|
r.Storage.SetArtifactURL(bucket.GetArtifact())
|
||||||
bucket.Status.URL = r.Storage.SetHostname(bucket.Status.URL)
|
bucket.Status.URL = r.Storage.SetHostname(bucket.Status.URL)
|
||||||
|
@ -401,12 +403,12 @@ func (r *BucketReconciler) recordReadiness(bucket sourcev1.Bucket) {
|
||||||
).Error(err, "unable to record readiness metric")
|
).Error(err, "unable to record readiness metric")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if rc := meta.GetCondition(bucket.Status.Conditions, meta.ReadyCondition); rc != nil {
|
if rc := apimeta.FindStatusCondition(bucket.Status.Conditions, meta.ReadyCondition); rc != nil {
|
||||||
r.MetricsRecorder.RecordCondition(*objRef, *rc, !bucket.DeletionTimestamp.IsZero())
|
r.MetricsRecorder.RecordCondition(*objRef, *rc, !bucket.DeletionTimestamp.IsZero())
|
||||||
} else {
|
} else {
|
||||||
r.MetricsRecorder.RecordCondition(*objRef, meta.Condition{
|
r.MetricsRecorder.RecordCondition(*objRef, metav1.Condition{
|
||||||
Type: meta.ReadyCondition,
|
Type: meta.ReadyCondition,
|
||||||
Status: corev1.ConditionUnknown,
|
Status: metav1.ConditionUnknown,
|
||||||
}, !bucket.DeletionTimestamp.IsZero())
|
}, !bucket.DeletionTimestamp.IsZero())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,8 @@ import (
|
||||||
"github.com/go-git/go-git/v5/plumbing/transport"
|
"github.com/go-git/go-git/v5/plumbing/transport"
|
||||||
"github.com/go-logr/logr"
|
"github.com/go-logr/logr"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
kuberecorder "k8s.io/client-go/tools/record"
|
kuberecorder "k8s.io/client-go/tools/record"
|
||||||
|
@ -198,7 +200,7 @@ func (r *GitRepositoryReconciler) reconcile(ctx context.Context, repository sour
|
||||||
|
|
||||||
// return early on unchanged revision
|
// return early on unchanged revision
|
||||||
artifact := r.Storage.NewArtifactFor(repository.Kind, repository.GetObjectMeta(), revision, fmt.Sprintf("%s.tar.gz", commit.Hash.String()))
|
artifact := r.Storage.NewArtifactFor(repository.Kind, repository.GetObjectMeta(), revision, fmt.Sprintf("%s.tar.gz", commit.Hash.String()))
|
||||||
if meta.HasReadyCondition(repository.Status.Conditions) && repository.GetArtifact().HasRevision(artifact.Revision) {
|
if meta.InReadyCondition(repository.Status.Conditions) && repository.GetArtifact().HasRevision(artifact.Revision) {
|
||||||
if artifact.URL != repository.GetArtifact().URL {
|
if artifact.URL != repository.GetArtifact().URL {
|
||||||
r.Storage.SetArtifactURL(repository.GetArtifact())
|
r.Storage.SetArtifactURL(repository.GetArtifact())
|
||||||
repository.Status.URL = r.Storage.SetHostname(repository.Status.URL)
|
repository.Status.URL = r.Storage.SetHostname(repository.Status.URL)
|
||||||
|
@ -360,12 +362,12 @@ func (r *GitRepositoryReconciler) recordReadiness(repository sourcev1.GitReposit
|
||||||
).Error(err, "unable to record readiness metric")
|
).Error(err, "unable to record readiness metric")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if rc := meta.GetCondition(repository.Status.Conditions, meta.ReadyCondition); rc != nil {
|
if rc := apimeta.FindStatusCondition(repository.Status.Conditions, meta.ReadyCondition); rc != nil {
|
||||||
r.MetricsRecorder.RecordCondition(*objRef, *rc, !repository.DeletionTimestamp.IsZero())
|
r.MetricsRecorder.RecordCondition(*objRef, *rc, !repository.DeletionTimestamp.IsZero())
|
||||||
} else {
|
} else {
|
||||||
r.MetricsRecorder.RecordCondition(*objRef, meta.Condition{
|
r.MetricsRecorder.RecordCondition(*objRef, metav1.Condition{
|
||||||
Type: meta.ReadyCondition,
|
Type: meta.ReadyCondition,
|
||||||
Status: corev1.ConditionUnknown,
|
Status: metav1.ConditionUnknown,
|
||||||
}, !repository.DeletionTimestamp.IsZero())
|
}, !repository.DeletionTimestamp.IsZero())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/fluxcd/pkg/apis/meta"
|
|
||||||
"github.com/go-git/go-billy/v5/memfs"
|
"github.com/go-git/go-billy/v5/memfs"
|
||||||
"github.com/go-git/go-git/v5"
|
"github.com/go-git/go-git/v5"
|
||||||
"github.com/go-git/go-git/v5/config"
|
"github.com/go-git/go-git/v5/config"
|
||||||
|
@ -84,7 +83,7 @@ var _ = Describe("GitRepositoryReconciler", func() {
|
||||||
|
|
||||||
waitForReason string
|
waitForReason string
|
||||||
|
|
||||||
expectStatus corev1.ConditionStatus
|
expectStatus metav1.ConditionStatus
|
||||||
expectMessage string
|
expectMessage string
|
||||||
expectRevision string
|
expectRevision string
|
||||||
}
|
}
|
||||||
|
@ -157,7 +156,7 @@ var _ = Describe("GitRepositoryReconciler", func() {
|
||||||
defer k8sClient.Delete(context.Background(), created)
|
defer k8sClient.Delete(context.Background(), created)
|
||||||
|
|
||||||
got := &sourcev1.GitRepository{}
|
got := &sourcev1.GitRepository{}
|
||||||
var cond meta.Condition
|
var cond metav1.Condition
|
||||||
Eventually(func() bool {
|
Eventually(func() bool {
|
||||||
_ = k8sClient.Get(context.Background(), key, got)
|
_ = k8sClient.Get(context.Background(), key, got)
|
||||||
for _, c := range got.Status.Conditions {
|
for _, c := range got.Status.Conditions {
|
||||||
|
@ -180,59 +179,59 @@ var _ = Describe("GitRepositoryReconciler", func() {
|
||||||
reference: &sourcev1.GitRepositoryRef{Branch: "some-branch"},
|
reference: &sourcev1.GitRepositoryRef{Branch: "some-branch"},
|
||||||
createRefs: []string{"refs/heads/some-branch"},
|
createRefs: []string{"refs/heads/some-branch"},
|
||||||
waitForReason: sourcev1.GitOperationSucceedReason,
|
waitForReason: sourcev1.GitOperationSucceedReason,
|
||||||
expectStatus: corev1.ConditionTrue,
|
expectStatus: metav1.ConditionTrue,
|
||||||
expectRevision: "some-branch",
|
expectRevision: "some-branch",
|
||||||
}),
|
}),
|
||||||
Entry("branch non existing", refTestCase{
|
Entry("branch non existing", refTestCase{
|
||||||
reference: &sourcev1.GitRepositoryRef{Branch: "invalid-branch"},
|
reference: &sourcev1.GitRepositoryRef{Branch: "invalid-branch"},
|
||||||
waitForReason: sourcev1.GitOperationFailedReason,
|
waitForReason: sourcev1.GitOperationFailedReason,
|
||||||
expectStatus: corev1.ConditionFalse,
|
expectStatus: metav1.ConditionFalse,
|
||||||
expectMessage: "couldn't find remote ref",
|
expectMessage: "couldn't find remote ref",
|
||||||
}),
|
}),
|
||||||
Entry("tag", refTestCase{
|
Entry("tag", refTestCase{
|
||||||
reference: &sourcev1.GitRepositoryRef{Tag: "some-tag"},
|
reference: &sourcev1.GitRepositoryRef{Tag: "some-tag"},
|
||||||
createRefs: []string{"refs/tags/some-tag"},
|
createRefs: []string{"refs/tags/some-tag"},
|
||||||
waitForReason: sourcev1.GitOperationSucceedReason,
|
waitForReason: sourcev1.GitOperationSucceedReason,
|
||||||
expectStatus: corev1.ConditionTrue,
|
expectStatus: metav1.ConditionTrue,
|
||||||
expectRevision: "some-tag",
|
expectRevision: "some-tag",
|
||||||
}),
|
}),
|
||||||
Entry("tag non existing", refTestCase{
|
Entry("tag non existing", refTestCase{
|
||||||
reference: &sourcev1.GitRepositoryRef{Tag: "invalid-tag"},
|
reference: &sourcev1.GitRepositoryRef{Tag: "invalid-tag"},
|
||||||
waitForReason: sourcev1.GitOperationFailedReason,
|
waitForReason: sourcev1.GitOperationFailedReason,
|
||||||
expectStatus: corev1.ConditionFalse,
|
expectStatus: metav1.ConditionFalse,
|
||||||
expectMessage: "couldn't find remote ref",
|
expectMessage: "couldn't find remote ref",
|
||||||
}),
|
}),
|
||||||
Entry("semver", refTestCase{
|
Entry("semver", refTestCase{
|
||||||
reference: &sourcev1.GitRepositoryRef{SemVer: "1.0.0"},
|
reference: &sourcev1.GitRepositoryRef{SemVer: "1.0.0"},
|
||||||
createRefs: []string{"refs/tags/v1.0.0"},
|
createRefs: []string{"refs/tags/v1.0.0"},
|
||||||
waitForReason: sourcev1.GitOperationSucceedReason,
|
waitForReason: sourcev1.GitOperationSucceedReason,
|
||||||
expectStatus: corev1.ConditionTrue,
|
expectStatus: metav1.ConditionTrue,
|
||||||
expectRevision: "v1.0.0",
|
expectRevision: "v1.0.0",
|
||||||
}),
|
}),
|
||||||
Entry("semver range", refTestCase{
|
Entry("semver range", refTestCase{
|
||||||
reference: &sourcev1.GitRepositoryRef{SemVer: ">=0.1.0 <1.0.0"},
|
reference: &sourcev1.GitRepositoryRef{SemVer: ">=0.1.0 <1.0.0"},
|
||||||
createRefs: []string{"refs/tags/0.1.0", "refs/tags/0.1.1", "refs/tags/0.2.0", "refs/tags/1.0.0"},
|
createRefs: []string{"refs/tags/0.1.0", "refs/tags/0.1.1", "refs/tags/0.2.0", "refs/tags/1.0.0"},
|
||||||
waitForReason: sourcev1.GitOperationSucceedReason,
|
waitForReason: sourcev1.GitOperationSucceedReason,
|
||||||
expectStatus: corev1.ConditionTrue,
|
expectStatus: metav1.ConditionTrue,
|
||||||
expectRevision: "0.2.0",
|
expectRevision: "0.2.0",
|
||||||
}),
|
}),
|
||||||
Entry("mixed semver range", refTestCase{
|
Entry("mixed semver range", refTestCase{
|
||||||
reference: &sourcev1.GitRepositoryRef{SemVer: ">=0.1.0 <1.0.0"},
|
reference: &sourcev1.GitRepositoryRef{SemVer: ">=0.1.0 <1.0.0"},
|
||||||
createRefs: []string{"refs/tags/0.1.0", "refs/tags/v0.1.1", "refs/tags/v0.2.0", "refs/tags/1.0.0"},
|
createRefs: []string{"refs/tags/0.1.0", "refs/tags/v0.1.1", "refs/tags/v0.2.0", "refs/tags/1.0.0"},
|
||||||
waitForReason: sourcev1.GitOperationSucceedReason,
|
waitForReason: sourcev1.GitOperationSucceedReason,
|
||||||
expectStatus: corev1.ConditionTrue,
|
expectStatus: metav1.ConditionTrue,
|
||||||
expectRevision: "v0.2.0",
|
expectRevision: "v0.2.0",
|
||||||
}),
|
}),
|
||||||
Entry("semver invalid", refTestCase{
|
Entry("semver invalid", refTestCase{
|
||||||
reference: &sourcev1.GitRepositoryRef{SemVer: "1.2.3.4"},
|
reference: &sourcev1.GitRepositoryRef{SemVer: "1.2.3.4"},
|
||||||
waitForReason: sourcev1.GitOperationFailedReason,
|
waitForReason: sourcev1.GitOperationFailedReason,
|
||||||
expectStatus: corev1.ConditionFalse,
|
expectStatus: metav1.ConditionFalse,
|
||||||
expectMessage: "semver parse range error: improper constraint: 1.2.3.4",
|
expectMessage: "semver parse range error: improper constraint: 1.2.3.4",
|
||||||
}),
|
}),
|
||||||
Entry("semver no match", refTestCase{
|
Entry("semver no match", refTestCase{
|
||||||
reference: &sourcev1.GitRepositoryRef{SemVer: "1.0.0"},
|
reference: &sourcev1.GitRepositoryRef{SemVer: "1.0.0"},
|
||||||
waitForReason: sourcev1.GitOperationFailedReason,
|
waitForReason: sourcev1.GitOperationFailedReason,
|
||||||
expectStatus: corev1.ConditionFalse,
|
expectStatus: metav1.ConditionFalse,
|
||||||
expectMessage: "no match found for semver: 1.0.0",
|
expectMessage: "no match found for semver: 1.0.0",
|
||||||
}),
|
}),
|
||||||
Entry("commit", refTestCase{
|
Entry("commit", refTestCase{
|
||||||
|
@ -240,7 +239,7 @@ var _ = Describe("GitRepositoryReconciler", func() {
|
||||||
Commit: "<commit>",
|
Commit: "<commit>",
|
||||||
},
|
},
|
||||||
waitForReason: sourcev1.GitOperationSucceedReason,
|
waitForReason: sourcev1.GitOperationSucceedReason,
|
||||||
expectStatus: corev1.ConditionTrue,
|
expectStatus: metav1.ConditionTrue,
|
||||||
expectRevision: "master",
|
expectRevision: "master",
|
||||||
}),
|
}),
|
||||||
Entry("commit in branch", refTestCase{
|
Entry("commit in branch", refTestCase{
|
||||||
|
@ -250,7 +249,7 @@ var _ = Describe("GitRepositoryReconciler", func() {
|
||||||
},
|
},
|
||||||
createRefs: []string{"refs/heads/some-branch"},
|
createRefs: []string{"refs/heads/some-branch"},
|
||||||
waitForReason: sourcev1.GitOperationSucceedReason,
|
waitForReason: sourcev1.GitOperationSucceedReason,
|
||||||
expectStatus: corev1.ConditionTrue,
|
expectStatus: metav1.ConditionTrue,
|
||||||
expectRevision: "some-branch",
|
expectRevision: "some-branch",
|
||||||
}),
|
}),
|
||||||
Entry("invalid commit", refTestCase{
|
Entry("invalid commit", refTestCase{
|
||||||
|
@ -259,7 +258,7 @@ var _ = Describe("GitRepositoryReconciler", func() {
|
||||||
Commit: "invalid",
|
Commit: "invalid",
|
||||||
},
|
},
|
||||||
waitForReason: sourcev1.GitOperationFailedReason,
|
waitForReason: sourcev1.GitOperationFailedReason,
|
||||||
expectStatus: corev1.ConditionFalse,
|
expectStatus: metav1.ConditionFalse,
|
||||||
expectMessage: "git commit 'invalid' not found: object not found",
|
expectMessage: "git commit 'invalid' not found: object not found",
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
|
@ -33,6 +33,8 @@ import (
|
||||||
"helm.sh/helm/v3/pkg/chartutil"
|
"helm.sh/helm/v3/pkg/chartutil"
|
||||||
"helm.sh/helm/v3/pkg/getter"
|
"helm.sh/helm/v3/pkg/getter"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
kuberecorder "k8s.io/client-go/tools/record"
|
kuberecorder "k8s.io/client-go/tools/record"
|
||||||
|
@ -423,7 +425,7 @@ func (r *HelmChartReconciler) reconcileFromTarballArtifact(ctx context.Context,
|
||||||
// Return early if the revision is still the same as the current chart artifact
|
// Return early if the revision is still the same as the current chart artifact
|
||||||
newArtifact := r.Storage.NewArtifactFor(chart.Kind, chart.ObjectMeta.GetObjectMeta(), helmChart.Metadata.Version,
|
newArtifact := r.Storage.NewArtifactFor(chart.Kind, chart.ObjectMeta.GetObjectMeta(), helmChart.Metadata.Version,
|
||||||
fmt.Sprintf("%s-%s.tgz", helmChart.Metadata.Name, helmChart.Metadata.Version))
|
fmt.Sprintf("%s-%s.tgz", helmChart.Metadata.Name, helmChart.Metadata.Version))
|
||||||
if !force && meta.HasReadyCondition(chart.Status.Conditions) && chart.GetArtifact().HasRevision(newArtifact.Revision) {
|
if !force && meta.InReadyCondition(chart.Status.Conditions) && chart.GetArtifact().HasRevision(newArtifact.Revision) {
|
||||||
if newArtifact.URL != artifact.URL {
|
if newArtifact.URL != artifact.URL {
|
||||||
r.Storage.SetArtifactURL(chart.GetArtifact())
|
r.Storage.SetArtifactURL(chart.GetArtifact())
|
||||||
chart.Status.URL = r.Storage.SetHostname(chart.Status.URL)
|
chart.Status.URL = r.Storage.SetHostname(chart.Status.URL)
|
||||||
|
@ -677,12 +679,12 @@ func (r *HelmChartReconciler) recordReadiness(chart sourcev1.HelmChart) {
|
||||||
).Error(err, "unable to record readiness metric")
|
).Error(err, "unable to record readiness metric")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if rc := meta.GetCondition(chart.Status.Conditions, meta.ReadyCondition); rc != nil {
|
if rc := apimeta.FindStatusCondition(chart.Status.Conditions, meta.ReadyCondition); rc != nil {
|
||||||
r.MetricsRecorder.RecordCondition(*objRef, *rc, !chart.DeletionTimestamp.IsZero())
|
r.MetricsRecorder.RecordCondition(*objRef, *rc, !chart.DeletionTimestamp.IsZero())
|
||||||
} else {
|
} else {
|
||||||
r.MetricsRecorder.RecordCondition(*objRef, meta.Condition{
|
r.MetricsRecorder.RecordCondition(*objRef, metav1.Condition{
|
||||||
Type: meta.ReadyCondition,
|
Type: meta.ReadyCondition,
|
||||||
Status: corev1.ConditionUnknown,
|
Status: metav1.ConditionUnknown,
|
||||||
}, !chart.DeletionTimestamp.IsZero())
|
}, !chart.DeletionTimestamp.IsZero())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,7 +406,7 @@ var _ = Describe("HelmChartReconciler", func() {
|
||||||
By("Expecting artifact")
|
By("Expecting artifact")
|
||||||
Eventually(func() bool {
|
Eventually(func() bool {
|
||||||
_ = k8sClient.Get(context.Background(), key, got)
|
_ = k8sClient.Get(context.Background(), key, got)
|
||||||
return meta.HasReadyCondition(got.Status.Conditions)
|
return meta.InReadyCondition(got.Status.Conditions)
|
||||||
}, timeout, interval).Should(BeTrue())
|
}, timeout, interval).Should(BeTrue())
|
||||||
Expect(got.Status.Artifact).ToNot(BeNil())
|
Expect(got.Status.Artifact).ToNot(BeNil())
|
||||||
})
|
})
|
||||||
|
|
|
@ -28,6 +28,8 @@ import (
|
||||||
"github.com/go-logr/logr"
|
"github.com/go-logr/logr"
|
||||||
"helm.sh/helm/v3/pkg/getter"
|
"helm.sh/helm/v3/pkg/getter"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
kuberecorder "k8s.io/client-go/tools/record"
|
kuberecorder "k8s.io/client-go/tools/record"
|
||||||
|
@ -202,7 +204,7 @@ func (r *HelmRepositoryReconciler) reconcile(ctx context.Context, repository sou
|
||||||
repository.ObjectMeta.GetObjectMeta(),
|
repository.ObjectMeta.GetObjectMeta(),
|
||||||
chartRepo.Index.Generated.Format(time.RFC3339Nano),
|
chartRepo.Index.Generated.Format(time.RFC3339Nano),
|
||||||
fmt.Sprintf("index-%s.yaml", url.PathEscape(chartRepo.Index.Generated.Format(time.RFC3339Nano))))
|
fmt.Sprintf("index-%s.yaml", url.PathEscape(chartRepo.Index.Generated.Format(time.RFC3339Nano))))
|
||||||
if meta.HasReadyCondition(repository.Status.Conditions) && repository.GetArtifact().HasRevision(artifact.Revision) {
|
if meta.InReadyCondition(repository.Status.Conditions) && repository.GetArtifact().HasRevision(artifact.Revision) {
|
||||||
if artifact.URL != repository.GetArtifact().URL {
|
if artifact.URL != repository.GetArtifact().URL {
|
||||||
r.Storage.SetArtifactURL(repository.GetArtifact())
|
r.Storage.SetArtifactURL(repository.GetArtifact())
|
||||||
repository.Status.URL = r.Storage.SetHostname(repository.Status.URL)
|
repository.Status.URL = r.Storage.SetHostname(repository.Status.URL)
|
||||||
|
@ -334,12 +336,12 @@ func (r *HelmRepositoryReconciler) recordReadiness(repository sourcev1.HelmRepos
|
||||||
).Error(err, "unable to record readiness metric")
|
).Error(err, "unable to record readiness metric")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if rc := meta.GetCondition(repository.Status.Conditions, meta.ReadyCondition); rc != nil {
|
if rc := apimeta.FindStatusCondition(repository.Status.Conditions, meta.ReadyCondition); rc != nil {
|
||||||
r.MetricsRecorder.RecordCondition(*objRef, *rc, !repository.DeletionTimestamp.IsZero())
|
r.MetricsRecorder.RecordCondition(*objRef, *rc, !repository.DeletionTimestamp.IsZero())
|
||||||
} else {
|
} else {
|
||||||
r.MetricsRecorder.RecordCondition(*objRef, meta.Condition{
|
r.MetricsRecorder.RecordCondition(*objRef, metav1.Condition{
|
||||||
Type: meta.ReadyCondition,
|
Type: meta.ReadyCondition,
|
||||||
Status: corev1.ConditionUnknown,
|
Status: metav1.ConditionUnknown,
|
||||||
}, !repository.DeletionTimestamp.IsZero())
|
}, !repository.DeletionTimestamp.IsZero())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ string
|
||||||
<td>
|
<td>
|
||||||
<code>metadata</code><br>
|
<code>metadata</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#objectmeta-v1-meta">
|
||||||
Kubernetes meta/v1.ObjectMeta
|
Kubernetes meta/v1.ObjectMeta
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
|
@ -136,7 +136,7 @@ string
|
||||||
<td>
|
<td>
|
||||||
<code>secretRef</code><br>
|
<code>secretRef</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#localobjectreference-v1-core">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#localobjectreference-v1-core">
|
||||||
Kubernetes core/v1.LocalObjectReference
|
Kubernetes core/v1.LocalObjectReference
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
|
@ -241,7 +241,7 @@ string
|
||||||
<td>
|
<td>
|
||||||
<code>metadata</code><br>
|
<code>metadata</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#objectmeta-v1-meta">
|
||||||
Kubernetes meta/v1.ObjectMeta
|
Kubernetes meta/v1.ObjectMeta
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
|
@ -279,7 +279,7 @@ string
|
||||||
<td>
|
<td>
|
||||||
<code>secretRef</code><br>
|
<code>secretRef</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#localobjectreference-v1-core">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#localobjectreference-v1-core">
|
||||||
Kubernetes core/v1.LocalObjectReference
|
Kubernetes core/v1.LocalObjectReference
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
|
@ -416,7 +416,7 @@ string
|
||||||
<td>
|
<td>
|
||||||
<code>metadata</code><br>
|
<code>metadata</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#objectmeta-v1-meta">
|
||||||
Kubernetes meta/v1.ObjectMeta
|
Kubernetes meta/v1.ObjectMeta
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
|
@ -555,7 +555,7 @@ string
|
||||||
<td>
|
<td>
|
||||||
<code>metadata</code><br>
|
<code>metadata</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#objectmeta-v1-meta">
|
||||||
Kubernetes meta/v1.ObjectMeta
|
Kubernetes meta/v1.ObjectMeta
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
|
@ -593,7 +593,7 @@ string
|
||||||
<td>
|
<td>
|
||||||
<code>secretRef</code><br>
|
<code>secretRef</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#localobjectreference-v1-core">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#localobjectreference-v1-core">
|
||||||
Kubernetes core/v1.LocalObjectReference
|
Kubernetes core/v1.LocalObjectReference
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
|
@ -726,7 +726,7 @@ string
|
||||||
<td>
|
<td>
|
||||||
<code>lastUpdateTime</code><br>
|
<code>lastUpdateTime</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#time-v1-meta">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#time-v1-meta">
|
||||||
Kubernetes meta/v1.Time
|
Kubernetes meta/v1.Time
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
|
@ -819,7 +819,7 @@ string
|
||||||
<td>
|
<td>
|
||||||
<code>secretRef</code><br>
|
<code>secretRef</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#localobjectreference-v1-core">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#localobjectreference-v1-core">
|
||||||
Kubernetes core/v1.LocalObjectReference
|
Kubernetes core/v1.LocalObjectReference
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
|
@ -908,8 +908,8 @@ int64
|
||||||
<td>
|
<td>
|
||||||
<code>conditions</code><br>
|
<code>conditions</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://godoc.org/github.com/fluxcd/pkg/apis/meta#Condition">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#condition-v1-meta">
|
||||||
[]github.com/fluxcd/pkg/apis/meta.Condition
|
[]Kubernetes meta/v1.Condition
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
</td>
|
</td>
|
||||||
|
@ -1049,7 +1049,7 @@ string
|
||||||
<td>
|
<td>
|
||||||
<code>secretRef</code><br>
|
<code>secretRef</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#localobjectreference-v1-core">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#localobjectreference-v1-core">
|
||||||
Kubernetes core/v1.LocalObjectReference
|
Kubernetes core/v1.LocalObjectReference
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
|
@ -1170,8 +1170,8 @@ int64
|
||||||
<td>
|
<td>
|
||||||
<code>conditions</code><br>
|
<code>conditions</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://godoc.org/github.com/fluxcd/pkg/apis/meta#Condition">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#condition-v1-meta">
|
||||||
[]github.com/fluxcd/pkg/apis/meta.Condition
|
[]Kubernetes meta/v1.Condition
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
</td>
|
</td>
|
||||||
|
@ -1243,7 +1243,7 @@ string
|
||||||
<td>
|
<td>
|
||||||
<code>secretRef</code><br>
|
<code>secretRef</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#localobjectreference-v1-core">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#localobjectreference-v1-core">
|
||||||
Kubernetes core/v1.LocalObjectReference
|
Kubernetes core/v1.LocalObjectReference
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
|
@ -1373,8 +1373,8 @@ int64
|
||||||
<td>
|
<td>
|
||||||
<code>conditions</code><br>
|
<code>conditions</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://godoc.org/github.com/fluxcd/pkg/apis/meta#Condition">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#condition-v1-meta">
|
||||||
[]github.com/fluxcd/pkg/apis/meta.Condition
|
[]Kubernetes meta/v1.Condition
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
</td>
|
</td>
|
||||||
|
@ -1445,7 +1445,7 @@ string
|
||||||
<td>
|
<td>
|
||||||
<code>secretRef</code><br>
|
<code>secretRef</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#localobjectreference-v1-core">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#localobjectreference-v1-core">
|
||||||
Kubernetes core/v1.LocalObjectReference
|
Kubernetes core/v1.LocalObjectReference
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
|
@ -1524,8 +1524,8 @@ int64
|
||||||
<td>
|
<td>
|
||||||
<code>conditions</code><br>
|
<code>conditions</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://godoc.org/github.com/fluxcd/pkg/apis/meta#Condition">
|
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#condition-v1-meta">
|
||||||
[]github.com/fluxcd/pkg/apis/meta.Condition
|
[]Kubernetes meta/v1.Condition
|
||||||
</a>
|
</a>
|
||||||
</em>
|
</em>
|
||||||
</td>
|
</td>
|
||||||
|
|
4
go.mod
4
go.mod
|
@ -6,11 +6,11 @@ replace github.com/fluxcd/source-controller/api => ./api
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Masterminds/semver/v3 v3.1.0
|
github.com/Masterminds/semver/v3 v3.1.0
|
||||||
github.com/fluxcd/pkg/apis/meta v0.2.0
|
github.com/fluxcd/pkg/apis/meta v0.3.0
|
||||||
github.com/fluxcd/pkg/gittestserver v0.0.2
|
github.com/fluxcd/pkg/gittestserver v0.0.2
|
||||||
github.com/fluxcd/pkg/helmtestserver v0.0.1
|
github.com/fluxcd/pkg/helmtestserver v0.0.1
|
||||||
github.com/fluxcd/pkg/lockedfile v0.0.5
|
github.com/fluxcd/pkg/lockedfile v0.0.5
|
||||||
github.com/fluxcd/pkg/runtime v0.2.0
|
github.com/fluxcd/pkg/runtime v0.3.0
|
||||||
github.com/fluxcd/pkg/ssh v0.0.5
|
github.com/fluxcd/pkg/ssh v0.0.5
|
||||||
github.com/fluxcd/pkg/untar v0.0.5
|
github.com/fluxcd/pkg/untar v0.0.5
|
||||||
github.com/fluxcd/pkg/version v0.0.1
|
github.com/fluxcd/pkg/version v0.0.1
|
||||||
|
|
8
go.sum
8
go.sum
|
@ -222,16 +222,16 @@ github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZM
|
||||||
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
|
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
|
||||||
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
|
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
github.com/fluxcd/pkg/apis/meta v0.2.0 h1:bxoFQtZM6OLLj0+n3h6ga7IEWUtGEDJPc65OWiXSMvY=
|
github.com/fluxcd/pkg/apis/meta v0.3.0 h1:o2YkfGgf0j8sKeZs8cBmmmMKLA7kEoS1qYViOial1Ds=
|
||||||
github.com/fluxcd/pkg/apis/meta v0.2.0/go.mod h1:50RLLSfqM4LlQrh/+5LiJVf7Hjdthee8WDdXBvpjBdA=
|
github.com/fluxcd/pkg/apis/meta v0.3.0/go.mod h1:wOzQQx8CdtUQCGaLzqGu4QgnNxYkI6/wvdvlovxWhF0=
|
||||||
github.com/fluxcd/pkg/gittestserver v0.0.2 h1:11aKRVuuHiyeaicdN4wPNSMy/dUarQkrPrg0uUgDcTw=
|
github.com/fluxcd/pkg/gittestserver v0.0.2 h1:11aKRVuuHiyeaicdN4wPNSMy/dUarQkrPrg0uUgDcTw=
|
||||||
github.com/fluxcd/pkg/gittestserver v0.0.2/go.mod h1:GW8N9d1o8/+mXWnSzs02qCB5WlArWQHdMpDPf7b/GZg=
|
github.com/fluxcd/pkg/gittestserver v0.0.2/go.mod h1:GW8N9d1o8/+mXWnSzs02qCB5WlArWQHdMpDPf7b/GZg=
|
||||||
github.com/fluxcd/pkg/helmtestserver v0.0.1 h1:8RcLZdg7Zr9ZqyijsIIASjjMXQtF4UWP4Uds4iK2VJM=
|
github.com/fluxcd/pkg/helmtestserver v0.0.1 h1:8RcLZdg7Zr9ZqyijsIIASjjMXQtF4UWP4Uds4iK2VJM=
|
||||||
github.com/fluxcd/pkg/helmtestserver v0.0.1/go.mod h1:GR8LriiU7PqZSTH4Xe6Cimpig2VVPB29PeUXJjNJYfA=
|
github.com/fluxcd/pkg/helmtestserver v0.0.1/go.mod h1:GR8LriiU7PqZSTH4Xe6Cimpig2VVPB29PeUXJjNJYfA=
|
||||||
github.com/fluxcd/pkg/lockedfile v0.0.5 h1:C3T8wfdff1UY1bvplmCkGOLrdMWJHO8Q8+tdlEXJYzQ=
|
github.com/fluxcd/pkg/lockedfile v0.0.5 h1:C3T8wfdff1UY1bvplmCkGOLrdMWJHO8Q8+tdlEXJYzQ=
|
||||||
github.com/fluxcd/pkg/lockedfile v0.0.5/go.mod h1:uAtPUBId6a2RqO84MTH5HKGX0SbM1kNW3Wr/FhYyDVA=
|
github.com/fluxcd/pkg/lockedfile v0.0.5/go.mod h1:uAtPUBId6a2RqO84MTH5HKGX0SbM1kNW3Wr/FhYyDVA=
|
||||||
github.com/fluxcd/pkg/runtime v0.2.0 h1:aZmSLuyA9pF/KANf4wi7pZIICE19BKTYFSPRbl6WHtY=
|
github.com/fluxcd/pkg/runtime v0.3.0 h1:WpeTmDT2meIe4NsU081I8zmUGgTYs3bIMRgs9F3Lj90=
|
||||||
github.com/fluxcd/pkg/runtime v0.2.0/go.mod h1:P1/S8TOSuJgVPU0SRahWzbNxLWYoUwvBcPCNGc+dWWg=
|
github.com/fluxcd/pkg/runtime v0.3.0/go.mod h1:gPe6JgfPB4EDh5gaVkuI0SPuATk3PmclbFa1kPcZrKE=
|
||||||
github.com/fluxcd/pkg/ssh v0.0.5 h1:rnbFZ7voy2JBlUfMbfyqArX2FYaLNpDhccGFC3qW83A=
|
github.com/fluxcd/pkg/ssh v0.0.5 h1:rnbFZ7voy2JBlUfMbfyqArX2FYaLNpDhccGFC3qW83A=
|
||||||
github.com/fluxcd/pkg/ssh v0.0.5/go.mod h1:7jXPdXZpc0ttMNz2kD9QuMi3RNn/e0DOFbj0Tij/+Hs=
|
github.com/fluxcd/pkg/ssh v0.0.5/go.mod h1:7jXPdXZpc0ttMNz2kD9QuMi3RNn/e0DOFbj0Tij/+Hs=
|
||||||
github.com/fluxcd/pkg/testserver v0.0.2 h1:SoaMtO9cE5p/wl2zkGudzflnEHd9mk68CGjZOo7w0Uk=
|
github.com/fluxcd/pkg/testserver v0.0.2 h1:SoaMtO9cE5p/wl2zkGudzflnEHd9mk68CGjZOo7w0Uk=
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"typeMatchPrefix": "^k8s\\.io/(api|apimachinery/pkg/apis)/",
|
"typeMatchPrefix": "^k8s\\.io/(api|apimachinery/pkg/apis)/",
|
||||||
"docsURLTemplate": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#{{lower .TypeIdentifier}}-{{arrIndex .PackageSegments -1}}-{{arrIndex .PackageSegments -2}}"
|
"docsURLTemplate": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#{{lower .TypeIdentifier}}-{{arrIndex .PackageSegments -1}}-{{arrIndex .PackageSegments -2}}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"typeMatchPrefix": "^github.com/fluxcd/pkg/apis/meta\\.Condition$",
|
"typeMatchPrefix": "^github.com/fluxcd/pkg/apis/meta\\.Condition$",
|
||||||
|
|
Loading…
Reference in New Issue