Skip to content

Commit

Permalink
CRD adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Kidswiss committed Feb 5, 2020
1 parent 4316176 commit 2802d5d
Show file tree
Hide file tree
Showing 13 changed files with 169 additions and 199 deletions.
80 changes: 33 additions & 47 deletions deploy/crds/syn.tools_clusters_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,57 +50,43 @@ spec:
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:
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
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:
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:
- apiSecretRef
- path
- repoName
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 Down
73 changes: 41 additions & 32 deletions deploy/crds/syn.tools_gitrepos_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,49 @@ 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:
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
tenantRef:
description: TenantRef references the tenant this repo belongs to
properties:
Expand All @@ -80,9 +90,8 @@ spec:
type: string
type: object
required:
- apiSecretRef
- path
- repoName
- gitRepoTemplate
- tenantRef
type: object
status:
description: GitRepoStatus defines the observed state of GitRepo
Expand Down
80 changes: 33 additions & 47 deletions deploy/crds/syn.tools_tenants_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,57 +42,43 @@ spec:
description: GitRepoTemplate Template for managing the GitRepo object.
If not set, no GitRepo object will be created.
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:
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
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:
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:
- apiSecretRef
- path
- repoName
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 tenant configuration.
Expand Down
21 changes: 10 additions & 11 deletions deploy/crds/syn.tools_v1alpha1_cluster_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ spec:
displayName: Big Corp. Production Cluster
slug: prodcluster
gitRepoTemplate:
spec:
path: test
repoName: test
apiSecretRef:
key: my-api-secret
name: default
deployKeys:
test:
type: ssh-ed25519
key: AAAA...
writeAccess: true
path: test
repoName: test
apiSecretRef:
key: my-api-secret
name: default
deployKeys:
test:
type: ssh-ed25519
key: AAAA...
writeAccess: true
tenantRef:
name: aezoo6
tokenLifeTime: 4h
Expand Down
11 changes: 7 additions & 4 deletions deploy/crds/syn.tools_v1alpha1_gitrepo_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ kind: GitRepo
metadata:
name: example-gitrepo
spec:
apiSecretRef:
name: test
path: test
repoName: test
gitRepoTemplate:
apiSecretRef:
name: test
path: test
repoName: test
tenantRef:
name: test
29 changes: 14 additions & 15 deletions deploy/crds/syn.tools_v1alpha1_tenant_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ spec:
slug: bigcorp
displayName: Big Corp.
gitRepoTemplate:
spec:
path: test
repoName: test
apiSecretRef:
key: my-api-secret
name: default
deployKeys:
test:
type: ssh-ed25519
key: AAAA...
writeAccess: true
test2:
type: ssh-rsa
key: AAAA...
writeAccess: false
path: test
repoName: test
apiSecretRef:
key: my-api-secret
name: default
deployKeys:
test:
type: ssh-ed25519
key: AAAA...
writeAccess: true
test2:
type: ssh-rsa
key: AAAA...
writeAccess: false
2 changes: 1 addition & 1 deletion pkg/apis/syn/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type ClusterSpec struct {
// GitRepoTemplate template for managing the GitRepo object.
GitRepoTemplate *GitRepoTemplate `json:"gitRepoTemplate,omitempty"`
// TenantRef reference to Tenant object the cluster belongs to.
TenantRef *corev1.LocalObjectReference `json:"tenantRef"`
TenantRef corev1.LocalObjectReference `json:"tenantRef"`
// TokenLifetime set the token lifetime
TokenLifeTime string `json:"tokenLifeTime,omitempty"`
// Facts are key/value pairs for statically configured facts
Expand Down
17 changes: 9 additions & 8 deletions pkg/apis/syn/v1alpha1/gitrepo_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,22 @@ func (g GitType) IsValid() bool {

// GitRepoSpec defines the desired state of GitRepo
type GitRepoSpec struct {
GitRepoTemplate `json:"gitRepoTemplate"`
// TenantRef references the tenant this repo belongs to
TenantRef corev1.LocalObjectReference `json:"tenantRef"`
}

// 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.
type GitRepoTemplate struct {
// APISecretRef reference to secret containing connection information
APISecretRef *corev1.SecretReference `json:"apiSecretRef"`
APISecretRef corev1.SecretReference `json:"apiSecretRef"`
// DeployKeys optional list of SSH deploy keys. If not set, not deploy keys will be configured
DeployKeys map[string]DeployKey `json:"deployKeys,omitempty"`
// Path to Git repository
Path string `json:"path"`
// RepoName ame of Git repository
RepoName string `json:"repoName"`
// TenantRef references the tenant this repo belongs to
TenantRef *corev1.LocalObjectReference `json:"tenantRef,omitempty"`
}

// DeployKey defines an SSH key to be used for git operations.
Expand Down Expand Up @@ -76,11 +82,6 @@ type GitRepoConditions struct {
Type string `json:"type,omitempty"`
}

// GitRepoTemplate contains a GitRepoSpec for use in other CRDs
type GitRepoTemplate struct {
Spec GitRepoSpec `json:"spec,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// GitRepo is the Schema for the gitrepos API
Expand Down
Loading

0 comments on commit 2802d5d

Please sign in to comment.