Skip to content
This repository was archived by the owner on Nov 7, 2019. It is now read-only.

Commit ee15428

Browse files
author
Christopher Hein
authored
Merge pull request #51 from christopherhein/feature/45-ecr-registry
Adding Support For Creating ECR Repos
2 parents 79aefff + b4e9c44 commit ee15428

File tree

20 files changed

+1155
-2
lines changed

20 files changed

+1155
-2
lines changed

cloudformation/ecrrepository.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
AWSTemplateFormatVersion: 2010-09-09
2+
Description: 'AWS Service Broker - Amazon SNS (qs-1nt0fs93c)'
3+
Parameters:
4+
Namespace:
5+
Description: >-
6+
This is the namespace for the Kubernetes object.
7+
Type: String
8+
ResourceVersion:
9+
Type: String
10+
Description: >-
11+
This is the resource version for the Kubernetes object.
12+
ResourceName:
13+
Description: >-
14+
This is the resource name for the Kubernetes object
15+
Type: String
16+
ClusterName:
17+
Description: >-
18+
This is the cluster name for the operator
19+
Type: String
20+
RepositoryName:
21+
Type: String
22+
Description: >-
23+
What should the ECR Repository be named
24+
Resources:
25+
ECRRepository:
26+
Type: AWS::ECR::Repository
27+
Properties:
28+
RepositoryName: !Ref RepositoryName
29+
30+
Outputs:
31+
RepositoryName:
32+
Value: !Ref ECRRepository
33+
Description: Name of the topic

examples/ecrrepository.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: operator.aws/v1alpha1
2+
kind: ECRRepository
3+
metadata:
4+
name: aws-operator

models/ecrrepository.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
apiVersion: operator.aws/v1alpha1
2+
kind: ModelDefinition
3+
metadata:
4+
name: ECRRepositoryResource
5+
spec:
6+
kind: ECRRepository
7+
type: Spec # can be Spec or Data
8+
queue: true
9+
useCloudFormation: true
10+
resource:
11+
name: ecrrepository
12+
plural: ecrrepositories
13+
shortNames:
14+
- name: ecr
15+
- name: repository
16+
body:
17+
schema:
18+
type: object
19+
properties:
20+
- key: repositoryName
21+
type: resourceName
22+
description: |
23+
A name for the image repository. If you don't specify a name, AWS
24+
CloudFormation generates a unique physical ID and uses that ID for
25+
the repository name. For more information, see Name Type.
26+
structKey: RepositoryName
27+
templateKey: RepositoryName
28+
# - key: lifecyclePolicy
29+
# type: string
30+
# description: |
31+
# A lifecycle policy for the repository.
32+
# structKey: LifecyclePolicy
33+
# templateKey: LifecyclePolicy
34+
# - key: repositoryPolicy
35+
# type: string
36+
# description: |
37+
# A policy that controls who has access to the repository and which
38+
# actions they can perform on it. For more information, see Amazon ECR
39+
# Repository Policies in the Amazon Elastic Container Registry User
40+
# Guide.
41+
# structKey: repositoryPolicy
42+
# templateKey: repositoryPolicy
43+
44+
output:
45+
schema:
46+
type: object
47+
properties:
48+
- key: repositoryName
49+
type: string
50+
description: |
51+
A name for the image repository. If you don't specify a name, AWS
52+
CloudFormation generates a unique physical ID and uses that ID for
53+
the repository name. For more information, see Name Type.
54+
structKey: RepositoryName
55+
templateKey: RepositoryName

pkg/apis/operator.aws/v1alpha1/dynamodb.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ type DynamoDBRangeAttribute struct {
3434
type DynamoDBSpec struct {
3535
CloudFormationTemplateName string `json:"cloudFormationTemplateName"`
3636
CloudFormationTemplateNamespace string `json:"cloudFormationTemplateNamespace"`
37-
TableName string `json:"tableName"`
3837
RangeAttribute DynamoDBRangeAttribute `json:"rangeAttribute"`
3938
ReadCapacityUnits int `json:"readCapacityUnits"`
4039
WriteCapacityUnits int `json:"writeCapacityUnits"`
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package v1alpha1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
"k8s.io/apimachinery/pkg/runtime"
6+
)
7+
8+
// +genclient
9+
// +genclient:noStatus
10+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
11+
12+
// ECRRepository defines the base resource
13+
type ECRRepository struct {
14+
metav1.TypeMeta `json:",inline"`
15+
metav1.ObjectMeta `json:"metadata"`
16+
Spec ECRRepositorySpec `json:"spec"`
17+
Status ECRRepositoryStatus `json:"status"`
18+
Output ECRRepositoryOutput `json:"output"`
19+
AdditionalResources ECRRepositoryAdditionalResources `json:"additionalResources"`
20+
}
21+
// ECRRepositorySpec defines the Spec resource for ECRRepository
22+
type ECRRepositorySpec struct {
23+
CloudFormationTemplateName string `json:"cloudFormationTemplateName"`
24+
CloudFormationTemplateNamespace string `json:"cloudFormationTemplateNamespace"`
25+
}
26+
27+
28+
// ECRRepositoryOutput defines the output resource for ECRRepository
29+
type ECRRepositoryOutput struct {
30+
RepositoryName string `json:"repositoryName"`
31+
}
32+
33+
// ECRRepositoryStatus holds the status of the Cloudformation template
34+
type ECRRepositoryStatus struct {
35+
ResourceStatus string `json:"resourceStatus"`
36+
ResourceStatusReason string `json:"resourceStatusReason"`
37+
StackID string `json:"stackID"`
38+
}
39+
40+
// ECRRepositoryAdditionalResources holds the additional resources
41+
type ECRRepositoryAdditionalResources struct {
42+
}
43+
44+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
45+
46+
// ECRRepositoryList defines the list attribute for the ECRRepository type
47+
type ECRRepositoryList struct {
48+
metav1.TypeMeta `json:",inline"`
49+
metav1.ListMeta `json:"metadata"`
50+
Items []ECRRepository `json:"items"`
51+
}
52+
53+
func init() {
54+
localSchemeBuilder.Register(addECRRepositoryTypes)
55+
}
56+
57+
func addECRRepositoryTypes(scheme *runtime.Scheme) error {
58+
scheme.AddKnownTypes(SchemeGroupVersion,
59+
&ECRRepository{},
60+
&ECRRepositoryList{},
61+
)
62+
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
63+
return nil
64+
}

pkg/apis/operator.aws/v1alpha1/s3bucket.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ type S3BucketLogging struct {
2828
type S3BucketSpec struct {
2929
CloudFormationTemplateName string `json:"cloudFormationTemplateName"`
3030
CloudFormationTemplateNamespace string `json:"cloudFormationTemplateNamespace"`
31-
BucketName string `json:"bucketName"`
3231
Versioning bool `json:"versioning"`
3332
Logging S3BucketLogging `json:"logging"`
3433
}

pkg/apis/operator.aws/v1alpha1/zz_generated.deepcopy.go

Lines changed: 127 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)