This repository has been archived by the owner on Nov 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from christopherhein/feature/5-add-s3bucket
Adding S3Bucket Resource
- Loading branch information
Showing
17 changed files
with
1,212 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: operator.aws/v1alpha1 | ||
kind: S3Bucket | ||
metadata: | ||
name: chrishein-test-bucket-104 | ||
spec: | ||
bucketName: chrishein-test-bucket-name-104 | ||
versioning: false | ||
logging: | ||
enabled: false | ||
prefix: "archive" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
apiVersion: operator.aws/v1alpha1 | ||
kind: ModelDefinition | ||
metadata: | ||
name: S3BucketResource | ||
spec: | ||
kind: S3Bucket | ||
type: Spec # can be Spec or Data | ||
queue: true | ||
useCloudFormation: true | ||
resource: | ||
name: s3bucket | ||
plural: s3buckets | ||
shortNames: | ||
- name: s3 | ||
- name: bucket | ||
- name: buckets | ||
body: | ||
schema: | ||
type: object | ||
properties: | ||
- key: bucketName | ||
type: string | ||
description: | | ||
BucketName is the name of the S3 Bucket to be created. | ||
structKey: BucketName | ||
templateKey: BucketName | ||
- key: versioning | ||
type: bool | ||
description: | | ||
Versioning specifies if whether you want to automatically enable versioning of the content in the bucket. | ||
structKey: Versioning | ||
templateKey: EnableVersioning | ||
- key: logging | ||
type: object | ||
description: | | ||
Logging defines the options for managing the S3 logging options. | ||
structKey: Logging | ||
templateKey: logging | ||
properties: | ||
- key: enabled | ||
type: bool | ||
description: | | ||
Logging Enabled configures the S3 Bucket to log to a separate Logging bucket | ||
structKey: Enabled | ||
templateKey: EnableLogging | ||
- key: prefix | ||
type: string | ||
description: | | ||
Logging prefix to attach to all logs in the bucket. | ||
structKey: Prefix | ||
templateKey: LoggingPrefix | ||
output: | ||
schema: | ||
type: object | ||
properties: | ||
- key: bucketName | ||
type: string | ||
description: | | ||
BucketName is the output bucketname incase it changed | ||
structKey: BucketName | ||
templateKey: BucketName | ||
- key: bucketARN | ||
type: string | ||
description: | | ||
BucketARN is the full Amazon ARN for the bucket created | ||
structKey: BucketARN | ||
templateKey: BucketArn | ||
# additionalResources: | ||
# services: | ||
# - type: ExternalName | ||
# externalName: "{{.Obj.Spec.BucketName}}.s3-{{.Config.Region}}.amazonaws.com" | ||
# ports: | ||
# - protocol: tcp | ||
# port: 443 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
) | ||
|
||
// +genclient | ||
// +genclient:noStatus | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// S3Bucket defines the base resource | ||
type S3Bucket struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata"` | ||
Spec S3BucketSpec `json:"spec"` | ||
Status S3BucketStatus `json:"status"` | ||
Output S3BucketOutput `json:"output"` | ||
AdditionalResources S3BucketAdditionalResources `json:"additionalResources"` | ||
} | ||
// S3BucketLogging defines the Logging resource for S3Bucket | ||
type S3BucketLogging struct { | ||
Enabled bool `json:"enabled"` | ||
Prefix string `json:"prefix"` | ||
} | ||
|
||
// S3BucketSpec defines the Spec resource for S3Bucket | ||
type S3BucketSpec struct { | ||
CloudFormationTemplateName string `json:"cloudFormationTemplateName"` | ||
CloudFormationTemplateNamespace string `json:"cloudFormationTemplateNamespace"` | ||
BucketName string `json:"bucketName"` | ||
Versioning bool `json:"versioning"` | ||
Logging S3BucketLogging `json:"logging"` | ||
} | ||
|
||
|
||
// S3BucketOutput defines the output resource for S3Bucket | ||
type S3BucketOutput struct { | ||
BucketName string `json:"bucketName"` | ||
BucketARN string `json:"bucketARN"` | ||
} | ||
|
||
// S3BucketStatus holds the status of the Cloudformation template | ||
type S3BucketStatus struct { | ||
ResourceStatus string `json:"resourceStatus"` | ||
ResourceStatusReason string `json:"resourceStatusReason"` | ||
StackID string `json:"stackID"` | ||
} | ||
|
||
// S3BucketAdditionalResources holds the additional resources | ||
type S3BucketAdditionalResources struct { | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// S3BucketList defines the list attribute for the S3Bucket type | ||
type S3BucketList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata"` | ||
Items []S3Bucket `json:"items"` | ||
} | ||
|
||
func init() { | ||
localSchemeBuilder.Register(addS3BucketTypes) | ||
} | ||
|
||
func addS3BucketTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&S3Bucket{}, | ||
&S3BucketList{}, | ||
) | ||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion) | ||
return nil | ||
} |
144 changes: 144 additions & 0 deletions
144
pkg/apis/operator.aws/v1alpha1/zz_generated.deepcopy.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
pkg/client/clientset/versioned/typed/operator.aws/v1alpha1/fake/fake_operator.aws_client.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.