Skip to content

Commit a3ef8ff

Browse files
authored
Merge pull request #11 from oracle-samples/upjet-update
Update the oci crossplane provider with Upjet
2 parents 5271670 + dbf11c4 commit a3ef8ff

File tree

840 files changed

+126964
-29424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

840 files changed

+126964
-29424
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.work/
2+
.cache/

CODE_OF_CONDUCT.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Code of Conduct
2+
3+
Upjet is under [the Apache 2.0 license](LICENSE) with [notice](NOTICE).

Makefile

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
# ====================================================================================
22
# Setup Project
33

4-
PROJECT_NAME := provider-jet-oci
5-
PROJECT_REPO := github.com/crossplane-contrib/$(PROJECT_NAME)
4+
PROJECT_NAME := provider-oci
5+
PROJECT_REPO := github.com/oracle/$(PROJECT_NAME)
66

7-
export TERRAFORM_VERSION := 1.1.6
7+
export TERRAFORM_VERSION := 1.3.3
88

99
export TERRAFORM_PROVIDER_SOURCE := oracle/oci
10-
export TERRAFORM_PROVIDER_VERSION := 4.96.0
10+
export TERRAFORM_PROVIDER_REPO := https://github.com/oracle/terraform-provider-oci
11+
export TERRAFORM_PROVIDER_VERSION := 4.112.0
1112
export TERRAFORM_PROVIDER_DOWNLOAD_NAME := terraform-provider-oci
12-
export TERRAFORM_PROVIDER_DOWNLOAD_URL_PREFIX := https://releases.hashicorp.com/terraform-provider-oci/4.96.0
13-
export TERRAFORM_NATIVE_PROVIDER_BINARY := terraform-provider-oci_v4.96.0
13+
export TERRAFORM_NATIVE_PROVIDER_BINARY := terraform-provider-oci_v4.112.0
14+
export TERRAFORM_PROVIDER_DOWNLOAD_URL_PREFIX := https://releases.hashicorp.com/terraform-provider-oci/4.112.0
15+
export TERRAFORM_DOCS_PATH := website/docs/r
1416

15-
PLATFORMS ?= linux_amd64 linux_arm64
17+
#PLATFORMS ?= linux_amd64 linux_arm64
18+
PLATFORMS ?= darwin_amd64
1619

1720
# -include will silently skip missing files, which allows us
1821
# to load those files with a target in the Makefile. If only
@@ -37,24 +40,46 @@ NPROCS ?= 1
3740
# to half the number of CPU cores.
3841
GO_TEST_PARALLEL := $(shell echo $$(( $(NPROCS) / 2 )))
3942

40-
GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/provider
43+
GO_REQUIRED_VERSION ?= 1.19
44+
GOLANGCILINT_VERSION ?= 1.50.0
45+
GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/provider $(GO_PROJECT)/cmd/generator
4146
GO_LDFLAGS += -X $(GO_PROJECT)/internal/version.Version=$(VERSION)
4247
GO_SUBDIRS += cmd internal apis
43-
GO111MODULE = on
4448
-include build/makelib/golang.mk
4549

4650
# ====================================================================================
4751
# Setup Kubernetes tools
4852

53+
KIND_VERSION = v0.15.0
54+
UP_VERSION = v0.14.0
55+
UP_CHANNEL = stable
56+
UPTEST_VERSION = v0.2.1
4957
-include build/makelib/k8s_tools.mk
5058

5159
# ====================================================================================
5260
# Setup Images
5361

54-
#DOCKER_REGISTRY ?= crossplane
55-
DOCKER_REGISTRY = hyd.ocir.io/axddifxif86p
56-
IMAGES = provider-jet-oci provider-jet-oci-controller
57-
-include build/makelib/image.mk
62+
REGISTRY_ORGS ?= xpkg.upbound.io/upbound
63+
IMAGES = $(PROJECT_NAME)
64+
-include build/makelib/imagelight.mk
65+
66+
# ====================================================================================
67+
# Setup XPKG
68+
69+
XPKG_REG_ORGS ?= xpkg.upbound.io/upbound
70+
# NOTE(hasheddan): skip promoting on xpkg.upbound.io as channel tags are
71+
# inferred.
72+
XPKG_REG_ORGS_NO_PROMOTE ?= xpkg.upbound.io/upbound
73+
XPKGS = $(PROJECT_NAME)
74+
-include build/makelib/xpkg.mk
75+
76+
# NOTE(hasheddan): we force image building to happen prior to xpkg build so that
77+
# we ensure image is present in daemon.
78+
xpkg.build.provider-oci: do.build.images
79+
80+
# NOTE(hasheddan): we ensure up is installed prior to running platform-specific
81+
# build steps in parallel to avoid encountering an installation race condition.
82+
build.init: $(UP)
5883

5984
# ====================================================================================
6085
# Fallthrough
@@ -93,9 +118,16 @@ $(TERRAFORM_PROVIDER_SCHEMA): $(TERRAFORM)
93118
@$(TERRAFORM) -chdir=$(TERRAFORM_WORKDIR) providers schema -json=true > $(TERRAFORM_PROVIDER_SCHEMA) 2>> $(TERRAFORM_WORKDIR)/terraform-logs.txt
94119
@$(OK) generating provider schema for $(TERRAFORM_PROVIDER_SOURCE) $(TERRAFORM_PROVIDER_VERSION)
95120

96-
generate.init: $(TERRAFORM_PROVIDER_SCHEMA)
121+
pull-docs:
122+
@if [ ! -d "$(WORK_DIR)/$(TERRAFORM_PROVIDER_SOURCE)" ]; then \
123+
mkdir -p "$(WORK_DIR)/$(TERRAFORM_PROVIDER_SOURCE)" && \
124+
git clone -c advice.detachedHead=false --depth 1 --filter=blob:none --branch "v$(TERRAFORM_PROVIDER_VERSION)" --sparse "$(TERRAFORM_PROVIDER_REPO)" "$(WORK_DIR)/$(TERRAFORM_PROVIDER_SOURCE)"; \
125+
fi
126+
@git -C "$(WORK_DIR)/$(TERRAFORM_PROVIDER_SOURCE)" sparse-checkout set "$(TERRAFORM_DOCS_PATH)"
127+
128+
generate.init: $(TERRAFORM_PROVIDER_SCHEMA) pull-docs
97129

98-
.PHONY: $(TERRAFORM_PROVIDER_SCHEMA)
130+
.PHONY: $(TERRAFORM_PROVIDER_SCHEMA) pull-docs
99131
# ====================================================================================
100132
# Targets
101133

@@ -126,7 +158,26 @@ submodules:
126158
run: go.build
127159
@$(INFO) Running Crossplane locally out-of-cluster . . .
128160
@# To see other arguments that can be provided, run the command with --help instead
129-
$(GO_OUT_DIR)/provider --debug
161+
UPBOUND_CONTEXT="local" $(GO_OUT_DIR)/provider --debug
162+
163+
# ====================================================================================
164+
# End to End Testing
165+
CROSSPLANE_NAMESPACE = upbound-system
166+
-include build/makelib/local.xpkg.mk
167+
-include build/makelib/controlplane.mk
168+
169+
uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
170+
@$(INFO) running automated tests
171+
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e "${UPTEST_EXAMPLE_LIST}" --setup-script=cluster/test/setup.sh || $(FAIL)
172+
@$(OK) running automated tests
173+
174+
local-deploy: build controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME)
175+
@$(INFO) running locally built provider
176+
@$(KUBECTL) wait provider.pkg $(PROJECT_NAME) --for condition=Healthy --timeout 5m
177+
@$(KUBECTL) -n upbound-system wait --for=condition=Available deployment --all --timeout=5m
178+
@$(OK) running locally built provider
179+
180+
e2e: local-deploy uptest
130181

131182
.PHONY: cobertura submodules fallthrough run crds.clean
132183

OWNERS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ guidelines and responsibilities for the steering committee and maintainers.
1010

1111
## Maintainers
1212

13-
* Maintainer 1 <[email protected]> ([maintainer1](https://github.com/maintainer1))
13+
* Saril Sudhakaran <[email protected]> ([saril sudhakaran](https://github.com/kssaril))
1414
* Maintainer 2 <[email protected]> ([maintainer1](https://github.com/maintainer2))

README.md

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,52 @@
1-
# Terrajet Oci Provider
1+
# Provider Oci
22

3-
`provider-jet-oci` is a [Crossplane](https://crossplane.io/) provider that
4-
is built using [Terrajet](https://github.com/crossplane/terrajet) code
3+
`provider-oci` is a [Crossplane](https://crossplane.io/) provider that
4+
is built using [Upjet](https://github.com/upbound/upjet) code
55
generation tools and exposes XRM-conformant managed resources for the
66
Oci API.
77

8-
## Installing the provider
8+
## Getting Started
99

10-
Install the provider by using the following steps and commands
10+
### Testing the provider
1111

12-
Build the provider and push to docker registry
12+
Follow the below steps for generating the code and test.
13+
Make sure go is installed and path is set for the go binaries
1314
```
14-
make all
15-
```
16-
17-
After pushing to the docker registry run the below command to install the provider
18-
`repoName` is the docker registry repo to which the image is pushed.
15+
Git clone the repo
16+
cd provider-oci/
17+
make generate # This will generate the binaries and CRDs.
18+
kubectl apply -f package/crds # A k8s cluster must be available running locally
19+
make run # This will start crossplane provider against the local kubernetes cluster .
1920
```
20-
kubectl crossplane install provider <repoName> /provider-jet-oci:v0.1.0
21+
In another terminal run the below commands to test the provider.
22+
Make sure to setup the OCI credentials in examples/providerconfig/secret.yaml using the template examples/providerconfig/secret.yaml.tmpl
2123
```
2224
23-
Alternatively, you can use declarative installation:
25+
# Create "crossplane-system" namespace if not exists
26+
kubectl create namespace crossplane-system --dry-run=client -o yaml | kubectl apply -f -
27+
28+
kubectl apply -f examples/providerconfig/
29+
kubectl apply -f examples/identity/compartment.yaml # open the compartment.yaml and update the compartment id in wich the new compartment to be created
30+
kubectl get managed # To check the status
2431
```
25-
kubectl apply -f examples/install.yaml
32+
## Building the provider and package as docker image
2633
```
34+
make build # This will build docker image in local machie. This can be pushed to any container registry
2735
28-
Notice that in this example Provider resource is referencing ControllerConfig with debug enabled.
36+
```
2937

38+
## Installing the provider from a container registry
39+
using declarative api
40+
```
41+
cat <<EOF | kubectl apply -f -
42+
apiVersion: pkg.crossplane.io/v1
43+
kind: Provider
44+
metadata:
45+
name: provider-oci
46+
spec:
47+
package: <registry>/provider-oci:<tag>
48+
EOF
49+
```
3050

3151
## Developing
3252

@@ -56,24 +76,8 @@ make build
5676
## Report a Bug
5777

5878
For filing bugs, suggesting improvements, or requesting new features, please
59-
open an [issue](https://github.com/crossplane-contrib/provider-jet-oci/issues).
60-
61-
## Contact
62-
63-
Please use the following to reach members of the community:
64-
65-
* Slack: Join our [slack channel](https://slack.crossplane.io)
66-
* Forums:
67-
[crossplane-dev](https://groups.google.com/forum/#!forum/crossplane-dev)
68-
* Twitter: [@crossplane_io](https://twitter.com/crossplane_io)
69-
70-
71-
## Governance and Owners
79+
open an [issue](https://github.com/oracle-samples/provider-oci/issues).
7280

73-
provider-jet-oci is run according to the same
74-
[Governance](https://github.com/crossplane/crossplane/blob/master/GOVERNANCE.md)
75-
and [Ownership](https://github.com/crossplane/crossplane/blob/master/OWNERS.md)
76-
structure as the core Crossplane project.
7781

7882
## Contributing
7983

THIRD_PARTY_LICENSES.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
=== Public License Template ===
2-
# Terrajet Template Provider
3-
github.com/crossplane-contrib/provider-jet-template
2+
# upjet Provider Template
3+
github.com/upbound/upjet-provider-template
4+
github.com/upbound/upjet/pkg
5+
6+
Copyright 2022 Upbound Inc. All rights reserved.
7+
Copyright 2023 Upbound Inc. All rights reserved.
48

5-
Copyright 2020 The Crossplane Authors.
69
-------- License
710
Apache License
811
Version 2.0, January 2004
@@ -192,7 +195,7 @@ Copyright 2020 The Crossplane Authors.
192195
same "printed page" as the copyright notice for easier
193196
identification within third-party archives.
194197

195-
Copyright 2016 The Crossplane Authors. All rights reserved.
198+
Copyright 2023 Upbound Inc. All rights reserved.
196199

197200
Licensed under the Apache License, Version 2.0 (the "License");
198201
you may not use this file except in compliance with the License.
@@ -205,4 +208,3 @@ Copyright 2020 The Crossplane Authors.
205208
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
206209
See the License for the specific language governing permissions and
207210
limitations under the License.
208-

apis/artifacts/v1alpha1/zz_containerconfiguration_types.go

Lines changed: 9 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)