Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor the source spec validation #1122

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/helm-sync/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ var (
flIncludeCRDs = flag.String("include-crds", os.Getenv(reconcilermanager.HelmIncludeCRDs),
"include CRDs in the helm rendering output")
flAuth = flag.String("auth", util.EnvString(reconcilermanager.HelmAuthType, string(configsync.AuthNone)),
fmt.Sprintf("the authentication type for access to the Helm repository. Must be one of %s, %s, %s, %s or %s. Defaults to %s",
configsync.AuthGCPServiceAccount, configsync.AuthK8sServiceAccount, configsync.AuthToken, configsync.AuthGCENode, configsync.AuthNone, configsync.AuthNone))
fmt.Sprintf("the authentication type for access to the Helm repository. Must be one of %s. Defaults to %s",
configsync.SupportedAuthTypes(configsync.HelmSource), configsync.AuthNone))
flReleaseName = flag.String("release-name", os.Getenv(reconcilermanager.HelmReleaseName),
"the name of helm release")
flNamespace = flag.String("namespace", os.Getenv(reconcilermanager.HelmReleaseNamespace),
Expand Down
3 changes: 1 addition & 2 deletions cmd/hydration-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"k8s.io/klog/v2"
"k8s.io/klog/v2/klogr"
"kpt.dev/configsync/pkg/api/configsync"
"kpt.dev/configsync/pkg/api/configsync/v1beta1"
"kpt.dev/configsync/pkg/hydrate"
"kpt.dev/configsync/pkg/importer/filesystem/cmpath"
"kpt.dev/configsync/pkg/kmetrics"
Expand Down Expand Up @@ -111,7 +110,7 @@ func main() {

hydrator := &hydrate.Hydrator{
DonePath: absDonePath,
SourceType: v1beta1.SourceType(*sourceType),
SourceType: configsync.SourceType(*sourceType),
SourceRoot: absSourceRootDir,
HydratedRoot: absHydratedRootDir,
SourceLink: *sourceLinkDir,
Expand Down
15 changes: 8 additions & 7 deletions cmd/nomos/status/cluster_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"kpt.dev/configsync/cmd/nomos/util"
v1 "kpt.dev/configsync/pkg/api/configmanagement/v1"
"kpt.dev/configsync/pkg/api/configsync"
"kpt.dev/configsync/pkg/api/configsync/v1beta1"
"kpt.dev/configsync/pkg/reposync"
"kpt.dev/configsync/pkg/rootsync"
Expand Down Expand Up @@ -75,7 +76,7 @@ func unavailableCluster(ref string) *ClusterState {
type RepoState struct {
scope string
syncName string
sourceType v1beta1.SourceType
sourceType configsync.SourceType
git *v1beta1.Git
oci *v1beta1.Oci
helm *v1beta1.HelmBase
Expand Down Expand Up @@ -133,13 +134,13 @@ func (r *RepoState) printRows(writer io.Writer) {
}
}

func sourceString(sourceType v1beta1.SourceType, git *v1beta1.Git, oci *v1beta1.Oci, helm *v1beta1.HelmBase) string {
func sourceString(sourceType configsync.SourceType, git *v1beta1.Git, oci *v1beta1.Oci, helm *v1beta1.HelmBase) string {
switch sourceType {
case v1beta1.OciSource:
case configsync.OciSource:
return ociString(oci)
case v1beta1.HelmSource:
case configsync.HelmSource:
return helmString(helm)
case v1beta1.GitSource:
case configsync.GitSource:
return gitString(git)
}
return gitString(git)
Expand Down Expand Up @@ -307,7 +308,7 @@ func namespaceRepoStatus(rs *v1beta1.RepoSync, rg *unstructured.Unstructured, sy
repostate := &RepoState{
scope: rs.Namespace,
syncName: rs.Name,
sourceType: v1beta1.SourceType(rs.Spec.SourceType),
sourceType: configsync.SourceType(rs.Spec.SourceType),
git: rs.Spec.Git,
oci: rs.Spec.Oci,
helm: reposync.GetHelmBase(rs.Spec.Helm),
Expand Down Expand Up @@ -409,7 +410,7 @@ func RootRepoStatus(rs *v1beta1.RootSync, rg *unstructured.Unstructured, syncing
repostate := &RepoState{
scope: "<root>",
syncName: rs.Name,
sourceType: v1beta1.SourceType(rs.Spec.SourceType),
sourceType: configsync.SourceType(rs.Spec.SourceType),
git: rs.Spec.Git,
oci: rs.Spec.Oci,
helm: rootsync.GetHelmBase(rs.Spec.Helm),
Expand Down
Loading