Skip to content

Commit

Permalink
Merge pull request #139 from mbaldessari/git-clone
Browse files Browse the repository at this point in the history
Fix sharedValueFiles templating and add support for private repos
  • Loading branch information
mbaldessari authored Dec 12, 2023
2 parents 69972c8 + 222a6b4 commit 352aa85
Show file tree
Hide file tree
Showing 175 changed files with 28,521 additions and 73 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/gosec.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ linters-settings:
threshold: 100
funlen:
lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner.
statements: 60
statements: 80
goconst:
min-len: 2
min-occurrences: 3
Expand All @@ -29,7 +29,7 @@ linters-settings:
- octalLiteral
- whyNoLint
gocyclo:
min-complexity: 32
min-complexity: 45
gofmt:
rewrite-rules:
- pattern: 'interface{}'
Expand Down
23 changes: 16 additions & 7 deletions api/v1alpha1/pattern_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,8 @@ type PatternSpec struct {

type GitConfig struct {
// Account string `json:"account,omitempty"`
// TokenSecret string `json:"tokenSecret,omitempty"`
// TokenSecretNamespace string `json:"tokenSecretNamespace,omitempty"`
// TokenSecretKey string `json:"tokenSecretKey,omitempty"`

// Git repo containing the pattern to deploy. Must use https/http
// Git repo containing the pattern to deploy. Must use https/http or, for ssh, git@server:foo/bar.git
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=1
TargetRepo string `json:"targetRepo"`

Expand All @@ -111,11 +108,21 @@ type GitConfig struct {
// Optional. FQDN of the git server if automatic parsing from TargetRepo is broken
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=6
Hostname string `json:"hostname,omitempty"`

// Optional. K8s secret name where the info for connecting to git can be found. The supported secrets are modeled after the
// private repositories in argo (https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#repositories)
// currently ssh and username+password are supported
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=7
TokenSecret string `json:"tokenSecret,omitempty"`

// Optional. K8s secret namespace where the token for connecting to git can be found
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=8
TokenSecretNamespace string `json:"tokenSecretNamespace,omitempty"`
}

type MultiSourceConfig struct {
// (EXPERIMENTAL) Enable multi-source support when deploying the clustergroup argo application
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=7,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=9,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
// +kubebuilder:default:=true
Enabled *bool `json:"enabled,omitempty"`

Expand All @@ -129,12 +136,12 @@ type MultiSourceConfig struct {

// The url when deploying the clustergroup helm chart directly from a git repo
// Defaults to '' which means not used (Only used when developing the clustergroup helm chart)
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=10,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldDependency:multiSourceConfig.enabled:true"}
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=12,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldDependency:multiSourceConfig.enabled:true"}
ClusterGroupGitRepoUrl string `json:"clusterGroupGitRepoUrl,omitempty"`

// The git reference when deploying the clustergroup helm chart directly from a git repo
// Defaults to 'main'. (Only used when developing the clustergroup helm chart)
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=11,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldDependency:multiSourceConfig.enabled:true"}
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=13,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldDependency:multiSourceConfig.enabled:true"}
// +kubebuilder:default:="main"
ClusterGroupChartGitRevision string `json:"clusterGroupChartGitRevision,omitempty"`
}
Expand Down Expand Up @@ -194,6 +201,8 @@ type PatternStatus struct {
AnalyticsSent int `json:"analyticsSent,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=status
AnalyticsUUID string `json:"analyticsUUID,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=status
LocalCheckoutPath string `json:"path,omitempty"`
}

// See: https://book.kubebuilder.io/reference/markers/crd.html
Expand Down
14 changes: 13 additions & 1 deletion bundle/manifests/gitops.hybrid-cloud-patterns.io_patterns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,22 @@ spec:
type: integer
targetRepo:
description: Git repo containing the pattern to deploy. Must use
https/http
https/http or, for ssh, git@server:foo/bar.git
type: string
targetRevision:
description: 'Branch, tag, or commit to deploy. Does not support
short-sha''s. Default: HEAD'
type: string
tokenSecret:
description: Optional. K8s secret name where the info for connecting
to git can be found. The supported secrets are modeled after
the private repositories in argo (https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#repositories)
currently ssh and username+password are supported
type: string
tokenSecretNamespace:
description: Optional. K8s secret namespace where the token for
connecting to git can be found
type: string
required:
- targetRepo
type: object
Expand Down Expand Up @@ -211,6 +221,8 @@ spec:
lastStep:
description: Last action related to the pattern
type: string
path:
type: string
version:
description: Number of updates to the pattern
type: integer
Expand Down
30 changes: 28 additions & 2 deletions bundle/manifests/patterns-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ spec:
- displayName: Name
path: extraParameters[0].name
- description: Git repo containing the pattern to deploy. Must use https/http
or, for ssh, git@server:foo/bar.git
displayName: Target Repo
path: gitSpec.targetRepo
- displayName: Value
Expand Down Expand Up @@ -84,14 +85,28 @@ spec:
- description: URLs to additional Helm parameter files
displayName: Extra Value Files
path: extraValueFiles
- description: Optional. K8s secret name where the info for connecting to git
can be found. The supported secrets are modeled after the private repositories
in argo (https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#repositories)
currently ssh and username+password are supported
displayName: Token Secret
path: gitSpec.tokenSecret
- displayName: Git Ops Config
path: gitOpsSpec
- description: Optional. K8s secret namespace where the token for connecting
to git can be found
displayName: Token Secret Namespace
path: gitSpec.tokenSecretNamespace
- description: Analytics UUID. Leave empty to autogenerate a random one. Not
PII information
displayName: Analytics UUID
path: analyticsUUID
- description: (EXPERIMENTAL) Enable multi-source support when deploying the
clustergroup argo application
displayName: Enabled
path: multiSourceConfig.enabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- displayName: Git Ops Config
path: gitOpsSpec
- description: The helm chart url to fetch the helm charts from in order to
deploy the pattern. Defaults to https://charts.validatedpatterns.io/
displayName: Helm Repo Url
Expand Down Expand Up @@ -149,6 +164,8 @@ spec:
- description: Last action related to the pattern
displayName: Last Step
path: lastStep
- displayName: Local Checkout Path
path: path
- description: Number of updates to the pattern
displayName: Version
path: version
Expand Down Expand Up @@ -176,6 +193,15 @@ spec:
verbs:
- get
- list
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
- get
- update
- watch
- apiGroups:
- argoproj.io
resources:
Expand Down
14 changes: 13 additions & 1 deletion config/crd/bases/gitops.hybrid-cloud-patterns.io_patterns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,22 @@ spec:
type: integer
targetRepo:
description: Git repo containing the pattern to deploy. Must use
https/http
https/http or, for ssh, git@server:foo/bar.git
type: string
targetRevision:
description: 'Branch, tag, or commit to deploy. Does not support
short-sha''s. Default: HEAD'
type: string
tokenSecret:
description: Optional. K8s secret name where the info for connecting
to git can be found. The supported secrets are modeled after
the private repositories in argo (https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#repositories)
currently ssh and username+password are supported
type: string
tokenSecretNamespace:
description: Optional. K8s secret namespace where the token for
connecting to git can be found
type: string
required:
- targetRepo
type: object
Expand Down Expand Up @@ -211,6 +221,8 @@ spec:
lastStep:
description: Last action related to the pattern
type: string
path:
type: string
version:
description: Number of updates to the pattern
type: integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spec:
- displayName: Name
path: extraParameters[0].name
- description: Git repo containing the pattern to deploy. Must use https/http
or, for ssh, git@server:foo/bar.git
displayName: Target Repo
path: gitSpec.targetRepo
- displayName: Value
Expand Down Expand Up @@ -64,14 +65,28 @@ spec:
- description: URLs to additional Helm parameter files
displayName: Extra Value Files
path: extraValueFiles
- description: Optional. K8s secret name where the info for connecting to git
can be found. The supported secrets are modeled after the private repositories
in argo (https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#repositories)
currently ssh and username+password are supported
displayName: Token Secret
path: gitSpec.tokenSecret
- displayName: Git Ops Config
path: gitOpsSpec
- description: Optional. K8s secret namespace where the token for connecting
to git can be found
displayName: Token Secret Namespace
path: gitSpec.tokenSecretNamespace
- description: Analytics UUID. Leave empty to autogenerate a random one. Not
PII information
displayName: Analytics UUID
path: analyticsUUID
- description: (EXPERIMENTAL) Enable multi-source support when deploying the
clustergroup argo application
displayName: Enabled
path: multiSourceConfig.enabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- displayName: Git Ops Config
path: gitOpsSpec
- description: The helm chart url to fetch the helm charts from in order to
deploy the pattern. Defaults to https://charts.validatedpatterns.io/
displayName: Helm Repo Url
Expand Down Expand Up @@ -129,6 +144,8 @@ spec:
- description: Last action related to the pattern
displayName: Last Step
path: lastStep
- displayName: Local Checkout Path
path: path
- description: Number of updates to the pattern
displayName: Version
path: version
Expand Down
9 changes: 9 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ rules:
verbs:
- get
- list
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
- get
- update
- watch
- apiGroups:
- argoproj.io
resources:
Expand Down
Loading

0 comments on commit 352aa85

Please sign in to comment.