This repository has been archived by the owner on Jun 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
1,251 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,7 @@ resources: | |
- group: git | ||
kind: GitBranch | ||
version: v1 | ||
- group: git | ||
kind: GitopsAPI | ||
version: v1 | ||
version: "2" |
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,84 @@ | ||
/* | ||
Copyright 2020 The Kubernetes 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 ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// GitopsAPISpec defines the desired state of GitopsAPI | ||
type GitopsAPISpec struct { | ||
// The repository URL, can be a HTTP or SSH address. | ||
// +kubebuilder:validation:Pattern="^(http|https|ssh)://" | ||
// +required | ||
GitRepository string `json:"gitRepository,omitempty"` | ||
GitUser string `json:"gitUser,omitempty"` | ||
GitEmail string `json:"gitEmail,omitempty"` | ||
Tags []string `json:"gitTags,omitempty"` | ||
Assignee []string `json:"gitAssignee,omitempty"` | ||
Branch string `json:"branch,omitempty"` | ||
PullRequest bool `json:"pull_request,omitempty"` | ||
|
||
// The secret name containing the Git credentials. | ||
// For SSH repositories the secret must contain SSH_PRIVATE_KEY, SSH_PRIVATE_KEY_PASSORD | ||
// For Github repositories it must contain GITHUB_TOKEN | ||
// +optional | ||
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"` | ||
|
||
// The secret name containing the static credential to authenticate agaist either | ||
// as a `Authorization: Bearer` header or as a `?token=` argument | ||
// Must contain a key called TOKEN | ||
// +optional | ||
TokenRef *corev1.LocalObjectReference `json:"tokenRef,omitempty"` | ||
|
||
// The path to a kustomization file to insert or remove the resource, can included templated values .e.g `specs/clusters/{{.cluster}}/kustomization.yaml` | ||
// +required | ||
Kustomization string `json:"kustomization,omitempty"` | ||
|
||
// The path to save the resource into, should including templating to make it unique per cluster/namespace/kind/name tuple e.g. `specs/clusters/{{.cluster}}/{{.name}}.yaml` | ||
// +required | ||
Path string `json:"path,omitempty"` | ||
} | ||
|
||
// GitopsAPIStatus defines the observed state of GitopsAPI | ||
type GitopsAPIStatus struct { | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// GitopsAPI is the Schema for the gitopsapis API | ||
type GitopsAPI struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec GitopsAPISpec `json:"spec,omitempty"` | ||
Status GitopsAPIStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// GitopsAPIList contains a list of GitopsAPI | ||
type GitopsAPIList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []GitopsAPI `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&GitopsAPI{}, &GitopsAPIList{}) | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,100 @@ | ||
|
||
--- | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.2.5 | ||
creationTimestamp: null | ||
name: gitopsapis.git.flanksource.com | ||
spec: | ||
group: git.flanksource.com | ||
names: | ||
kind: GitopsAPI | ||
listKind: GitopsAPIList | ||
plural: gitopsapis | ||
singular: gitopsapi | ||
scope: Namespaced | ||
validation: | ||
openAPIV3Schema: | ||
description: GitopsAPI is the Schema for the gitopsapis API | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: GitopsAPISpec defines the desired state of GitopsAPI | ||
properties: | ||
branch: | ||
type: string | ||
gitAssignee: | ||
items: | ||
type: string | ||
type: array | ||
gitEmail: | ||
type: string | ||
gitRepository: | ||
description: The repository URL, can be a HTTP or SSH address. | ||
pattern: ^(http|https|ssh):// | ||
type: string | ||
gitTags: | ||
items: | ||
type: string | ||
type: array | ||
gitUser: | ||
type: string | ||
kustomization: | ||
description: The path to a kustomization file to insert or remove the | ||
resource, can included templated values .e.g `specs/clusters/{{.cluster}}/kustomization.yaml` | ||
type: string | ||
path: | ||
description: The path to save the resource into, should including templating | ||
to make it unique per cluster/namespace/kind/name tuple e.g. `specs/clusters/{{.cluster}}/{{.name}}.yaml` | ||
type: string | ||
pull_request: | ||
type: boolean | ||
secretRef: | ||
description: The secret name containing the Git credentials. For SSH | ||
repositories the secret must contain SSH_PRIVATE_KEY, SSH_PRIVATE_KEY_PASSORD | ||
For Github repositories it must contain GITHUB_TOKEN | ||
properties: | ||
name: | ||
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names | ||
TODO: Add other useful fields. apiVersion, kind, uid?' | ||
type: string | ||
type: object | ||
tokenRef: | ||
description: 'The secret name containing the static credential to authenticate | ||
agaist either as a `Authorization: Bearer` header or as a `?token=` | ||
argument Must contain a key called TOKEN' | ||
properties: | ||
name: | ||
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names | ||
TODO: Add other useful fields. apiVersion, kind, uid?' | ||
type: string | ||
type: object | ||
type: object | ||
status: | ||
description: GitopsAPIStatus defines the observed state of GitopsAPI | ||
type: object | ||
type: object | ||
version: v1 | ||
versions: | ||
- name: v1 | ||
served: true | ||
storage: true | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
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
Oops, something went wrong.