-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1056 from fluxcd/gitrepository-v1
GA: Promote GitRepository API to `source.toolkit.fluxcd.io/v1`
- Loading branch information
Showing
66 changed files
with
4,115 additions
and
1,314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
Copyright 2023 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. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1 | ||
|
||
import ( | ||
"path" | ||
"strings" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// Artifact represents the output of a Source reconciliation. | ||
type Artifact struct { | ||
// 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. | ||
// +required | ||
Path string `json:"path"` | ||
|
||
// 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. | ||
// +required | ||
URL string `json:"url"` | ||
|
||
// 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. | ||
// +required | ||
Revision string `json:"revision"` | ||
|
||
// Digest is the digest of the file in the form of '<algorithm>:<checksum>'. | ||
// +optional | ||
// +kubebuilder:validation:Pattern="^[a-z0-9]+(?:[.+_-][a-z0-9]+)*:[a-zA-Z0-9=_-]+$" | ||
Digest string `json:"digest,omitempty"` | ||
|
||
// LastUpdateTime is the timestamp corresponding to the last update of the | ||
// Artifact. | ||
// +required | ||
LastUpdateTime metav1.Time `json:"lastUpdateTime"` | ||
|
||
// Size is the number of bytes in the file. | ||
// +optional | ||
Size *int64 `json:"size,omitempty"` | ||
|
||
// Metadata holds upstream information such as OCI annotations. | ||
// +optional | ||
Metadata map[string]string `json:"metadata,omitempty"` | ||
} | ||
|
||
// HasRevision returns if the given revision matches the current Revision of | ||
// the Artifact. | ||
func (in *Artifact) HasRevision(revision string) bool { | ||
if in == nil { | ||
return false | ||
} | ||
return in.Revision == revision | ||
} | ||
|
||
// HasDigest returns if the given digest matches the current Digest of the | ||
// Artifact. | ||
func (in *Artifact) HasDigest(digest string) bool { | ||
if in == nil { | ||
return false | ||
} | ||
return in.Digest == digest | ||
} | ||
|
||
// ArtifactDir returns the artifact dir path in the form of | ||
// '<kind>/<namespace>/<name>'. | ||
func ArtifactDir(kind, namespace, name string) string { | ||
kind = strings.ToLower(kind) | ||
return path.Join(kind, namespace, name) | ||
} | ||
|
||
// ArtifactPath returns the artifact path in the form of | ||
// '<kind>/<namespace>/name>/<filename>'. | ||
func ArtifactPath(kind, namespace, name, filename string) string { | ||
return path.Join(ArtifactDir(kind, namespace, name), filename) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* | ||
Copyright 2023 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. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1 | ||
|
||
const SourceFinalizer = "finalizers.fluxcd.io" | ||
|
||
const ( | ||
// ArtifactInStorageCondition indicates the availability of the Artifact in | ||
// the storage. | ||
// If True, the Artifact is stored successfully. | ||
// This Condition is only present on the resource if the Artifact is | ||
// successfully stored. | ||
ArtifactInStorageCondition string = "ArtifactInStorage" | ||
|
||
// ArtifactOutdatedCondition indicates the current Artifact of the Source | ||
// is outdated. | ||
// This is a "negative polarity" or "abnormal-true" type, and is only | ||
// present on the resource if it is True. | ||
ArtifactOutdatedCondition string = "ArtifactOutdated" | ||
|
||
// SourceVerifiedCondition indicates the integrity verification of the | ||
// Source. | ||
// If True, the integrity check succeeded. If False, it failed. | ||
// This Condition is only present on the resource if the integrity check | ||
// is enabled. | ||
SourceVerifiedCondition string = "SourceVerified" | ||
|
||
// FetchFailedCondition indicates a transient or persistent fetch failure | ||
// of an upstream Source. | ||
// If True, observations on the upstream Source revision may be impossible, | ||
// and the Artifact available for the Source may be outdated. | ||
// This is a "negative polarity" or "abnormal-true" type, and is only | ||
// present on the resource if it is True. | ||
FetchFailedCondition string = "FetchFailed" | ||
|
||
// BuildFailedCondition indicates a transient or persistent build failure | ||
// of a Source's Artifact. | ||
// If True, the Source can be in an ArtifactOutdatedCondition. | ||
// This is a "negative polarity" or "abnormal-true" type, and is only | ||
// present on the resource if it is True. | ||
BuildFailedCondition string = "BuildFailed" | ||
|
||
// StorageOperationFailedCondition indicates a transient or persistent | ||
// failure related to storage. If True, the reconciliation failed while | ||
// performing some filesystem operation. | ||
// This is a "negative polarity" or "abnormal-true" type, and is only | ||
// present on the resource if it is True. | ||
StorageOperationFailedCondition string = "StorageOperationFailed" | ||
) | ||
|
||
// Reasons are provided as utility, and not part of the declarative API. | ||
const ( | ||
// URLInvalidReason signals that a given Source has an invalid URL. | ||
URLInvalidReason string = "URLInvalid" | ||
|
||
// AuthenticationFailedReason signals that a Secret does not have the | ||
// required fields, or the provided credentials do not match. | ||
AuthenticationFailedReason string = "AuthenticationFailed" | ||
|
||
// VerificationError signals that the Source's verification | ||
// check failed. | ||
VerificationError string = "VerificationError" | ||
|
||
// DirCreationFailedReason signals a failure caused by a directory creation | ||
// operation. | ||
DirCreationFailedReason string = "DirectoryCreationFailed" | ||
|
||
// StatOperationFailedReason signals a failure caused by a stat operation on | ||
// a path. | ||
StatOperationFailedReason string = "StatOperationFailed" | ||
|
||
// ReadOperationFailedReason signals a failure caused by a read operation. | ||
ReadOperationFailedReason string = "ReadOperationFailed" | ||
|
||
// AcquireLockFailedReason signals a failure in acquiring lock. | ||
AcquireLockFailedReason string = "AcquireLockFailed" | ||
|
||
// InvalidPathReason signals a failure caused by an invalid path. | ||
InvalidPathReason string = "InvalidPath" | ||
|
||
// ArchiveOperationFailedReason signals a failure in archive operation. | ||
ArchiveOperationFailedReason string = "ArchiveOperationFailed" | ||
|
||
// SymlinkUpdateFailedReason signals a failure in updating a symlink. | ||
SymlinkUpdateFailedReason string = "SymlinkUpdateFailed" | ||
|
||
// ArtifactUpToDateReason signals that an existing Artifact is up-to-date | ||
// with the Source. | ||
ArtifactUpToDateReason string = "ArtifactUpToDate" | ||
|
||
// CacheOperationFailedReason signals a failure in cache operation. | ||
CacheOperationFailedReason string = "CacheOperationFailed" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
Copyright 2023 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. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// Package v1 contains API Schema definitions for the source v1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=source.toolkit.fluxcd.io | ||
package v1 |
Oops, something went wrong.