| 
 | 1 | +/*  | 
 | 2 | +Copyright 2020 The Kubernetes authors.  | 
 | 3 | +
  | 
 | 4 | +Licensed under the Apache License, Version 2.0 (the "License");  | 
 | 5 | +you may not use this file except in compliance with the License.  | 
 | 6 | +You may obtain a copy of the License at  | 
 | 7 | +
  | 
 | 8 | +    http://www.apache.org/licenses/LICENSE-2.0  | 
 | 9 | +
  | 
 | 10 | +Unless required by applicable law or agreed to in writing, software  | 
 | 11 | +distributed under the License is distributed on an "AS IS" BASIS,  | 
 | 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  | 
 | 13 | +See the License for the specific language governing permissions and  | 
 | 14 | +limitations under the License.  | 
 | 15 | +*/  | 
 | 16 | + | 
 | 17 | +package v1  | 
 | 18 | + | 
 | 19 | +import (  | 
 | 20 | +	corev1 "k8s.io/api/core/v1"  | 
 | 21 | +	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"  | 
 | 22 | +)  | 
 | 23 | + | 
 | 24 | +// GitopsAPISpec defines the desired state of GitopsAPI  | 
 | 25 | +type GitopsAPISpec struct {  | 
 | 26 | +	// The repository URL, can be a HTTP or SSH address.  | 
 | 27 | +	// +kubebuilder:validation:Pattern="^(http|https|ssh)://"  | 
 | 28 | +	// +required  | 
 | 29 | +	GitRepository string   `json:"gitRepository,omitempty"`  | 
 | 30 | +	GitUser       string   `json:"gitUser,omitempty"`  | 
 | 31 | +	GitEmail      string   `json:"gitEmail,omitempty"`  | 
 | 32 | +	Tags          []string `json:"gitTags,omitempty"`  | 
 | 33 | +	Assignee      []string `json:"gitAssignee,omitempty"`  | 
 | 34 | +	Branch        string   `json:"branch,omitempty"`  | 
 | 35 | +	PullRequest   bool     `json:"pull_request,omitempty"`  | 
 | 36 | + | 
 | 37 | +	// The secret name containing the Git credentials.  | 
 | 38 | +	// For SSH repositories the secret must contain SSH_PRIVATE_KEY, SSH_PRIVATE_KEY_PASSORD  | 
 | 39 | +	// For Github repositories it must contain GITHUB_TOKEN  | 
 | 40 | +	// +optional  | 
 | 41 | +	SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"`  | 
 | 42 | + | 
 | 43 | +	// The secret name containing the static credential to authenticate agaist either  | 
 | 44 | +	// as a `Authorization: Bearer` header or as a `?token=` argument  | 
 | 45 | +	// Must contain a key called TOKEN  | 
 | 46 | +	// +optional  | 
 | 47 | +	TokenRef *corev1.LocalObjectReference `json:"tokenRef,omitempty"`  | 
 | 48 | + | 
 | 49 | +	// The path to a kustomization file to insert or remove the resource, can included templated values .e.g `specs/clusters/{{.cluster}}/kustomization.yaml`  | 
 | 50 | +	// +required  | 
 | 51 | +	Kustomization string `json:"kustomization,omitempty"`  | 
 | 52 | + | 
 | 53 | +	// 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`  | 
 | 54 | +	// +required  | 
 | 55 | +	Path string `json:"path,omitempty"`  | 
 | 56 | +}  | 
 | 57 | + | 
 | 58 | +// GitopsAPIStatus defines the observed state of GitopsAPI  | 
 | 59 | +type GitopsAPIStatus struct {  | 
 | 60 | +}  | 
 | 61 | + | 
 | 62 | +// +kubebuilder:object:root=true  | 
 | 63 | + | 
 | 64 | +// GitopsAPI is the Schema for the gitopsapis API  | 
 | 65 | +type GitopsAPI struct {  | 
 | 66 | +	metav1.TypeMeta   `json:",inline"`  | 
 | 67 | +	metav1.ObjectMeta `json:"metadata,omitempty"`  | 
 | 68 | + | 
 | 69 | +	Spec   GitopsAPISpec   `json:"spec,omitempty"`  | 
 | 70 | +	Status GitopsAPIStatus `json:"status,omitempty"`  | 
 | 71 | +}  | 
 | 72 | + | 
 | 73 | +// +kubebuilder:object:root=true  | 
 | 74 | + | 
 | 75 | +// GitopsAPIList contains a list of GitopsAPI  | 
 | 76 | +type GitopsAPIList struct {  | 
 | 77 | +	metav1.TypeMeta `json:",inline"`  | 
 | 78 | +	metav1.ListMeta `json:"metadata,omitempty"`  | 
 | 79 | +	Items           []GitopsAPI `json:"items"`  | 
 | 80 | +}  | 
 | 81 | + | 
 | 82 | +func init() {  | 
 | 83 | +	SchemeBuilder.Register(&GitopsAPI{}, &GitopsAPIList{})  | 
 | 84 | +}  | 
0 commit comments