Skip to content

Commit

Permalink
Run init make commands and update the readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
etesami committed Aug 29, 2024
1 parent 6996a39 commit f9591a2
Show file tree
Hide file tree
Showing 29 changed files with 66 additions and 786 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ====================================================================================
# Setup Project
PROJECT_NAME := provider-template
PROJECT_NAME := provider-ssh
PROJECT_REPO := github.com/crossplane/$(PROJECT_NAME)

PLATFORMS ?= linux_amd64 linux_arm64
Expand Down Expand Up @@ -30,7 +30,7 @@ GO111MODULE = on
# ====================================================================================
# Setup Images

IMAGES = provider-template
IMAGES = provider-ssh
-include build/makelib/imagelight.mk

# ====================================================================================
Expand All @@ -40,12 +40,12 @@ XPKG_REG_ORGS ?= xpkg.upbound.io/crossplane
# NOTE(hasheddan): skip promoting on xpkg.upbound.io as channel tags are
# inferred.
XPKG_REG_ORGS_NO_PROMOTE ?= xpkg.upbound.io/crossplane
XPKGS = provider-template
XPKGS = provider-ssh
-include build/makelib/xpkg.mk

# NOTE(hasheddan): we force image building to happen prior to xpkg build so that
# we ensure image is present in daemon.
xpkg.build.provider-template: do.build.images
xpkg.build.provider-ssh: do.build.images

fallthrough: submodules
@echo Initial setup complete. Running make again . . .
Expand Down Expand Up @@ -93,9 +93,9 @@ dev: $(KIND) $(KUBECTL)
@$(KUBECTL) cluster-info --context kind-$(PROJECT_NAME)-dev
@$(INFO) Installing Crossplane CRDs
@$(KUBECTL) apply --server-side -k https://github.com/crossplane/crossplane//cluster?ref=master
@$(INFO) Installing Provider Template CRDs
@$(INFO) Installing Provider SSH CRDs
@$(KUBECTL) apply -R -f package/crds
@$(INFO) Starting Provider Template controllers
@$(INFO) Starting Provider SSH controllers
@$(GO) run cmd/provider/main.go --debug

dev-clean: $(KIND) $(KUBECTL)
Expand All @@ -120,7 +120,7 @@ $(GOMPLATE):

export GOMPLATE

# This target prepares repo for your provider by replacing all "template"
# This target prepares repo for your provider by replacing all "ssh"
# occurrences with your provider name.
# This target can only be run once, if you want to rerun for some reason,
# consider stashing/resetting your git state.
Expand Down
24 changes: 12 additions & 12 deletions PROVIDER_CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ Generally projects are named `provider-<name>`, with `name` being the API being
managed. Example project names are `provider-aws`, `provider-kubernetes`,
and `provider-github`.

The [provider-template](https://github.com/crossplane/provider-template) repository can be
The [provider-ssh](https://github.com/crossplane/provider-ssh) repository can be
used as a starting point for new providers. For [terrajet](https://github.com/crossplane/terrajet)-based providers, the
[provider-jet-template](https://github.com/crossplane-contrib/provider-jet-template) is
[provider-jet-ssh](https://github.com/crossplane-contrib/provider-jet-ssh) is
available.

## Files
Expand All @@ -43,17 +43,17 @@ Most Crossplane providers include the following files:
[provider-gcp/README.md](https://github.com/crossplane/provider-gcp/blob/master/README.md)
as an example)
- [ ] Code is licensed under the [Apache 2.0
License](https://github.com/crossplane/provider-template/blob/main/LICENSE)
License](https://github.com/crossplane/provider-ssh/blob/main/LICENSE)
- [ ] Include a “Developer Certificate of Origin”. Example:
[DCO](https://github.com/upbound/build/blob/master/DCO)
- [ ] Include the CNCF [Code of
Conduct](https://github.com/crossplane/crossplane/blob/master/CODE_OF_CONDUCT.md)
- [ ] Update
[OWNERS.md](https://github.com/crossplane/provider-template/blob/main/OWNERS.md)
[OWNERS.md](https://github.com/crossplane/provider-ssh/blob/main/OWNERS.md)
with contacts for project Owners
- [ ] Ensure `hack/boilerplate.go.txt` (used in Code generation) includes
Crossplane Authors, Apache license and any other Copyright statements:
[https://github.com/crossplane/provider-template/blob/main/hack/boilerplate.go.txt](https://github.com/crossplane/provider-template/blob/main/hack/boilerplate.go.txt)
[https://github.com/crossplane/provider-ssh/blob/main/hack/boilerplate.go.txt](https://github.com/crossplane/provider-ssh/blob/main/hack/boilerplate.go.txt)
- [ ] Include Documentation on how to:
- [ ] Install Provider
- [ ] Contribute to Development
Expand All @@ -68,7 +68,7 @@ There are a number of build tools and processes that are common across the
Crossplane ecosystem. Using these ensures a consistent development environment
across projects.

The [provider-template](https://github.com/crossplane/provider-template)
The [provider-ssh](https://github.com/crossplane/provider-ssh)
repository contains most of these settings.

- [ ] Use the [Upbound build](https://github.com/upbound/build) submodule. (see
Expand All @@ -81,7 +81,7 @@ repository contains most of these settings.
- [ ] Create a [Crossplane
Package](https://crossplane.io/docs/master/concepts/packages.html)
configuration (see
[package/crossplane.yaml)](https://github.com/crossplane/provider-template/blob/main/package/crossplane.yaml)
[package/crossplane.yaml)](https://github.com/crossplane/provider-ssh/blob/main/package/crossplane.yaml)

## Deployment of Artifacts

Expand All @@ -96,7 +96,7 @@ the publish and promotion workflows.
In general, providers should:

- [ ] Utilize GitHub workflows from
<https://github.com/crossplane/provider-template/tree/main/.github/workflows>
<https://github.com/crossplane/provider-ssh/tree/main/.github/workflows>
- [ ] Create OCI image repos to push Package and Controller images.
- [ ] Automatically push Provider images and packages via CI
- [ ] Add GitHub Secrets to push to Docker repository. (To be performed by
Expand All @@ -112,7 +112,7 @@ to grant your project access to the GitHub org scoped secrets.

- [ ] Follow recommendations at
[https://github.com/crossplane/crossplane/blob/master/GOVERNANCE.md#repository-governance](https://github.com/crossplane/crossplane/blob/master/GOVERNANCE.md#repository-governance)
- [ ] Enable Issues on your project and configure Issue templates (examples at:
[.github/ISSUE_TEMPLATE](https://github.com/crossplane/provider-template/tree/master/.github/ISSUE_TEMPLATE))
- [ ] Create Pull Request Templates: (example:
[PULL_REQUEST_TEMPLATE.md](https://github.com/crossplane/provider-template/blob/master/.github/PULL_REQUEST_TEMPLATE.md))
- [ ] Enable Issues on your project and configure Issue sshs (examples at:
[.github/ISSUE_TEMPLATE](https://github.com/crossplane/provider-ssh/tree/master/.github/ISSUE_TEMPLATE))
- [ ] Create Pull Request SSHs: (example:
[PULL_REQUEST_TEMPLATE.md](https://github.com/crossplane/provider-ssh/blob/master/.github/PULL_REQUEST_TEMPLATE.md))
45 changes: 12 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,17 @@
# provider-template
# provider-ssh

`provider-template` is a minimal [Crossplane](https://crossplane.io/) Provider
that is meant to be used as a template for implementing new Providers. It comes
with the following features that are meant to be refactored:
The `provider-ssh` is a Crossplane provider designed for executing scripts on a remote machine over SSH.

- A `ProviderConfig` type that only points to a credentials `Secret`.
- A `MyType` resource type that serves as an example managed resource.
- A managed resource controller that reconciles `MyType` objects and simply
prints their configuration in its `Observe` method.
The SSH provider adds support for `Script` resources with a `managementPolicy` of `Observe`. This means `Script` resources do not manage any external resources, instead they are used only to execute scripts on and fetch data from an external source.

## Developing
The `provider-ssh` requires:

1. Use this repository as a template to create a new one.
1. Run `make submodules` to initialize the "build" Make submodule we use for CI/CD.
1. Rename the provider by running the following command:
```shell
export provider_name=MyProvider # Camel case, e.g. GitHub
make provider.prepare provider=${provider_name}
```
4. Add your new type by running the following command:
```shell
export group=sample # lower case e.g. core, cache, database, storage, etc.
export type=MyType # Camel casee.g. Bucket, Database, CacheCluster, etc.
make provider.addtype provider=${provider_name} group=${group} kind=${type}
```
5. Replace the *sample* group with your new group in apis/{provider}.go
5. Replace the *mytype* type with your new type in internal/controller/{provider}.go
5. Replace the default controller and ProviderConfig implementations with your own
5. Run `make reviewable` to run code generation, linters, and tests.
5. Run `make build` to build the provider.
- A `ProviderConfig` type that references a credentials `Secret`, which contains the remote machine's `IP`, `Port`, and `Username` and `Private Key`.
- A `Script` resource type that includes the script to be executed and any variables
with their corresponding values. These variables will be replaced with actual values
before the script is sent to the remote machine.
- A managed resource controller that reconciles `Script` objects, by connecting
to the target machine, executing the scripts, and writing the output (`stdout` and `stderr`)
back to the respective status fields of the object.

Refer to Crossplane's [CONTRIBUTING.md] file for more information on how the
Crossplane community prefers to work. The [Provider Development][provider-dev]
guide may also be of use.

[CONTRIBUTING.md]: https://github.com/crossplane/crossplane/blob/master/CONTRIBUTING.md
[provider-dev]: https://github.com/crossplane/crossplane/blob/master/contributing/guide-provider-development.md
> Feel free to submit any issues you encounter.
18 changes: 0 additions & 18 deletions apis/sample/sample.go

This file was deleted.

17 changes: 0 additions & 17 deletions apis/sample/v1alpha1/doc.go

This file was deleted.

40 changes: 0 additions & 40 deletions apis/sample/v1alpha1/groupversion_info.go

This file was deleted.

87 changes: 0 additions & 87 deletions apis/sample/v1alpha1/mytype_types.go

This file was deleted.

Loading

0 comments on commit f9591a2

Please sign in to comment.