diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..22dbccb --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,13 @@ +name: Create Release + +on: + push: + tags: + - "v*.*.*" + +permissions: + contents: write # For creating releases + +jobs: + call-create-release: + uses: aws-controllers-k8s/.github/.github/workflows/reusable-create-release.yaml@main diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b82694a --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.DS_Store +*.swp +*~ +.idea +bin +build +.env +READ_BEFORE_COMMIT.md diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md new file mode 100644 index 0000000..e69de29 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c4b6a1c..99fd57d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,4 +56,4 @@ If you discover a potential security issue in this project we ask that you notif ## Licensing -See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. +See the [LICENSE](/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. diff --git a/GOVERNANCE.md b/GOVERNANCE.md new file mode 100644 index 0000000..b883940 --- /dev/null +++ b/GOVERNANCE.md @@ -0,0 +1,24 @@ +# Project governance + +This document lays out the guidelines under which the AWS Controllers for Kubernetes (ACK) project will be governed. +The goal is to make sure that the roles and responsibilities are well defined and clarify on how decisions are made. + +## Communication + +The primary mechanism for communication will be via the `#provider-aws` channel on the Kubernetes Slack community. +All features and bug fixes will be tracked as issues in GitHub. All decisions will be documented in GitHub issues. + +In the future, we may consider using a public mailing list, which can be better archived. + +## Roadmap Planning + +Maintainers will share roadmap and release versions as milestones in GitHub. + +## Release Management + +The Advisory Board will propose a release management proposal via a GitHub issue and resolve it there. + +## Other relevant governance resources + +* The ACK [Contributing Guidelines](CONTRIBUTING.md) +* Our [Code of Conduct](CODE_OF_CONDUCT.md) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0953c01 --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +SHELL := /bin/bash # Use bash syntax + +# Set up variables +GO111MODULE=on + +# Build ldflags +VERSION ?= "v0.0.0" +GITCOMMIT=$(shell git rev-parse HEAD) +BUILDDATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') +GO_LDFLAGS=-ldflags "-X main.version=$(VERSION) \ + -X main.buildHash=$(GITCOMMIT) \ + -X main.buildDate=$(BUILDDATE)" + +.PHONY: all test + +all: test + +test: ## Run code tests + go test -v ./... + +help: ## Show this help. + @grep -F -h "##" $(MAKEFILE_LIST) | grep -F -v grep | sed -e 's/\\$$//' \ + | awk -F'[:#]' '{print $$1 = sprintf("%-30s", $$1), $$4}' diff --git a/NOTICE b/NOTICE index 616fc58..cbf924b 100644 --- a/NOTICE +++ b/NOTICE @@ -1 +1,2 @@ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + diff --git a/OWNERS b/OWNERS new file mode 100644 index 0000000..ba901dc --- /dev/null +++ b/OWNERS @@ -0,0 +1,5 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: + - core-ack-team + - service-team diff --git a/OWNERS_ALIASES b/OWNERS_ALIASES new file mode 100644 index 0000000..b898572 --- /dev/null +++ b/OWNERS_ALIASES @@ -0,0 +1,9 @@ +# See the OWNERS docs at https://go.k8s.io/owners#owners_aliases + +aliases: + core-ack-team: + - a-hilaly + - jlbutler + - michaelhtm + - rushmash91 + - knottnt \ No newline at end of file diff --git a/README.md b/README.md index 847260c..44fe286 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,26 @@ -## My Project +# ACK service controller for AWS Transfer Family -TODO: Fill this README out! +This repository contains source code for the AWS Controllers for Kubernetes +(ACK) service controller for AWS Transfer. -Be sure to: +Please [log issues][ack-issues] and feedback on the main AWS Controllers for +Kubernetes Github project. -* Change the title in this README -* Edit your repository description on GitHub +[ack-issues]: https://github.com/aws/aws-controllers-k8s/issues -## Security +## Contributing -See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. +We welcome community contributions and pull requests. -## License +See our [contribution guide](/CONTRIBUTING.md) for more information on how to +report issues, set up a development environment, and submit code. + +We adhere to the [Amazon Open Source Code of Conduct][coc]. + +You can also learn more about our [Governance](/GOVERNANCE.md) structure. -This project is licensed under the Apache-2.0 License. +[coc]: https://aws.github.io/code-of-conduct + +## License +This project is [licensed](/LICENSE) under the Apache-2.0 License. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..2c8325b --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,3 @@ +# Security issue notifications + +If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. diff --git a/generator.yaml b/generator.yaml new file mode 100644 index 0000000..06274df --- /dev/null +++ b/generator.yaml @@ -0,0 +1,9 @@ +ignore: + resource_names: + - Access + - Agreement + - Connector + - Profile + - Server + - User + - Workflow diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..5be67be --- /dev/null +++ b/go.mod @@ -0,0 +1,14 @@ +module github.com/aws-controllers-k8s/transfer-controller + +go 1.19 + +require ( + github.com/aws-controllers-k8s/runtime v0.46.1 + github.com/aws/aws-sdk-go v1.55.7 + github.com/go-logr/logr v1.2.0 + github.com/spf13/pflag v1.0.5 + k8s.io/api v0.23.0 + k8s.io/apimachinery v0.23.0 + k8s.io/client-go v0.23.0 + sigs.k8s.io/controller-runtime v0.11.0 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..e69de29 diff --git a/metadata.yaml b/metadata.yaml new file mode 100644 index 0000000..ba0d580 --- /dev/null +++ b/metadata.yaml @@ -0,0 +1,8 @@ +service: + full_name: + short_name: + link: + documentation: +api_versions: + - api_version: v1alpha1 + status: available diff --git a/olm/olmconfig.yaml b/olm/olmconfig.yaml new file mode 100644 index 0000000..7529607 --- /dev/null +++ b/olm/olmconfig.yaml @@ -0,0 +1,40 @@ +# This configuration is a placeholder. Replace any values with relevant values for your +# service controller project. +--- +annotations: + capabilityLevel: Basic Install + shortDescription: AWS Transfer controller is a service controller for managing Transfer resources + in Kubernetes +displayName: AWS Controllers for Kubernetes - Amazon Transfer +description: |- + Manage Amazon Transfer resources in AWS from within your Kubernetes cluster. + + + **About Amazon Transfer** + + + {ADD YOUR DESCRIPTION HERE} + + + **About the AWS Controllers for Kubernetes** + + + This controller is a component of the [AWS Controller for Kubernetes](https://github.com/aws/aws-controllers-k8s) + project. This project is currently in **developer preview**. + + + **Pre-Installation Steps** + + + Please follow the following link: [Red Hat OpenShift](https://aws-controllers-k8s.github.io/community/docs/user-docs/openshift/) +samples: +- kind: ExampleCustomKind + spec: '{}' +- kind: SecondExampleCustomKind + spec: '{}' +maintainers: +- name: "transfer maintainer team" + email: "ack-maintainers@amazon.com" +links: +- name: Amazon Transfer Developer Resources + url: https://aws.amazon.com/Transfer/developer-resources/ diff --git a/templates/.gitkeep b/templates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/e2e/.gitignore b/test/e2e/.gitignore new file mode 100644 index 0000000..92c35a4 --- /dev/null +++ b/test/e2e/.gitignore @@ -0,0 +1,4 @@ +__pycache__/ +*.py[cod] +**/bootstrap.yaml +**/bootstrap.pkl diff --git a/test/e2e/__init__.py b/test/e2e/__init__.py new file mode 100644 index 0000000..cb5bc34 --- /dev/null +++ b/test/e2e/__init__.py @@ -0,0 +1,34 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may +# not use this file except in compliance with the License. A copy of the +# License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. + +import pytest +from typing import Dict, Any +from pathlib import Path + +from acktest.resources import load_resource_file + +SERVICE_NAME = "transfer" +CRD_GROUP = "transfer.services.k8s.aws" +CRD_VERSION = "v1alpha1" + +# PyTest marker for the current service +service_marker = pytest.mark.service(arg=SERVICE_NAME) + +bootstrap_directory = Path(__file__).parent +resource_directory = Path(__file__).parent / "resources" + +def load_transfer_resource(resource_name: str, additional_replacements: Dict[str, Any] = {}): + """ Overrides the default `load_resource_file` to access the specific resources + directory for the current service. + """ + return load_resource_file(resource_directory, resource_name, additional_replacements=additional_replacements) diff --git a/test/e2e/bootstrap_resources.py b/test/e2e/bootstrap_resources.py new file mode 100644 index 0000000..450a769 --- /dev/null +++ b/test/e2e/bootstrap_resources.py @@ -0,0 +1,32 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may +# not use this file except in compliance with the License. A copy of the +# License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. + +"""Declares the structure of the bootstrapped resources and provides a loader +for them. +""" + +from dataclasses import dataclass +from acktest.bootstrapping import Resources +from e2e import bootstrap_directory + +@dataclass +class BootstrapResources(Resources): + pass + +_bootstrap_resources = None + +def get_bootstrap_resources(bootstrap_file_name: str = "bootstrap.pkl") -> BootstrapResources: + global _bootstrap_resources + if _bootstrap_resources is None: + _bootstrap_resources = BootstrapResources.deserialize(bootstrap_directory, bootstrap_file_name=bootstrap_file_name) + return _bootstrap_resources diff --git a/test/e2e/conftest.py b/test/e2e/conftest.py new file mode 100644 index 0000000..b810c52 --- /dev/null +++ b/test/e2e/conftest.py @@ -0,0 +1,45 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may +# not use this file except in compliance with the License. A copy of the +# License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. + +import boto3 +import pytest + +from acktest import k8s + +def pytest_addoption(parser): + parser.addoption("--runslow", action="store_true", default=False, help="run slow tests") + +def pytest_configure(config): + config.addinivalue_line( + "markers", "service(arg): mark test associated with a given service" + ) + config.addinivalue_line( + "markers", "slow: mark test as slow to run" + ) + +def pytest_collection_modifyitems(config, items): + if config.getoption("--runslow"): + return + skip_slow = pytest.mark.skip(reason="need --runslow option to run") + for item in items: + if "slow" in item.keywords: + item.add_marker(skip_slow) + +# Provide a k8s client to interact with the integration test cluster +@pytest.fixture(scope='class') +def k8s_client(): + return k8s._get_k8s_api_client() + +@pytest.fixture(scope='module') +def transfer_client(): + return boto3.client('transfer') diff --git a/test/e2e/replacement_values.py b/test/e2e/replacement_values.py new file mode 100644 index 0000000..e082d9b --- /dev/null +++ b/test/e2e/replacement_values.py @@ -0,0 +1,18 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may +# not use this file except in compliance with the License. A copy of the +# License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. +"""Stores the values used by each of the integration tests for replacing the +Transfer-specific test variables. +""" + +REPLACEMENT_VALUES = { +} diff --git a/test/e2e/requirements.txt b/test/e2e/requirements.txt new file mode 100644 index 0000000..2497c94 --- /dev/null +++ b/test/e2e/requirements.txt @@ -0,0 +1 @@ +acktest @ git+https://github.com/aws-controllers-k8s/test-infra.git@e119ae519f02048f3673e90b0482963c24a9699a diff --git a/test/e2e/resources/.gitkeep b/test/e2e/resources/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/e2e/service_bootstrap.py b/test/e2e/service_bootstrap.py new file mode 100644 index 0000000..7de7976 --- /dev/null +++ b/test/e2e/service_bootstrap.py @@ -0,0 +1,39 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may +# not use this file except in compliance with the License. A copy of the +# License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. +"""Bootstraps the resources required to run the Transfer integration tests. +""" +import logging + +from acktest.bootstrapping import Resources, BootstrapFailureException + +from e2e import bootstrap_directory +from e2e.bootstrap_resources import BootstrapResources + +def service_bootstrap() -> Resources: + logging.getLogger().setLevel(logging.INFO) + + resources = BootstrapResources( + # TODO: Add bootstrapping when you have defined the resources + ) + + try: + resources.bootstrap() + except BootstrapFailureException as ex: + exit(254) + + return resources + +if __name__ == "__main__": + config = service_bootstrap() + # Write config to current directory by default + config.serialize(bootstrap_directory) diff --git a/test/e2e/service_cleanup.py b/test/e2e/service_cleanup.py new file mode 100644 index 0000000..d765f51 --- /dev/null +++ b/test/e2e/service_cleanup.py @@ -0,0 +1,30 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may +# not use this file except in compliance with the License. A copy of the +# License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. + +"""Cleans up the resources created by the bootstrapping process. +""" + +import logging + +from acktest.bootstrapping import Resources + +from e2e import bootstrap_directory + +def service_cleanup(): + logging.getLogger().setLevel(logging.INFO) + + resources = Resources.deserialize(bootstrap_directory) + resources.cleanup() + +if __name__ == "__main__": + service_cleanup() diff --git a/test/e2e/tests/.gitkeep b/test/e2e/tests/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/e2e/tests/__init__.py b/test/e2e/tests/__init__.py new file mode 100644 index 0000000..97b6b43 --- /dev/null +++ b/test/e2e/tests/__init__.py @@ -0,0 +1,12 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may +# not use this file except in compliance with the License. A copy of the +# License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License.