From f85bc174e63c65938ffe8e1e7d16fa3372a02498 Mon Sep 17 00:00:00 2001
From: Stefan Prodan HelmChart is the Schema for the helmcharts API. Chart is the name or path the Helm chart is available at in the
+SourceRef. Version is the chart version semver expression, ignored for charts from
+GitRepository and Bucket sources. Defaults to latest when omitted. SourceRef is the reference to the Source the chart is available at. Interval at which the HelmChart SourceRef is checked for updates.
+This interval is approximate and may be subject to jitter to ensure
+efficient use of resources. ReconcileStrategy determines what enables the creation of a new artifact.
+Valid values are (‘ChartVersion’, ‘Revision’).
+See the documentation of the values for an explanation on their behavior.
+Defaults to ChartVersion when omitted. ValuesFiles is an alternative list of values files to use as the chart
+values (values.yaml is not included by default), expected to be a
+relative path in the SourceRef.
+Values files are merged in the order of this list with the last file
+overriding the first. Ignored when omitted. ValuesFile is an alternative values file to use as the default chart
+values, expected to be a relative path in the SourceRef. Deprecated in
+favor of ValuesFiles, for backwards compatibility the file specified here
+is merged before the ValuesFiles items. Ignored when omitted. Suspend tells the controller to suspend the reconciliation of this
+source. AccessFrom specifies an Access Control List for allowing cross-namespace
+references to this object.
+NOTE: Not implemented, provisional as of https://github.com/fluxcd/flux2/pull/2092 Verify contains the secret name containing the trusted public keys
+used to verify the signature and specifies which provider to use to check
+whether OCI image is authentic.
+This field is only supported when using HelmRepository source with spec.type ‘oci’.
+Chart dependencies, which are not bundled in the umbrella chart artifact, are not verified. HelmRepository is the Schema for the helmrepositories API. URL of the Helm repository, a valid URL contains at least a protocol and
+host. SecretRef specifies the Secret containing authentication credentials
+for the HelmRepository.
+For HTTP/S basic auth the secret must contain ‘username’ and ‘password’
+fields.
+Support for TLS auth using the ‘certFile’ and ‘keyFile’, and/or ‘caFile’
+keys is deprecated. Please use CertSecretRef can be given the name of a Secret containing
+either or both of and whichever are supplied, will be used for connecting to the
+registry. The client cert and key are useful if you are
+authenticating with a certificate; the CA cert is useful if
+you are using a self-signed server certificate. The Secret must
+be of type It takes precedence over the values specified in the Secret referred
+to by PassCredentials allows the credentials from the SecretRef to be passed
+on to a host that does not match the host as defined in URL.
+This may be required if the host of the advertised chart URLs in the
+index differ from the defined URL.
+Enabling this should be done with caution, as it can potentially result
+in credentials getting stolen in a MITM-attack. Interval at which the HelmRepository URL is checked for updates.
+This interval is approximate and may be subject to jitter to ensure
+efficient use of resources. Insecure allows connecting to a non-TLS HTTP container registry.
+This field is only taken into account if the .spec.type field is set to ‘oci’. Timeout is used for the index fetch operation for an HTTPS helm repository,
+and for remote OCI Repository operations like pulling for an OCI helm
+chart by the associated HelmChart.
+Its default value is 60s. Suspend tells the controller to suspend the reconciliation of this
+HelmRepository. AccessFrom specifies an Access Control List for allowing cross-namespace
+references to this object.
+NOTE: Not implemented, provisional as of https://github.com/fluxcd/flux2/pull/2092 Type of the HelmRepository.
+When this field is set to “oci”, the URL field value must be prefixed with “oci://”. Provider used for authentication, can be ‘aws’, ‘azure’, ‘gcp’ or ‘generic’.
+This field is optional, and only taken into account if the .spec.type field is set to ‘oci’.
+When not specified, defaults to ‘generic’.
(Appears on:
-GitRepositoryStatus)
+GitRepositoryStatus,
+HelmChartStatus,
+HelmRepositoryStatus)
+ Artifact represents the output of a Source reconciliation. Path is the relative file path of the Artifact. It can be used to locate
+the file in the root of the Artifact storage on the local file system of
+the controller managing the Source. URL is the HTTP address of the Artifact as exposed by the controller
+managing the Source. It can be used to retrieve the Artifact for
+consumption, e.g. by another controller applying the Artifact contents. Revision is a human-readable identifier traceable in the origin source
+system. It can be a Git commit SHA, Git tag, a Helm chart version, etc. Digest is the digest of the file in the form of ‘ LastUpdateTime is the timestamp corresponding to the last update of the
+Artifact. Size is the number of bytes in the file. Metadata holds upstream information such as OCI annotations.
+(Appears on:
+GitRepositorySpec,
+GitRepositoryStatus)
+ GitRepositoryInclude specifies a local reference to a GitRepository which
+Artifact (sub-)contents must be included, and where they should be placed. GitRepositoryRef specifies the GitRepository which Artifact contents
+must be included. FromPath specifies the path to copy contents from, defaults to the root
+of the Artifact. ToPath specifies the path to copy contents to, defaults to the name of
+the GitRepositoryRef.
+(Appears on:
+GitRepositorySpec)
+ GitRepositoryRef specifies the Git reference to resolve and checkout. Branch to check out, defaults to ‘master’ if no other field is defined. Tag to check out, takes precedence over Branch. SemVer tag expression to check out, takes precedence over Tag. Name of the reference to check out; takes precedence over Branch, Tag and SemVer. It must be a valid Git reference: https://git-scm.com/docs/git-check-ref-format#_description
+Examples: “refs/heads/main”, “refs/tags/v0.1.0”, “refs/pull/420/head”, “refs/merge-requests/1/head” Commit SHA to check out, takes precedence over all reference fields. This can be combined with Branch to shallow clone the branch, in which
+the commit is expected to exist.
+(Appears on:
+GitRepository)
Artifact represents the output of a Source reconciliation. GitRepositorySpec specifies the required configuration to produce an
+Artifact for a Git repository. URL specifies the Git repository URL, it can be an HTTP/S or SSH address. SecretRef specifies the Secret containing authentication credentials for
+the GitRepository.
+For HTTPS repositories the Secret must contain ‘username’ and ‘password’
+fields for basic auth or ‘bearerToken’ field for token auth.
+For SSH repositories the Secret must contain ‘identity’
+and ‘known_hosts’ fields. Interval at which the GitRepository URL is checked for updates.
+This interval is approximate and may be subject to jitter to ensure
+efficient use of resources. Timeout for Git operations like cloning, defaults to 60s. Reference specifies the Git reference to resolve and monitor for
+changes, defaults to the ‘master’ branch. Verification specifies the configuration to verify the Git commit
+signature(s). ProxySecretRef specifies the Secret containing the proxy configuration
+to use while communicating with the Git server. Ignore overrides the set of excluded patterns in the .sourceignore format
+(which is the same as .gitignore). If not provided, a default will be used,
+consult the documentation for your version to find out what those are. Suspend tells the controller to suspend the reconciliation of this
+GitRepository. RecurseSubmodules enables the initialization of all submodules within
+the GitRepository as cloned from the URL, using their default settings. Include specifies a list of GitRepository resources which Artifacts
+should be included in the Artifact produced for this GitRepository.
+(Appears on:
+GitRepository)
+ GitRepositoryStatus records the observed state of a Git repository. ObservedGeneration is the last observed generation of the GitRepository
+object. Conditions holds the conditions for the GitRepository. Path is the relative file path of the Artifact. It can be used to locate
-the file in the root of the Artifact storage on the local file system of
-the controller managing the Source. Artifact represents the last successful GitRepository reconciliation. URL is the HTTP address of the Artifact as exposed by the controller
-managing the Source. It can be used to retrieve the Artifact for
-consumption, e.g. by another controller applying the Artifact contents. IncludedArtifacts contains a list of the last successfully included
+Artifacts as instructed by GitRepositorySpec.Include. Revision is a human-readable identifier traceable in the origin source
-system. It can be a Git commit SHA, Git tag, a Helm chart version, etc. ObservedIgnore is the observed exclusion patterns used for constructing
+the source artifact. Digest is the digest of the file in the form of ‘ ObservedRecurseSubmodules is the observed resource submodules
+configuration used to produce the current Artifact. LastUpdateTime is the timestamp corresponding to the last update of the
-Artifact. ObservedInclude is the observed list of GitRepository resources used to
+produce the current Artifact. Size is the number of bytes in the file. SourceVerificationMode is the last used verification mode indicating
+which Git object(s) have been verified. Metadata holds upstream information such as OCI annotations.
+(Members of
(Appears on:
-GitRepositorySpec,
-GitRepositoryStatus)
+GitRepositorySpec)
GitRepositoryInclude specifies a local reference to a GitRepository which
-Artifact (sub-)contents must be included, and where they should be placed. GitRepositoryVerification specifies the Git commit signature verification
+strategy. Mode specifies which Git object(s) should be verified. The variants “head” and “HEAD” both imply the same thing, i.e. verify
+the commit that the HEAD of the Git repository points to. The variant
+“head” solely exists to ensure backwards compatibility. GitRepositoryRef specifies the GitRepository which Artifact contents
-must be included. SecretRef specifies the Secret containing the public keys of trusted Git
+authors.
+(Appears on:
+GitRepositoryStatus,
+GitRepositoryVerification)
+ GitVerificationMode specifies the verification mode for a Git repository.
+(Appears on:
+HelmChart)
+ HelmChartSpec specifies the desired state of a Helm chart. Chart is the name or path the Helm chart is available at in the
+SourceRef. FromPath specifies the path to copy contents from, defaults to the root
-of the Artifact. Version is the chart version semver expression, ignored for charts from
+GitRepository and Bucket sources. Defaults to latest when omitted. SourceRef is the reference to the Source the chart is available at. Interval at which the HelmChart SourceRef is checked for updates.
+This interval is approximate and may be subject to jitter to ensure
+efficient use of resources. ToPath specifies the path to copy contents to, defaults to the name of
-the GitRepositoryRef. ReconcileStrategy determines what enables the creation of a new artifact.
+Valid values are (‘ChartVersion’, ‘Revision’).
+See the documentation of the values for an explanation on their behavior.
+Defaults to ChartVersion when omitted. ValuesFiles is an alternative list of values files to use as the chart
+values (values.yaml is not included by default), expected to be a
+relative path in the SourceRef.
+Values files are merged in the order of this list with the last file
+overriding the first. Ignored when omitted. ValuesFile is an alternative values file to use as the default chart
+values, expected to be a relative path in the SourceRef. Deprecated in
+favor of ValuesFiles, for backwards compatibility the file specified here
+is merged before the ValuesFiles items. Ignored when omitted. Suspend tells the controller to suspend the reconciliation of this
+source. AccessFrom specifies an Access Control List for allowing cross-namespace
+references to this object.
+NOTE: Not implemented, provisional as of https://github.com/fluxcd/flux2/pull/2092 Verify contains the secret name containing the trusted public keys
+used to verify the signature and specifies which provider to use to check
+whether OCI image is authentic.
+This field is only supported when using HelmRepository source with spec.type ‘oci’.
+Chart dependencies, which are not bundled in the umbrella chart artifact, are not verified.
(Appears on:
-GitRepositorySpec)
+HelmChart)
GitRepositoryRef specifies the Git reference to resolve and checkout. HelmChartStatus records the observed state of the HelmChart. ObservedGeneration is the last observed generation of the HelmChart
+object. Branch to check out, defaults to ‘master’ if no other field is defined. ObservedSourceArtifactRevision is the last observed Artifact.Revision
+of the HelmChartSpec.SourceRef. Tag to check out, takes precedence over Branch. ObservedChartName is the last observed chart name as specified by the
+resolved chart reference. SemVer tag expression to check out, takes precedence over Tag. Conditions holds the conditions for the HelmChart. Name of the reference to check out; takes precedence over Branch, Tag and SemVer. It must be a valid Git reference: https://git-scm.com/docs/git-check-ref-format#_description
-Examples: “refs/heads/main”, “refs/tags/v0.1.0”, “refs/pull/420/head”, “refs/merge-requests/1/head” URL is the dynamic fetch link for the latest Artifact.
+It is provided on a “best effort” basis, and using the precise
+BucketStatus.Artifact data is recommended. Commit SHA to check out, takes precedence over all reference fields. This can be combined with Branch to shallow clone the branch, in which
-the commit is expected to exist. Artifact represents the output of the last successful reconciliation.
+(Members of
(Appears on:
-GitRepository)
+HelmRepository)
GitRepositorySpec specifies the required configuration to produce an
-Artifact for a Git repository. HelmRepositorySpec specifies the required configuration to produce an
+Artifact for a Helm repository index YAML. URL specifies the Git repository URL, it can be an HTTP/S or SSH address. URL of the Helm repository, a valid URL contains at least a protocol and
+host. SecretRef specifies the Secret containing authentication credentials for
-the GitRepository.
-For HTTPS repositories the Secret must contain ‘username’ and ‘password’
-fields for basic auth or ‘bearerToken’ field for token auth.
-For SSH repositories the Secret must contain ‘identity’
-and ‘known_hosts’ fields. SecretRef specifies the Secret containing authentication credentials
+for the HelmRepository.
+For HTTP/S basic auth the secret must contain ‘username’ and ‘password’
+fields.
+Support for TLS auth using the ‘certFile’ and ‘keyFile’, and/or ‘caFile’
+keys is deprecated. Please use Interval at which the GitRepository URL is checked for updates.
-This interval is approximate and may be subject to jitter to ensure
-efficient use of resources. CertSecretRef can be given the name of a Secret containing
+either or both of and whichever are supplied, will be used for connecting to the
+registry. The client cert and key are useful if you are
+authenticating with a certificate; the CA cert is useful if
+you are using a self-signed server certificate. The Secret must
+be of type It takes precedence over the values specified in the Secret referred
+to by Timeout for Git operations like cloning, defaults to 60s. PassCredentials allows the credentials from the SecretRef to be passed
+on to a host that does not match the host as defined in URL.
+This may be required if the host of the advertised chart URLs in the
+index differ from the defined URL.
+Enabling this should be done with caution, as it can potentially result
+in credentials getting stolen in a MITM-attack. Reference specifies the Git reference to resolve and monitor for
-changes, defaults to the ‘master’ branch. Interval at which the HelmRepository URL is checked for updates.
+This interval is approximate and may be subject to jitter to ensure
+efficient use of resources. Verification specifies the configuration to verify the Git commit
-signature(s). Insecure allows connecting to a non-TLS HTTP container registry.
+This field is only taken into account if the .spec.type field is set to ‘oci’. ProxySecretRef specifies the Secret containing the proxy configuration
-to use while communicating with the Git server. Timeout is used for the index fetch operation for an HTTPS helm repository,
+and for remote OCI Repository operations like pulling for an OCI helm
+chart by the associated HelmChart.
+Its default value is 60s. Ignore overrides the set of excluded patterns in the .sourceignore format
-(which is the same as .gitignore). If not provided, a default will be used,
-consult the documentation for your version to find out what those are. Suspend tells the controller to suspend the reconciliation of this
+HelmRepository. Suspend tells the controller to suspend the reconciliation of this
-GitRepository. AccessFrom specifies an Access Control List for allowing cross-namespace
+references to this object.
+NOTE: Not implemented, provisional as of https://github.com/fluxcd/flux2/pull/2092 RecurseSubmodules enables the initialization of all submodules within
-the GitRepository as cloned from the URL, using their default settings. Type of the HelmRepository.
+When this field is set to “oci”, the URL field value must be prefixed with “oci://”. Include specifies a list of GitRepository resources which Artifacts
-should be included in the Artifact produced for this GitRepository. Provider used for authentication, can be ‘aws’, ‘azure’, ‘gcp’ or ‘generic’.
+This field is optional, and only taken into account if the .spec.type field is set to ‘oci’.
+When not specified, defaults to ‘generic’.
(Appears on:
-GitRepository)
+HelmRepository)
GitRepositoryStatus records the observed state of a Git repository. HelmRepositoryStatus records the observed state of the HelmRepository. ObservedGeneration is the last observed generation of the GitRepository
+ ObservedGeneration is the last observed generation of the HelmRepository
object. Conditions holds the conditions for the GitRepository. Conditions holds the conditions for the HelmRepository. URL is the dynamic fetch link for the latest Artifact.
+It is provided on a “best effort” basis, and using the precise
+HelmRepositoryStatus.Artifact data is recommended. Artifact represents the last successful GitRepository reconciliation. Artifact represents the last successful HelmRepository reconciliation. IncludedArtifacts contains a list of the last successfully included
-Artifacts as instructed by GitRepositorySpec.Include.
+(Members of
+(Appears on:
+HelmChartSpec)
+ LocalHelmChartSourceReference contains enough information to let you locate
+the typed referenced object at namespace level. ObservedIgnore is the observed exclusion patterns used for constructing
-the source artifact. APIVersion of the referent. ObservedRecurseSubmodules is the observed resource submodules
-configuration used to produce the current Artifact. Kind of the referent, valid values are (‘HelmRepository’, ‘GitRepository’,
+‘Bucket’). ObservedInclude is the observed list of GitRepository resources used to
-produce the current Artifact. Name of the referent.
+(Appears on:
+HelmChartSpec)
+ OCIRepositoryVerification verifies the authenticity of an OCI Artifact Provider specifies the technology used to sign the OCI Artifact. SourceVerificationMode is the last used verification mode indicating
-which Git object(s) have been verified. SecretRef specifies the Kubernetes Secret containing the
+trusted public keys.
-(Members of MatchOIDCIdentity specifies the identity matching criteria to use
+while verifying an OCI artifact which was signed using Cosign keyless
+signing. The artifact’s identity is deemed to be verified if any of the
+specified matchers match against the identity.
(Appears on:
-GitRepositorySpec)
+OCIRepositoryVerification)
GitRepositoryVerification specifies the Git commit signature verification
-strategy. OIDCIdentityMatch specifies options for verifying the certificate identity,
+i.e. the issuer and the subject of the certificate. Mode specifies which Git object(s) should be verified. The variants “head” and “HEAD” both imply the same thing, i.e. verify
-the commit that the HEAD of the Git repository points to. The variant
-“head” solely exists to ensure backwards compatibility. Issuer specifies the regex pattern to match against to verify
+the OIDC issuer in the Fulcio certificate. The pattern must be a
+valid Go regular expression. SecretRef specifies the Secret containing the public keys of trusted Git
-authors. Subject specifies the regex pattern to match against to verify
+the identity subject in the Fulcio certificate. The pattern must
+be a valid Go regular expression.
-(Appears on:
-GitRepositoryStatus,
-GitRepositoryVerification)
- GitVerificationMode specifies the verification mode for a Git repository. Source interface must be supported by all API types.
diff --git a/docs/api/v1beta2/source.md b/docs/api/v1beta2/source.md
index 7144c8566..439c81afd 100644
--- a/docs/api/v1beta2/source.md
+++ b/docs/api/v1beta2/source.md
@@ -704,8 +704,8 @@ NOTE: Not implemented, provisional as of
-OCIRepositoryVerification
+
+github.com/fluxcd/source-controller/api/v1.OCIRepositoryVerification
@@ -1122,8 +1122,8 @@ The secret must be of type kubernetes.io/dockerconfigjson.GitRepository
@@ -246,124 +250,1077 @@ GitRepositoryStatus
+HelmChart
+
+
+
+
+
+
+
+
+Field
+Description
+
+
+
+
+apiVersion
+string
+
+source.toolkit.fluxcd.io/v1
+
+
+
+
+kind
+string
+
+
+HelmChart
+
+
+
+
+metadata
+
+
+Kubernetes meta/v1.ObjectMeta
+
+
+
+Refer to the Kubernetes API documentation for the fields of the
+
+metadata
field.
+
+
+
+
+spec
+
+
+HelmChartSpec
+
+
+
+
+
+
+
+
+
+
+
+
+chart
+
+string
+
+
+
+
+
+
+
+version
+
+string
+
+
+(Optional)
+
+
+
+
+
+sourceRef
+
+
+LocalHelmChartSourceReference
+
+
+
+
+
+
+
+
+interval
+
+
+Kubernetes meta/v1.Duration
+
+
+
+
+
+
+
+
+reconcileStrategy
+
+string
+
+
+(Optional)
+
+
+
+
+
+valuesFiles
+
+[]string
+
+
+(Optional)
+
+
+
+
+
+valuesFile
+
+string
+
+
+(Optional)
+
+
+
+
+
+suspend
+
+bool
+
+
+(Optional)
+
+
+
+
+
+accessFrom
+
+
+github.com/fluxcd/pkg/apis/acl.AccessFrom
+
+
+
+(Optional)
+
+
+
+
+
+verify
+
+
+OCIRepositoryVerification
+
+
+
+(Optional)
+
+
+
+
+
+
+status
+
+
+HelmChartStatus
+
+
+
+
+HelmRepository
+
+
+
+
+
+
+
+
+Field
+Description
+
+
+
+
+apiVersion
+string
+
+source.toolkit.fluxcd.io/v1
+
+
+
+
+kind
+string
+
+
+HelmRepository
+
+
+
+
+metadata
+
+
+Kubernetes meta/v1.ObjectMeta
+
+
+
+Refer to the Kubernetes API documentation for the fields of the
+
+metadata
field.
+
+
+
+
+spec
+
+
+HelmRepositorySpec
+
+
+
+
+
+
+
+
+
+
+
+
+url
+
+string
+
+
+
+
+
+
+
+secretRef
+
+
+github.com/fluxcd/pkg/apis/meta.LocalObjectReference
+
+
+
+(Optional)
+
+.spec.certSecretRef
instead.
+
+
+
+certSecretRef
+
+
+github.com/fluxcd/pkg/apis/meta.LocalObjectReference
+
+
+
+(Optional)
+
+
+
+tls.crt
) and private
+key (tls.key
);ca.crt
)Opaque
or kubernetes.io/tls
..spec.secretRef
.
+
+
+
+passCredentials
+
+bool
+
+
+(Optional)
+
+
+
+
+
+interval
+
+
+Kubernetes meta/v1.Duration
+
+
+
+(Optional)
+
+
+
+
+
+insecure
+
+bool
+
+
+(Optional)
+
+
+
+
+
+timeout
+
+
+Kubernetes meta/v1.Duration
+
+
+
+(Optional)
+
+
+
+
+
+suspend
+
+bool
+
+
+(Optional)
+
+
+
+
+
+accessFrom
+
+
+github.com/fluxcd/pkg/apis/acl.AccessFrom
+
+
+
+(Optional)
+
+
+
+
+
+type
+
+string
+
+
+(Optional)
+
+
+
+
+
+provider
+
+string
+
+
+(Optional)
+
+
+
+
+
+
+status
+
+
+HelmRepositoryStatus
+
+
+
+
+Artifact
+
+
+
+
+
+
+Field
+Description
+
+
+
+
+path
+
+string
+
+
+
+
+
+
+
+url
+
+string
+
+
+
+
+
+
+
+revision
+
+string
+
+
+
+
+
+
+
+digest
+
+string
+
+
+(Optional)
+
+
+
+
+
+lastUpdateTime
+
+
+Kubernetes meta/v1.Time
+
+
+
+
+
+
+
+
+size
+
+int64
+
+
+(Optional)
+
+
+
+
+
+
+metadata
+
+map[string]string
+
+
+(Optional)
+
+GitRepositoryInclude
+
+
+
+
+
+
+
+
+Field
+Description
+
+
+
+
+repository
+
+
+github.com/fluxcd/pkg/apis/meta.LocalObjectReference
+
+
+
+
+
+
+
+
+fromPath
+
+string
+
+
+(Optional)
+
+
+
+
+
+
+toPath
+
+string
+
+
+(Optional)
+
+GitRepositoryRef
+
+
+
+
+
+
+
+
+Field
+Description
+
+
+
+
+branch
+
+string
+
+
+(Optional)
+
+
+
+
+
+tag
+
+string
+
+
+(Optional)
+
+
+
+
+
+semver
+
+string
+
+
+(Optional)
+
+
+
+
+
+name
+
+string
+
+
+(Optional)
+
+
+
+
+
+
+commit
+
+string
+
+
+(Optional)
+
+GitRepositorySpec
+
+
+
+
+
+
+
+
+Field
+Description
+
+
+
+
+url
+
+string
+
+
+
+
+
+
+
+secretRef
+
+
+github.com/fluxcd/pkg/apis/meta.LocalObjectReference
+
+
+
+(Optional)
+
+
+
+
+
+interval
+
+
+Kubernetes meta/v1.Duration
+
+
+
+
+
+
+
+
+timeout
+
+
+Kubernetes meta/v1.Duration
+
+
+
+(Optional)
+
+
+
+
+
+ref
+
+
+GitRepositoryRef
+
+
+
+(Optional)
+
+
+
+
+
+verify
+
+
+GitRepositoryVerification
+
+
+
+(Optional)
+
+
+
+
+
+proxySecretRef
+
+
+github.com/fluxcd/pkg/apis/meta.LocalObjectReference
+
+
+
+(Optional)
+
+
+
+
+
+ignore
+
+string
+
+
+(Optional)
+
+
+
+
+
+suspend
+
+bool
+
+
+(Optional)
+
+
+
+
+
+recurseSubmodules
+
+bool
+
+
+(Optional)
+
+
+
+
+
+
+include
+
+
+[]GitRepositoryInclude
+
+
+
+(Optional)
+
+GitRepositoryStatus
+
+
-
+
+
+Field
-Description
+Field
+Description
+
+
+
+
+observedGeneration
+
+int64
+
+
+(Optional)
+
+
+
-
-
+
+conditions
+
+
+[]Kubernetes meta/v1.Condition
+
+
+
+(Optional)
+
-
path
+artifact
-string
+
+Artifact
+
-
-
url
+includedArtifacts
-string
+
+[]Artifact
+
-
-
revision
+observedIgnore
string
-
-
digest
+observedRecurseSubmodules
-string
+bool
(Optional)
-
-
lastUpdateTime
+observedInclude
-
-Kubernetes meta/v1.Time
+
+[]GitRepositoryInclude
-
-
size
+sourceVerificationMode
-int64
+
+GitVerificationMode
+
(Optional)
-
-
metadata
+ReconcileRequestStatus
-map[string]string
+
+github.com/fluxcd/pkg/apis/meta.ReconcileRequestStatus
+
-(Optional)
-
ReconcileRequestStatus
are embedded into this type.)
+GitRepositoryInclude
+
GitRepositoryVerification
@@ -376,7 +1333,24 @@ Artifact (sub-)contents must be included, and where they should be placed.
+
+
-
+repository
+mode
+
+
+GitVerificationMode
+
+
+
+(Optional)
+
+
+
+
+
+
secretRef
github.com/fluxcd/pkg/apis/meta.LocalObjectReference
@@ -384,47 +1358,196 @@ github.com/fluxcd/pkg/apis/meta.LocalObjectReference
-
+GitVerificationMode
+(
+string
alias)HelmChartSpec
+
+
+
+
+
+
+
+Field
+Description
+
+
+
+chart
+
+string
+
+
+
-
fromPath
+version
string
(Optional)
-
+
-
+toPath
+sourceRef
+
+
+LocalHelmChartSourceReference
+
+
+
+
+
+
+
+
+interval
+
+
+Kubernetes meta/v1.Duration
+
+
+
+
+
+
+
+
reconcileStrategy
string
(Optional)
-
+
+
+
+
+valuesFiles
+
+[]string
+
+
+(Optional)
+
+
+
+
+
+valuesFile
+
+string
+
+
+(Optional)
+
+
+
+
+
+suspend
+
+bool
+
+
+(Optional)
+
+
+
+
+
+accessFrom
+
+
+github.com/fluxcd/pkg/apis/acl.AccessFrom
+
+
+
+(Optional)
+
+
+
+
+verify
+
+
+OCIRepositoryVerification
+
+
+
+(Optional)
+
GitRepositoryRef
+
HelmChartStatus
@@ -437,80 +1560,112 @@ the GitRepositoryRef.
+
-
+branch
+observedGeneration
+
+int64
+
+
+(Optional)
+
+
+
+
observedSourceArtifactRevision
string
(Optional)
-
-
tag
+observedChartName
string
(Optional)
-
-
semver
+conditions
-string
+
+[]Kubernetes meta/v1.Condition
+
(Optional)
-
-
name
+url
string
(Optional)
-
+
-
commit
+artifact
-string
+
+Artifact
+
(Optional)
-
+
+
+
+ReconcileRequestStatus
+
+
+github.com/fluxcd/pkg/apis/meta.ReconcileRequestStatus
+
+
+
+
ReconcileRequestStatus
are embedded into this type.)
+GitRepositorySpec
+
HelmRepositorySpec
@@ -529,7 +1684,8 @@ string
-
@@ -543,154 +1699,171 @@ github.com/fluxcd/pkg/apis/meta.LocalObjectReference
(Optional)
-
.spec.certSecretRef
instead.
-
interval
+certSecretRef
-
-Kubernetes meta/v1.Duration
+
+github.com/fluxcd/pkg/apis/meta.LocalObjectReference
-
+
+tls.crt
) and private
+key (tls.key
);ca.crt
)Opaque
or kubernetes.io/tls
..spec.secretRef
.
-
timeout
+passCredentials
-
-Kubernetes meta/v1.Duration
-
+bool
(Optional)
-
-
ref
+interval
-
-GitRepositoryRef
+
+Kubernetes meta/v1.Duration
(Optional)
-
-
verify
+insecure
-
-GitRepositoryVerification
-
+bool
(Optional)
-
-
proxySecretRef
+timeout
-
-github.com/fluxcd/pkg/apis/meta.LocalObjectReference
+
+Kubernetes meta/v1.Duration
(Optional)
-
-
ignore
+suspend
-string
+bool
(Optional)
-
-
suspend
+accessFrom
-bool
+
+github.com/fluxcd/pkg/apis/acl.AccessFrom
+
(Optional)
-
-
recurseSubmodules
+type
-bool
+string
(Optional)
-
-
include
+provider
-
-[]GitRepositoryInclude
-
+string
(Optional)
-
GitRepositoryStatus
+
HelmRepositoryStatus
@@ -710,7 +1883,7 @@ int64
+
(Optional)
-
@@ -725,7 +1898,21 @@ object.
(Optional)
-
+
+
+
+
+url
+
+string
+
+
+(Optional)
+
@@ -739,107 +1926,157 @@ Artifact
(Optional)
-
+
+
-
includedArtifacts
+ReconcileRequestStatus
-
-[]Artifact
+
+github.com/fluxcd/pkg/apis/meta.ReconcileRequestStatus
-(Optional)
-
ReconcileRequestStatus
are embedded into this type.)
+LocalHelmChartSourceReference
+
+
+
+
+
+
+
+
Field
+Description
+
-
observedIgnore
+apiVersion
string
(Optional)
-
-
observedRecurseSubmodules
+kind
-bool
+string
-(Optional)
-
+
+
-
observedInclude
+name
-
-[]GitRepositoryInclude
-
+string
-(Optional)
-
+OCIRepositoryVerification
+
+
+
+
+
+
+
+Field
+Description
+
+
+
+provider
+
+string
+
+
+
-
sourceVerificationMode
+secretRef
-
-GitVerificationMode
+
+github.com/fluxcd/pkg/apis/meta.LocalObjectReference
(Optional)
-
-
ReconcileRequestStatus
+matchOIDCIdentity
-
-github.com/fluxcd/pkg/apis/meta.ReconcileRequestStatus
+
+[]OIDCIdentityMatch
-
ReconcileRequestStatus
are embedded into this type.)
-GitRepositoryVerification
+
OIDCIdentityMatch
@@ -852,47 +2089,34 @@ strategy.
-
mode
+issuer
-
-GitVerificationMode
-
+string
-(Optional)
-
-
secretRef
+subject
-
-github.com/fluxcd/pkg/apis/meta.LocalObjectReference
-
+string
-
GitVerificationMode
-(
-string
alias)Source
@@ -2386,8 +2386,8 @@ NOTE: Not implemented, provisional as of
-OCIRepositoryVerification
+
+github.com/fluxcd/source-controller/api/v1.OCIRepositoryVerification
@@ -3096,8 +3096,8 @@ The secret must be of type kubernetes.io/dockerconfigjson.verify
-
-OCIRepositoryVerification
+
+github.com/fluxcd/source-controller/api/v1.OCIRepositoryVerification
verify
-(Appears on: -HelmChartSpec, -OCIRepositorySpec) -
-OCIRepositoryVerification verifies the authenticity of an OCI Artifact
-Field | -Description | -
---|---|
-provider - -string - - |
-
- Provider specifies the technology used to sign the OCI Artifact. - |
-
-secretRef - - -github.com/fluxcd/pkg/apis/meta.LocalObjectReference - - - |
-
-(Optional)
- SecretRef specifies the Kubernetes Secret containing the -trusted public keys. - |
-
-matchOIDCIdentity - - -[]OIDCIdentityMatch - - - |
-
-(Optional)
- MatchOIDCIdentity specifies the identity matching criteria to use -while verifying an OCI artifact which was signed using Cosign keyless -signing. The artifact’s identity is deemed to be verified if any of the -specified matchers match against the identity. - |
-
-(Appears on: -OCIRepositoryVerification) -
-OIDCIdentityMatch specifies options for verifying the certificate identity, -i.e. the issuer and the subject of the certificate.
-Field | -Description | -
---|---|
-issuer - -string - - |
-
- Issuer specifies the regex pattern to match against to verify -the OIDC issuer in the Fulcio certificate. The pattern must be a -valid Go regular expression. - |
-
-subject - -string - - |
-
- Subject specifies the regex pattern to match against to verify -the identity subject in the Fulcio certificate. The pattern must -be a valid Go regular expression. - |
-
Source interface must be supported by all API types.
diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt
index e4b53a5f0..79a769a8c 100644
--- a/hack/boilerplate.go.txt
+++ b/hack/boilerplate.go.txt
@@ -1,5 +1,5 @@
/*
-Copyright 2023 The Flux authors
+Copyright 2024 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/internal/controller/helmchart_controller.go b/internal/controller/helmchart_controller.go
index 608b8382d..b8d2aa88f 100644
--- a/internal/controller/helmchart_controller.go
+++ b/internal/controller/helmchart_controller.go
@@ -65,7 +65,7 @@ import (
"github.com/fluxcd/pkg/tar"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
- helmv1 "github.com/fluxcd/source-controller/api/v1beta2"
+ sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/fluxcd/source-controller/internal/cache"
serror "github.com/fluxcd/source-controller/internal/error"
"github.com/fluxcd/source-controller/internal/helm/chart"
@@ -162,26 +162,26 @@ type HelmChartReconcilerOptions struct {
// helmChartReconcileFunc is the function type for all the v1beta2.HelmChart
// (sub)reconcile functions. The type implementations are grouped and
// executed serially to perform the complete reconcile of the object.
-type helmChartReconcileFunc func(ctx context.Context, sp *patch.SerialPatcher, obj *helmv1.HelmChart, build *chart.Build) (sreconcile.Result, error)
+type helmChartReconcileFunc func(ctx context.Context, sp *patch.SerialPatcher, obj *sourcev1.HelmChart, build *chart.Build) (sreconcile.Result, error)
func (r *HelmChartReconciler) SetupWithManagerAndOptions(ctx context.Context, mgr ctrl.Manager, opts HelmChartReconcilerOptions) error {
r.patchOptions = getPatchOptions(helmChartReadyCondition.Owned, r.ControllerName)
- if err := mgr.GetCache().IndexField(ctx, &helmv1.HelmRepository{}, helmv1.HelmRepositoryURLIndexKey,
+ if err := mgr.GetCache().IndexField(ctx, &sourcev1.HelmRepository{}, sourcev1.HelmRepositoryURLIndexKey,
r.indexHelmRepositoryByURL); err != nil {
return fmt.Errorf("failed setting index fields: %w", err)
}
- if err := mgr.GetCache().IndexField(ctx, &helmv1.HelmChart{}, sourcev1.SourceIndexKey,
+ if err := mgr.GetCache().IndexField(ctx, &sourcev1.HelmChart{}, sourcev1.SourceIndexKey,
r.indexHelmChartBySource); err != nil {
return fmt.Errorf("failed setting index fields: %w", err)
}
return ctrl.NewControllerManagedBy(mgr).
- For(&helmv1.HelmChart{}, builder.WithPredicates(
+ For(&sourcev1.HelmChart{}, builder.WithPredicates(
predicate.Or(predicate.GenerationChangedPredicate{}, predicates.ReconcileRequestedPredicate{}),
)).
Watches(
- &helmv1.HelmRepository{},
+ &sourcev1.HelmRepository{},
handler.EnqueueRequestsFromMapFunc(r.requestsForHelmRepositoryChange),
builder.WithPredicates(SourceRevisionChangePredicate{}),
).
@@ -191,7 +191,7 @@ func (r *HelmChartReconciler) SetupWithManagerAndOptions(ctx context.Context, mg
builder.WithPredicates(SourceRevisionChangePredicate{}),
).
Watches(
- &helmv1.Bucket{},
+ &sourcev1beta2.Bucket{},
handler.EnqueueRequestsFromMapFunc(r.requestsForBucketChange),
builder.WithPredicates(SourceRevisionChangePredicate{}),
).
@@ -206,7 +206,7 @@ func (r *HelmChartReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
log := ctrl.LoggerFrom(ctx)
// Fetch the HelmChart
- obj := &helmv1.HelmChart{}
+ obj := &sourcev1.HelmChart{}
if err := r.Get(ctx, req.NamespacedName, obj); err != nil {
return ctrl.Result{}, client.IgnoreNotFound(err)
}
@@ -280,7 +280,7 @@ func (r *HelmChartReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
// reconcile iterates through the helmChartReconcileFunc tasks for the
// object. It returns early on the first call that returns
// reconcile.ResultRequeue, or produces an error.
-func (r *HelmChartReconciler) reconcile(ctx context.Context, sp *patch.SerialPatcher, obj *helmv1.HelmChart, reconcilers []helmChartReconcileFunc) (sreconcile.Result, error) {
+func (r *HelmChartReconciler) reconcile(ctx context.Context, sp *patch.SerialPatcher, obj *sourcev1.HelmChart, reconcilers []helmChartReconcileFunc) (sreconcile.Result, error) {
oldObj := obj.DeepCopy()
rreconcile.ProgressiveStatus(false, obj, meta.ProgressingReason, "reconciliation in progress")
@@ -333,7 +333,7 @@ func (r *HelmChartReconciler) reconcile(ctx context.Context, sp *patch.SerialPat
}
// notify emits notification related to the reconciliation.
-func (r *HelmChartReconciler) notify(ctx context.Context, oldObj, newObj *helmv1.HelmChart, build *chart.Build, res sreconcile.Result, resErr error) {
+func (r *HelmChartReconciler) notify(ctx context.Context, oldObj, newObj *sourcev1.HelmChart, build *chart.Build, res sreconcile.Result, resErr error) {
// Notify successful reconciliation for new artifact and recovery from any
// failure.
if resErr == nil && res == sreconcile.ResultSuccess && newObj.Status.Artifact != nil {
@@ -369,7 +369,7 @@ func (r *HelmChartReconciler) notify(ctx context.Context, oldObj, newObj *helmv1
// condition is added.
// The hostname of any URL in the Status of the object are updated, to ensure
// they match the Storage server hostname of current runtime.
-func (r *HelmChartReconciler) reconcileStorage(ctx context.Context, sp *patch.SerialPatcher, obj *helmv1.HelmChart, _ *chart.Build) (sreconcile.Result, error) {
+func (r *HelmChartReconciler) reconcileStorage(ctx context.Context, sp *patch.SerialPatcher, obj *sourcev1.HelmChart, _ *chart.Build) (sreconcile.Result, error) {
// Garbage collect previous advertised artifact(s) from storage
_ = r.garbageCollect(ctx, obj)
@@ -423,7 +423,7 @@ func (r *HelmChartReconciler) reconcileStorage(ctx context.Context, sp *patch.Se
return sreconcile.ResultSuccess, nil
}
-func (r *HelmChartReconciler) reconcileSource(ctx context.Context, sp *patch.SerialPatcher, obj *helmv1.HelmChart, build *chart.Build) (_ sreconcile.Result, retErr error) {
+func (r *HelmChartReconciler) reconcileSource(ctx context.Context, sp *patch.SerialPatcher, obj *sourcev1.HelmChart, build *chart.Build) (_ sreconcile.Result, retErr error) {
// Remove any failed verification condition.
// The reason is that a failing verification should be recalculated.
if conditions.IsFalse(obj, sourcev1.SourceVerifiedCondition) {
@@ -453,7 +453,7 @@ func (r *HelmChartReconciler) reconcileSource(ctx context.Context, sp *patch.Ser
// Assert source has an artifact
if s.GetArtifact() == nil || !r.Storage.ArtifactExist(*s.GetArtifact()) {
// Set the condition to indicate that the source has no artifact for all types except OCI HelmRepository
- if helmRepo, ok := s.(*helmv1.HelmRepository); !ok || helmRepo.Spec.Type != helmv1.HelmRepositoryTypeOCI {
+ if helmRepo, ok := s.(*sourcev1.HelmRepository); !ok || helmRepo.Spec.Type != sourcev1.HelmRepositoryTypeOCI {
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, "NoSourceArtifact",
"no artifact available for %s source '%s'", obj.Spec.SourceRef.Kind, obj.Spec.SourceRef.Name)
r.eventLogf(ctx, obj, eventv1.EventTypeTrace, "NoSourceArtifact",
@@ -500,9 +500,9 @@ func (r *HelmChartReconciler) reconcileSource(ctx context.Context, sp *patch.Ser
// Perform the build for the chart source type
switch typedSource := s.(type) {
- case *helmv1.HelmRepository:
+ case *sourcev1.HelmRepository:
return r.buildFromHelmRepository(ctx, obj, typedSource, build)
- case *sourcev1.GitRepository, *helmv1.Bucket:
+ case *sourcev1.GitRepository, *sourcev1beta2.Bucket:
return r.buildFromTarballArtifact(ctx, obj, *typedSource.GetArtifact(), build)
default:
// Ending up here should generally not be possible
@@ -516,8 +516,8 @@ func (r *HelmChartReconciler) reconcileSource(ctx context.Context, sp *patch.Ser
// objects.
// In case of a failure it records v1beta2.FetchFailedCondition on the chart
// object, and returns early.
-func (r *HelmChartReconciler) buildFromHelmRepository(ctx context.Context, obj *helmv1.HelmChart,
- repo *helmv1.HelmRepository, b *chart.Build) (sreconcile.Result, error) {
+func (r *HelmChartReconciler) buildFromHelmRepository(ctx context.Context, obj *sourcev1.HelmChart,
+ repo *sourcev1.HelmRepository, b *chart.Build) (sreconcile.Result, error) {
// Used to login with the repository declared provider
ctxTimeout, cancel := context.WithTimeout(ctx, repo.GetTimeout())
defer cancel()
@@ -550,7 +550,7 @@ func (r *HelmChartReconciler) buildFromHelmRepository(ctx context.Context, obj *
// Initialize the chart repository
var chartRepo repository.Downloader
switch repo.Spec.Type {
- case helmv1.HelmRepositoryTypeOCI:
+ case sourcev1.HelmRepositoryTypeOCI:
if !helmreg.IsOCI(normalizedURL) {
err := fmt.Errorf("invalid OCI registry URL: %s", normalizedURL)
return chartRepoConfigErrorReturn(err, obj)
@@ -700,7 +700,7 @@ func (r *HelmChartReconciler) buildFromHelmRepository(ctx context.Context, obj *
// v1beta2.Artifact.
// In case of a failure it records v1beta2.FetchFailedCondition on the chart
// object, and returns early.
-func (r *HelmChartReconciler) buildFromTarballArtifact(ctx context.Context, obj *helmv1.HelmChart, source sourcev1.Artifact, b *chart.Build) (sreconcile.Result, error) {
+func (r *HelmChartReconciler) buildFromTarballArtifact(ctx context.Context, obj *sourcev1.HelmChart, source sourcev1.Artifact, b *chart.Build) (sreconcile.Result, error) {
// Create temporary working directory
tmpDir, err := util.TempDirForObj("", obj)
if err != nil {
@@ -772,17 +772,17 @@ func (r *HelmChartReconciler) buildFromTarballArtifact(ctx context.Context, obj
}
// Configure revision metadata for chart build if we should react to revision changes
- if obj.Spec.ReconcileStrategy == helmv1.ReconcileStrategyRevision {
+ if obj.Spec.ReconcileStrategy == sourcev1.ReconcileStrategyRevision {
rev := source.Revision
if obj.Spec.SourceRef.Kind == sourcev1.GitRepositoryKind {
rev = git.ExtractHashFromRevision(rev).String()
}
- if obj.Spec.SourceRef.Kind == helmv1.BucketKind {
+ if obj.Spec.SourceRef.Kind == sourcev1beta2.BucketKind {
if dig := digest.Digest(rev); dig.Validate() == nil {
rev = dig.Encoded()
}
}
- if kind := obj.Spec.SourceRef.Kind; kind == sourcev1.GitRepositoryKind || kind == helmv1.BucketKind {
+ if kind := obj.Spec.SourceRef.Kind; kind == sourcev1.GitRepositoryKind || kind == sourcev1beta2.BucketKind {
// The SemVer from the metadata is at times used in e.g. the label metadata for a resource
// in a chart, which has a limited length of 63 characters.
// To not fill most of this space with a full length SHA hex (40 characters for SHA-1, and
@@ -829,7 +829,7 @@ func (r *HelmChartReconciler) buildFromTarballArtifact(ctx context.Context, obj
// early.
// On a successful archive, the Artifact in the Status of the object is set,
// and the symlink in the Storage is updated to its path.
-func (r *HelmChartReconciler) reconcileArtifact(ctx context.Context, _ *patch.SerialPatcher, obj *helmv1.HelmChart, b *chart.Build) (sreconcile.Result, error) {
+func (r *HelmChartReconciler) reconcileArtifact(ctx context.Context, _ *patch.SerialPatcher, obj *sourcev1.HelmChart, b *chart.Build) (sreconcile.Result, error) {
// Without a complete chart build, there is little to reconcile
if !b.Complete() {
return sreconcile.ResultRequeue, nil
@@ -909,15 +909,15 @@ func (r *HelmChartReconciler) reconcileArtifact(ctx context.Context, _ *patch.Se
// getSource returns the v1beta1.Source for the given object, or an error describing why the source could not be
// returned.
-func (r *HelmChartReconciler) getSource(ctx context.Context, obj *helmv1.HelmChart) (sourcev1.Source, error) {
+func (r *HelmChartReconciler) getSource(ctx context.Context, obj *sourcev1.HelmChart) (sourcev1.Source, error) {
namespacedName := types.NamespacedName{
Namespace: obj.GetNamespace(),
Name: obj.Spec.SourceRef.Name,
}
var s sourcev1.Source
switch obj.Spec.SourceRef.Kind {
- case helmv1.HelmRepositoryKind:
- var repo helmv1.HelmRepository
+ case sourcev1.HelmRepositoryKind:
+ var repo sourcev1.HelmRepository
if err := r.Client.Get(ctx, namespacedName, &repo); err != nil {
return nil, err
}
@@ -928,15 +928,15 @@ func (r *HelmChartReconciler) getSource(ctx context.Context, obj *helmv1.HelmCha
return nil, err
}
s = &repo
- case helmv1.BucketKind:
- var bucket helmv1.Bucket
+ case sourcev1beta2.BucketKind:
+ var bucket sourcev1beta2.Bucket
if err := r.Client.Get(ctx, namespacedName, &bucket); err != nil {
return nil, err
}
s = &bucket
default:
return nil, fmt.Errorf("unsupported source kind '%s', must be one of: %v", obj.Spec.SourceRef.Kind, []string{
- helmv1.HelmRepositoryKind, sourcev1.GitRepositoryKind, helmv1.BucketKind})
+ sourcev1.HelmRepositoryKind, sourcev1.GitRepositoryKind, sourcev1beta2.BucketKind})
}
return s, nil
}
@@ -944,7 +944,7 @@ func (r *HelmChartReconciler) getSource(ctx context.Context, obj *helmv1.HelmCha
// reconcileDelete handles the deletion of the object.
// It first garbage collects all Artifacts for the object from the Storage.
// Removing the finalizer from the object if successful.
-func (r *HelmChartReconciler) reconcileDelete(ctx context.Context, obj *helmv1.HelmChart) (sreconcile.Result, error) {
+func (r *HelmChartReconciler) reconcileDelete(ctx context.Context, obj *sourcev1.HelmChart) (sreconcile.Result, error) {
// Garbage collect the resource's artifacts
if err := r.garbageCollect(ctx, obj); err != nil {
// Return the error so we retry the failed garbage collection
@@ -963,7 +963,7 @@ func (r *HelmChartReconciler) reconcileDelete(ctx context.Context, obj *helmv1.H
// It removes all but the current Artifact from the Storage, unless the
// deletion timestamp on the object is set. Which will result in the
// removal of all Artifacts for the objects.
-func (r *HelmChartReconciler) garbageCollect(ctx context.Context, obj *helmv1.HelmChart) error {
+func (r *HelmChartReconciler) garbageCollect(ctx context.Context, obj *sourcev1.HelmChart) error {
if !obj.DeletionTimestamp.IsZero() {
if deleted, err := r.Storage.RemoveAll(r.Storage.NewArtifactFor(obj.Kind, obj.GetObjectMeta(), "", "*")); err != nil {
return serror.NewGeneric(
@@ -1010,8 +1010,8 @@ func (r *HelmChartReconciler) namespacedChartRepositoryCallback(ctx context.Cont
if apierrs.ReasonForError(err) != metav1.StatusReasonUnknown {
return nil, err
}
- obj = &helmv1.HelmRepository{
- Spec: helmv1.HelmRepositorySpec{
+ obj = &sourcev1.HelmRepository{
+ Spec: sourcev1.HelmRepositorySpec{
URL: url,
Timeout: &metav1.Duration{Duration: 60 * time.Second},
},
@@ -1099,13 +1099,13 @@ func (r *HelmChartReconciler) namespacedChartRepositoryCallback(ctx context.Cont
}
}
-func (r *HelmChartReconciler) resolveDependencyRepository(ctx context.Context, url string, namespace string) (*helmv1.HelmRepository, error) {
+func (r *HelmChartReconciler) resolveDependencyRepository(ctx context.Context, url string, namespace string) (*sourcev1.HelmRepository, error) {
listOpts := []client.ListOption{
client.InNamespace(namespace),
- client.MatchingFields{helmv1.HelmRepositoryURLIndexKey: url},
+ client.MatchingFields{sourcev1.HelmRepositoryURLIndexKey: url},
client.Limit(1),
}
- var list helmv1.HelmRepositoryList
+ var list sourcev1.HelmRepositoryList
err := r.Client.List(ctx, &list, listOpts...)
if err != nil {
return nil, fmt.Errorf("unable to retrieve HelmRepositoryList: %w", err)
@@ -1117,7 +1117,7 @@ func (r *HelmChartReconciler) resolveDependencyRepository(ctx context.Context, u
}
func (r *HelmChartReconciler) indexHelmRepositoryByURL(o client.Object) []string {
- repo, ok := o.(*helmv1.HelmRepository)
+ repo, ok := o.(*sourcev1.HelmRepository)
if !ok {
panic(fmt.Sprintf("Expected a HelmRepository, got %T", o))
}
@@ -1129,7 +1129,7 @@ func (r *HelmChartReconciler) indexHelmRepositoryByURL(o client.Object) []string
}
func (r *HelmChartReconciler) indexHelmChartBySource(o client.Object) []string {
- hc, ok := o.(*helmv1.HelmChart)
+ hc, ok := o.(*sourcev1.HelmChart)
if !ok {
panic(fmt.Sprintf("Expected a HelmChart, got %T", o))
}
@@ -1137,7 +1137,7 @@ func (r *HelmChartReconciler) indexHelmChartBySource(o client.Object) []string {
}
func (r *HelmChartReconciler) requestsForHelmRepositoryChange(ctx context.Context, o client.Object) []reconcile.Request {
- repo, ok := o.(*helmv1.HelmRepository)
+ repo, ok := o.(*sourcev1.HelmRepository)
if !ok {
ctrl.LoggerFrom(ctx).Error(fmt.Errorf("expected a HelmRepository, got %T", o), "failed to get requests for HelmRepository change")
return nil
@@ -1148,9 +1148,9 @@ func (r *HelmChartReconciler) requestsForHelmRepositoryChange(ctx context.Contex
return nil
}
- var list helmv1.HelmChartList
+ var list sourcev1.HelmChartList
if err := r.List(ctx, &list, client.MatchingFields{
- sourcev1.SourceIndexKey: fmt.Sprintf("%s/%s", helmv1.HelmRepositoryKind, repo.Name),
+ sourcev1.SourceIndexKey: fmt.Sprintf("%s/%s", sourcev1.HelmRepositoryKind, repo.Name),
}); err != nil {
ctrl.LoggerFrom(ctx).Error(err, "failed to list HelmCharts for HelmRepository change")
return nil
@@ -1178,7 +1178,7 @@ func (r *HelmChartReconciler) requestsForGitRepositoryChange(ctx context.Context
return nil
}
- var list helmv1.HelmChartList
+ var list sourcev1.HelmChartList
if err := r.List(ctx, &list, client.MatchingFields{
sourcev1.SourceIndexKey: fmt.Sprintf("%s/%s", sourcev1.GitRepositoryKind, repo.Name),
}); err != nil {
@@ -1196,7 +1196,7 @@ func (r *HelmChartReconciler) requestsForGitRepositoryChange(ctx context.Context
}
func (r *HelmChartReconciler) requestsForBucketChange(ctx context.Context, o client.Object) []reconcile.Request {
- bucket, ok := o.(*helmv1.Bucket)
+ bucket, ok := o.(*sourcev1beta2.Bucket)
if !ok {
ctrl.LoggerFrom(ctx).Error(fmt.Errorf("expected a Bucket, got %T", o),
"failed to get reconcile requests for Bucket change")
@@ -1208,9 +1208,9 @@ func (r *HelmChartReconciler) requestsForBucketChange(ctx context.Context, o cli
return nil
}
- var list helmv1.HelmChartList
+ var list sourcev1.HelmChartList
if err := r.List(ctx, &list, client.MatchingFields{
- sourcev1.SourceIndexKey: fmt.Sprintf("%s/%s", helmv1.BucketKind, bucket.Name),
+ sourcev1.SourceIndexKey: fmt.Sprintf("%s/%s", sourcev1beta2.BucketKind, bucket.Name),
}); err != nil {
ctrl.LoggerFrom(ctx).Error(err, "failed to list HelmCharts for Bucket change")
return nil
@@ -1242,7 +1242,7 @@ func (r *HelmChartReconciler) eventLogf(ctx context.Context, obj runtime.Object,
}
// observeChartBuild records the observation on the given given build and error on the object.
-func observeChartBuild(ctx context.Context, sp *patch.SerialPatcher, pOpts []patch.Option, obj *helmv1.HelmChart, build *chart.Build, err error) {
+func observeChartBuild(ctx context.Context, sp *patch.SerialPatcher, pOpts []patch.Option, obj *sourcev1.HelmChart, build *chart.Build, err error) {
if build.HasMetadata() {
if build.Name != obj.Status.ObservedChartName || !obj.GetArtifact().HasRevision(build.Version) {
if obj.GetArtifact() != nil {
@@ -1297,12 +1297,12 @@ func reasonForBuild(build *chart.Build) string {
return ""
}
if build.Packaged {
- return helmv1.ChartPackageSucceededReason
+ return sourcev1.ChartPackageSucceededReason
}
- return helmv1.ChartPullSucceededReason
+ return sourcev1.ChartPullSucceededReason
}
-func chartRepoConfigErrorReturn(err error, obj *helmv1.HelmChart) (sreconcile.Result, error) {
+func chartRepoConfigErrorReturn(err error, obj *sourcev1.HelmChart) (sreconcile.Result, error) {
switch err.(type) {
case *url.Error:
e := serror.NewStalling(
@@ -1322,7 +1322,7 @@ func chartRepoConfigErrorReturn(err error, obj *helmv1.HelmChart) (sreconcile.Re
}
// makeVerifiers returns a list of verifiers for the given chart.
-func (r *HelmChartReconciler) makeVerifiers(ctx context.Context, obj *helmv1.HelmChart, clientOpts getter.ClientOpts) ([]soci.Verifier, error) {
+func (r *HelmChartReconciler) makeVerifiers(ctx context.Context, obj *sourcev1.HelmChart, clientOpts getter.ClientOpts) ([]soci.Verifier, error) {
var verifiers []soci.Verifier
verifyOpts := []remote.Option{}
diff --git a/internal/controller/helmchart_controller_test.go b/internal/controller/helmchart_controller_test.go
index b15fcf6d5..06426068a 100644
--- a/internal/controller/helmchart_controller_test.go
+++ b/internal/controller/helmchart_controller_test.go
@@ -67,7 +67,7 @@ import (
"github.com/fluxcd/pkg/testserver"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
- helmv1 "github.com/fluxcd/source-controller/api/v1beta2"
+ sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
serror "github.com/fluxcd/source-controller/internal/error"
"github.com/fluxcd/source-controller/internal/helm/chart"
"github.com/fluxcd/source-controller/internal/helm/chart/secureloader"
@@ -90,13 +90,13 @@ func TestHelmChartReconciler_deleteBeforeFinalizer(t *testing.T) {
g.Expect(k8sClient.Delete(ctx, namespace)).NotTo(HaveOccurred())
})
- helmchart := &helmv1.HelmChart{}
+ helmchart := &sourcev1.HelmChart{}
helmchart.Name = "test-helmchart"
helmchart.Namespace = namespaceName
- helmchart.Spec = helmv1.HelmChartSpec{
+ helmchart.Spec = sourcev1.HelmChartSpec{
Interval: metav1.Duration{Duration: interval},
Chart: "foo",
- SourceRef: helmv1.LocalHelmChartSourceReference{
+ SourceRef: sourcev1.LocalHelmChartSourceReference{
Kind: "HelmRepository",
Name: "bar",
},
@@ -135,12 +135,12 @@ func TestHelmChartReconciler_Reconcile(t *testing.T) {
tests := []struct {
name string
- beforeFunc func(repository *helmv1.HelmRepository)
- assertFunc func(g *WithT, obj *helmv1.HelmChart, repository *helmv1.HelmRepository)
+ beforeFunc func(repository *sourcev1.HelmRepository)
+ assertFunc func(g *WithT, obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository)
}{
{
name: "Reconciles chart build",
- assertFunc: func(g *WithT, obj *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ assertFunc: func(g *WithT, obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
origObj := obj.DeepCopy()
key := client.ObjectKey{Name: obj.Name, Namespace: obj.Namespace}
@@ -206,10 +206,10 @@ func TestHelmChartReconciler_Reconcile(t *testing.T) {
},
{
name: "Stalling on invalid repository URL",
- beforeFunc: func(repository *helmv1.HelmRepository) {
+ beforeFunc: func(repository *sourcev1.HelmRepository) {
repository.Spec.URL = "https://unsupported/foo://" // Invalid URL
},
- assertFunc: func(g *WithT, obj *helmv1.HelmChart, _ *helmv1.HelmRepository) {
+ assertFunc: func(g *WithT, obj *sourcev1.HelmChart, _ *sourcev1.HelmRepository) {
key := client.ObjectKey{Name: obj.Name, Namespace: obj.Namespace}
// Wait for HelmChart to be FetchFailed == true
g.Eventually(func() bool {
@@ -241,10 +241,10 @@ func TestHelmChartReconciler_Reconcile(t *testing.T) {
},
{
name: "Stalling on invalid oci repository URL",
- beforeFunc: func(repository *helmv1.HelmRepository) {
+ beforeFunc: func(repository *sourcev1.HelmRepository) {
repository.Spec.URL = strings.Replace(repository.Spec.URL, "http", "oci", 1)
},
- assertFunc: func(g *WithT, obj *helmv1.HelmChart, _ *helmv1.HelmRepository) {
+ assertFunc: func(g *WithT, obj *sourcev1.HelmChart, _ *sourcev1.HelmRepository) {
key := client.ObjectKey{Name: obj.Name, Namespace: obj.Namespace}
// Wait for HelmChart to be Ready
g.Eventually(func() bool {
@@ -288,12 +288,12 @@ func TestHelmChartReconciler_Reconcile(t *testing.T) {
g.Expect(err).ToNot(HaveOccurred())
defer func() { g.Expect(testEnv.Delete(ctx, ns)).To(Succeed()) }()
- repository := helmv1.HelmRepository{
+ repository := sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmrepository-",
Namespace: ns.Name,
},
- Spec: helmv1.HelmRepositorySpec{
+ Spec: sourcev1.HelmRepositorySpec{
URL: server.URL(),
},
}
@@ -305,16 +305,16 @@ func TestHelmChartReconciler_Reconcile(t *testing.T) {
g.Expect(testEnv.CreateAndWait(ctx, &repository)).To(Succeed())
defer func() { g.Expect(testEnv.Delete(ctx, &repository)).To(Succeed()) }()
- obj := helmv1.HelmChart{
+ obj := sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmrepository-reconcile-",
Namespace: ns.Name,
},
- Spec: helmv1.HelmChartSpec{
+ Spec: sourcev1.HelmChartSpec{
Chart: chartName,
Version: chartVersion,
- SourceRef: helmv1.LocalHelmChartSourceReference{
- Kind: helmv1.HelmRepositoryKind,
+ SourceRef: sourcev1.LocalHelmChartSourceReference{
+ Kind: sourcev1.HelmRepositoryKind,
Name: repository.Name,
},
},
@@ -331,7 +331,7 @@ func TestHelmChartReconciler_Reconcile(t *testing.T) {
func TestHelmChartReconciler_reconcileStorage(t *testing.T) {
tests := []struct {
name string
- beforeFunc func(obj *helmv1.HelmChart, storage *Storage) error
+ beforeFunc func(obj *sourcev1.HelmChart, storage *Storage) error
want sreconcile.Result
wantErr bool
assertArtifact *sourcev1.Artifact
@@ -340,7 +340,7 @@ func TestHelmChartReconciler_reconcileStorage(t *testing.T) {
}{
{
name: "garbage collects",
- beforeFunc: func(obj *helmv1.HelmChart, storage *Storage) error {
+ beforeFunc: func(obj *sourcev1.HelmChart, storage *Storage) error {
revisions := []string{"a", "b", "c", "d"}
for n := range revisions {
v := revisions[n]
@@ -390,7 +390,7 @@ func TestHelmChartReconciler_reconcileStorage(t *testing.T) {
},
{
name: "notices missing artifact in storage",
- beforeFunc: func(obj *helmv1.HelmChart, storage *Storage) error {
+ beforeFunc: func(obj *sourcev1.HelmChart, storage *Storage) error {
obj.Status.Artifact = &sourcev1.Artifact{
Path: "/reconcile-storage/invalid.txt",
Revision: "d",
@@ -409,7 +409,7 @@ func TestHelmChartReconciler_reconcileStorage(t *testing.T) {
},
{
name: "notices empty artifact digest",
- beforeFunc: func(obj *helmv1.HelmChart, storage *Storage) error {
+ beforeFunc: func(obj *sourcev1.HelmChart, storage *Storage) error {
f := "empty-digest.txt"
obj.Status.Artifact = &sourcev1.Artifact{
@@ -440,7 +440,7 @@ func TestHelmChartReconciler_reconcileStorage(t *testing.T) {
},
{
name: "notices artifact digest mismatch",
- beforeFunc: func(obj *helmv1.HelmChart, storage *Storage) error {
+ beforeFunc: func(obj *sourcev1.HelmChart, storage *Storage) error {
f := "digest-mismatch.txt"
obj.Status.Artifact = &sourcev1.Artifact{
@@ -471,7 +471,7 @@ func TestHelmChartReconciler_reconcileStorage(t *testing.T) {
},
{
name: "updates hostname on diff from current",
- beforeFunc: func(obj *helmv1.HelmChart, storage *Storage) error {
+ beforeFunc: func(obj *sourcev1.HelmChart, storage *Storage) error {
obj.Status.Artifact = &sourcev1.Artifact{
Path: "/reconcile-storage/hostname.txt",
Revision: "f",
@@ -514,14 +514,14 @@ func TestHelmChartReconciler_reconcileStorage(t *testing.T) {
r := &HelmChartReconciler{
Client: fakeclient.NewClientBuilder().
WithScheme(testEnv.GetScheme()).
- WithStatusSubresource(&helmv1.HelmChart{}).
+ WithStatusSubresource(&sourcev1.HelmChart{}).
Build(),
EventRecorder: record.NewFakeRecorder(32),
Storage: testStorage,
patchOptions: getPatchOptions(helmChartReadyCondition.Owned, "sc"),
}
- obj := &helmv1.HelmChart{
+ obj := &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "test-",
Generation: 1,
@@ -581,10 +581,10 @@ func TestHelmChartReconciler_reconcileSource(t *testing.T) {
tests := []struct {
name string
source sourcev1.Source
- beforeFunc func(obj *helmv1.HelmChart)
+ beforeFunc func(obj *sourcev1.HelmChart)
want sreconcile.Result
wantErr error
- assertFunc func(g *WithT, build chart.Build, obj helmv1.HelmChart)
+ assertFunc func(g *WithT, build chart.Build, obj sourcev1.HelmChart)
cleanFunc func(g *WithT, build *chart.Build)
}{
{
@@ -598,15 +598,15 @@ func TestHelmChartReconciler_reconcileSource(t *testing.T) {
Artifact: gitArtifact,
},
},
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = "testdata/charts/helmchart-0.1.0.tgz"
- obj.Spec.SourceRef = helmv1.LocalHelmChartSourceReference{
+ obj.Spec.SourceRef = sourcev1.LocalHelmChartSourceReference{
Name: "gitrepository",
Kind: sourcev1.GitRepositoryKind,
}
},
want: sreconcile.ResultSuccess,
- assertFunc: func(g *WithT, build chart.Build, obj helmv1.HelmChart) {
+ assertFunc: func(g *WithT, build chart.Build, obj sourcev1.HelmChart) {
g.Expect(build.Complete()).To(BeTrue())
g.Expect(build.Name).To(Equal("helmchart"))
g.Expect(build.Version).To(Equal("0.1.0"))
@@ -633,9 +633,9 @@ func TestHelmChartReconciler_reconcileSource(t *testing.T) {
Artifact: gitArtifact,
},
},
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = "testdata/charts/helmchart-0.1.0.tgz"
- obj.Spec.SourceRef = helmv1.LocalHelmChartSourceReference{
+ obj.Spec.SourceRef = sourcev1.LocalHelmChartSourceReference{
Name: "gitrepository",
Kind: sourcev1.GitRepositoryKind,
}
@@ -645,7 +645,7 @@ func TestHelmChartReconciler_reconcileSource(t *testing.T) {
}
},
want: sreconcile.ResultSuccess,
- assertFunc: func(g *WithT, build chart.Build, obj helmv1.HelmChart) {
+ assertFunc: func(g *WithT, build chart.Build, obj sourcev1.HelmChart) {
g.Expect(build.Complete()).To(BeTrue())
g.Expect(build.Name).To(Equal("helmchart"))
g.Expect(build.Version).To(Equal("0.1.0"))
@@ -661,8 +661,8 @@ func TestHelmChartReconciler_reconcileSource(t *testing.T) {
},
{
name: "Error on unavailable source",
- beforeFunc: func(obj *helmv1.HelmChart) {
- obj.Spec.SourceRef = helmv1.LocalHelmChartSourceReference{
+ beforeFunc: func(obj *sourcev1.HelmChart) {
+ obj.Spec.SourceRef = sourcev1.LocalHelmChartSourceReference{
Name: "unavailable",
Kind: sourcev1.GitRepositoryKind,
}
@@ -671,7 +671,7 @@ func TestHelmChartReconciler_reconcileSource(t *testing.T) {
},
want: sreconcile.ResultEmpty,
wantErr: &serror.Generic{Err: errors.New("gitrepositories.source.toolkit.fluxcd.io \"unavailable\" not found")},
- assertFunc: func(g *WithT, build chart.Build, obj helmv1.HelmChart) {
+ assertFunc: func(g *WithT, build chart.Build, obj sourcev1.HelmChart) {
g.Expect(build.Complete()).To(BeFalse())
g.Expect(obj.Status.Conditions).To(conditions.MatchConditions([]metav1.Condition{
@@ -683,8 +683,8 @@ func TestHelmChartReconciler_reconcileSource(t *testing.T) {
},
{
name: "Stalling on unsupported source kind",
- beforeFunc: func(obj *helmv1.HelmChart) {
- obj.Spec.SourceRef = helmv1.LocalHelmChartSourceReference{
+ beforeFunc: func(obj *sourcev1.HelmChart) {
+ obj.Spec.SourceRef = sourcev1.LocalHelmChartSourceReference{
Name: "unavailable",
Kind: "Unsupported",
}
@@ -693,7 +693,7 @@ func TestHelmChartReconciler_reconcileSource(t *testing.T) {
},
want: sreconcile.ResultEmpty,
wantErr: &serror.Stalling{Err: errors.New("unsupported source kind 'Unsupported'")},
- assertFunc: func(g *WithT, build chart.Build, obj helmv1.HelmChart) {
+ assertFunc: func(g *WithT, build chart.Build, obj sourcev1.HelmChart) {
g.Expect(build.Complete()).To(BeFalse())
g.Expect(obj.Status.Conditions).To(conditions.MatchConditions([]metav1.Condition{
@@ -714,9 +714,9 @@ func TestHelmChartReconciler_reconcileSource(t *testing.T) {
Artifact: gitArtifact,
},
},
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = "testdata/charts/helmchart-0.1.0.tgz"
- obj.Spec.SourceRef = helmv1.LocalHelmChartSourceReference{
+ obj.Spec.SourceRef = sourcev1.LocalHelmChartSourceReference{
Name: "gitrepository",
Kind: sourcev1.GitRepositoryKind,
}
@@ -726,7 +726,7 @@ func TestHelmChartReconciler_reconcileSource(t *testing.T) {
},
want: sreconcile.ResultEmpty,
wantErr: &serror.Stalling{Err: errors.New("values files merge error: no values file found at path")},
- assertFunc: func(g *WithT, build chart.Build, obj helmv1.HelmChart) {
+ assertFunc: func(g *WithT, build chart.Build, obj sourcev1.HelmChart) {
g.Expect(build.Complete()).To(BeFalse())
g.Expect(obj.Status.Conditions).To(conditions.MatchConditions([]metav1.Condition{
@@ -745,9 +745,9 @@ func TestHelmChartReconciler_reconcileSource(t *testing.T) {
},
Status: sourcev1.GitRepositoryStatus{},
},
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = "testdata/charts/helmchart-0.1.0.tgz"
- obj.Spec.SourceRef = helmv1.LocalHelmChartSourceReference{
+ obj.Spec.SourceRef = sourcev1.LocalHelmChartSourceReference{
Name: "gitrepository",
Kind: sourcev1.GitRepositoryKind,
}
@@ -756,7 +756,7 @@ func TestHelmChartReconciler_reconcileSource(t *testing.T) {
conditions.MarkUnknown(obj, meta.ReadyCondition, meta.ProgressingReason, "foo")
},
want: sreconcile.ResultRequeue,
- assertFunc: func(g *WithT, build chart.Build, obj helmv1.HelmChart) {
+ assertFunc: func(g *WithT, build chart.Build, obj sourcev1.HelmChart) {
g.Expect(build.Complete()).To(BeFalse())
g.Expect(obj.Status.ObservedSourceArtifactRevision).To(Equal("foo"))
@@ -774,7 +774,7 @@ func TestHelmChartReconciler_reconcileSource(t *testing.T) {
clientBuilder := fakeclient.NewClientBuilder().
WithScheme(testEnv.GetScheme()).
- WithStatusSubresource(&helmv1.HelmChart{})
+ WithStatusSubresource(&sourcev1.HelmChart{})
if tt.source != nil {
clientBuilder.WithRuntimeObjects(tt.source)
@@ -787,13 +787,13 @@ func TestHelmChartReconciler_reconcileSource(t *testing.T) {
patchOptions: getPatchOptions(helmChartReadyCondition.Owned, "sc"),
}
- obj := helmv1.HelmChart{
+ obj := sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "chart",
Namespace: "default",
Generation: 1,
},
- Spec: helmv1.HelmChartSpec{},
+ Spec: sourcev1.HelmChartSpec{},
}
if tt.beforeFunc != nil {
tt.beforeFunc(&obj)
@@ -859,19 +859,19 @@ func TestHelmChartReconciler_buildFromHelmRepository(t *testing.T) {
name string
server options
secret *corev1.Secret
- beforeFunc func(obj *helmv1.HelmChart, repository *helmv1.HelmRepository)
+ beforeFunc func(obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository)
want sreconcile.Result
wantErr error
- assertFunc func(g *WithT, obj *helmv1.HelmChart, build chart.Build)
+ assertFunc func(g *WithT, obj *sourcev1.HelmChart, build chart.Build)
cleanFunc func(g *WithT, build *chart.Build)
}{
{
name: "Reconciles chart build",
- beforeFunc: func(obj *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
obj.Spec.Chart = "helmchart"
},
want: sreconcile.ResultSuccess,
- assertFunc: func(g *WithT, _ *helmv1.HelmChart, build chart.Build) {
+ assertFunc: func(g *WithT, _ *sourcev1.HelmChart, build chart.Build) {
g.Expect(build.Name).To(Equal(chartName))
g.Expect(build.Version).To(Equal(higherChartVersion))
g.Expect(build.Path).ToNot(BeEmpty())
@@ -896,13 +896,13 @@ func TestHelmChartReconciler_buildFromHelmRepository(t *testing.T) {
"password": []byte("bar"),
},
},
- beforeFunc: func(obj *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
obj.Spec.Chart = chartName
obj.Spec.Version = chartVersion
repository.Spec.SecretRef = &meta.LocalObjectReference{Name: "auth"}
},
want: sreconcile.ResultSuccess,
- assertFunc: func(g *WithT, _ *helmv1.HelmChart, build chart.Build) {
+ assertFunc: func(g *WithT, _ *sourcev1.HelmChart, build chart.Build) {
g.Expect(build.Name).To(Equal(chartName))
g.Expect(build.Version).To(Equal(chartVersion))
g.Expect(build.Path).ToNot(BeEmpty())
@@ -914,13 +914,13 @@ func TestHelmChartReconciler_buildFromHelmRepository(t *testing.T) {
},
{
name: "Uses artifact as build cache",
- beforeFunc: func(obj *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
obj.Spec.Chart = chartName
obj.Spec.Version = chartVersion
obj.Status.Artifact = &sourcev1.Artifact{Path: chartName + "-" + chartVersion + ".tgz"}
},
want: sreconcile.ResultSuccess,
- assertFunc: func(g *WithT, obj *helmv1.HelmChart, build chart.Build) {
+ assertFunc: func(g *WithT, obj *sourcev1.HelmChart, build chart.Build) {
g.Expect(build.Name).To(Equal(chartName))
g.Expect(build.Version).To(Equal(chartVersion))
g.Expect(build.Path).To(Equal(filepath.Join(serverFactory.Root(), obj.Status.Artifact.Path)))
@@ -946,13 +946,13 @@ func TestHelmChartReconciler_buildFromHelmRepository(t *testing.T) {
},
{
name: "Sets Generation as VersionMetadata with values files",
- beforeFunc: func(obj *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
obj.Spec.Chart = chartName
obj.Generation = 3
obj.Spec.ValuesFiles = []string{"values.yaml", "override.yaml"}
},
want: sreconcile.ResultSuccess,
- assertFunc: func(g *WithT, _ *helmv1.HelmChart, build chart.Build) {
+ assertFunc: func(g *WithT, _ *sourcev1.HelmChart, build chart.Build) {
g.Expect(build.Name).To(Equal(chartName))
g.Expect(build.Version).To(Equal(higherChartVersion + "+3"))
g.Expect(build.Path).ToNot(BeEmpty())
@@ -1009,7 +1009,7 @@ func TestHelmChartReconciler_buildFromHelmRepository(t *testing.T) {
},
{
name: "Forces build on generation change",
- beforeFunc: func(obj *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
obj.Generation = 3
obj.Spec.Chart = chartName
obj.Spec.Version = chartVersion
@@ -1018,7 +1018,7 @@ func TestHelmChartReconciler_buildFromHelmRepository(t *testing.T) {
obj.Status.Artifact = &sourcev1.Artifact{Path: chartName + "-" + chartVersion + ".tgz"}
},
want: sreconcile.ResultSuccess,
- assertFunc: func(g *WithT, obj *helmv1.HelmChart, build chart.Build) {
+ assertFunc: func(g *WithT, obj *sourcev1.HelmChart, build chart.Build) {
g.Expect(build.Name).To(Equal(chartName))
g.Expect(build.Version).To(Equal(chartVersion))
g.Expect(build.Path).ToNot(Equal(filepath.Join(serverFactory.Root(), obj.Status.Artifact.Path)))
@@ -1030,14 +1030,14 @@ func TestHelmChartReconciler_buildFromHelmRepository(t *testing.T) {
},
{
name: "Event on unsuccessful secret retrieval",
- beforeFunc: func(_ *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ beforeFunc: func(_ *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
repository.Spec.SecretRef = &meta.LocalObjectReference{
Name: "invalid",
}
},
want: sreconcile.ResultEmpty,
wantErr: &serror.Generic{Err: errors.New("failed to get authentication secret '/invalid'")},
- assertFunc: func(g *WithT, obj *helmv1.HelmChart, build chart.Build) {
+ assertFunc: func(g *WithT, obj *sourcev1.HelmChart, build chart.Build) {
g.Expect(build.Complete()).To(BeFalse())
g.Expect(obj.Status.Conditions).To(conditions.MatchConditions([]metav1.Condition{
@@ -1047,12 +1047,12 @@ func TestHelmChartReconciler_buildFromHelmRepository(t *testing.T) {
},
{
name: "Stalling on invalid client options",
- beforeFunc: func(obj *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
repository.Spec.URL = "file://unsupported" // Unsupported protocol
},
want: sreconcile.ResultEmpty,
wantErr: &serror.Stalling{Err: errors.New("scheme \"file\" not supported")},
- assertFunc: func(g *WithT, obj *helmv1.HelmChart, build chart.Build) {
+ assertFunc: func(g *WithT, obj *sourcev1.HelmChart, build chart.Build) {
g.Expect(build.Complete()).To(BeFalse())
g.Expect(obj.Status.Conditions).To(conditions.MatchConditions([]metav1.Condition{
@@ -1062,12 +1062,12 @@ func TestHelmChartReconciler_buildFromHelmRepository(t *testing.T) {
},
{
name: "Stalling on invalid repository URL",
- beforeFunc: func(obj *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
repository.Spec.URL = "://unsupported" // Invalid URL
},
want: sreconcile.ResultEmpty,
wantErr: &serror.Stalling{Err: errors.New("missing protocol scheme")},
- assertFunc: func(g *WithT, obj *helmv1.HelmChart, build chart.Build) {
+ assertFunc: func(g *WithT, obj *sourcev1.HelmChart, build chart.Build) {
g.Expect(build.Complete()).To(BeFalse())
g.Expect(obj.Status.Conditions).To(conditions.MatchConditions([]metav1.Condition{
@@ -1077,7 +1077,7 @@ func TestHelmChartReconciler_buildFromHelmRepository(t *testing.T) {
},
{
name: "BuildError on temporary build error",
- beforeFunc: func(obj *helmv1.HelmChart, _ *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmChart, _ *sourcev1.HelmRepository) {
obj.Spec.Chart = "invalid"
},
want: sreconcile.ResultEmpty,
@@ -1107,7 +1107,7 @@ func TestHelmChartReconciler_buildFromHelmRepository(t *testing.T) {
clientBuilder := fakeclient.NewClientBuilder().
WithScheme(testEnv.Scheme()).
- WithStatusSubresource(&helmv1.HelmChart{})
+ WithStatusSubresource(&sourcev1.HelmChart{})
if tt.secret != nil {
clientBuilder.WithObjects(tt.secret.DeepCopy())
@@ -1124,25 +1124,25 @@ func TestHelmChartReconciler_buildFromHelmRepository(t *testing.T) {
patchOptions: getPatchOptions(helmChartReadyCondition.Owned, "sc"),
}
- repository := &helmv1.HelmRepository{
+ repository := &sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmrepository-",
},
- Spec: helmv1.HelmRepositorySpec{
+ Spec: sourcev1.HelmRepositorySpec{
URL: server.URL(),
Timeout: &metav1.Duration{Duration: timeout},
},
- Status: helmv1.HelmRepositoryStatus{
+ Status: sourcev1.HelmRepositoryStatus{
Artifact: &sourcev1.Artifact{
Path: "index.yaml",
},
},
}
- obj := &helmv1.HelmChart{
+ obj := &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmrepository-",
},
- Spec: helmv1.HelmChartSpec{},
+ Spec: sourcev1.HelmChartSpec{},
}
if tt.beforeFunc != nil {
@@ -1198,10 +1198,10 @@ func TestHelmChartReconciler_buildFromOCIHelmRepository(t *testing.T) {
tests := []struct {
name string
secret *corev1.Secret
- beforeFunc func(obj *helmv1.HelmChart, repository *helmv1.HelmRepository)
+ beforeFunc func(obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository)
want sreconcile.Result
wantErr error
- assertFunc func(g *WithT, obj *helmv1.HelmChart, build chart.Build)
+ assertFunc func(g *WithT, obj *sourcev1.HelmChart, build chart.Build)
cleanFunc func(g *WithT, build *chart.Build)
}{
{
@@ -1217,13 +1217,13 @@ func TestHelmChartReconciler_buildFromOCIHelmRepository(t *testing.T) {
`auth":"` + base64.StdEncoding.EncodeToString([]byte(testRegistryUsername+":"+testRegistryPassword)) + `"}}}`),
},
},
- beforeFunc: func(obj *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
obj.Spec.Chart = metadata.Name
obj.Spec.Version = metadata.Version
repository.Spec.SecretRef = &meta.LocalObjectReference{Name: "auth"}
},
want: sreconcile.ResultSuccess,
- assertFunc: func(g *WithT, _ *helmv1.HelmChart, build chart.Build) {
+ assertFunc: func(g *WithT, _ *sourcev1.HelmChart, build chart.Build) {
g.Expect(build.Name).To(Equal(metadata.Name))
g.Expect(build.Version).To(Equal(metadata.Version))
g.Expect(build.Path).ToNot(BeEmpty())
@@ -1244,13 +1244,13 @@ func TestHelmChartReconciler_buildFromOCIHelmRepository(t *testing.T) {
"password": []byte(testRegistryPassword),
},
},
- beforeFunc: func(obj *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
obj.Spec.Chart = metadata.Name
obj.Spec.Version = metadata.Version
repository.Spec.SecretRef = &meta.LocalObjectReference{Name: "auth"}
},
want: sreconcile.ResultSuccess,
- assertFunc: func(g *WithT, _ *helmv1.HelmChart, build chart.Build) {
+ assertFunc: func(g *WithT, _ *sourcev1.HelmChart, build chart.Build) {
g.Expect(build.Name).To(Equal(metadata.Name))
g.Expect(build.Version).To(Equal(metadata.Version))
g.Expect(build.Path).ToNot(BeEmpty())
@@ -1262,13 +1262,13 @@ func TestHelmChartReconciler_buildFromOCIHelmRepository(t *testing.T) {
},
{
name: "Uses artifact as build cache",
- beforeFunc: func(obj *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
obj.Spec.Chart = metadata.Name
obj.Spec.Version = metadata.Version
obj.Status.Artifact = &sourcev1.Artifact{Path: metadata.Name + "-" + metadata.Version + ".tgz"}
},
want: sreconcile.ResultSuccess,
- assertFunc: func(g *WithT, obj *helmv1.HelmChart, build chart.Build) {
+ assertFunc: func(g *WithT, obj *sourcev1.HelmChart, build chart.Build) {
g.Expect(build.Name).To(Equal(metadata.Name))
g.Expect(build.Version).To(Equal(metadata.Version))
g.Expect(build.Path).To(Equal(storage.LocalPath(*cachedArtifact.DeepCopy())))
@@ -1278,7 +1278,7 @@ func TestHelmChartReconciler_buildFromOCIHelmRepository(t *testing.T) {
},
{
name: "Forces build on generation change",
- beforeFunc: func(obj *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
obj.Generation = 3
obj.Spec.Chart = metadata.Name
obj.Spec.Version = metadata.Version
@@ -1287,7 +1287,7 @@ func TestHelmChartReconciler_buildFromOCIHelmRepository(t *testing.T) {
obj.Status.Artifact = &sourcev1.Artifact{Path: metadata.Name + "-" + metadata.Version + ".tgz"}
},
want: sreconcile.ResultSuccess,
- assertFunc: func(g *WithT, obj *helmv1.HelmChart, build chart.Build) {
+ assertFunc: func(g *WithT, obj *sourcev1.HelmChart, build chart.Build) {
g.Expect(build.Name).To(Equal(metadata.Name))
g.Expect(build.Version).To(Equal(metadata.Version))
g.Expect(build.Path).ToNot(Equal(storage.LocalPath(*cachedArtifact.DeepCopy())))
@@ -1299,14 +1299,14 @@ func TestHelmChartReconciler_buildFromOCIHelmRepository(t *testing.T) {
},
{
name: "Event on unsuccessful secret retrieval",
- beforeFunc: func(_ *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ beforeFunc: func(_ *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
repository.Spec.SecretRef = &meta.LocalObjectReference{
Name: "invalid",
}
},
want: sreconcile.ResultEmpty,
wantErr: &serror.Generic{Err: errors.New("failed to get authentication secret '/invalid'")},
- assertFunc: func(g *WithT, obj *helmv1.HelmChart, build chart.Build) {
+ assertFunc: func(g *WithT, obj *sourcev1.HelmChart, build chart.Build) {
g.Expect(build.Complete()).To(BeFalse())
g.Expect(obj.Status.Conditions).To(conditions.MatchConditions([]metav1.Condition{
@@ -1316,12 +1316,12 @@ func TestHelmChartReconciler_buildFromOCIHelmRepository(t *testing.T) {
},
{
name: "Stalling on invalid client options",
- beforeFunc: func(obj *helmv1.HelmChart, repository *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmChart, repository *sourcev1.HelmRepository) {
repository.Spec.URL = "https://unsupported" // Unsupported protocol
},
want: sreconcile.ResultEmpty,
wantErr: &serror.Stalling{Err: errors.New("failed to construct Helm client: invalid OCI registry URL: https://unsupported")},
- assertFunc: func(g *WithT, obj *helmv1.HelmChart, build chart.Build) {
+ assertFunc: func(g *WithT, obj *sourcev1.HelmChart, build chart.Build) {
g.Expect(build.Complete()).To(BeFalse())
g.Expect(obj.Status.Conditions).To(conditions.MatchConditions([]metav1.Condition{
@@ -1331,7 +1331,7 @@ func TestHelmChartReconciler_buildFromOCIHelmRepository(t *testing.T) {
},
{
name: "BuildError on temporary build error",
- beforeFunc: func(obj *helmv1.HelmChart, _ *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmChart, _ *sourcev1.HelmRepository) {
obj.Spec.Chart = "invalid"
},
want: sreconcile.ResultEmpty,
@@ -1344,7 +1344,7 @@ func TestHelmChartReconciler_buildFromOCIHelmRepository(t *testing.T) {
clientBuilder := fakeclient.NewClientBuilder().
WithScheme(testEnv.Scheme()).
- WithStatusSubresource(&helmv1.HelmChart{})
+ WithStatusSubresource(&sourcev1.HelmChart{})
if tt.secret != nil {
clientBuilder.WithObjects(tt.secret.DeepCopy())
@@ -1359,23 +1359,23 @@ func TestHelmChartReconciler_buildFromOCIHelmRepository(t *testing.T) {
patchOptions: getPatchOptions(helmChartReadyCondition.Owned, "sc"),
}
- repository := &helmv1.HelmRepository{
+ repository := &sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmrepository-",
},
- Spec: helmv1.HelmRepositorySpec{
+ Spec: sourcev1.HelmRepositorySpec{
URL: fmt.Sprintf("oci://%s/testrepo", testRegistryServer.registryHost),
Timeout: &metav1.Duration{Duration: timeout},
- Provider: helmv1.GenericOCIProvider,
- Type: helmv1.HelmRepositoryTypeOCI,
+ Provider: sourcev1beta2.GenericOCIProvider,
+ Type: sourcev1.HelmRepositoryTypeOCI,
Insecure: true,
},
}
- obj := &helmv1.HelmChart{
+ obj := &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmrepository-",
},
- Spec: helmv1.HelmChartSpec{},
+ Spec: sourcev1.HelmChartSpec{},
}
if tt.beforeFunc != nil {
@@ -1431,7 +1431,7 @@ func TestHelmChartReconciler_buildFromTarballArtifact(t *testing.T) {
tests := []struct {
name string
source sourcev1.Artifact
- beforeFunc func(obj *helmv1.HelmChart)
+ beforeFunc func(obj *sourcev1.HelmChart)
want sreconcile.Result
wantErr error
assertFunc func(g *WithT, build chart.Build)
@@ -1440,7 +1440,7 @@ func TestHelmChartReconciler_buildFromTarballArtifact(t *testing.T) {
{
name: "Resolves chart dependencies and builds",
source: *chartsArtifact.DeepCopy(),
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = "testdata/charts/helmchartwithdeps"
},
want: sreconcile.ResultSuccess,
@@ -1462,10 +1462,10 @@ func TestHelmChartReconciler_buildFromTarballArtifact(t *testing.T) {
{
name: "ReconcileStrategyRevision sets VersionMetadata",
source: *chartsArtifact.DeepCopy(),
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = "testdata/charts/helmchart"
obj.Spec.SourceRef.Kind = sourcev1.GitRepositoryKind
- obj.Spec.ReconcileStrategy = helmv1.ReconcileStrategyRevision
+ obj.Spec.ReconcileStrategy = sourcev1.ReconcileStrategyRevision
},
want: sreconcile.ResultSuccess,
assertFunc: func(g *WithT, build chart.Build) {
@@ -1481,7 +1481,7 @@ func TestHelmChartReconciler_buildFromTarballArtifact(t *testing.T) {
{
name: "ValuesFiles sets Generation as VersionMetadata",
source: *chartsArtifact.DeepCopy(),
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Generation = 3
obj.Spec.Chart = "testdata/charts/helmchart"
obj.Spec.SourceRef.Kind = sourcev1.GitRepositoryKind
@@ -1508,7 +1508,7 @@ func TestHelmChartReconciler_buildFromTarballArtifact(t *testing.T) {
{
name: "Chart from storage cache",
source: *chartsArtifact.DeepCopy(),
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = "testdata/charts/helmchart-0.1.0.tgz"
obj.Status.Artifact = cachedArtifact.DeepCopy()
},
@@ -1541,7 +1541,7 @@ func TestHelmChartReconciler_buildFromTarballArtifact(t *testing.T) {
{
name: "Generation change forces rebuild",
source: *chartsArtifact.DeepCopy(),
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Generation = 2
obj.Spec.Chart = "testdata/charts/helmchart-0.1.0.tgz"
obj.Status.Artifact = cachedArtifact.DeepCopy()
@@ -1585,7 +1585,7 @@ func TestHelmChartReconciler_buildFromTarballArtifact(t *testing.T) {
r := &HelmChartReconciler{
Client: fakeclient.NewClientBuilder().
WithScheme(testEnv.Scheme()).
- WithStatusSubresource(&helmv1.HelmChart{}).
+ WithStatusSubresource(&sourcev1.HelmChart{}).
Build(),
EventRecorder: record.NewFakeRecorder(32),
Storage: storage,
@@ -1594,12 +1594,12 @@ func TestHelmChartReconciler_buildFromTarballArtifact(t *testing.T) {
patchOptions: getPatchOptions(helmChartReadyCondition.Owned, "sc"),
}
- obj := &helmv1.HelmChart{
+ obj := &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
Name: "artifact",
Namespace: "default",
},
- Spec: helmv1.HelmChartSpec{},
+ Spec: sourcev1.HelmChartSpec{},
}
if tt.beforeFunc != nil {
tt.beforeFunc(obj)
@@ -1632,16 +1632,16 @@ func TestHelmChartReconciler_reconcileArtifact(t *testing.T) {
tests := []struct {
name string
build *chart.Build
- beforeFunc func(obj *helmv1.HelmChart)
+ beforeFunc func(obj *sourcev1.HelmChart)
want sreconcile.Result
wantErr bool
assertConditions []metav1.Condition
- afterFunc func(t *WithT, obj *helmv1.HelmChart)
+ afterFunc func(t *WithT, obj *sourcev1.HelmChart)
}{
{
name: "Incomplete build requeues and does not update status",
build: &chart.Build{},
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
conditions.MarkTrue(obj, sourcev1.ArtifactOutdatedCondition, "Foo", "")
},
want: sreconcile.ResultRequeue,
@@ -1652,10 +1652,10 @@ func TestHelmChartReconciler_reconcileArtifact(t *testing.T) {
{
name: "Copying artifact to storage from build makes ArtifactInStorage=True",
build: mockChartBuild("helmchart", "0.1.0", "testdata/charts/helmchart-0.1.0.tgz", nil),
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
conditions.MarkTrue(obj, sourcev1.ArtifactOutdatedCondition, "Foo", "")
},
- afterFunc: func(t *WithT, obj *helmv1.HelmChart) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmChart) {
t.Expect(obj.GetArtifact()).ToNot(BeNil())
t.Expect(obj.GetArtifact().Digest).To(Equal("sha256:bbdf96023c912c393b49d5238e227576ed0d20d1bb145d7476d817b80e20c11a"))
t.Expect(obj.GetArtifact().Revision).To(Equal("0.1.0"))
@@ -1665,7 +1665,7 @@ func TestHelmChartReconciler_reconcileArtifact(t *testing.T) {
},
want: sreconcile.ResultSuccess,
assertConditions: []metav1.Condition{
- *conditions.TrueCondition(sourcev1.ArtifactInStorageCondition, helmv1.ChartPullSucceededReason, "pulled 'helmchart' chart with version '0.1.0'"),
+ *conditions.TrueCondition(sourcev1.ArtifactInStorageCondition, sourcev1.ChartPullSucceededReason, "pulled 'helmchart' chart with version '0.1.0'"),
},
},
{
@@ -1675,13 +1675,13 @@ func TestHelmChartReconciler_reconcileArtifact(t *testing.T) {
Version: "0.1.0",
Path: filepath.Join(testStorage.BasePath, "testdata/charts/helmchart-0.1.0.tgz"),
},
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Status.Artifact = &sourcev1.Artifact{
Path: "testdata/charts/helmchart-0.1.0.tgz",
}
},
want: sreconcile.ResultSuccess,
- afterFunc: func(t *WithT, obj *helmv1.HelmChart) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmChart) {
t.Expect(obj.Status.Artifact.Path).To(Equal("testdata/charts/helmchart-0.1.0.tgz"))
t.Expect(obj.Status.ObservedChartName).To(BeEmpty())
t.Expect(obj.Status.ObservedValuesFiles).To(BeNil())
@@ -1696,7 +1696,7 @@ func TestHelmChartReconciler_reconcileArtifact(t *testing.T) {
Path: filepath.Join(testStorage.BasePath, "testdata/charts/helmchart-0.1.0.tgz"),
Packaged: true,
},
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Status.ObservedChartName = "helmchart"
obj.Status.Artifact = &sourcev1.Artifact{
Revision: "0.1.0",
@@ -1704,21 +1704,21 @@ func TestHelmChartReconciler_reconcileArtifact(t *testing.T) {
}
},
want: sreconcile.ResultSuccess,
- afterFunc: func(t *WithT, obj *helmv1.HelmChart) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmChart) {
t.Expect(obj.Status.Artifact.Path).To(Equal("testdata/charts/helmchart-0.1.0.tgz"))
t.Expect(obj.Status.URL).To(BeEmpty())
},
assertConditions: []metav1.Condition{
- *conditions.TrueCondition(sourcev1.ArtifactInStorageCondition, helmv1.ChartPackageSucceededReason, "packaged 'helmchart' chart with version '0.1.0'"),
+ *conditions.TrueCondition(sourcev1.ArtifactInStorageCondition, sourcev1.ChartPackageSucceededReason, "packaged 'helmchart' chart with version '0.1.0'"),
},
},
{
name: "Removes ArtifactOutdatedCondition after creating new artifact",
build: mockChartBuild("helmchart", "0.1.0", "testdata/charts/helmchart-0.1.0.tgz", nil),
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
conditions.MarkTrue(obj, sourcev1.ArtifactOutdatedCondition, "Foo", "")
},
- afterFunc: func(t *WithT, obj *helmv1.HelmChart) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmChart) {
t.Expect(obj.GetArtifact()).ToNot(BeNil())
t.Expect(obj.GetArtifact().Digest).To(Equal("sha256:bbdf96023c912c393b49d5238e227576ed0d20d1bb145d7476d817b80e20c11a"))
t.Expect(obj.GetArtifact().Revision).To(Equal("0.1.0"))
@@ -1728,13 +1728,13 @@ func TestHelmChartReconciler_reconcileArtifact(t *testing.T) {
},
want: sreconcile.ResultSuccess,
assertConditions: []metav1.Condition{
- *conditions.TrueCondition(sourcev1.ArtifactInStorageCondition, helmv1.ChartPullSucceededReason, "pulled 'helmchart' chart with version '0.1.0'"),
+ *conditions.TrueCondition(sourcev1.ArtifactInStorageCondition, sourcev1.ChartPullSucceededReason, "pulled 'helmchart' chart with version '0.1.0'"),
},
},
{
name: "Creates latest symlink to the created artifact",
build: mockChartBuild("helmchart", "0.1.0", "testdata/charts/helmchart-0.1.0.tgz", nil),
- afterFunc: func(t *WithT, obj *helmv1.HelmChart) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmChart) {
t.Expect(obj.GetArtifact()).ToNot(BeNil())
localPath := testStorage.LocalPath(*obj.GetArtifact())
@@ -1745,7 +1745,7 @@ func TestHelmChartReconciler_reconcileArtifact(t *testing.T) {
},
want: sreconcile.ResultSuccess,
assertConditions: []metav1.Condition{
- *conditions.TrueCondition(sourcev1.ArtifactInStorageCondition, helmv1.ChartPullSucceededReason, "pulled 'helmchart' chart with version '0.1.0'"),
+ *conditions.TrueCondition(sourcev1.ArtifactInStorageCondition, sourcev1.ChartPullSucceededReason, "pulled 'helmchart' chart with version '0.1.0'"),
},
},
{
@@ -1797,19 +1797,19 @@ func TestHelmChartReconciler_reconcileArtifact(t *testing.T) {
r := &HelmChartReconciler{
Client: fakeclient.NewClientBuilder().
WithScheme(testEnv.GetScheme()).
- WithStatusSubresource(&helmv1.HelmChart{}).
+ WithStatusSubresource(&sourcev1.HelmChart{}).
Build(),
EventRecorder: record.NewFakeRecorder(32),
Storage: testStorage,
patchOptions: getPatchOptions(helmChartReadyCondition.Owned, "sc"),
}
- obj := &helmv1.HelmChart{
+ obj := &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "reconcile-artifact-",
Generation: 1,
},
- Status: helmv1.HelmChartStatus{},
+ Status: sourcev1.HelmChartStatus{},
}
if tt.beforeFunc != nil {
tt.beforeFunc(obj)
@@ -1835,10 +1835,10 @@ func TestHelmChartReconciler_reconcileArtifact(t *testing.T) {
func TestHelmChartReconciler_getSource(t *testing.T) {
mocks := []client.Object{
- &helmv1.HelmRepository{
+ &sourcev1.HelmRepository{
TypeMeta: metav1.TypeMeta{
- Kind: helmv1.HelmRepositoryKind,
- APIVersion: helmv1.GroupVersion.String(),
+ Kind: sourcev1.HelmRepositoryKind,
+ APIVersion: sourcev1.GroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: "helmrepository",
@@ -1855,10 +1855,10 @@ func TestHelmChartReconciler_getSource(t *testing.T) {
Namespace: "foo",
},
},
- &helmv1.Bucket{
+ &sourcev1beta2.Bucket{
TypeMeta: metav1.TypeMeta{
- Kind: helmv1.BucketKind,
- APIVersion: helmv1.GroupVersion.String(),
+ Kind: sourcev1beta2.BucketKind,
+ APIVersion: sourcev1beta2.GroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: "bucket",
@@ -1868,7 +1868,7 @@ func TestHelmChartReconciler_getSource(t *testing.T) {
}
clientBuilder := fakeclient.NewClientBuilder().
- WithStatusSubresource(&helmv1.HelmChart{}).
+ WithStatusSubresource(&sourcev1.HelmChart{}).
WithObjects(mocks...)
r := &HelmChartReconciler{
@@ -1878,18 +1878,18 @@ func TestHelmChartReconciler_getSource(t *testing.T) {
tests := []struct {
name string
- obj *helmv1.HelmChart
+ obj *sourcev1.HelmChart
want sourcev1.Source
wantErr bool
}{
{
name: "Get HelmRepository source for reference",
- obj: &helmv1.HelmChart{
+ obj: &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
Namespace: mocks[0].GetNamespace(),
},
- Spec: helmv1.HelmChartSpec{
- SourceRef: helmv1.LocalHelmChartSourceReference{
+ Spec: sourcev1.HelmChartSpec{
+ SourceRef: sourcev1.LocalHelmChartSourceReference{
Name: mocks[0].GetName(),
Kind: mocks[0].GetObjectKind().GroupVersionKind().Kind,
},
@@ -1899,12 +1899,12 @@ func TestHelmChartReconciler_getSource(t *testing.T) {
},
{
name: "Get GitRepository source for reference",
- obj: &helmv1.HelmChart{
+ obj: &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
Namespace: mocks[1].GetNamespace(),
},
- Spec: helmv1.HelmChartSpec{
- SourceRef: helmv1.LocalHelmChartSourceReference{
+ Spec: sourcev1.HelmChartSpec{
+ SourceRef: sourcev1.LocalHelmChartSourceReference{
Name: mocks[1].GetName(),
Kind: mocks[1].GetObjectKind().GroupVersionKind().Kind,
},
@@ -1914,12 +1914,12 @@ func TestHelmChartReconciler_getSource(t *testing.T) {
},
{
name: "Get Bucket source for reference",
- obj: &helmv1.HelmChart{
+ obj: &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
Namespace: mocks[2].GetNamespace(),
},
- Spec: helmv1.HelmChartSpec{
- SourceRef: helmv1.LocalHelmChartSourceReference{
+ Spec: sourcev1.HelmChartSpec{
+ SourceRef: sourcev1.LocalHelmChartSourceReference{
Name: mocks[2].GetName(),
Kind: mocks[2].GetObjectKind().GroupVersionKind().Kind,
},
@@ -1929,12 +1929,12 @@ func TestHelmChartReconciler_getSource(t *testing.T) {
},
{
name: "Error on client error",
- obj: &helmv1.HelmChart{
+ obj: &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
Namespace: mocks[2].GetNamespace(),
},
- Spec: helmv1.HelmChartSpec{
- SourceRef: helmv1.LocalHelmChartSourceReference{
+ Spec: sourcev1.HelmChartSpec{
+ SourceRef: sourcev1.LocalHelmChartSourceReference{
Name: mocks[1].GetName(),
Kind: mocks[2].GetObjectKind().GroupVersionKind().Kind,
},
@@ -1944,9 +1944,9 @@ func TestHelmChartReconciler_getSource(t *testing.T) {
},
{
name: "Error on unsupported source kind",
- obj: &helmv1.HelmChart{
- Spec: helmv1.HelmChartSpec{
- SourceRef: helmv1.LocalHelmChartSourceReference{
+ obj: &sourcev1.HelmChart{
+ Spec: sourcev1.HelmChartSpec{
+ SourceRef: sourcev1.LocalHelmChartSourceReference{
Name: "unsupported",
Kind: "Unsupported",
},
@@ -1982,7 +1982,7 @@ func TestHelmChartReconciler_reconcileDelete(t *testing.T) {
patchOptions: getPatchOptions(helmChartReadyCondition.Owned, "sc"),
}
- obj := &helmv1.HelmChart{
+ obj := &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
Name: "reconcile-delete-",
DeletionTimestamp: &metav1.Time{Time: time.Now()},
@@ -1990,10 +1990,10 @@ func TestHelmChartReconciler_reconcileDelete(t *testing.T) {
sourcev1.SourceFinalizer,
},
},
- Status: helmv1.HelmChartStatus{},
+ Status: sourcev1.HelmChartStatus{},
}
- artifact := testStorage.NewArtifactFor(helmv1.HelmChartKind, obj.GetObjectMeta(), "revision", "foo.txt")
+ artifact := testStorage.NewArtifactFor(sourcev1.HelmChartKind, obj.GetObjectMeta(), "revision", "foo.txt")
obj.Status.Artifact = &artifact
got, err := r.reconcileDelete(ctx, obj)
@@ -2006,7 +2006,7 @@ func TestHelmChartReconciler_reconcileDelete(t *testing.T) {
func TestHelmChartReconciler_reconcileSubRecs(t *testing.T) {
// Helper to build simple helmChartReconcileFunc with result and error.
buildReconcileFuncs := func(r sreconcile.Result, e error) helmChartReconcileFunc {
- return func(_ context.Context, _ *patch.SerialPatcher, _ *helmv1.HelmChart, _ *chart.Build) (sreconcile.Result, error) {
+ return func(_ context.Context, _ *patch.SerialPatcher, _ *sourcev1.HelmChart, _ *chart.Build) (sreconcile.Result, error) {
return r, e
}
}
@@ -2061,11 +2061,11 @@ func TestHelmChartReconciler_reconcileSubRecs(t *testing.T) {
{
name: "multiple object status conditions mutations",
reconcileFuncs: []helmChartReconcileFunc{
- func(_ context.Context, _ *patch.SerialPatcher, obj *helmv1.HelmChart, _ *chart.Build) (sreconcile.Result, error) {
+ func(_ context.Context, _ *patch.SerialPatcher, obj *sourcev1.HelmChart, _ *chart.Build) (sreconcile.Result, error) {
conditions.MarkTrue(obj, sourcev1.ArtifactOutdatedCondition, "NewRevision", "new index revision")
return sreconcile.ResultSuccess, nil
},
- func(_ context.Context, _ *patch.SerialPatcher, obj *helmv1.HelmChart, _ *chart.Build) (sreconcile.Result, error) {
+ func(_ context.Context, _ *patch.SerialPatcher, obj *sourcev1.HelmChart, _ *chart.Build) (sreconcile.Result, error) {
conditions.MarkTrue(obj, meta.ReconcilingCondition, "Progressing", "creating artifact")
return sreconcile.ResultSuccess, nil
},
@@ -2115,16 +2115,16 @@ func TestHelmChartReconciler_reconcileSubRecs(t *testing.T) {
r := &HelmChartReconciler{
Client: fakeclient.NewClientBuilder().
WithScheme(testEnv.GetScheme()).
- WithStatusSubresource(&helmv1.HelmChart{}).
+ WithStatusSubresource(&sourcev1.HelmChart{}).
Build(),
patchOptions: getPatchOptions(helmChartReadyCondition.Owned, "sc"),
}
- obj := &helmv1.HelmChart{
+ obj := &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "test-",
Generation: tt.generation,
},
- Status: helmv1.HelmChartStatus{
+ Status: sourcev1.HelmChartStatus{
ObservedGeneration: tt.observedGeneration,
},
}
@@ -2171,13 +2171,13 @@ func mockChartBuild(name, version, path string, valuesFiles []string) *chart.Bui
func TestHelmChartReconciler_statusConditions(t *testing.T) {
tests := []struct {
name string
- beforeFunc func(obj *helmv1.HelmChart)
+ beforeFunc func(obj *sourcev1.HelmChart)
assertConditions []metav1.Condition
wantErr bool
}{
{
name: "positive conditions only",
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
conditions.MarkTrue(obj, sourcev1.ArtifactInStorageCondition, meta.SucceededReason, "stored artifact for revision")
},
assertConditions: []metav1.Condition{
@@ -2187,7 +2187,7 @@ func TestHelmChartReconciler_statusConditions(t *testing.T) {
},
{
name: "multiple failures",
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, sourcev1.AuthenticationFailedReason, "failed to get secret")
conditions.MarkTrue(obj, sourcev1.StorageOperationFailedCondition, sourcev1.DirCreationFailedReason, "failed to create directory")
conditions.MarkTrue(obj, sourcev1.BuildFailedCondition, "ChartPackageError", "some error")
@@ -2204,7 +2204,7 @@ func TestHelmChartReconciler_statusConditions(t *testing.T) {
},
{
name: "mixed positive and negative conditions",
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
conditions.MarkTrue(obj, sourcev1.ArtifactInStorageCondition, meta.SucceededReason, "stored artifact for revision")
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, sourcev1.AuthenticationFailedReason, "failed to get secret")
},
@@ -2221,10 +2221,10 @@ func TestHelmChartReconciler_statusConditions(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
- obj := &helmv1.HelmChart{
+ obj := &sourcev1.HelmChart{
TypeMeta: metav1.TypeMeta{
- Kind: helmv1.HelmChartKind,
- APIVersion: helmv1.GroupVersion.String(),
+ Kind: sourcev1.HelmChartKind,
+ APIVersion: sourcev1.GroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: "helmchart",
@@ -2234,7 +2234,7 @@ func TestHelmChartReconciler_statusConditions(t *testing.T) {
clientBuilder := fakeclient.NewClientBuilder().
WithObjects(obj).
- WithStatusSubresource(&helmv1.HelmChart{})
+ WithStatusSubresource(&sourcev1.HelmChart{})
c := clientBuilder.Build()
@@ -2271,8 +2271,8 @@ func TestHelmChartReconciler_notify(t *testing.T) {
name string
res sreconcile.Result
resErr error
- oldObjBeforeFunc func(obj *helmv1.HelmChart)
- newObjBeforeFunc func(obj *helmv1.HelmChart)
+ oldObjBeforeFunc func(obj *sourcev1.HelmChart)
+ newObjBeforeFunc func(obj *sourcev1.HelmChart)
wantEvent string
}{
{
@@ -2284,7 +2284,7 @@ func TestHelmChartReconciler_notify(t *testing.T) {
name: "new artifact",
res: sreconcile.ResultSuccess,
resErr: nil,
- newObjBeforeFunc: func(obj *helmv1.HelmChart) {
+ newObjBeforeFunc: func(obj *sourcev1.HelmChart) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "xxx", Digest: "yyy"}
},
wantEvent: "Normal ChartPackageSucceeded packaged",
@@ -2293,12 +2293,12 @@ func TestHelmChartReconciler_notify(t *testing.T) {
name: "recovery from failure",
res: sreconcile.ResultSuccess,
resErr: nil,
- oldObjBeforeFunc: func(obj *helmv1.HelmChart) {
+ oldObjBeforeFunc: func(obj *sourcev1.HelmChart) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "xxx", Digest: "yyy"}
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, sourcev1.GitOperationFailedReason, "fail")
conditions.MarkFalse(obj, meta.ReadyCondition, meta.FailedReason, "foo")
},
- newObjBeforeFunc: func(obj *helmv1.HelmChart) {
+ newObjBeforeFunc: func(obj *sourcev1.HelmChart) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "xxx", Digest: "yyy"}
conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "ready")
},
@@ -2308,12 +2308,12 @@ func TestHelmChartReconciler_notify(t *testing.T) {
name: "recovery and new artifact",
res: sreconcile.ResultSuccess,
resErr: nil,
- oldObjBeforeFunc: func(obj *helmv1.HelmChart) {
+ oldObjBeforeFunc: func(obj *sourcev1.HelmChart) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "xxx", Digest: "yyy"}
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, sourcev1.GitOperationFailedReason, "fail")
conditions.MarkFalse(obj, meta.ReadyCondition, meta.FailedReason, "foo")
},
- newObjBeforeFunc: func(obj *helmv1.HelmChart) {
+ newObjBeforeFunc: func(obj *sourcev1.HelmChart) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "aaa", Digest: "bbb"}
conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "ready")
},
@@ -2323,11 +2323,11 @@ func TestHelmChartReconciler_notify(t *testing.T) {
name: "no updates",
res: sreconcile.ResultSuccess,
resErr: nil,
- oldObjBeforeFunc: func(obj *helmv1.HelmChart) {
+ oldObjBeforeFunc: func(obj *sourcev1.HelmChart) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "xxx", Digest: "yyy"}
conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "ready")
},
- newObjBeforeFunc: func(obj *helmv1.HelmChart) {
+ newObjBeforeFunc: func(obj *sourcev1.HelmChart) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "xxx", Digest: "yyy"}
conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "ready")
},
@@ -2339,7 +2339,7 @@ func TestHelmChartReconciler_notify(t *testing.T) {
g := NewWithT(t)
recorder := record.NewFakeRecorder(32)
- oldObj := &helmv1.HelmChart{}
+ oldObj := &sourcev1.HelmChart{}
newObj := oldObj.DeepCopy()
if tt.oldObjBeforeFunc != nil {
@@ -2569,7 +2569,7 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_authStrategy(t *testing.T) {
clientBuilder := fakeclient.NewClientBuilder().
WithScheme(testEnv.GetScheme()).
- WithStatusSubresource(&helmv1.HelmChart{})
+ WithStatusSubresource(&sourcev1.HelmChart{})
workspaceDir := t.TempDir()
@@ -2587,15 +2587,15 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_authStrategy(t *testing.T) {
metadata, err := loadTestChartToOCI(chartData, server, "testdata/certs/client.pem", "testdata/certs/client-key.pem", "testdata/certs/ca.pem")
g.Expect(err).ToNot(HaveOccurred())
- repo := &helmv1.HelmRepository{
+ repo := &sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "auth-strategy-",
},
- Spec: helmv1.HelmRepositorySpec{
+ Spec: sourcev1.HelmRepositorySpec{
Interval: metav1.Duration{Duration: interval},
Timeout: &metav1.Duration{Duration: timeout},
- Type: helmv1.HelmRepositoryTypeOCI,
- Provider: helmv1.GenericOCIProvider,
+ Type: sourcev1.HelmRepositoryTypeOCI,
+ Provider: sourcev1beta2.GenericOCIProvider,
URL: fmt.Sprintf("oci://%s/testrepo", server.registryHost),
Insecure: tt.insecure,
},
@@ -2632,15 +2632,15 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_authStrategy(t *testing.T) {
clientBuilder.WithObjects(repo)
- obj := &helmv1.HelmChart{
+ obj := &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "auth-strategy-",
},
- Spec: helmv1.HelmChartSpec{
+ Spec: sourcev1.HelmChartSpec{
Chart: metadata.Name,
Version: metadata.Version,
- SourceRef: helmv1.LocalHelmChartSourceReference{
- Kind: helmv1.HelmRepositoryKind,
+ SourceRef: sourcev1.LocalHelmChartSourceReference{
+ Kind: sourcev1.HelmRepositoryKind,
Name: repo.Name,
},
Interval: metav1.Duration{Duration: interval},
@@ -2694,7 +2694,7 @@ func TestHelmChartRepository_reconcileSource_verifyOCISourceSignature_keyless(t
version string
want sreconcile.Result
wantErr bool
- beforeFunc func(obj *helmv1.HelmChart)
+ beforeFunc func(obj *sourcev1.HelmChart)
assertConditions []metav1.Condition
revision string
}{
@@ -2713,8 +2713,8 @@ func TestHelmChartRepository_reconcileSource_verifyOCISourceSignature_keyless(t
name: "signed image with correct subject and issuer should pass verification",
version: "6.5.1",
want: sreconcile.ResultSuccess,
- beforeFunc: func(obj *helmv1.HelmChart) {
- obj.Spec.Verify.MatchOIDCIdentity = []helmv1.OIDCIdentityMatch{
+ beforeFunc: func(obj *sourcev1.HelmChart) {
+ obj.Spec.Verify.MatchOIDCIdentity = []sourcev1.OIDCIdentityMatch{
{
Subject: "^https://github.com/stefanprodan/podinfo.*$",
@@ -2733,8 +2733,8 @@ func TestHelmChartRepository_reconcileSource_verifyOCISourceSignature_keyless(t
name: "signed image with incorrect and correct identity matchers should pass verification",
version: "6.5.1",
want: sreconcile.ResultSuccess,
- beforeFunc: func(obj *helmv1.HelmChart) {
- obj.Spec.Verify.MatchOIDCIdentity = []helmv1.OIDCIdentityMatch{
+ beforeFunc: func(obj *sourcev1.HelmChart) {
+ obj.Spec.Verify.MatchOIDCIdentity = []sourcev1.OIDCIdentityMatch{
{
Subject: "intruder",
Issuer: "^https://honeypot.com$",
@@ -2758,8 +2758,8 @@ func TestHelmChartRepository_reconcileSource_verifyOCISourceSignature_keyless(t
version: "6.5.1",
wantErr: true,
want: sreconcile.ResultEmpty,
- beforeFunc: func(obj *helmv1.HelmChart) {
- obj.Spec.Verify.MatchOIDCIdentity = []helmv1.OIDCIdentityMatch{
+ beforeFunc: func(obj *sourcev1.HelmChart) {
+ obj.Spec.Verify.MatchOIDCIdentity = []sourcev1.OIDCIdentityMatch{
{
Subject: "intruder",
Issuer: "^https://honeypot.com$",
@@ -2791,15 +2791,15 @@ func TestHelmChartRepository_reconcileSource_verifyOCISourceSignature_keyless(t
clientBuilder := fakeclient.NewClientBuilder()
- repository := &helmv1.HelmRepository{
+ repository := &sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmrepository-",
},
- Spec: helmv1.HelmRepositorySpec{
+ Spec: sourcev1.HelmRepositorySpec{
URL: "oci://ghcr.io/stefanprodan/charts",
Timeout: &metav1.Duration{Duration: timeout},
- Provider: helmv1.GenericOCIProvider,
- Type: helmv1.HelmRepositoryTypeOCI,
+ Provider: sourcev1beta2.GenericOCIProvider,
+ Type: sourcev1.HelmRepositoryTypeOCI,
},
}
clientBuilder.WithObjects(repository)
@@ -2813,18 +2813,18 @@ func TestHelmChartRepository_reconcileSource_verifyOCISourceSignature_keyless(t
patchOptions: getPatchOptions(helmChartReadyCondition.Owned, "sc"),
}
- obj := &helmv1.HelmChart{
+ obj := &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmchart-",
},
- Spec: helmv1.HelmChartSpec{
- SourceRef: helmv1.LocalHelmChartSourceReference{
- Kind: helmv1.HelmRepositoryKind,
+ Spec: sourcev1.HelmChartSpec{
+ SourceRef: sourcev1.LocalHelmChartSourceReference{
+ Kind: sourcev1.HelmRepositoryKind,
Name: repository.Name,
},
Version: tt.version,
Chart: "podinfo",
- Verify: &helmv1.OCIRepositoryVerification{
+ Verify: &sourcev1.OCIRepositoryVerification{
Provider: "cosign",
},
},
@@ -2916,7 +2916,7 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureNotation(t *t
tests := []struct {
name string
shouldSign bool
- beforeFunc func(obj *helmv1.HelmChart)
+ beforeFunc func(obj *sourcev1.HelmChart)
want sreconcile.Result
wantErr bool
wantErrMsg string
@@ -2928,10 +2928,10 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureNotation(t *t
}{
{
name: "unsigned charts should not pass verification",
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = metadata.Name
obj.Spec.Version = metadata.Version
- obj.Spec.Verify = &helmv1.OCIRepositoryVerification{
+ obj.Spec.Verify = &sourcev1.OCIRepositoryVerification{
Provider: "notation",
SecretRef: &meta.LocalObjectReference{Name: "notation-config"},
}
@@ -2947,10 +2947,10 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureNotation(t *t
{
name: "signed charts should pass verification",
shouldSign: true,
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = metadata.Name
obj.Spec.Version = metadata.Version
- obj.Spec.Verify = &helmv1.OCIRepositoryVerification{
+ obj.Spec.Verify = &sourcev1.OCIRepositoryVerification{
Provider: "notation",
SecretRef: &meta.LocalObjectReference{Name: "notation-config"},
}
@@ -2968,10 +2968,10 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureNotation(t *t
{
name: "multiple certs should still pass verification",
addMultipleCerts: true,
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = metadata.Name
obj.Spec.Version = metadata.Version
- obj.Spec.Verify = &helmv1.OCIRepositoryVerification{
+ obj.Spec.Verify = &sourcev1.OCIRepositoryVerification{
Provider: "notation",
SecretRef: &meta.LocalObjectReference{Name: "notation-config"},
}
@@ -2988,7 +2988,7 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureNotation(t *t
},
{
name: "verify failed before, removed from spec, remove condition",
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = metadata.Name
obj.Spec.Version = metadata.Version
obj.Spec.Verify = nil
@@ -3007,10 +3007,10 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureNotation(t *t
},
{
name: "no cert provided should not pass verification",
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = metadata.Name
obj.Spec.Version = metadata.Version
- obj.Spec.Verify = &helmv1.OCIRepositoryVerification{
+ obj.Spec.Verify = &sourcev1.OCIRepositoryVerification{
Provider: "notation",
SecretRef: &meta.LocalObjectReference{Name: "notation-config"},
}
@@ -3027,10 +3027,10 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureNotation(t *t
},
{
name: "empty string should fail verification",
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = metadata.Name
obj.Spec.Version = metadata.Version
- obj.Spec.Verify = &helmv1.OCIRepositoryVerification{
+ obj.Spec.Verify = &sourcev1.OCIRepositoryVerification{
Provider: "notation",
SecretRef: &meta.LocalObjectReference{Name: "notation-config"},
}
@@ -3052,15 +3052,15 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureNotation(t *t
clientBuilder := fakeclient.NewClientBuilder()
- repository := &helmv1.HelmRepository{
+ repository := &sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmrepository-",
},
- Spec: helmv1.HelmRepositorySpec{
+ Spec: sourcev1.HelmRepositorySpec{
URL: fmt.Sprintf("oci://%s/testrepo", server.registryHost),
Timeout: &metav1.Duration{Duration: timeout},
- Provider: helmv1.GenericOCIProvider,
- Type: helmv1.HelmRepositoryTypeOCI,
+ Provider: sourcev1beta2.GenericOCIProvider,
+ Type: sourcev1.HelmRepositoryTypeOCI,
Insecure: true,
},
}
@@ -3112,13 +3112,13 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureNotation(t *t
patchOptions: getPatchOptions(helmChartReadyCondition.Owned, "sc"),
}
- obj := &helmv1.HelmChart{
+ obj := &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmchart-",
},
- Spec: helmv1.HelmChartSpec{
- SourceRef: helmv1.LocalHelmChartSourceReference{
- Kind: helmv1.HelmRepositoryKind,
+ Spec: sourcev1.HelmChartSpec{
+ SourceRef: sourcev1.LocalHelmChartSourceReference{
+ Kind: sourcev1.HelmRepositoryKind,
Name: repository.Name,
},
},
@@ -3236,7 +3236,7 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureCosign(t *tes
tests := []struct {
name string
shouldSign bool
- beforeFunc func(obj *helmv1.HelmChart)
+ beforeFunc func(obj *sourcev1.HelmChart)
want sreconcile.Result
wantErr bool
wantErrMsg string
@@ -3245,10 +3245,10 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureCosign(t *tes
}{
{
name: "unsigned charts should not pass verification",
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = metadata.Name
obj.Spec.Version = metadata.Version
- obj.Spec.Verify = &helmv1.OCIRepositoryVerification{
+ obj.Spec.Verify = &sourcev1.OCIRepositoryVerification{
Provider: "cosign",
SecretRef: &meta.LocalObjectReference{Name: "cosign-key"},
}
@@ -3263,10 +3263,10 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureCosign(t *tes
},
{
name: "unsigned charts should not pass keyless verification",
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = metadata.Name
obj.Spec.Version = metadata.Version
- obj.Spec.Verify = &helmv1.OCIRepositoryVerification{
+ obj.Spec.Verify = &sourcev1.OCIRepositoryVerification{
Provider: "cosign",
}
},
@@ -3280,10 +3280,10 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureCosign(t *tes
{
name: "signed charts should pass verification",
shouldSign: true,
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = metadata.Name
obj.Spec.Version = metadata.Version
- obj.Spec.Verify = &helmv1.OCIRepositoryVerification{
+ obj.Spec.Verify = &sourcev1.OCIRepositoryVerification{
Provider: "cosign",
SecretRef: &meta.LocalObjectReference{Name: "cosign-key"},
}
@@ -3300,7 +3300,7 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureCosign(t *tes
},
{
name: "verify failed before, removed from spec, remove condition",
- beforeFunc: func(obj *helmv1.HelmChart) {
+ beforeFunc: func(obj *sourcev1.HelmChart) {
obj.Spec.Chart = metadata.Name
obj.Spec.Version = metadata.Version
obj.Spec.Verify = nil
@@ -3325,15 +3325,15 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureCosign(t *tes
clientBuilder := fakeclient.NewClientBuilder()
- repository := &helmv1.HelmRepository{
+ repository := &sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmrepository-",
},
- Spec: helmv1.HelmRepositorySpec{
+ Spec: sourcev1.HelmRepositorySpec{
URL: fmt.Sprintf("oci://%s/testrepo", server.registryHost),
Timeout: &metav1.Duration{Duration: timeout},
- Provider: helmv1.GenericOCIProvider,
- Type: helmv1.HelmRepositoryTypeOCI,
+ Provider: sourcev1beta2.GenericOCIProvider,
+ Type: sourcev1.HelmRepositoryTypeOCI,
Insecure: true,
},
}
@@ -3357,13 +3357,13 @@ func TestHelmChartReconciler_reconcileSourceFromOCI_verifySignatureCosign(t *tes
patchOptions: getPatchOptions(helmChartReadyCondition.Owned, "sc"),
}
- obj := &helmv1.HelmChart{
+ obj := &sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmchart-",
},
- Spec: helmv1.HelmChartSpec{
- SourceRef: helmv1.LocalHelmChartSourceReference{
- Kind: helmv1.HelmRepositoryKind,
+ Spec: sourcev1.HelmChartSpec{
+ SourceRef: sourcev1.LocalHelmChartSourceReference{
+ Kind: sourcev1.HelmRepositoryKind,
Name: repository.Name,
},
},
diff --git a/internal/controller/helmrepository_controller.go b/internal/controller/helmrepository_controller.go
index d48b3c2f8..35bcfd08f 100644
--- a/internal/controller/helmrepository_controller.go
+++ b/internal/controller/helmrepository_controller.go
@@ -49,7 +49,6 @@ import (
rreconcile "github.com/fluxcd/pkg/runtime/reconcile"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
- helmv1 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/fluxcd/source-controller/internal/cache"
intdigest "github.com/fluxcd/source-controller/internal/digest"
serror "github.com/fluxcd/source-controller/internal/error"
@@ -61,7 +60,7 @@ import (
)
// helmRepositoryReadyCondition contains the information required to summarize a
-// v1beta2.HelmRepository Ready Condition.
+// v1.HelmRepository Ready Condition.
var helmRepositoryReadyCondition = summarize.Conditions{
Target: meta.ReadyCondition,
Owned: []string{
@@ -102,7 +101,7 @@ var helmRepositoryFailConditions = []string{
// +kubebuilder:rbac:groups=source.toolkit.fluxcd.io,resources=helmrepositories/finalizers,verbs=get;create;update;patch;delete
// +kubebuilder:rbac:groups="",resources=events,verbs=create;patch
-// HelmRepositoryReconciler reconciles a v1beta2.HelmRepository object.
+// HelmRepositoryReconciler reconciles a v1.HelmRepository object.
type HelmRepositoryReconciler struct {
client.Client
kuberecorder.EventRecorder
@@ -124,10 +123,10 @@ type HelmRepositoryReconcilerOptions struct {
}
// helmRepositoryReconcileFunc is the function type for all the
-// v1beta2.HelmRepository (sub)reconcile functions. The type implementations
+// v1.HelmRepository (sub)reconcile functions. The type implementations
// are grouped and executed serially to perform the complete reconcile of the
// object.
-type helmRepositoryReconcileFunc func(ctx context.Context, sp *patch.SerialPatcher, obj *helmv1.HelmRepository, artifact *sourcev1.Artifact, repo *repository.ChartRepository) (sreconcile.Result, error)
+type helmRepositoryReconcileFunc func(ctx context.Context, sp *patch.SerialPatcher, obj *sourcev1.HelmRepository, artifact *sourcev1.Artifact, repo *repository.ChartRepository) (sreconcile.Result, error)
func (r *HelmRepositoryReconciler) SetupWithManager(mgr ctrl.Manager) error {
return r.SetupWithManagerAndOptions(mgr, HelmRepositoryReconcilerOptions{})
@@ -137,7 +136,7 @@ func (r *HelmRepositoryReconciler) SetupWithManagerAndOptions(mgr ctrl.Manager,
r.patchOptions = getPatchOptions(helmRepositoryReadyCondition.Owned, r.ControllerName)
return ctrl.NewControllerManagedBy(mgr).
- For(&helmv1.HelmRepository{}).
+ For(&sourcev1.HelmRepository{}).
WithEventFilter(
predicate.And(
intpredicates.HelmRepositoryOCIMigrationPredicate{},
@@ -155,7 +154,7 @@ func (r *HelmRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Reque
log := ctrl.LoggerFrom(ctx)
// Fetch the HelmRepository
- obj := &helmv1.HelmRepository{}
+ obj := &sourcev1.HelmRepository{}
if err := r.Get(ctx, req.NamespacedName, obj); err != nil {
return ctrl.Result{}, client.IgnoreNotFound(err)
}
@@ -164,7 +163,7 @@ func (r *HelmRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Reque
serialPatcher := patch.NewSerialPatcher(obj, r.Client)
// If it's of type OCI, migrate the object to static.
- if obj.Spec.Type == helmv1.HelmRepositoryTypeOCI {
+ if obj.Spec.Type == sourcev1.HelmRepositoryTypeOCI {
return r.migrationToStatic(ctx, serialPatcher, obj)
}
@@ -234,7 +233,7 @@ func (r *HelmRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Reque
// object. It returns early on the first call that returns
// reconcile.ResultRequeue, or produces an error.
func (r *HelmRepositoryReconciler) reconcile(ctx context.Context, sp *patch.SerialPatcher,
- obj *helmv1.HelmRepository, reconcilers []helmRepositoryReconcileFunc) (sreconcile.Result, error) {
+ obj *sourcev1.HelmRepository, reconcilers []helmRepositoryReconcileFunc) (sreconcile.Result, error) {
oldObj := obj.DeepCopy()
rreconcile.ProgressiveStatus(false, obj, meta.ProgressingReason, "reconciliation in progress")
@@ -287,7 +286,7 @@ func (r *HelmRepositoryReconciler) reconcile(ctx context.Context, sp *patch.Seri
}
// notify emits notification related to the reconciliation.
-func (r *HelmRepositoryReconciler) notify(ctx context.Context, oldObj, newObj *helmv1.HelmRepository, chartRepo *repository.ChartRepository, res sreconcile.Result, resErr error) {
+func (r *HelmRepositoryReconciler) notify(ctx context.Context, oldObj, newObj *sourcev1.HelmRepository, chartRepo *repository.ChartRepository, res sreconcile.Result, resErr error) {
// Notify successful reconciliation for new artifact and recovery from any
// failure.
if resErr == nil && res == sreconcile.ResultSuccess && newObj.Status.Artifact != nil {
@@ -331,7 +330,7 @@ func (r *HelmRepositoryReconciler) notify(ctx context.Context, oldObj, newObj *h
// The hostname of any URL in the Status of the object are updated, to ensure
// they match the Storage server hostname of current runtime.
func (r *HelmRepositoryReconciler) reconcileStorage(ctx context.Context, sp *patch.SerialPatcher,
- obj *helmv1.HelmRepository, _ *sourcev1.Artifact, _ *repository.ChartRepository) (sreconcile.Result, error) {
+ obj *sourcev1.HelmRepository, _ *sourcev1.Artifact, _ *repository.ChartRepository) (sreconcile.Result, error) {
// Garbage collect previous advertised artifact(s) from storage
_ = r.garbageCollect(ctx, obj)
@@ -386,15 +385,15 @@ func (r *HelmRepositoryReconciler) reconcileStorage(ctx context.Context, sp *pat
}
// reconcileSource attempts to fetch the Helm repository index using the
-// specified configuration on the v1beta2.HelmRepository object.
+// specified configuration on the v1.HelmRepository object.
//
-// When the fetch fails, it records v1beta2.FetchFailedCondition=True and
+// When the fetch fails, it records v.FetchFailedCondition=True and
// returns early.
// If successful and the index is valid, any previous
-// v1beta2.FetchFailedCondition is removed, and the repository.ChartRepository
+// v1.FetchFailedCondition is removed, and the repository.ChartRepository
// pointer is set to the newly fetched index.
func (r *HelmRepositoryReconciler) reconcileSource(ctx context.Context, sp *patch.SerialPatcher,
- obj *helmv1.HelmRepository, artifact *sourcev1.Artifact, chartRepo *repository.ChartRepository) (sreconcile.Result, error) {
+ obj *sourcev1.HelmRepository, artifact *sourcev1.Artifact, chartRepo *repository.ChartRepository) (sreconcile.Result, error) {
// Ensure it's not an OCI URL. API validation ensures that only
// http/https/oci scheme are allowed.
if strings.HasPrefix(obj.Spec.URL, helmreg.OCIScheme) {
@@ -483,7 +482,7 @@ func (r *HelmRepositoryReconciler) reconcileSource(ctx context.Context, sp *patc
if err := chartRepo.LoadFromPath(); err != nil {
e := serror.NewGeneric(
fmt.Errorf("failed to load Helm repository from index YAML: %w", err),
- helmv1.IndexationFailedReason,
+ sourcev1.IndexationFailedReason,
)
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, e.Reason, e.Err.Error())
return sreconcile.ResultEmpty, e
@@ -496,7 +495,7 @@ func (r *HelmRepositoryReconciler) reconcileSource(ctx context.Context, sp *patc
if revision.Validate() != nil {
e := serror.NewGeneric(
fmt.Errorf("failed to calculate revision: %w", err),
- helmv1.IndexationFailedReason,
+ sourcev1.IndexationFailedReason,
)
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, e.Reason, e.Err.Error())
return sreconcile.ResultEmpty, e
@@ -526,12 +525,12 @@ func (r *HelmRepositoryReconciler) reconcileSource(ctx context.Context, sp *patc
// (Status) data on the object does not match the given.
//
// The inspection of the given data to the object is differed, ensuring any
-// stale observations like v1beta2.ArtifactOutdatedCondition are removed.
+// stale observations like v1.ArtifactOutdatedCondition are removed.
// If the given Artifact does not differ from the object's current, it returns
// early.
// On a successful archive, the Artifact in the Status of the object is set,
// and the symlink in the Storage is updated to its path.
-func (r *HelmRepositoryReconciler) reconcileArtifact(ctx context.Context, sp *patch.SerialPatcher, obj *helmv1.HelmRepository, artifact *sourcev1.Artifact, chartRepo *repository.ChartRepository) (sreconcile.Result, error) {
+func (r *HelmRepositoryReconciler) reconcileArtifact(ctx context.Context, sp *patch.SerialPatcher, obj *sourcev1.HelmRepository, artifact *sourcev1.Artifact, chartRepo *repository.ChartRepository) (sreconcile.Result, error) {
// Set the ArtifactInStorageCondition if there's no drift.
defer func() {
if obj.GetArtifact().HasRevision(artifact.Revision) {
@@ -623,7 +622,7 @@ func (r *HelmRepositoryReconciler) reconcileArtifact(ctx context.Context, sp *pa
// reconcileDelete handles the deletion of the object.
// It first garbage collects all Artifacts for the object from the Storage.
// Removing the finalizer from the object if successful.
-func (r *HelmRepositoryReconciler) reconcileDelete(ctx context.Context, obj *helmv1.HelmRepository) (sreconcile.Result, error) {
+func (r *HelmRepositoryReconciler) reconcileDelete(ctx context.Context, obj *sourcev1.HelmRepository) (sreconcile.Result, error) {
// Garbage collect the resource's artifacts
if err := r.garbageCollect(ctx, obj); err != nil {
// Return the error so we retry the failed garbage collection
@@ -651,8 +650,8 @@ func (r *HelmRepositoryReconciler) reconcileDelete(ctx context.Context, obj *hel
// - the deletion timestamp on the object is set
// - the obj.Spec.Type has changed and artifacts are not supported by the new type
// Which will result in the removal of all Artifacts for the objects.
-func (r *HelmRepositoryReconciler) garbageCollect(ctx context.Context, obj *helmv1.HelmRepository) error {
- if !obj.DeletionTimestamp.IsZero() || (obj.Spec.Type != "" && obj.Spec.Type != helmv1.HelmRepositoryTypeDefault) {
+func (r *HelmRepositoryReconciler) garbageCollect(ctx context.Context, obj *sourcev1.HelmRepository) error {
+ if !obj.DeletionTimestamp.IsZero() || (obj.Spec.Type != "" && obj.Spec.Type != sourcev1.HelmRepositoryTypeDefault) {
if deleted, err := r.Storage.RemoveAll(r.Storage.NewArtifactFor(obj.Kind, obj.GetObjectMeta(), "", "*")); err != nil {
return serror.NewGeneric(
fmt.Errorf("garbage collection for deleted resource failed: %w", err),
@@ -703,7 +702,7 @@ func (r *HelmRepositoryReconciler) eventLogf(ctx context.Context, obj runtime.Ob
}
// migrateToStatic is HelmRepository OCI migration to static object.
-func (r *HelmRepositoryReconciler) migrationToStatic(ctx context.Context, sp *patch.SerialPatcher, obj *helmv1.HelmRepository) (result ctrl.Result, err error) {
+func (r *HelmRepositoryReconciler) migrationToStatic(ctx context.Context, sp *patch.SerialPatcher, obj *sourcev1.HelmRepository) (result ctrl.Result, err error) {
// Skip migration if suspended and not being deleted.
if obj.Spec.Suspend && obj.DeletionTimestamp.IsZero() {
return ctrl.Result{}, nil
@@ -721,7 +720,7 @@ func (r *HelmRepositoryReconciler) migrationToStatic(ctx context.Context, sp *pa
}
// Delete finalizer and reset the status.
controllerutil.RemoveFinalizer(obj, sourcev1.SourceFinalizer)
- obj.Status = helmv1.HelmRepositoryStatus{}
+ obj.Status = sourcev1.HelmRepositoryStatus{}
if err := sp.Patch(ctx, obj); err != nil {
return ctrl.Result{}, err
diff --git a/internal/controller/helmrepository_controller_test.go b/internal/controller/helmrepository_controller_test.go
index 0da154a15..9724baf65 100644
--- a/internal/controller/helmrepository_controller_test.go
+++ b/internal/controller/helmrepository_controller_test.go
@@ -50,7 +50,6 @@ import (
"github.com/fluxcd/pkg/runtime/patch"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
- helmv1 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/fluxcd/source-controller/internal/cache"
intdigest "github.com/fluxcd/source-controller/internal/digest"
"github.com/fluxcd/source-controller/internal/helm/getter"
@@ -73,10 +72,10 @@ func TestHelmRepositoryReconciler_deleteBeforeFinalizer(t *testing.T) {
g.Expect(k8sClient.Delete(ctx, namespace)).NotTo(HaveOccurred())
})
- helmrepo := &helmv1.HelmRepository{}
+ helmrepo := &sourcev1.HelmRepository{}
helmrepo.Name = "test-helmrepo"
helmrepo.Namespace = namespaceName
- helmrepo.Spec = helmv1.HelmRepositorySpec{
+ helmrepo.Spec = sourcev1.HelmRepositorySpec{
Interval: metav1.Duration{Duration: interval},
URL: "https://example.com",
}
@@ -109,12 +108,12 @@ func TestHelmRepositoryReconciler_Reconcile(t *testing.T) {
testServer.Start()
defer testServer.Stop()
- origObj := &helmv1.HelmRepository{
+ origObj := &sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmrepository-reconcile-",
Namespace: "default",
},
- Spec: helmv1.HelmRepositorySpec{
+ Spec: sourcev1.HelmRepositorySpec{
Interval: metav1.Duration{Duration: interval},
URL: testServer.URL(),
},
@@ -175,7 +174,7 @@ func TestHelmRepositoryReconciler_Reconcile(t *testing.T) {
func TestHelmRepositoryReconciler_reconcileStorage(t *testing.T) {
tests := []struct {
name string
- beforeFunc func(obj *helmv1.HelmRepository, storage *Storage) error
+ beforeFunc func(obj *sourcev1.HelmRepository, storage *Storage) error
want sreconcile.Result
wantErr bool
assertArtifact *sourcev1.Artifact
@@ -184,7 +183,7 @@ func TestHelmRepositoryReconciler_reconcileStorage(t *testing.T) {
}{
{
name: "garbage collects",
- beforeFunc: func(obj *helmv1.HelmRepository, storage *Storage) error {
+ beforeFunc: func(obj *sourcev1.HelmRepository, storage *Storage) error {
revisions := []string{"a", "b", "c", "d"}
for n := range revisions {
v := revisions[n]
@@ -234,7 +233,7 @@ func TestHelmRepositoryReconciler_reconcileStorage(t *testing.T) {
},
{
name: "notices missing artifact in storage",
- beforeFunc: func(obj *helmv1.HelmRepository, storage *Storage) error {
+ beforeFunc: func(obj *sourcev1.HelmRepository, storage *Storage) error {
obj.Status.Artifact = &sourcev1.Artifact{
Path: "/reconcile-storage/invalid.txt",
Revision: "d",
@@ -253,7 +252,7 @@ func TestHelmRepositoryReconciler_reconcileStorage(t *testing.T) {
},
{
name: "notices empty artifact digest",
- beforeFunc: func(obj *helmv1.HelmRepository, storage *Storage) error {
+ beforeFunc: func(obj *sourcev1.HelmRepository, storage *Storage) error {
f := "empty-digest.txt"
obj.Status.Artifact = &sourcev1.Artifact{
@@ -284,7 +283,7 @@ func TestHelmRepositoryReconciler_reconcileStorage(t *testing.T) {
},
{
name: "notices artifact digest mismatch",
- beforeFunc: func(obj *helmv1.HelmRepository, storage *Storage) error {
+ beforeFunc: func(obj *sourcev1.HelmRepository, storage *Storage) error {
f := "digest-mismatch.txt"
obj.Status.Artifact = &sourcev1.Artifact{
@@ -315,7 +314,7 @@ func TestHelmRepositoryReconciler_reconcileStorage(t *testing.T) {
},
{
name: "updates hostname on diff from current",
- beforeFunc: func(obj *helmv1.HelmRepository, storage *Storage) error {
+ beforeFunc: func(obj *sourcev1.HelmRepository, storage *Storage) error {
obj.Status.Artifact = &sourcev1.Artifact{
Path: "/reconcile-storage/hostname.txt",
Revision: "f",
@@ -354,14 +353,14 @@ func TestHelmRepositoryReconciler_reconcileStorage(t *testing.T) {
r := &HelmRepositoryReconciler{
Client: fakeclient.NewClientBuilder().
WithScheme(testEnv.GetScheme()).
- WithStatusSubresource(&helmv1.HelmRepository{}).
+ WithStatusSubresource(&sourcev1.HelmRepository{}).
Build(),
EventRecorder: record.NewFakeRecorder(32),
Storage: testStorage,
patchOptions: getPatchOptions(helmRepositoryReadyCondition.Owned, "sc"),
}
- obj := &helmv1.HelmRepository{
+ obj := &sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "test-",
Generation: 1,
@@ -421,8 +420,8 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
server options
url string
secret *corev1.Secret
- beforeFunc func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest)
- afterFunc func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository)
+ beforeFunc func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest)
+ afterFunc func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository)
want sreconcile.Result
wantErr bool
assertConditions []metav1.Condition
@@ -440,7 +439,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
"ca.crt": tlsCA,
},
},
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest) {
obj.Spec.CertSecretRef = &meta.LocalObjectReference{Name: "ca-file"}
},
assertConditions: []metav1.Condition{
@@ -464,7 +463,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
"ca.crt": tlsCA,
},
},
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest) {
obj.Spec.CertSecretRef = &meta.LocalObjectReference{Name: "ca-file"}
},
want: sreconcile.ResultSuccess,
@@ -472,7 +471,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "building artifact: new index revision"),
*conditions.UnknownCondition(meta.ReadyCondition, meta.ProgressingReason, "building artifact: new index revision"),
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
t.Expect(chartRepo.Path).ToNot(BeEmpty())
t.Expect(chartRepo.Index).ToNot(BeNil())
t.Expect(artifact.Revision).ToNot(BeEmpty())
@@ -494,7 +493,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
"caFile": tlsCA,
},
},
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest) {
obj.Spec.SecretRef = &meta.LocalObjectReference{Name: "ca-file"}
},
want: sreconcile.ResultSuccess,
@@ -502,7 +501,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "building artifact: new index revision"),
*conditions.UnknownCondition(meta.ReadyCondition, meta.ProgressingReason, "building artifact: new index revision"),
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
t.Expect(chartRepo.Path).ToNot(BeEmpty())
t.Expect(chartRepo.Index).ToNot(BeNil())
t.Expect(artifact.Revision).ToNot(BeEmpty())
@@ -526,7 +525,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
},
Type: corev1.SecretTypeDockerConfigJson,
},
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest) {
obj.Spec.SecretRef = &meta.LocalObjectReference{Name: "ca-file"}
},
want: sreconcile.ResultSuccess,
@@ -534,7 +533,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "building artifact: new index revision"),
*conditions.UnknownCondition(meta.ReadyCondition, meta.ProgressingReason, "building artifact: new index revision"),
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
t.Expect(chartRepo.Path).ToNot(BeEmpty())
t.Expect(chartRepo.Index).ToNot(BeNil())
t.Expect(artifact.Revision).ToNot(BeEmpty())
@@ -548,7 +547,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "building artifact: new index revision"),
*conditions.UnknownCondition(meta.ReadyCondition, meta.ProgressingReason, "building artifact: new index revision"),
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
t.Expect(chartRepo.Path).ToNot(BeEmpty())
t.Expect(chartRepo.Index).ToNot(BeNil())
t.Expect(artifact.Revision).ToNot(BeEmpty())
@@ -570,7 +569,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
"password": []byte("1234"),
},
},
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest) {
obj.Spec.SecretRef = &meta.LocalObjectReference{Name: "basic-auth"}
},
want: sreconcile.ResultSuccess,
@@ -578,7 +577,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "building artifact: new index revision"),
*conditions.UnknownCondition(meta.ReadyCondition, meta.ProgressingReason, "building artifact: new index revision"),
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
t.Expect(chartRepo.Path).ToNot(BeEmpty())
t.Expect(chartRepo.Index).ToNot(BeNil())
t.Expect(artifact.Revision).ToNot(BeEmpty())
@@ -602,7 +601,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
},
Type: corev1.SecretTypeDockerConfigJson,
},
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest) {
obj.Spec.SecretRef = &meta.LocalObjectReference{Name: "basic-auth"}
},
want: sreconcile.ResultSuccess,
@@ -610,7 +609,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "building artifact: new index revision"),
*conditions.UnknownCondition(meta.ReadyCondition, meta.ProgressingReason, "building artifact: new index revision"),
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
t.Expect(chartRepo.Path).ToNot(BeEmpty())
t.Expect(chartRepo.Index).ToNot(BeNil())
t.Expect(artifact.Revision).ToNot(BeEmpty())
@@ -632,7 +631,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
"ca.crt": []byte("invalid"),
},
},
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest) {
obj.Spec.CertSecretRef = &meta.LocalObjectReference{Name: "invalid-ca"}
conditions.MarkReconciling(obj, meta.ProgressingReason, "foo")
conditions.MarkUnknown(obj, meta.ReadyCondition, "foo", "bar")
@@ -643,7 +642,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "foo"),
*conditions.UnknownCondition(meta.ReadyCondition, "foo", "bar"),
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
// No repo index due to fetch fail.
t.Expect(chartRepo.Path).To(BeEmpty())
t.Expect(chartRepo.Index).To(BeNil())
@@ -653,7 +652,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
{
name: "Invalid URL makes FetchFailed=True and returns stalling error",
protocol: "http",
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest) {
obj.Spec.URL = strings.ReplaceAll(obj.Spec.URL, "http://", "")
conditions.MarkReconciling(obj, meta.ProgressingReason, "foo")
conditions.MarkUnknown(obj, meta.ReadyCondition, "foo", "bar")
@@ -665,7 +664,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "foo"),
*conditions.UnknownCondition(meta.ReadyCondition, "foo", "bar"),
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
// No repo index due to fetch fail.
t.Expect(chartRepo.Path).To(BeEmpty())
t.Expect(chartRepo.Index).To(BeNil())
@@ -675,7 +674,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
{
name: "Unsupported scheme makes FetchFailed=True and returns stalling error",
protocol: "http",
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest) {
obj.Spec.URL = strings.ReplaceAll(obj.Spec.URL, "http://", "ftp://")
conditions.MarkReconciling(obj, meta.ProgressingReason, "foo")
conditions.MarkUnknown(obj, meta.ReadyCondition, "foo", "bar")
@@ -687,7 +686,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "foo"),
*conditions.UnknownCondition(meta.ReadyCondition, "foo", "bar"),
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
// No repo index due to fetch fail.
t.Expect(chartRepo.Path).To(BeEmpty())
t.Expect(chartRepo.Index).To(BeNil())
@@ -697,7 +696,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
{
name: "Missing secret returns FetchFailed=True and returns error",
protocol: "http",
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest) {
obj.Spec.SecretRef = &meta.LocalObjectReference{Name: "non-existing"}
conditions.MarkReconciling(obj, meta.ProgressingReason, "foo")
conditions.MarkUnknown(obj, meta.ReadyCondition, "foo", "bar")
@@ -708,7 +707,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "foo"),
*conditions.UnknownCondition(meta.ReadyCondition, "foo", "bar"),
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
// No repo index due to fetch fail.
t.Expect(chartRepo.Path).To(BeEmpty())
t.Expect(chartRepo.Index).To(BeNil())
@@ -726,7 +725,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
"username": []byte("git"),
},
},
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest) {
obj.Spec.SecretRef = &meta.LocalObjectReference{Name: "malformed-basic-auth"}
conditions.MarkReconciling(obj, meta.ProgressingReason, "foo")
conditions.MarkUnknown(obj, meta.ReadyCondition, "foo", "bar")
@@ -737,7 +736,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "foo"),
*conditions.UnknownCondition(meta.ReadyCondition, "foo", "bar"),
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
// No repo index due to fetch fail.
t.Expect(chartRepo.Path).To(BeEmpty())
t.Expect(chartRepo.Index).To(BeNil())
@@ -747,7 +746,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
{
name: "Stored index with same revision",
protocol: "http",
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest) {
obj.Status.Artifact = &sourcev1.Artifact{
Revision: rev.String(),
}
@@ -760,7 +759,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "foo"),
*conditions.UnknownCondition(meta.ReadyCondition, "foo", "bar"),
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
t.Expect(chartRepo.Path).ToNot(BeEmpty())
t.Expect(chartRepo.Index).To(BeNil())
@@ -771,7 +770,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
{
name: "Stored index with different revision",
protocol: "http",
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest) {
obj.Status.Artifact = &sourcev1.Artifact{
Revision: "80bb3dd67c63095d985850459834ea727603727a370079de90d221191d375a86",
}
@@ -784,7 +783,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "building artifact: new index revision"),
*conditions.UnknownCondition(meta.ReadyCondition, meta.ProgressingReason, "building artifact: new index revision"),
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, chartRepo *repository.ChartRepository) {
t.Expect(chartRepo.Path).ToNot(BeEmpty())
t.Expect(chartRepo.Index).ToNot(BeNil())
@@ -796,7 +795,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
{
name: "Existing artifact makes ArtifactOutdated=True",
protocol: "http",
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, rev digest.Digest) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, rev digest.Digest) {
obj.Status.Artifact = &sourcev1.Artifact{
Path: "some-path",
Revision: "some-rev",
@@ -812,12 +811,12 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
}
for _, tt := range tests {
- obj := &helmv1.HelmRepository{
+ obj := &sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "auth-strategy-",
Generation: 1,
},
- Spec: helmv1.HelmRepositorySpec{
+ Spec: sourcev1.HelmRepositorySpec{
Interval: metav1.Duration{Duration: interval},
Timeout: &metav1.Duration{Duration: timeout},
},
@@ -868,7 +867,7 @@ func TestHelmRepositoryReconciler_reconcileSource(t *testing.T) {
clientBuilder := fakeclient.NewClientBuilder().
WithScheme(testEnv.GetScheme()).
- WithStatusSubresource(&helmv1.HelmRepository{})
+ WithStatusSubresource(&sourcev1.HelmRepository{})
if secret != nil {
clientBuilder.WithObjects(secret.DeepCopy())
@@ -960,19 +959,19 @@ func TestHelmRepositoryReconciler_reconcileArtifact(t *testing.T) {
tests := []struct {
name string
cache *cache.Cache
- beforeFunc func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, index *repository.ChartRepository)
- afterFunc func(t *WithT, obj *helmv1.HelmRepository, cache *cache.Cache)
+ beforeFunc func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, index *repository.ChartRepository)
+ afterFunc func(t *WithT, obj *sourcev1.HelmRepository, cache *cache.Cache)
want sreconcile.Result
wantErr bool
assertConditions []metav1.Condition
}{
{
name: "Archiving artifact to storage makes ArtifactInStorage=True and artifact is stored as JSON",
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, index *repository.ChartRepository) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, index *repository.ChartRepository) {
obj.Spec.Interval = metav1.Duration{Duration: interval}
},
want: sreconcile.ResultSuccess,
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, cache *cache.Cache) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, cache *cache.Cache) {
localPath := testStorage.LocalPath(*obj.GetArtifact())
b, err := os.ReadFile(localPath)
t.Expect(err).To(Not(HaveOccurred()))
@@ -985,7 +984,7 @@ func TestHelmRepositoryReconciler_reconcileArtifact(t *testing.T) {
{
name: "Archiving (loaded) artifact to storage adds to cache",
cache: cache.New(10, time.Minute),
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, index *repository.ChartRepository) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, index *repository.ChartRepository) {
index.Index = &repo.IndexFile{
APIVersion: "v1",
Generated: time.Now(),
@@ -993,7 +992,7 @@ func TestHelmRepositoryReconciler_reconcileArtifact(t *testing.T) {
obj.Spec.Interval = metav1.Duration{Duration: interval}
},
want: sreconcile.ResultSuccess,
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, cache *cache.Cache) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, cache *cache.Cache) {
i, ok := cache.Get(obj.GetArtifact().Path)
t.Expect(ok).To(BeTrue())
t.Expect(i).To(BeAssignableToTypeOf(&repo.IndexFile{}))
@@ -1004,11 +1003,11 @@ func TestHelmRepositoryReconciler_reconcileArtifact(t *testing.T) {
},
{
name: "Up-to-date artifact should not update status",
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, index *repository.ChartRepository) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, index *repository.ChartRepository) {
obj.Spec.Interval = metav1.Duration{Duration: interval}
obj.Status.Artifact = artifact.DeepCopy()
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, _ *cache.Cache) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, _ *cache.Cache) {
t.Expect(obj.Status.URL).To(BeEmpty())
},
want: sreconcile.ResultSuccess,
@@ -1018,7 +1017,7 @@ func TestHelmRepositoryReconciler_reconcileArtifact(t *testing.T) {
},
{
name: "Removes ArtifactOutdatedCondition after creating a new artifact",
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, index *repository.ChartRepository) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, index *repository.ChartRepository) {
obj.Spec.Interval = metav1.Duration{Duration: interval}
conditions.MarkTrue(obj, sourcev1.ArtifactOutdatedCondition, "Foo", "")
},
@@ -1029,10 +1028,10 @@ func TestHelmRepositoryReconciler_reconcileArtifact(t *testing.T) {
},
{
name: "Creates latest symlink to the created artifact",
- beforeFunc: func(t *WithT, obj *helmv1.HelmRepository, artifact sourcev1.Artifact, index *repository.ChartRepository) {
+ beforeFunc: func(t *WithT, obj *sourcev1.HelmRepository, artifact sourcev1.Artifact, index *repository.ChartRepository) {
obj.Spec.Interval = metav1.Duration{Duration: interval}
},
- afterFunc: func(t *WithT, obj *helmv1.HelmRepository, _ *cache.Cache) {
+ afterFunc: func(t *WithT, obj *sourcev1.HelmRepository, _ *cache.Cache) {
localPath := testStorage.LocalPath(*obj.GetArtifact())
symlinkPath := filepath.Join(filepath.Dir(localPath), "index.yaml")
targetFile, err := os.Readlink(symlinkPath)
@@ -1053,7 +1052,7 @@ func TestHelmRepositoryReconciler_reconcileArtifact(t *testing.T) {
r := &HelmRepositoryReconciler{
Client: fakeclient.NewClientBuilder().
WithScheme(testEnv.GetScheme()).
- WithStatusSubresource(&helmv1.HelmRepository{}).
+ WithStatusSubresource(&sourcev1.HelmRepository{}).
Build(),
EventRecorder: record.NewFakeRecorder(32),
Storage: testStorage,
@@ -1062,16 +1061,16 @@ func TestHelmRepositoryReconciler_reconcileArtifact(t *testing.T) {
patchOptions: getPatchOptions(helmRepositoryReadyCondition.Owned, "sc"),
}
- obj := &helmv1.HelmRepository{
+ obj := &sourcev1.HelmRepository{
TypeMeta: metav1.TypeMeta{
- Kind: helmv1.HelmRepositoryKind,
+ Kind: sourcev1.HelmRepositoryKind,
},
ObjectMeta: metav1.ObjectMeta{
GenerateName: "test-bucket-",
Generation: 1,
Namespace: "default",
},
- Spec: helmv1.HelmRepositorySpec{
+ Spec: sourcev1.HelmRepositorySpec{
Timeout: &metav1.Duration{Duration: timeout},
URL: "https://example.com/index.yaml",
},
@@ -1111,7 +1110,7 @@ func TestHelmRepositoryReconciler_reconcileArtifact(t *testing.T) {
func TestHelmRepositoryReconciler_reconcileSubRecs(t *testing.T) {
// Helper to build simple helmRepositoryReconcileFunc with result and error.
buildReconcileFuncs := func(r sreconcile.Result, e error) helmRepositoryReconcileFunc {
- return func(ctx context.Context, sp *patch.SerialPatcher, obj *helmv1.HelmRepository, artifact *sourcev1.Artifact, repo *repository.ChartRepository) (sreconcile.Result, error) {
+ return func(ctx context.Context, sp *patch.SerialPatcher, obj *sourcev1.HelmRepository, artifact *sourcev1.Artifact, repo *repository.ChartRepository) (sreconcile.Result, error) {
return r, e
}
}
@@ -1166,11 +1165,11 @@ func TestHelmRepositoryReconciler_reconcileSubRecs(t *testing.T) {
{
name: "multiple object status conditions mutations",
reconcileFuncs: []helmRepositoryReconcileFunc{
- func(ctx context.Context, sp *patch.SerialPatcher, obj *helmv1.HelmRepository, artifact *sourcev1.Artifact, repo *repository.ChartRepository) (sreconcile.Result, error) {
+ func(ctx context.Context, sp *patch.SerialPatcher, obj *sourcev1.HelmRepository, artifact *sourcev1.Artifact, repo *repository.ChartRepository) (sreconcile.Result, error) {
conditions.MarkTrue(obj, sourcev1.ArtifactOutdatedCondition, "NewRevision", "new index revision")
return sreconcile.ResultSuccess, nil
},
- func(ctx context.Context, sp *patch.SerialPatcher, obj *helmv1.HelmRepository, artifact *sourcev1.Artifact, repo *repository.ChartRepository) (sreconcile.Result, error) {
+ func(ctx context.Context, sp *patch.SerialPatcher, obj *sourcev1.HelmRepository, artifact *sourcev1.Artifact, repo *repository.ChartRepository) (sreconcile.Result, error) {
conditions.MarkTrue(obj, meta.ReconcilingCondition, meta.ProgressingReason, "creating artifact")
return sreconcile.ResultSuccess, nil
},
@@ -1220,16 +1219,16 @@ func TestHelmRepositoryReconciler_reconcileSubRecs(t *testing.T) {
r := &HelmRepositoryReconciler{
Client: fakeclient.NewClientBuilder().
WithScheme(testEnv.GetScheme()).
- WithStatusSubresource(&helmv1.HelmRepository{}).
+ WithStatusSubresource(&sourcev1.HelmRepository{}).
Build(),
patchOptions: getPatchOptions(helmRepositoryReadyCondition.Owned, "sc"),
}
- obj := &helmv1.HelmRepository{
+ obj := &sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "test-",
Generation: tt.generation,
},
- Status: helmv1.HelmRepositoryStatus{
+ Status: sourcev1.HelmRepositoryStatus{
ObservedGeneration: tt.observedGeneration,
},
}
@@ -1254,13 +1253,13 @@ func TestHelmRepositoryReconciler_reconcileSubRecs(t *testing.T) {
func TestHelmRepositoryReconciler_statusConditions(t *testing.T) {
tests := []struct {
name string
- beforeFunc func(obj *helmv1.HelmRepository)
+ beforeFunc func(obj *sourcev1.HelmRepository)
assertConditions []metav1.Condition
wantErr bool
}{
{
name: "positive conditions only",
- beforeFunc: func(obj *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmRepository) {
conditions.MarkTrue(obj, sourcev1.ArtifactInStorageCondition, meta.SucceededReason, "stored artifact for revision")
},
assertConditions: []metav1.Condition{
@@ -1271,7 +1270,7 @@ func TestHelmRepositoryReconciler_statusConditions(t *testing.T) {
},
{
name: "multiple failures",
- beforeFunc: func(obj *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmRepository) {
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, sourcev1.AuthenticationFailedReason, "failed to get secret")
conditions.MarkTrue(obj, sourcev1.StorageOperationFailedCondition, sourcev1.DirCreationFailedReason, "failed to create directory")
conditions.MarkTrue(obj, sourcev1.ArtifactOutdatedCondition, "NewRevision", "some error")
@@ -1286,7 +1285,7 @@ func TestHelmRepositoryReconciler_statusConditions(t *testing.T) {
},
{
name: "mixed positive and negative conditions",
- beforeFunc: func(obj *helmv1.HelmRepository) {
+ beforeFunc: func(obj *sourcev1.HelmRepository) {
conditions.MarkTrue(obj, sourcev1.ArtifactInStorageCondition, meta.SucceededReason, "stored artifact for revision")
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, sourcev1.AuthenticationFailedReason, "failed to get secret")
},
@@ -1303,10 +1302,10 @@ func TestHelmRepositoryReconciler_statusConditions(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
- obj := &helmv1.HelmRepository{
+ obj := &sourcev1.HelmRepository{
TypeMeta: metav1.TypeMeta{
- Kind: helmv1.HelmRepositoryKind,
- APIVersion: helmv1.GroupVersion.String(),
+ Kind: sourcev1.HelmRepositoryKind,
+ APIVersion: sourcev1.GroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: "helmrepo",
@@ -1316,7 +1315,7 @@ func TestHelmRepositoryReconciler_statusConditions(t *testing.T) {
clientBuilder := fakeclient.NewClientBuilder().
WithObjects(obj).
- WithStatusSubresource(&helmv1.HelmRepository{})
+ WithStatusSubresource(&sourcev1.HelmRepository{})
c := clientBuilder.Build()
@@ -1351,8 +1350,8 @@ func TestHelmRepositoryReconciler_notify(t *testing.T) {
name string
res sreconcile.Result
resErr error
- oldObjBeforeFunc func(obj *helmv1.HelmRepository)
- newObjBeforeFunc func(obj *helmv1.HelmRepository)
+ oldObjBeforeFunc func(obj *sourcev1.HelmRepository)
+ newObjBeforeFunc func(obj *sourcev1.HelmRepository)
wantEvent string
}{
{
@@ -1364,7 +1363,7 @@ func TestHelmRepositoryReconciler_notify(t *testing.T) {
name: "new artifact with nil size",
res: sreconcile.ResultSuccess,
resErr: nil,
- newObjBeforeFunc: func(obj *helmv1.HelmRepository) {
+ newObjBeforeFunc: func(obj *sourcev1.HelmRepository) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "xxx", Digest: "yyy", Size: nil}
},
wantEvent: "Normal NewArtifact stored fetched index of unknown size",
@@ -1373,7 +1372,7 @@ func TestHelmRepositoryReconciler_notify(t *testing.T) {
name: "new artifact",
res: sreconcile.ResultSuccess,
resErr: nil,
- newObjBeforeFunc: func(obj *helmv1.HelmRepository) {
+ newObjBeforeFunc: func(obj *sourcev1.HelmRepository) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "xxx", Digest: "yyy", Size: &aSize}
},
wantEvent: "Normal NewArtifact stored fetched index of size",
@@ -1382,12 +1381,12 @@ func TestHelmRepositoryReconciler_notify(t *testing.T) {
name: "recovery from failure",
res: sreconcile.ResultSuccess,
resErr: nil,
- oldObjBeforeFunc: func(obj *helmv1.HelmRepository) {
+ oldObjBeforeFunc: func(obj *sourcev1.HelmRepository) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "xxx", Digest: "yyy", Size: &aSize}
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, sourcev1.GitOperationFailedReason, "fail")
conditions.MarkFalse(obj, meta.ReadyCondition, meta.FailedReason, "foo")
},
- newObjBeforeFunc: func(obj *helmv1.HelmRepository) {
+ newObjBeforeFunc: func(obj *sourcev1.HelmRepository) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "xxx", Digest: "yyy", Size: &aSize}
conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "ready")
},
@@ -1397,12 +1396,12 @@ func TestHelmRepositoryReconciler_notify(t *testing.T) {
name: "recovery and new artifact",
res: sreconcile.ResultSuccess,
resErr: nil,
- oldObjBeforeFunc: func(obj *helmv1.HelmRepository) {
+ oldObjBeforeFunc: func(obj *sourcev1.HelmRepository) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "xxx", Digest: "yyy", Size: &aSize}
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, sourcev1.GitOperationFailedReason, "fail")
conditions.MarkFalse(obj, meta.ReadyCondition, meta.FailedReason, "foo")
},
- newObjBeforeFunc: func(obj *helmv1.HelmRepository) {
+ newObjBeforeFunc: func(obj *sourcev1.HelmRepository) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "aaa", Digest: "bbb", Size: &aSize}
conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "ready")
},
@@ -1412,11 +1411,11 @@ func TestHelmRepositoryReconciler_notify(t *testing.T) {
name: "no updates",
res: sreconcile.ResultSuccess,
resErr: nil,
- oldObjBeforeFunc: func(obj *helmv1.HelmRepository) {
+ oldObjBeforeFunc: func(obj *sourcev1.HelmRepository) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "xxx", Digest: "yyy", Size: &aSize}
conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "ready")
},
- newObjBeforeFunc: func(obj *helmv1.HelmRepository) {
+ newObjBeforeFunc: func(obj *sourcev1.HelmRepository) {
obj.Status.Artifact = &sourcev1.Artifact{Revision: "xxx", Digest: "yyy", Size: &aSize}
conditions.MarkTrue(obj, meta.ReadyCondition, meta.SucceededReason, "ready")
},
@@ -1428,7 +1427,7 @@ func TestHelmRepositoryReconciler_notify(t *testing.T) {
g := NewWithT(t)
recorder := record.NewFakeRecorder(32)
- oldObj := &helmv1.HelmRepository{}
+ oldObj := &sourcev1.HelmRepository{}
newObj := oldObj.DeepCopy()
if tt.oldObjBeforeFunc != nil {
@@ -1475,12 +1474,12 @@ func TestHelmRepositoryReconciler_ReconcileTypeUpdatePredicateFilter(t *testing.
testServer.Start()
defer testServer.Stop()
- obj := &helmv1.HelmRepository{
+ obj := &sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmrepository-reconcile-",
Namespace: "default",
},
- Spec: helmv1.HelmRepositorySpec{
+ Spec: sourcev1.HelmRepositorySpec{
Interval: metav1.Duration{Duration: interval},
URL: testServer.URL(),
},
@@ -1524,7 +1523,7 @@ func TestHelmRepositoryReconciler_ReconcileTypeUpdatePredicateFilter(t *testing.
g.Expect(res.Status).To(Equal(kstatus.CurrentStatus))
// Switch to a OCI helm repository type
- obj.Spec.Type = helmv1.HelmRepositoryTypeOCI
+ obj.Spec.Type = sourcev1.HelmRepositoryTypeOCI
obj.Spec.URL = fmt.Sprintf("oci://%s", testRegistryServer.registryHost)
oldGen := obj.GetGeneration()
@@ -1564,12 +1563,12 @@ func TestHelmRepositoryReconciler_ReconcileSpecUpdatePredicateFilter(t *testing.
testServer.Start()
defer testServer.Stop()
- obj := &helmv1.HelmRepository{
+ obj := &sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmrepository-reconcile-",
Namespace: "default",
},
- Spec: helmv1.HelmRepositorySpec{
+ Spec: sourcev1.HelmRepositorySpec{
Interval: metav1.Duration{Duration: interval},
URL: testServer.URL(),
},
@@ -1666,12 +1665,12 @@ func TestHelmRepositoryReconciler_InMemoryCaching(t *testing.T) {
g.Expect(err).ToNot(HaveOccurred())
defer func() { g.Expect(testEnv.Delete(ctx, ns)).To(Succeed()) }()
- helmRepo := &helmv1.HelmRepository{
+ helmRepo := &sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "helmrepository-",
Namespace: ns.Name,
},
- Spec: helmv1.HelmRepositorySpec{
+ Spec: sourcev1.HelmRepositorySpec{
URL: testServer.URL(),
},
}
@@ -1725,7 +1724,7 @@ func TestHelmRepositoryReconciler_ociMigration(t *testing.T) {
g.Expect(testEnv.Cleanup(ctx, testns)).ToNot(HaveOccurred())
})
- hr := &helmv1.HelmRepository{
+ hr := &sourcev1.HelmRepository{
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("hr-%s", randStringRunes(5)),
Namespace: testns.Name,
@@ -1736,8 +1735,8 @@ func TestHelmRepositoryReconciler_ociMigration(t *testing.T) {
// Migrates newly created object with finalizer.
hr.ObjectMeta.Finalizers = append(hr.ObjectMeta.Finalizers, "foo.bar", sourcev1.SourceFinalizer)
- hr.Spec = helmv1.HelmRepositorySpec{
- Type: helmv1.HelmRepositoryTypeOCI,
+ hr.Spec = sourcev1.HelmRepositorySpec{
+ Type: sourcev1.HelmRepositoryTypeOCI,
URL: "oci://foo/bar",
Interval: metav1.Duration{Duration: interval},
}
diff --git a/internal/controller/ocirepository_controller_test.go b/internal/controller/ocirepository_controller_test.go
index d136efd22..0e9f89885 100644
--- a/internal/controller/ocirepository_controller_test.go
+++ b/internal/controller/ocirepository_controller_test.go
@@ -1393,7 +1393,7 @@ func TestOCIRepository_reconcileSource_verifyOCISourceSignatureNotation(t *testi
},
Spec: ociv1.OCIRepositorySpec{
URL: fmt.Sprintf("oci://%s/podinfo", server.registryHost),
- Verify: &ociv1.OCIRepositoryVerification{
+ Verify: &sourcev1.OCIRepositoryVerification{
Provider: "notation",
},
Interval: metav1.Duration{Duration: interval},
@@ -1713,7 +1713,7 @@ func TestOCIRepository_reconcileSource_verifyOCISourceTrustPolicyNotation(t *tes
},
Spec: ociv1.OCIRepositorySpec{
URL: fmt.Sprintf("oci://%s/podinfo", server.registryHost),
- Verify: &ociv1.OCIRepositoryVerification{
+ Verify: &sourcev1.OCIRepositoryVerification{
Provider: "notation",
},
Interval: metav1.Duration{Duration: interval},
@@ -2037,7 +2037,7 @@ func TestOCIRepository_reconcileSource_verifyOCISourceSignatureCosign(t *testing
},
Spec: ociv1.OCIRepositorySpec{
URL: fmt.Sprintf("oci://%s/podinfo", server.registryHost),
- Verify: &ociv1.OCIRepositoryVerification{
+ Verify: &sourcev1.OCIRepositoryVerification{
Provider: "cosign",
},
Interval: metav1.Duration{Duration: interval},
@@ -2159,7 +2159,7 @@ func TestOCIRepository_reconcileSource_verifyOCISourceSignature_keyless(t *testi
},
want: sreconcile.ResultSuccess,
beforeFunc: func(obj *ociv1.OCIRepository) {
- obj.Spec.Verify.MatchOIDCIdentity = []ociv1.OIDCIdentityMatch{
+ obj.Spec.Verify.MatchOIDCIdentity = []sourcev1.OIDCIdentityMatch{
{
Subject: "^https://github.com/stefanprodan/podinfo.*$",
@@ -2181,7 +2181,7 @@ func TestOCIRepository_reconcileSource_verifyOCISourceSignature_keyless(t *testi
},
want: sreconcile.ResultSuccess,
beforeFunc: func(obj *ociv1.OCIRepository) {
- obj.Spec.Verify.MatchOIDCIdentity = []ociv1.OIDCIdentityMatch{
+ obj.Spec.Verify.MatchOIDCIdentity = []sourcev1.OIDCIdentityMatch{
{
Subject: "intruder",
Issuer: "^https://honeypot.com$",
@@ -2208,7 +2208,7 @@ func TestOCIRepository_reconcileSource_verifyOCISourceSignature_keyless(t *testi
wantErr: true,
want: sreconcile.ResultEmpty,
beforeFunc: func(obj *ociv1.OCIRepository) {
- obj.Spec.Verify.MatchOIDCIdentity = []ociv1.OIDCIdentityMatch{
+ obj.Spec.Verify.MatchOIDCIdentity = []sourcev1.OIDCIdentityMatch{
{
Subject: "intruder",
Issuer: "^https://honeypot.com$",
@@ -2260,7 +2260,7 @@ func TestOCIRepository_reconcileSource_verifyOCISourceSignature_keyless(t *testi
},
Spec: ociv1.OCIRepositorySpec{
URL: "oci://ghcr.io/stefanprodan/manifests/podinfo",
- Verify: &ociv1.OCIRepositoryVerification{
+ Verify: &sourcev1.OCIRepositoryVerification{
Provider: "cosign",
},
Interval: metav1.Duration{Duration: interval},
diff --git a/internal/helm/getter/client_opts.go b/internal/helm/getter/client_opts.go
index 58477ca70..c305b7385 100644
--- a/internal/helm/getter/client_opts.go
+++ b/internal/helm/getter/client_opts.go
@@ -32,7 +32,8 @@ import (
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
- helmv1 "github.com/fluxcd/source-controller/api/v1beta2"
+ sourcev1 "github.com/fluxcd/source-controller/api/v1"
+ sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/fluxcd/source-controller/internal/helm/registry"
soci "github.com/fluxcd/source-controller/internal/oci"
stls "github.com/fluxcd/source-controller/internal/tls"
@@ -69,7 +70,7 @@ func (o ClientOpts) MustLoginToRegistry() bool {
// auth mechanisms.
// A temporary directory is created to store the certs files if needed and its path is returned along with the options object. It is the
// caller's responsibility to clean up the directory.
-func GetClientOpts(ctx context.Context, c client.Client, obj *helmv1.HelmRepository, url string) (*ClientOpts, string, error) {
+func GetClientOpts(ctx context.Context, c client.Client, obj *sourcev1.HelmRepository, url string) (*ClientOpts, string, error) {
hrOpts := &ClientOpts{
GetterOpts: []helmgetter.Option{
helmgetter.WithURL(url),
@@ -77,7 +78,7 @@ func GetClientOpts(ctx context.Context, c client.Client, obj *helmv1.HelmReposit
helmgetter.WithPassCredentialsAll(obj.Spec.PassCredentials),
},
}
- ociRepo := obj.Spec.Type == helmv1.HelmRepositoryTypeOCI
+ ociRepo := obj.Spec.Type == sourcev1.HelmRepositoryTypeOCI
var (
certSecret *corev1.Secret
@@ -135,7 +136,7 @@ func GetClientOpts(ctx context.Context, c client.Client, obj *helmv1.HelmReposit
return nil, "", fmt.Errorf("failed to configure login options: %w", err)
}
}
- } else if obj.Spec.Provider != helmv1.GenericOCIProvider && obj.Spec.Type == helmv1.HelmRepositoryTypeOCI && ociRepo {
+ } else if obj.Spec.Provider != sourcev1beta2.GenericOCIProvider && obj.Spec.Type == sourcev1.HelmRepositoryTypeOCI && ociRepo {
authenticator, authErr := soci.OIDCAuth(ctx, obj.Spec.URL, obj.Spec.Provider)
if authErr != nil && !errors.Is(authErr, oci.ErrUnconfiguredProvider) {
return nil, "", fmt.Errorf("failed to get credential from '%s': %w", obj.Spec.Provider, authErr)
diff --git a/internal/helm/getter/client_opts_test.go b/internal/helm/getter/client_opts_test.go
index f8acd79fb..b8bf15f28 100644
--- a/internal/helm/getter/client_opts_test.go
+++ b/internal/helm/getter/client_opts_test.go
@@ -29,7 +29,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fakeclient "sigs.k8s.io/controller-runtime/pkg/client/fake"
- helmv1 "github.com/fluxcd/source-controller/api/v1beta2"
+ helmv1 "github.com/fluxcd/source-controller/api/v1"
)
func TestGetClientOpts(t *testing.T) {
diff --git a/internal/predicates/helmrepository_type_predicate.go b/internal/predicates/helmrepository_type_predicate.go
index cc7c8fc7e..714d77942 100644
--- a/internal/predicates/helmrepository_type_predicate.go
+++ b/internal/predicates/helmrepository_type_predicate.go
@@ -22,7 +22,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/predicate"
- sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
+ sourcev1 "github.com/fluxcd/source-controller/api/v1"
)
// HelmRepositoryOCIMigrationPredicate implements predicate functions to allow
diff --git a/internal/predicates/helmrepository_type_predicate_test.go b/internal/predicates/helmrepository_type_predicate_test.go
index 0d3489d1f..643e823e7 100644
--- a/internal/predicates/helmrepository_type_predicate_test.go
+++ b/internal/predicates/helmrepository_type_predicate_test.go
@@ -25,8 +25,7 @@ import (
"github.com/fluxcd/pkg/apis/meta"
"github.com/fluxcd/pkg/runtime/conditions"
- v1 "github.com/fluxcd/source-controller/api/v1"
- sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
+ sourcev1 "github.com/fluxcd/source-controller/api/v1"
)
func TestHelmRepositoryOCIMigrationPredicate_Create(t *testing.T) {
@@ -161,7 +160,7 @@ func TestHelmRepositoryOCIMigrationPredicate_Update(t *testing.T) {
Type: sourcev1.HelmRepositoryTypeDefault,
}
oldObj.Status = sourcev1.HelmRepositoryStatus{
- Artifact: &v1.Artifact{},
+ Artifact: &sourcev1.Artifact{},
URL: "http://some-address",
ObservedGeneration: 3,
}
diff --git a/main.go b/main.go
index e2bd08efb..a0abb7c8c 100644
--- a/main.go
+++ b/main.go
@@ -50,7 +50,7 @@ import (
"github.com/fluxcd/pkg/runtime/pprof"
"github.com/fluxcd/pkg/runtime/probes"
- v1 "github.com/fluxcd/source-controller/api/v1"
+ "github.com/fluxcd/source-controller/api/v1"
"github.com/fluxcd/source-controller/api/v1beta2"
// +kubebuilder:scaffold:imports
@@ -199,7 +199,7 @@ func main() {
DependencyRequeueInterval: requeueDependency,
RateLimiter: helper.GetRateLimiter(rateLimiterOptions),
}); err != nil {
- setupLog.Error(err, "unable to create controller", "controller", v1beta2.GitRepositoryKind)
+ setupLog.Error(err, "unable to create controller", "controller", v1.GitRepositoryKind)
os.Exit(1)
}
@@ -216,7 +216,7 @@ func main() {
}).SetupWithManagerAndOptions(mgr, controller.HelmRepositoryReconcilerOptions{
RateLimiter: helper.GetRateLimiter(rateLimiterOptions),
}); err != nil {
- setupLog.Error(err, "unable to create controller", "controller", v1beta2.HelmRepositoryKind)
+ setupLog.Error(err, "unable to create controller", "controller", v1.HelmRepositoryKind)
os.Exit(1)
}
@@ -234,7 +234,7 @@ func main() {
}).SetupWithManagerAndOptions(ctx, mgr, controller.HelmChartReconcilerOptions{
RateLimiter: helper.GetRateLimiter(rateLimiterOptions),
}); err != nil {
- setupLog.Error(err, "unable to create controller", "controller", v1beta2.HelmChartKind)
+ setupLog.Error(err, "unable to create controller", "controller", v1.HelmChartKind)
os.Exit(1)
}
@@ -247,7 +247,7 @@ func main() {
}).SetupWithManagerAndOptions(mgr, controller.BucketReconcilerOptions{
RateLimiter: helper.GetRateLimiter(rateLimiterOptions),
}); err != nil {
- setupLog.Error(err, "unable to create controller", "controller", "Bucket")
+ setupLog.Error(err, "unable to create controller", "controller", v1beta2.BucketKind)
os.Exit(1)
}
@@ -260,7 +260,7 @@ func main() {
}).SetupWithManagerAndOptions(mgr, controller.OCIRepositoryReconcilerOptions{
RateLimiter: helper.GetRateLimiter(rateLimiterOptions),
}); err != nil {
- setupLog.Error(err, "unable to create controller", "controller", "OCIRepository")
+ setupLog.Error(err, "unable to create controller", "controller", v1beta2.OCIRepositoryKind)
os.Exit(1)
}
// +kubebuilder:scaffold:builder
@@ -348,11 +348,11 @@ func mustSetupManager(metricsAddr, healthAddr string, maxConcurrent int,
},
Cache: ctrlcache.Options{
ByObject: map[ctrlclient.Object]ctrlcache.ByObject{
- &v1.GitRepository{}: {Label: watchSelector},
- &v1beta2.HelmRepository{}: {Label: watchSelector},
- &v1beta2.HelmChart{}: {Label: watchSelector},
- &v1beta2.Bucket{}: {Label: watchSelector},
- &v1beta2.OCIRepository{}: {Label: watchSelector},
+ &v1.GitRepository{}: {Label: watchSelector},
+ &v1.HelmRepository{}: {Label: watchSelector},
+ &v1.HelmChart{}: {Label: watchSelector},
+ &v1beta2.Bucket{}: {Label: watchSelector},
+ &v1beta2.OCIRepository{}: {Label: watchSelector},
},
},
Metrics: metricsserver.Options{
From 0a7f66b0e3186a2773351684f4b1a9651cdd23c3 Mon Sep 17 00:00:00 2001
From: Stefan Prodan
ignoreMissingValuesFiles
IgnoreMissingValuesFiles controls whether to silently ignore missing values +files rather than failing.
+suspend
ignoreMissingValuesFiles
IgnoreMissingValuesFiles controls whether to silently ignore missing values +files rather than failing.
+suspend
observedValuesFiles
ObservedValuesFiles are the observed value files of the last successful +reconciliation. +It matches the chart in the last successfully reconciled artifact.
+conditions
valuesFile
ValuesFile is an alternative values file to use as the default chart -values, expected to be a relative path in the SourceRef. Deprecated in -favor of ValuesFiles, for backwards compatibility the file specified here -is merged before the ValuesFiles items. Ignored when omitted.
-ignoreMissingValuesFiles
accessFrom
AccessFrom specifies an Access Control List for allowing cross-namespace -references to this object. -NOTE: Not implemented, provisional as of https://github.com/fluxcd/flux2/pull/2092
-verify
valuesFile
ValuesFile is an alternative values file to use as the default chart -values, expected to be a relative path in the SourceRef. Deprecated in -favor of ValuesFiles, for backwards compatibility the file specified here -is merged before the ValuesFiles items. Ignored when omitted.
-ignoreMissingValuesFiles
accessFrom
AccessFrom specifies an Access Control List for allowing cross-namespace -references to this object. -NOTE: Not implemented, provisional as of https://github.com/fluxcd/flux2/pull/2092
-verify