Skip to content

Commit

Permalink
feat(provider) initial generation
Browse files Browse the repository at this point in the history
  • Loading branch information
transacid committed Mar 22, 2024
1 parent 2a7cfde commit 0c44014
Show file tree
Hide file tree
Showing 286 changed files with 30,109 additions and 1,519 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on:

env:
# Common versions
GO_VERSION: '1.19'
GOLANGCI_VERSION: 'v1.50.0'
GO_VERSION: '1.21'
GOLANGCI_VERSION: 'v1.57.1'
DOCKER_BUILDX_VERSION: 'v0.8.2'

# Common users. We can't run a step 'if secrets.XXX != ""' but we can run a
Expand Down Expand Up @@ -100,9 +100,10 @@ jobs:
# We could run 'make lint' but we prefer this action because it leaves
# 'annotations' (i.e. it comments on PRs to point out linter violations).
- name: Lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: ${{ env.GOLANGCI_VERSION }}
skip-cache: true

check-diff:
runs-on: ubuntu-22.04
Expand Down
23 changes: 11 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ run:
deadline: 10m

skip-files:
- "zz_\\..+\\.go$"
- "zz_\\..+\\.go$"

output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
Expand Down Expand Up @@ -107,11 +107,11 @@ linters:
- megacheck
- govet
- gocyclo
- gocritic
# - gocritic # disable for now
- interfacer
- goconst
- goimports
- gofmt # We enable this as well as goimports for its simplify mode.
- gofmt # We enable this as well as goimports for its simplify mode.
- prealloc
- golint
- unconvert
Expand All @@ -123,7 +123,6 @@ linters:
- unused
fast: false


issues:
# Excluding configuration per-path and per-linter
exclude-rules:
Expand All @@ -136,7 +135,7 @@ issues:
- gosec
- scopelint
- unparam

# Ease some gocritic warnings on test files.
- path: _test\.go
text: "(unnamedResult|exitAfterDefer)"
Expand All @@ -148,31 +147,31 @@ issues:
# rather than using a pointer.
- text: "(hugeParam|rangeValCopy):"
linters:
- gocritic
- gocritic

# This "TestMain should call os.Exit to set exit code" warning is not clever
# enough to notice that we call a helper method that calls os.Exit.
- text: "SA3000:"
linters:
- staticcheck
- staticcheck

- text: "k8s.io/api/core/v1"
linters:
- goimports
- goimports

# This is a "potential hardcoded credentials" warning. It's triggered by
# any variable with 'secret' in the same, and thus hits a lot of false
# positives in Kubernetes land where a Secret is an object type.
- text: "G101:"
linters:
- gosec
- gas
- gosec
- gas

# This is an 'errors unhandled' warning that duplicates errcheck.
- text: "G104:"
linters:
- gosec
- gas
- gosec
- gas

# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# See also OWNERS.md for governance details

# Fallback owners
* @ulucinar @sergenyalcin
* @transacid
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [YEAR] Upbound Inc. All rights reserved.
Copyright 2024 Upbound Inc. 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.
Expand Down
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# ====================================================================================
# Setup Project

PROJECT_NAME ?= upjet-provider-template
PROJECT_REPO ?= github.com/upbound/$(PROJECT_NAME)
PROJECT_NAME ?= provider-hcloud
PROJECT_REPO ?= github.com/transacid/$(PROJECT_NAME)

export TERRAFORM_VERSION ?= 1.2.1
export TERRAFORM_VERSION ?= 1.7.4

export TERRAFORM_PROVIDER_SOURCE ?= hashicorp/null
export TERRAFORM_PROVIDER_REPO ?= https://github.com/hashicorp/terraform-provider-null
export TERRAFORM_PROVIDER_VERSION ?= 3.1.0
export TERRAFORM_PROVIDER_DOWNLOAD_NAME ?= terraform-provider-null
export TERRAFORM_PROVIDER_SOURCE ?= hetznercloud/hcloud
export TERRAFORM_PROVIDER_REPO ?= https://github.com/hetznercloud/terraform-provider-hcloud
export TERRAFORM_PROVIDER_VERSION ?= 1.45.0
export TERRAFORM_PROVIDER_DOWNLOAD_NAME ?= terraform-provider-hcloud
export TERRAFORM_PROVIDER_DOWNLOAD_URL_PREFIX ?= https://releases.hashicorp.com/$(TERRAFORM_PROVIDER_DOWNLOAD_NAME)/$(TERRAFORM_PROVIDER_VERSION)
export TERRAFORM_NATIVE_PROVIDER_BINARY ?= terraform-provider-null_v3.1.0_x5
export TERRAFORM_DOCS_PATH ?= docs/resources
export TERRAFORM_NATIVE_PROVIDER_BINARY ?= terraform-provider-hcloud_v1.45.0
export TERRAFORM_DOCS_PATH ?= website/docs/r


PLATFORMS ?= linux_amd64 linux_arm64
Expand Down Expand Up @@ -40,7 +40,7 @@ NPROCS ?= 1
# to half the number of CPU cores.
GO_TEST_PARALLEL := $(shell echo $$(( $(NPROCS) / 2 )))

GO_REQUIRED_VERSION ?= 1.19
GO_REQUIRED_VERSION ?= 1.21
GOLANGCILINT_VERSION ?= 1.50.0
GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/provider $(GO_PROJECT)/cmd/generator
GO_LDFLAGS += -X $(GO_PROJECT)/internal/version.Version=$(VERSION)
Expand Down Expand Up @@ -89,7 +89,7 @@ fallthrough: submodules

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

# NOTE(hasheddan): we ensure up is installed prior to running platform-specific
# build steps in parallel to avoid encountering an installation race condition.
Expand Down Expand Up @@ -169,7 +169,7 @@ CROSSPLANE_NAMESPACE = upbound-system
# This target requires the following environment variables to be set:
# - UPTEST_EXAMPLE_LIST, a comma-separated list of examples to test
# To ensure the proper functioning of the end-to-end test resource pre-deletion hook, it is crucial to arrange your resources appropriately.
# You can check the basic implementation here: https://github.com/upbound/uptest/blob/main/internal/templates/01-delete.yaml.tmpl.
# You can check the basic implementation here: https://github.com/upbound/uptest/blob/main/internal/hclouds/01-delete.yaml.tmpl.
# - UPTEST_CLOUD_CREDENTIALS (optional), multiple sets of AWS IAM User credentials specified as key=value pairs.
# The support keys are currently `DEFAULT` and `PEER`. So, an example for the value of this env. variable is:
# DEFAULT='[default]
Expand Down
4 changes: 2 additions & 2 deletions OWNERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ organization](https://github.com/upbound/) will list their repository maintainer

## Maintainers

* Alper Ulucinar <alper@upbound.com> ([ulucinar](https://github.com/ulucinar))
* Sergen Yalcin <sergen@upbound.com> ([sergenyalcin](https://github.com/sergenyalcin))
* Boris Petersen <bp@boris-petersen.de> ([transacid](https://github.com/transacid))


See [CODEOWNERS](./CODEOWNERS) for automatic PR assignment.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Provider Template
# Provider hCloud

`upjet-provider-template` is a [Crossplane](https://crossplane.io/) provider that
`provider-hcloud` is a [Crossplane](https://crossplane.io/) provider that
is built using [Upjet](https://github.com/crossplane/upjet) code
generation tools and exposes XRM-conformant managed resources for the
Template API.
hCloud API.

## Getting Started

Install the provider by using the following command after changing the image tag
to the [latest release](https://marketplace.upbound.io/providers/upbound/upjet-provider-template):
to the [latest release](https://marketplace.upbound.io/providers/transacid/provider-hcloud):
```
up ctp provider install upbound/upjet-provider-template:v0.1.0
up ctp provider install transacid/provider-hcloud:v0.1.0
```

Alternatively, you can use declarative installation:
Expand All @@ -19,15 +19,15 @@ cat <<EOF | kubectl apply -f -
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: upjet-provider-template
name: provider-hcloud
spec:
package: upbound/upjet-provider-template:v0.1.0
package: transacid/provider-hcloud:v0.1.0
EOF
```

Notice that in this example Provider resource is referencing ControllerConfig with debug enabled.

You can see the API reference [here](https://doc.crds.dev/github.com/upbound/upjet-provider-template).
You can see the API reference [here](https://doc.crds.dev/github.com/transacid/provider-hcloud).

## Developing

Expand Down Expand Up @@ -57,4 +57,4 @@ make build
## Report a Bug

For filing bugs, suggesting improvements, or requesting new features, please
open an [issue](https://github.com/upbound/upjet-provider-template/issues).
open an [issue](https://github.com/transacid/provider-hcloud/issues).
129 changes: 129 additions & 0 deletions apis/firewall/v1alpha1/zz_firewall_terraformed.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0c44014

Please sign in to comment.