Skip to content

bootstrap controller #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
*.swp
*~
.idea
bin
build
.env
READ_BEFORE_COMMIT.md
Empty file added ATTRIBUTION.md
Empty file.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
24 changes: 24 additions & 0 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
@@ -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)
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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}'
1 change: 1 addition & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

5 changes: 5 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See the OWNERS docs at https://go.k8s.io/owners

approvers:
- core-ack-team
- service-team
9 changes: 9 additions & 0 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
@@ -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
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 3 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 9 additions & 0 deletions generator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ignore:
resource_names:
- Access
- Agreement
- Connector
- Profile
- Server
- User
- Workflow
14 changes: 14 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
)
Empty file added go.sum
Empty file.
8 changes: 8 additions & 0 deletions metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
service:
full_name:
short_name:
link:
documentation:
api_versions:
- api_version: v1alpha1
status: available
40 changes: 40 additions & 0 deletions olm/olmconfig.yaml
Original file line number Diff line number Diff line change
@@ -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: "[email protected]"
links:
- name: Amazon Transfer Developer Resources
url: https://aws.amazon.com/Transfer/developer-resources/
Empty file added templates/.gitkeep
Empty file.
4 changes: 4 additions & 0 deletions test/e2e/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__pycache__/
*.py[cod]
**/bootstrap.yaml
**/bootstrap.pkl
34 changes: 34 additions & 0 deletions test/e2e/__init__.py
Original file line number Diff line number Diff line change
@@ -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)
32 changes: 32 additions & 0 deletions test/e2e/bootstrap_resources.py
Original file line number Diff line number Diff line change
@@ -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
45 changes: 45 additions & 0 deletions test/e2e/conftest.py
Original file line number Diff line number Diff line change
@@ -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')
18 changes: 18 additions & 0 deletions test/e2e/replacement_values.py
Original file line number Diff line number Diff line change
@@ -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 = {
}
1 change: 1 addition & 0 deletions test/e2e/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
acktest @ git+https://github.com/aws-controllers-k8s/test-infra.git@e119ae519f02048f3673e90b0482963c24a9699a
Empty file added test/e2e/resources/.gitkeep
Empty file.
39 changes: 39 additions & 0 deletions test/e2e/service_bootstrap.py
Original file line number Diff line number Diff line change
@@ -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)
Loading