Skip to content

Commit

Permalink
Clean up Required/Optional API Fields (kptdev#2778)
Browse files Browse the repository at this point in the history
Git branch and directory can be optional (defaulting to `main` and `/` respectively,
while `SecretRef.Name` is required since nameless secret reference is unhelpful.
  • Loading branch information
martinmaly committed Feb 18, 2022
1 parent c47b355 commit 9a08e95
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
branch:
description: Name of the branch containig the packages. Finalized
packages will be committed to this branch (if the repository
allows write access).
allows write access). If unspecified, defaults to "main".
type: string
directory:
description: Directory within the Git repository where the packages
Expand All @@ -85,10 +85,10 @@ spec:
be located in the same namespace as the resource containing
the reference.
type: string
required:
- name
type: object
required:
- branch
- directory
- repo
type: object
mutators:
Expand Down Expand Up @@ -139,6 +139,8 @@ spec:
be located in the same namespace as the resource containing
the reference.
type: string
required:
- name
type: object
required:
- registry
Expand All @@ -161,7 +163,7 @@ spec:
branch:
description: Name of the branch containig the packages. Finalized
packages will be committed to this branch (if the repository
allows write access).
allows write access). If unspecified, defaults to "main".
type: string
directory:
description: Directory within the Git repository where the
Expand All @@ -181,10 +183,10 @@ spec:
to be located in the same namespace as the resource
containing the reference.
type: string
required:
- name
type: object
required:
- branch
- directory
- repo
type: object
oci:
Expand All @@ -203,6 +205,8 @@ spec:
to be located in the same namespace as the resource
containing the reference.
type: string
required:
- name
type: object
required:
- registry
Expand Down
8 changes: 4 additions & 4 deletions porch/controllers/pkg/apis/porch/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ type GitRepository struct {
// Address of the Git repository, for example:
// `https://github.com/GoogleCloudPlatform/blueprints.git`
Repo string `json:"repo"`
// Name of the branch containig the packages. Finalized packages will be committed to this branch (if the repository allows write access).
Branch string `json:"branch"`
// Name of the branch containig the packages. Finalized packages will be committed to this branch (if the repository allows write access). If unspecified, defaults to "main".
Branch string `json:"branch,omitempty"`
// Directory within the Git repository where the packages are stored. A subdirectory of this directory containing a Kptfile is considered a package. If unspecified, defaults to root directory.
Directory string `json:"directory"`
Directory string `json:"directory,omitempty"`
// Reference to secret containing authentication credentials.
SecretRef SecretRef `json:"secretRef,omitempty"`
}
Expand Down Expand Up @@ -124,7 +124,7 @@ type RepositoryRef struct {

type SecretRef struct {
// Name of the secret. The secret is expected to be located in the same namespace as the resource containing the reference.
Name string `json:"name,omitempty"`
Name string `json:"name"`
}

type FunctionEval struct {
Expand Down

0 comments on commit 9a08e95

Please sign in to comment.