Skip to content

Commit a2a8208

Browse files
committed
add initial support for local and embdedded fs
push manifests to gitea Signed-off-by: Manabu Mccloskey <[email protected]>
1 parent 458852c commit a2a8208

22 files changed

+1363
-58
lines changed

api/v1alpha1/gitrepository_types.go

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package v1alpha1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
)
6+
7+
type GitRepositorySpec struct {
8+
Source GitRepositorySource `json:"source,omitempty"`
9+
// GitURL is the base URL of Git server used for API calls.
10+
// +kubebuilder:validation:Required
11+
// +kubebuilder:validation:Pattern=`^https?:\/\/.+$`
12+
GitURL string `json:"gitURL"`
13+
// SecretRef is the reference to secret that contain Git server credentials
14+
// +kubebuilder:validation:Optional
15+
SecretRef SecretReference `json:"secretRef"`
16+
}
17+
18+
type GitRepositorySource struct {
19+
// +kubebuilder:validation:Enum:=argocd;backstage;crossplane;gitea;nginx
20+
// +kubebuilder:validation:Optional
21+
EmbeddedAppName string `json:"embeddedAppName"`
22+
// Path is the absolute path to directory that contains Kustomize structure or raw manifests.
23+
// This is required when Type is set to local.
24+
// +kubebuilder:validation:Optional
25+
Path string `json:"path"`
26+
// Type is the source type.
27+
// +kubebuilder:validation:Enum:=local;embedded
28+
// +kubebuilder:default:=embedded
29+
Type string `json:"type"`
30+
}
31+
32+
type SecretReference struct {
33+
Name string `json:"name"`
34+
Namespace string `json:"namespace"`
35+
}
36+
37+
type Commit struct {
38+
// Hash is the digest of the most recent commit
39+
// +kubebuilder:validation:Optional
40+
Hash string `json:"hash"`
41+
}
42+
43+
type GitRepositoryStatus struct {
44+
// LatestCommit is the most recent commit known to the controller
45+
// +kubebuilder:validation:Optional
46+
LatestCommit Commit `json:"commit"`
47+
// ExternalGitRepositoryUrl is the url for the in-cluster repository accessible from local machine.
48+
// +kubebuilder:validation:Optional
49+
ExternalGitRepositoryUrl string `json:"externalGitRepositoryUrl"`
50+
// GitRepositoryUrl is the url for the in-cluster repository accessible within the cluster.
51+
// +kubebuilder:validation:Optional
52+
GitRepositoryUrl string `json:"gitRepositoryUrl"`
53+
// Path is the path within the repository that contains the files.
54+
// +kubebuilder:validation:Optional
55+
Path string `json:"path"`
56+
57+
Synced bool `json:"synced"`
58+
}
59+
60+
// +kubebuilder:object:root=true
61+
// +kubebuilder:subresource:status
62+
type GitRepository struct {
63+
metav1.TypeMeta `json:",inline"`
64+
metav1.ObjectMeta `json:"metadata,omitempty"`
65+
66+
Spec GitRepositorySpec `json:"spec,omitempty"`
67+
Status GitRepositoryStatus `json:"status,omitempty"`
68+
}
69+
70+
// +kubebuilder:object:root=true
71+
type GitRepositoryList struct {
72+
metav1.TypeMeta `json:",inline"`
73+
metav1.ListMeta `json:"metadata,omitempty"`
74+
Items []GitRepository `json:"items"`
75+
}

api/v1alpha1/groupversion_info.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ var (
2121
func init() {
2222
SchemeBuilder.Register(&Localbuild{}, &LocalbuildList{})
2323
SchemeBuilder.Register(&GitServer{}, &GitServerList{})
24+
SchemeBuilder.Register(&GitRepository{}, &GitRepositoryList{})
2425
}

api/v1alpha1/localbuild_types.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,19 @@ type LocalbuildStatus struct {
4141
// +optional
4242
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
4343

44-
GitServerAvailable bool `json:"gitServerAvailable,omitempty"`
45-
ArgoAvailable bool `json:"argoAvailable,omitempty"`
46-
NginxAvailable bool `json:"nginxAvailable,omitempty"`
47-
GiteaAvailable bool `json:"giteaAvailable,omitempty"`
48-
ArgoAppsCreated bool `json:"argoAppsCreated,omitempty"`
49-
GiteaSecretName string `json:"giteaSecret,omitempty"`
44+
GitServerAvailable bool `json:"gitServerAvailable,omitempty"`
45+
ArgoAvailable bool `json:"argoAvailable,omitempty"`
46+
NginxAvailable bool `json:"nginxAvailable,omitempty"`
47+
ArgoAppsCreated bool `json:"argoAppsCreated,omitempty"`
48+
Gitea GiteaStatus `json:"giteaStatus,omitempty"`
49+
}
50+
51+
type GiteaStatus struct {
52+
Available bool `json:"available,omitempty"`
53+
ExternalURL string `json:"externalURL,omitempty"`
54+
InternalURL string `json:"internalURL,omitempty"`
55+
AdminUserSecretName string `json:"adminUserSecretNameecret,omitempty"`
56+
AdminUserSecretNamespace string `json:"adminUserSecretNamespace,omitempty"`
5057
}
5158

5259
// +kubebuilder:object:root=true

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 153 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ module github.com/cnoe-io/idpbuilder
33
go 1.20
44

55
require (
6+
code.gitea.io/sdk/gitea v0.16.0
67
github.com/argoproj/argo-cd/v2 v2.8.3
78
github.com/docker/docker v24.0.6+incompatible
89
github.com/docker/go-connections v0.4.0
10+
github.com/go-git/go-git/v5 v5.10.0
911
github.com/google/go-cmp v0.5.9
1012
github.com/spf13/cobra v1.7.0
1113
github.com/stretchr/testify v1.8.4
@@ -20,12 +22,13 @@ require (
2022
require (
2123
cloud.google.com/go/compute v1.19.1 // indirect
2224
cloud.google.com/go/compute/metadata v0.2.3 // indirect
25+
dario.cat/mergo v1.0.0 // indirect
2326
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
2427
github.com/BurntSushi/toml v1.0.0 // indirect
2528
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd // indirect
2629
github.com/Masterminds/semver/v3 v3.2.1 // indirect
2730
github.com/Microsoft/go-winio v0.6.1 // indirect
28-
github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 // indirect
31+
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
2932
github.com/acomagu/bufpipe v1.0.4 // indirect
3033
github.com/alessio/shellescape v1.4.1 // indirect
3134
github.com/argoproj/gitops-engine v0.7.1-0.20230607163028-425d65e07695 // indirect
@@ -38,7 +41,9 @@ require (
3841
github.com/chai2010/gettext-go v0.0.0-20170215093142-bf70f2a70fb1 // indirect
3942
github.com/cloudflare/circl v1.3.3 // indirect
4043
github.com/containerd/containerd v1.7.5 // indirect
44+
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
4145
github.com/davecgh/go-spew v1.1.1 // indirect
46+
github.com/davidmz/go-pageant v1.0.2 // indirect
4247
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
4348
github.com/docker/distribution v2.8.2+incompatible // indirect
4449
github.com/docker/go-units v0.5.0 // indirect
@@ -51,9 +56,9 @@ require (
5156
github.com/fsnotify/fsnotify v1.6.0 // indirect
5257
github.com/fvbommel/sortorder v1.0.1 // indirect
5358
github.com/go-errors/errors v1.4.2 // indirect
59+
github.com/go-fed/httpsig v1.1.0 // indirect
5460
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
55-
github.com/go-git/go-billy/v5 v5.4.1 // indirect
56-
github.com/go-git/go-git/v5 v5.7.0 // indirect
61+
github.com/go-git/go-billy/v5 v5.5.0 // indirect
5762
github.com/go-logr/logr v1.2.4 // indirect
5863
github.com/go-logr/zapr v1.2.0 // indirect
5964
github.com/go-openapi/jsonpointer v0.19.5 // indirect
@@ -74,6 +79,7 @@ require (
7479
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
7580
github.com/google/uuid v1.3.0 // indirect
7681
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
82+
github.com/hashicorp/go-version v1.5.0 // indirect
7783
github.com/imdario/mergo v0.3.16 // indirect
7884
github.com/inconshreveable/mousetrap v1.1.0 // indirect
7985
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
@@ -114,7 +120,7 @@ require (
114120
github.com/russross/blackfriday v1.6.0 // indirect
115121
github.com/sergi/go-diff v1.1.0 // indirect
116122
github.com/sirupsen/logrus v1.9.3 // indirect
117-
github.com/skeema/knownhosts v1.1.1 // indirect
123+
github.com/skeema/knownhosts v1.2.0 // indirect
118124
github.com/spf13/pflag v1.0.5 // indirect
119125
github.com/vmihailenco/go-tinylfu v0.2.2 // indirect
120126
github.com/vmihailenco/msgpack/v5 v5.3.4 // indirect
@@ -125,16 +131,16 @@ require (
125131
go.uber.org/atomic v1.7.0 // indirect
126132
go.uber.org/multierr v1.6.0 // indirect
127133
go.uber.org/zap v1.19.1 // indirect
128-
golang.org/x/crypto v0.10.0 // indirect
129-
golang.org/x/mod v0.9.0 // indirect
130-
golang.org/x/net v0.11.0 // indirect
134+
golang.org/x/crypto v0.14.0 // indirect
135+
golang.org/x/mod v0.12.0 // indirect
136+
golang.org/x/net v0.17.0 // indirect
131137
golang.org/x/oauth2 v0.9.0 // indirect
132138
golang.org/x/sync v0.3.0 // indirect
133-
golang.org/x/sys v0.9.0 // indirect
134-
golang.org/x/term v0.9.0 // indirect
135-
golang.org/x/text v0.10.0 // indirect
139+
golang.org/x/sys v0.13.0 // indirect
140+
golang.org/x/term v0.13.0 // indirect
141+
golang.org/x/text v0.13.0 // indirect
136142
golang.org/x/time v0.3.0 // indirect
137-
golang.org/x/tools v0.7.0 // indirect
143+
golang.org/x/tools v0.13.0 // indirect
138144
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
139145
google.golang.org/appengine v1.6.7 // indirect
140146
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect

0 commit comments

Comments
 (0)