Skip to content

Commit

Permalink
Merge pull request #2 from projectsyn/SYN-24_cluster_registry
Browse files Browse the repository at this point in the history
Finalising cluster logic and add unit tests
  • Loading branch information
Simon Rüegg authored Feb 5, 2020
2 parents 2ee9c01 + 2802d5d commit babaa33
Show file tree
Hide file tree
Showing 24 changed files with 528 additions and 274 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
_antora

build/_output/*
.vscode/
.idea/
17 changes: 0 additions & 17 deletions .vscode/launch.json

This file was deleted.

4 changes: 4 additions & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"os"
"runtime"
"time"

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
_ "k8s.io/client-go/plugin/pkg/client/auth"
Expand Down Expand Up @@ -90,10 +91,13 @@ func main() {
os.Exit(1)
}

duration := 30 * time.Second

// Create a new Cmd to provide shared dependencies and start components
mgr, err := manager.New(cfg, manager.Options{
Namespace: namespace,
MetricsBindAddress: fmt.Sprintf("%s:%d", metricsHost, metricsPort),
SyncPeriod: &duration,
})
if err != nil {
log.Error(err, "")
Expand Down
105 changes: 45 additions & 60 deletions deploy/crds/syn.tools_clusters_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ kind: CustomResourceDefinition
metadata:
name: clusters.syn.tools
spec:
additionalPrinterColumns:
- JSONPath: .spec.displayName
name: Display Name
type: string
- JSONPath: .spec.tenantRef.name
name: Tenant
type: string
group: syn.tools
names:
kind: Cluster
Expand Down Expand Up @@ -31,80 +38,55 @@ spec:
spec:
description: ClusterSpec defines the desired state of Cluster
properties:
apiEndpointSecretRef:
description: APIEndpointSecretRef references the secret containing connection
information to Kubernetes API endpoint of the registered Kubernetes
cluster.
properties:
name:
description: Name is unique within a namespace to reference a secret
resource.
type: string
namespace:
description: Namespace defines the space within which the secret
name must be unique.
type: string
type: object
displayName:
description: DisplayName of cluster which could be different from metadata.name.
Allows cluster renaming should it be needed.
type: string
facts:
additionalProperties:
description: FactValue is the value for the facts map
type: string
description: Facts are key/value pairs for statically configured facts
type: object
gitRepoTemplate:
description: GitRepoTemplate template for managing the GitRepo object.
properties:
spec:
description: GitRepoSpec defines the desired state of GitRepo
apiSecretRef:
description: APISecretRef reference to secret containing connection
information
properties:
apiSecretRef:
description: APISecretRef reference to secret containing connection
information
properties:
name:
description: Name is unique within a namespace to reference
a secret resource.
type: string
namespace:
description: Namespace defines the space within which the
secret name must be unique.
type: string
type: object
deployKeys:
description: DeployKeys optional list of SSH deploy keys. If
not set, not deploy keys will be configured
items:
description: DeployKey defines an SSH key to be used for git
operations.
properties:
key:
type: string
type:
type: string
writeAccess:
type: boolean
type: object
type: array
path:
description: Path to Git repository
name:
description: Name is unique within a namespace to reference
a secret resource.
type: string
repoName:
description: RepoName ame of Git repository
namespace:
description: Namespace defines the space within which the secret
name must be unique.
type: string
tenantRef:
description: TenantRef references the tenant this repo belongs
to
properties:
name:
type: string
namespace:
type: string
type: object
type: object
deployKeys:
additionalProperties:
description: DeployKey defines an SSH key to be used for git operations.
properties:
key:
type: string
type:
type: string
writeAccess:
type: boolean
type: object
description: DeployKeys optional list of SSH deploy keys. If not
set, not deploy keys will be configured
type: object
path:
description: Path to Git repository
type: string
repoName:
description: RepoName ame of Git repository
type: string
required:
- apiSecretRef
- path
- repoName
type: object
gitRepoURL:
description: GitRepoURL git repository storing the cluster configuration
Expand All @@ -115,13 +97,16 @@ spec:
to.
properties:
name:
type: string
namespace:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type: object
tokenLifeTime:
description: TokenLifetime set the token lifetime
type: string
required:
- displayName
- tenantRef
type: object
status:
description: ClusterStatus defines the observed state of Cluster
Expand Down
82 changes: 51 additions & 31 deletions deploy/crds/syn.tools_gitrepos_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ kind: CustomResourceDefinition
metadata:
name: gitrepos.syn.tools
spec:
additionalPrinterColumns:
- JSONPath: .spec.repoName
name: Repo Name
type: string
- JSONPath: .status.phase
name: Phase
type: string
group: syn.tools
names:
kind: GitRepo
Expand Down Expand Up @@ -31,47 +38,60 @@ spec:
spec:
description: GitRepoSpec defines the desired state of GitRepo
properties:
apiSecretRef:
description: APISecretRef reference to secret containing connection
information
gitRepoTemplate:
description: GitRepoTemplate is used for templating git repos, it does
not contain the tenantRef as it will be added by the controller creating
the template instance.
properties:
name:
description: Name is unique within a namespace to reference a secret
resource.
apiSecretRef:
description: APISecretRef reference to secret containing connection
information
properties:
name:
description: Name is unique within a namespace to reference
a secret resource.
type: string
namespace:
description: Namespace defines the space within which the secret
name must be unique.
type: string
type: object
deployKeys:
additionalProperties:
description: DeployKey defines an SSH key to be used for git operations.
properties:
key:
type: string
type:
type: string
writeAccess:
type: boolean
type: object
description: DeployKeys optional list of SSH deploy keys. If not
set, not deploy keys will be configured
type: object
path:
description: Path to Git repository
type: string
namespace:
description: Namespace defines the space within which the secret
name must be unique.
repoName:
description: RepoName ame of Git repository
type: string
required:
- apiSecretRef
- path
- repoName
type: object
deployKeys:
description: DeployKeys optional list of SSH deploy keys. If not set,
not deploy keys will be configured
items:
description: DeployKey defines an SSH key to be used for git operations.
properties:
key:
type: string
type:
type: string
writeAccess:
type: boolean
type: object
type: array
path:
description: Path to Git repository
type: string
repoName:
description: RepoName ame of Git repository
type: string
tenantRef:
description: TenantRef references the tenant this repo belongs to
properties:
name:
type: string
namespace:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type: object
required:
- gitRepoTemplate
- tenantRef
type: object
status:
description: GitRepoStatus defines the observed state of GitRepo
Expand Down
Loading

0 comments on commit babaa33

Please sign in to comment.