-
Notifications
You must be signed in to change notification settings - Fork 232
GA: Promote GitRepository API to source.toolkit.fluxcd.io/v1
#1056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ef8804c
Promote GitRepository API to v1
stefanprodan 9c80a66
Mark GitRepository v1beta1 and v1beta2 as deprecated
stefanprodan b2da6f0
api: Remove deprecated `Checksum` from `Artifact`
hiddeco 462178e
api/v1: Remove deprecated `ContentConfigChecksum`
hiddeco 97a2cdd
api/v1: Remove deprecated `GitImplementation`
hiddeco e9de3a7
Update `fluxcd/pkg/apis/meta` to v1.0.0
stefanprodan d905985
docs: Add GitRepository v1 docs
stefanprodan 929d42e
docs: remove deprecated `Checksum` from specs
hiddeco ee7d9b3
Add GitRepository v1 to project file
stefanprodan 861343d
Put back deprecated types and hint to v1
hiddeco 19ba61a
Remove `TransformLegacyRevision` from v1
hiddeco 4ab3c21
Delete `Status.URL` field from `GitRepository` v1
hiddeco 8fcfde9
api-docs: fix external link source for v1.Artifact
hiddeco f65e261
api: improve validation rules and omitempty nits
hiddeco 1023315
misc: various nits in doc blocks
hiddeco f2da9bf
docs: address nits
hiddeco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.