Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Enable builds on Apple Silicon chips #139

Merged
merged 8 commits into from
Apr 29, 2021
Merged

Enable builds on Apple Silicon chips #139

merged 8 commits into from
Apr 29, 2021

Conversation

AaronME
Copy link
Contributor

@AaronME AaronME commented Mar 2, 2021

This enables building of crossplane on the new Apple Silicon M1 chips.

Introduces a set of new variables to define platform:
SAFEHOSTOS
SAFEHOSTARCH
TARGETARCH

SAFEHOSTPLATFORM
SAFEHOST_PLATFORM
TARGET_PLATFORM

These are required to handle the unique conditions for Apple Silicon, for which arm64 binaries are not always available. For tools which are not currently offering arm64 binaries, the installer can rely on SAFE* values, since M1-based Macs can run ad64 binaries under Rosetta2.

TARGET* values allow us to build arm64-native binaries where necessary.

makelib/common.mk Outdated Show resolved Hide resolved
Copy link
Member

@jbw976 jbw976 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable based on the experiences we've had with apple arm so far. We'll simply be building as if we're x86 and relying on the built in rosetta translation.

@AaronME can you add a quick note to show how you've tested this?

@AaronME AaronME marked this pull request as draft March 4, 2021 14:43
@AaronME
Copy link
Contributor Author

AaronME commented Mar 4, 2021

@jbw976 I've tested the from our local-dev-config repository on my M1 and on a linux dev instance. The linux build succeeds, but the M1 still has errors finding the correct images for arm architecture when deploying charts to the kind cluster.

I am moving this PR to "Draft" status until we can get the full development env bootstrapped and proven.

@AaronME
Copy link
Contributor Author

AaronME commented Apr 5, 2021

This PR has been tested on both apple-silicon M1 chip and an environment running an intel processor. The test repos were crossplane, provider-helm, and some internal upbound-cloud repos.

make and make -j build and make test succeeded on both architectures for all repos.

@AaronME AaronME marked this pull request as ready for review April 5, 2021 19:42
@AaronME AaronME requested a review from jbw976 April 5, 2021 19:42
@AaronME AaronME requested a review from ulucinar April 16, 2021 12:16
Copy link
Member

@jbw976 jbw976 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on @AaronME, the future generation of M1 owners will be grateful!! a few questions about the usage of our vars here, but looks like an approach that should work overall. has anyone used this to build on regular mac intel hardware yet? i'd be happy to take it for a spin to check for regressions :)

makelib/common.mk Outdated Show resolved Hide resolved
makelib/common.mk Outdated Show resolved Hide resolved
makelib/common.mk Outdated Show resolved Hide resolved
makelib/common.mk Outdated Show resolved Hide resolved
@jbw976
Copy link
Member

jbw976 commented Apr 16, 2021

Also, is the PR description still up to date with the approach you've landed on? if not, do you want to update it?

Copy link
Member

@stevendborrelli stevendborrelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been able to build several projects on Apple Silicon using this branch.

@ulucinar
Copy link
Contributor

Thanks @AaronME, LGTM from build perspective.

makelib/common.mk Outdated Show resolved Hide resolved
Copy link
Member

@jbw976 jbw976 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor last couple comments. I was able to build crossplane/crossplane locally on my intel mac and then run my locally built image on a kind cluster locally too. That worked great! Thanks for the continued efforts on this @AaronME 💪

makelib/k8s_tools.mk Outdated Show resolved Hide resolved
makelib/common.mk Outdated Show resolved Hide resolved
Aaron Eaton and others added 8 commits April 29, 2021 14:01
Signed-off-by: Aaron Eaton <aaron@upbound.io>
Signed-off-by: Aaron Eaton <aaron@upbound.io>
Signed-off-by: Aaron Eaton <aaron@upbound.io>
Signed-off-by: Aaron Eaton <aaron@upbound.io>
Signed-off-by: Aaron Eaton <aaron@upbound.io>
Signed-off-by: Aaron Eaton <aaron@upbound.io>
Signed-off-by: Aaron Eaton <aaron@upbound.io>
Signed-off-by: Aaron Eaton <aaron@upbound.io>
negz added a commit to negz/crossplane that referenced this pull request Jun 8, 2021
See upbound/build#139 for details.

Signed-off-by: Nic Cope <negz@rk0n.org>
hasheddan pushed a commit to hasheddan/crossplane that referenced this pull request Aug 17, 2021
See upbound/build#139 for details.

Signed-off-by: Nic Cope <negz@rk0n.org>
(cherry picked from commit 309f440)
hasheddan pushed a commit to hasheddan/crossplane that referenced this pull request Aug 17, 2021
See upbound/build#139 for details.

Signed-off-by: Nic Cope <negz@rk0n.org>
(cherry picked from commit 309f440)
arturobrzut pushed a commit to IBM/ibm-crossplane that referenced this pull request Oct 12, 2021
* feat(cli/crank): add verbose flag and logs in kubectl crossplane cmd

Signed-off-by: Pratyush Singhal <psinghal20@gmail.com>

* Honor ControllerConfig ImagePullPolicy

Currently the ControllerConfig API supports setting the imagePullPolicy
for the Controller Deployment, but it is not being honored when
constructing the Deployment. This updates to honor it.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* feat(cli/crank): add wait flag in pkg install cmd in crossplane cli

This commit introduces a wait flag in the install cmd to wait for the
installed package to be in a healthy state.

Signed-off-by: Pratyush Singhal <psinghal20@gmail.com>

* Add initial e2e tests for compositions

Signed-off-by: Rahul Grover <rahulgrover99@gmail.com>

* Update release table with v1.0.1, v1.1.2, v1.2.2

Updates the patch releases table to the latest versions for v1.0, v1.1,
v1.2, which are the currently active branches.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Propagate handy GitHub workflows

Signed-off-by: Nic Cope <negz@rk0n.org>

* Deprecate v1beta1 Composition and CompositeResourceDefinition

Deprecates v1beta1 Composition and CompositeResourceDefinition in favor
of their v1 counterparts. The v1beta1 APIs are scheduled for removal in
Crossplane v1.6.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Deprecate v1beta1 pkg APIs

Deprecates v1beta1 pkg APIs in favor of their v1 counterparts. The
v1beta1 APIs are scheduled for removal in Crossplane v1.6.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Remove kustomize dependency from Makefile

We build a directory for Kustomize but we don't actually depend on the
tool. This updates to remove it.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Make name in composite resource references optional

Makes it possible for a resource reference to exist with just GVK to
accomodate for incremental rendering of resources in a composition.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Use composed.Unstructured wrapper in e2e tests for unstructured objects.

Signed-off-by: Rahul Grover <rahulgrover99@gmail.com>

* Move extra env vars documentation from template to README

Removes the examples in the helm values template file and updates the
documentation to specify how extra environment variables can be
provided. This makes it such that the examples will be shown on the
documentation website and makes it such that we don't have some fields
documented in the template file but not others.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* refactor: use wait.PollImmediately, make waitDuration configurable and add format string for error and log messages

Signed-off-by: Pratyush Singhal <psinghal20@gmail.com>

* Do not block composed resources on failed neighbor

Updates the composite resource reconciler to render all resources it is
able to even if it is not able to render all resources in the specified
composition. This is a change in behavior from refusing to render any
composed resources if not able to render all.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Do not garbage collect composed resources with no name

Skips composed resource references with no name when garbage collecting
in the template associator because the lack of a name indicates that the
resource was not rendered.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Update xcrd tests to allow for missing name in composed refs

Composites can now reference missing composed resources that it can't
render so we must allow for empty names.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Use build submodule reviewable and check-diff targets

We've been using these broadly for a while but never got around to adding them
upstream until now.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Use SAFEHOSTARCH in integration tests

See upbound/build#139 for details.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Remove superfluous Kustomize dependency

Signed-off-by: Nic Cope <negz@rk0n.org>

* add coordination API scheme as well to the scheme so that Lease object can be used by controller-runtime

Signed-off-by: Muvaffak Onus <me@muvaf.com>

* chore(crank): fix error and logs msgs and use getConditions

Signed-off-by: Pratyush Singhal <psinghal20@gmail.com>

* Add Combine{From,To}Composite patch types (#2352)

* Add Combine{From,To}Composite patch types

This commit implements multiple source patches as a new pair of patch
types, where multiple source values from the same resource can be
combined into a single destination field. These patches take a new
combine struct as input, allowing for expansion of the combine
functionality in future.

Fixes #1973, reimplements #2093

Signed-off-by: Ben Agricola <bagricola@squiz.co.uk>

* Add docs for combine patch types

Fixes #2362

Signed-off-by: Ben Agricola <bagricola@squiz.co.uk>

* Add CombineToComposite example

Adds an example of building up a DSN from user input and status output,
patching back to the Composite resource ready for consumption by other
resources in the same Composite.

Signed-off-by: Ben Agricola <bagricola@squiz.co.uk>

* Clarify dsn example in composition doc

It was not clear that the DSN example was a separate output from the
configuration around connectionDetails, so it has been renamed for
clarity. Examples of the describe output have also been added, to expose
how these fields are displayed to an operator.

Signed-off-by: Ben Agricola <bagricola@squiz.co.uk>

* Add periods to end of CLI flag descriptions

Adds periods to CLI flag descriptions that do not currently have them.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Use shorter wait interval when watching installs

Updates install polling to use a shorter interval so that feedback is
provided more rapidly. In the future, a list watch on the conditions of
the resource could make this functionality even more responsive.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* fix(cli/crank): fix infinite poll timeout when wait flag is absent

Signed-off-by: Pratyush Singhal <psinghal20@gmail.com>

* Consume improved package parser

Updates crossplane-runtime to latest on master to use the new package
parser that makes use of YAML stream concatenation to accomodate more
file structures when building and parsing packages. We are updating to
latest before a release so that the parser has some additional bake time
before the v1.3.0 release.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Fix statement about meta.pkg.crossplane.io

Updates note to say the meta.pkg.crossplane.io does NOT contain custom
resource definitions that can be installed into a cluster.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Add documentation on the Crossplane package cache

Adds a section to the package documentation describing the package cache
and how to interact with it.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Give providers proper lease access in coordination.k8s.io

Providers were previously being given access to leases in the
coordination/v1 API group, which should be coordination.k8s.io. This
updates to use the proper API group.

Note that this only causes issues in the case that providers are run
with leader election enabled.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* refactor(cli/crank): use listwatch instead of polling for wait flag

Signed-off-by: Pratyush Singhal <psinghal20@gmail.com>

* Fix error message in Crossplane CLI package push

Fixes an error message emitted when we fail to identify a package in the
current working directory.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Update patch releases table with v1.1.3 and v1.2.3

Update the v1.1 and v1.2 release patches to v1.1.3 and v1.2.3 in
README.md.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Default to stable channel on promote workflow

In practice, we are only promoting releases to the stable channel today,
so it makes sense for it to serve as the default.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Update crossplane-runtime to v0.14.0

Updates crossplane-runtime to v0.14.0 ahead of the release-1.3 branch
cut and code freeze.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* bumped used postgres version from v9.6 to v12

Signed-off-by: Matthias Luebken <matthias.luebken@gmail.com>

* bumped postgres in getting-started resources

Signed-off-by: Matthias Luebken <matthias.luebken@gmail.com>

* bumped postgres version in guide

Signed-off-by: Matthias Luebken <matthias.luebken@gmail.com>

* Empty commit to advance master ahead of release-1.3

This empty commit advances the master branch ahead of release-1.3 such
that the v1.3.0-rc.0 will be the latest tag on release-1.3 after we tag
this commit on master for v1.4.0-rc.0.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Prevent superfluous external-name annotation on XRs

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Do not reconcile if claim's and composite's external-names do not match

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Deprecate one pager host aware stack manager

Signed-off-by: Hasan Turken <turkenh@gmail.com>

* Add test TestCompositeConfigure/NameMismatchExistingXR

- Assert an error if claim's and bound statically provisioned
  XR's external-names do not match

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Allow passing default registry override to core crossplane

Adds flag and corresponding registry env var to core crossplane start to
allow for overriding where Crossplane will fetch images from when
registry is not specified in the image tag.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Make HEAD requests with default registry

Updates the package manager to make HEAD requests to acquire image
digest using the configured default registry is one if provided and
image does not specify in tag.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Use default registry to pull package images

Updates the image cache backend to pull images using the configured
default registry if one is not specified in tag.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Pass default registry to relevant package controllers

Passes the configured default registry to the package manager and
revision controllers.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Add issue template for cutting releases

Adds an issue template for cutting minor and patch releases.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Update events link

Signed-off-by: Alec Rajeev <alecinthecloud@gmail.com>

* Fix broken link in release issue template

Fixes a broken ci-workflow link in the release issue template.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Add step to update releases table in release issue template

The releases table in the README.md should be updated after cutting any
minor or patch release.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Fix broken links in README.md releases table

The link names in the README.md releases table were incorrect causing
the links to not render correctly.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Use original package source string when adding and removing self from lock

Updates the package revision controller to use the original package
source as the source in the package lock so that configuration packages
are able to accurately match their dependencies in the lock. This is
necessary because go-containerregistry will overwrite docker.io to
index.docker.io to accomodate legacy docker format, which is desirable
when pushing or pulling images, but not when persisting the package
source and attempting to match it with another package's declared
dependencies.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Mark Crossplane v1.0 as EOL

Marks the v1.0 Crossplane release branch as end of life.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Add Crossplane v1.3 to maintained releases

Adds Crossplane v1.3 to releases table as it has entered the maintained
release branches with the v1.3.0 release.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Add upcoming v1.4.0 release date

Adds targeted release date of v1.4.0 to the releases table as August 31,
2021.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Fix and improve comments

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Add docs version update to release steps

Adds a step to the release issue template to update current version in
docs.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Reconcile external-name annotation from existing XR to XRC

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Preserve rendered annotations & labels on composed resources

- Do not override rendered annotations or labels when
  patches on metadata.annotations or metadata.labels are
  defined
- Fixes #2416

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Reallow name, namepsace, generated-name of a composed to be patched

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Use go-containrregistry default registry if none provided

Makes the default registry match the upstream go-containerregistry
default if none is supplied. This same behavior could be accomplished by
not passing the WithDefaultRegistry option to places where we parse
image references, but it is a bit cleaner to always pass the option and
just populate it with the upstream default if not overridden with a flag
or environment variable. It also makes it more discoverable at the core
crossplane command level.

This change makes the default behavior match that from before the
default registry was configurable.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Fail don't panic on failure to list NopResources

Fails on error to list NopResource with descriptive error rather than
panic on deferencing a nil pointer.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Follow repo commenting conventions

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* refactor(cli/crossplane): replace kingping with kong cli framework

Signed-off-by: Pratyush Singhal <psinghal20@gmail.com>

* refactor(cli/crossplane): move rbac kong var to rbac pkg, fix logger
usage and add comments for linter exceptions and BingTo usage

Signed-off-by: Pratyush Singhal <psinghal20@gmail.com>

* chore(cli/crossplane): remove outdated comments

Signed-off-by: Pratyush Singhal <psinghal20@gmail.com>

* refactor(cli/crossplane): add default registry kong var

Signed-off-by: Pratyush Singhal <psinghal20@gmail.com>

* chore(cli/crossplane): update comments and fix type in help message

Signed-off-by: Pratyush Singhal <psinghal20@gmail.com>

* Add IBM Power Linux Platform (ppc64le) support

Resolves crossplane/crossplane#2424

Signed-off-by: Amit Sadaphule <amits2@us.ibm.com>

* Mark many design docs as defunct

These documents are just that. I'm also moving them into a directory to more
clearly distinguish which design docs are still relevant.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Remove Upbound specific UI metadata designs

Upbound Cloud actually still respects this spec, but the design is Upbound
specific and thus belongs under the github.com/upbound org - perhaps in the
Universal Crossplane repository.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Annotate potentially misleading design docs

We have a few design documents that are still mostly accurate and interesting
when it comes to describing problems we've wanted to solve, but that either
mention defunct concepts (e.g. resource classes) or go into detail about the
initial rather than the current technical implementation of a problem (e.g. the
code examples in the cross resource references document).

Signed-off-by: Nic Cope <negz@rk0n.org>

* Explain how we currently address partially defunct design docs

Signed-off-by: Nic Cope <negz@rk0n.org>

* Fix design doc image links

I broke a bunch of these in a previous commit by moving design docs into the
defunct directory.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Add a page documenting Crossplane terminology

We don't currently have a single place to find details about common Crossplane
concepts. I've added this under 'concepts' rather than 'reference' in the hope
it might be more discoverable there, though I could go either way.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Move Terminology page to Concepts

I had intended this page to be under the 'Concepts' sidebar heading, but because
I used TOC entry 51 it lands under 'Welcome' (aka getting started). I suspect
this is because that heading gets TOC entries 0-99 while 'Concepts' gets 100-199.

Signed-off-by: Nic Cope <negz@rk0n.org>

* minor adjustment to setup/install docs

Signed-off-by: Taylor Thornton <taylor@upbound.io>

* Adds support for building/running using darwin_arm64

Signed-off-by: Taylor Thornton <taylor@upbound.io>

* A one-pager describing composition revisions

Signed-off-by: Nic Cope <negz@rk0n.org>

* Allow user control over pod labels using controllerconfig

To be able to select pods using PodSecurityPolicy in EKS, we need to
have predictable labels on the pods. Currently only an unpredictable
hash label is provided on the pods, and the user can only add
annotations.

This change adds a label map for the pod template, similar to the
existing annotation map.

To ensure future extensibility labels with crossplane.io prefixes are
forbidden in the documentation, and the code is structured to ensure
that the template will match the pod selector, and that any user
provided labels which overlaps with the selector will be overriden.

Fixes #2398

Signed-off-by: Carl Henrik Lunde <chlunde@ifi.uio.no>

* output darwin_amd64 for both x86_64 and amd64

Signed-off-by: Taylor Thornton <taylor@upbound.io>

* Update ControllerConfig Label reserved key documentation

From @hasheddan

Signed-off-by: Carl Henrik Lunde <chlunde@ifi.uio.no>

* Test for buildProviderDeployment and fix labels

Ensure labels are set if cc is nil, and add a test with basic coverag
for buildProviderDeployment.

Signed-off-by: Carl Henrik Lunde <chlunde@ifi.uio.no>

* Remove Composition status

This status was added by accident, and has never been used. It doesn't really
hurt, but it's a little misleading given that a Composition never has status
conditions in practice.

Removing this is technically a breaking API change, but none of our controllers
have ever set it so I can't imagine anyone is actually depending on it.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Remove v1beta1 Package interfaces

I believe we only use the v1 versions of these interfaces, and that the v1beta1
versions are now vestigial; we only need the type definitions.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Re-order imports with goimports and add license

Signed-off-by: Carl Henrik Lunde <chlunde@ifi.uio.no>

* Add troubleshooting tips on Crossplane package handling

Signed-off-by: Ying Mo <morningspace@yahoo.com>

* output darwin_amd64 for arm64 (m1)

Signed-off-by: Ben Lackey <ben.lackey@outlook.com>

* Update per review comments

Signed-off-by: Ying Mo <morningspace@yahoo.com>

* Use Helm 3

We're increasingly seeing the Helm 2 download link serving sporadic 403s.
Furthermore Helm 2 has been unsupported for almost a year now. It's time to
use Helm 3. :) As far as I can tell everything works just fine when doing so.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Bump the build submodule

Signed-off-by: Nic Cope <negz@rk0n.org>

* Fix for issue #2480, Install error on arm64

Signed-off-by: Vladimir Novoselskiy <vnovoselskiy@gmail.com>

* Support merging instead of replacing in patches

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Adapt to review changes in parent crossplane-runtime PR

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Receive & unexport "fieldpath.object" package from crossplane-runtime

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Update crossplane-runtime version in go.mod

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Unexport v1.patchFieldValueToObject

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Remove v1.Patch.Filtered

- The `Filtered` attribute was used as a cache
  to store filter result computed during Patch.Apply

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Use embedded type metadata, not ObjectTypers, in claim Reconciler

I believe this pattern of using ObjectTypers was copied from a past iteration
of the Claim reconciler that dealt in strongly typed Claims. At some point those
types did not have their APIVersion and Kind deserialized when read from the API
server so we needed to look them up in the scheme.

This iteration of the claim reconciler always deals with types that are built on
the *unstructured.Unstructured type, which always has its APIVersion and Kind
set when it is read from the API server. Therefore we can just use GetObjectKind
rather than needing to pass around an ObjectTyper.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Cleanup external-name persistence when configuring XR

Just a little cleanup - previously there were two conflicting comments - one
stated we wanted to keep the external name even if it was empty while the other
stated that we did not.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Use a dry-run create to name XRs during Configure

This is similar to the approach we take in the XR reconciler when creating
composed resources. The dry-run create causes the XR's metadata.name to be
populated based on its metadata.generateName, without the XR actually being
created. This gives us a generated XR name that is very likely to be available
that we could persist as our claim's resourceRef _before_ we actually create the
XR, thus allowing us to reduce the likelihood that we would leak XRs.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Persist claim's resourceRef before creating its XR

This commit leverages our newly implemented ability to name XRs before they're
created by persisting the XR's name to the claim's resourceRef before we create
(i.e. apply) the XR. 'Binding' a claim to an XR is now broken up into three
stages.

1. We set the XR's claimRef during Configure.
2. We set (and persist) the XRC's resourceRef during Bind
3. We persist the XR's claimRef during Apply.

This approach has a handful of benefits:

1. It prevents 'leaking' XRs. Previously if anything went wrong between when we
   first created an XR and when we persisted its resourceRef we'd return from
   the Reconcile and requeue a new one. The new reconcile would have no way of
   knowing that we'd already created an XR for this claim so it would create a
   new one.
2. It ensures dynamically provisioned XRs never exist without a claimRef - it's
   set when the XR is created. This can help avoid issues like #2464. Note that
   XRs should still be designed to support static binding - i.e. they should not
   assume that the claimRef will always be set at XR creation time.
3. It eliminates one superfluous API server write, because we only update the XR
   once, rather than applying it then updating it to bind it.

Note that this commit changes the behaviour of the (AFAIK _exceedingly_ obscure)
edge case in which someone attempts to claim an XR tha does not exist - i.e. by
explicitly setting their claim's resourceRef. Previously we'd assume they did in
fact want to claim an XR that hadn't yet been created, and wait around for it to
exist. Now we assume that the resourceRef was populated by a previous iteration
of the reconciler and proceed to dynamically provision an XR of that name. One
interesting side effect here is that this means claim authors can now influence
the (Kubernetes) name of the XR they would like to provision, though we'll still
bail out if they try to 'claim over' an XR that is claimed by some other entity.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Back-propagate XR external name in claim Configurator

Previously this was done during claim binding. In reality either are fine,
but it seems a little more 'in spirit' of the Configurator, which is broadly
responsible for late-initializing the claim with XR values.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Don't update a claim's resourceRef needlessly

Signed-off-by: Nic Cope <negz@rk0n.org>

* Don't let claims delete XRs they are not bound to

Previously a malicious (or malformed) claim could reference an XR that was
already bound to another claim (potentially in another namespace), and when the
malicious claim was deleted the XR would be deleted too.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Update pkg e2e tests to use v1 types

Updates pkg e2e tests to use v1 types now that the interfaces for
v1beta1 types have been removed.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Check the e2e tests compile for each platform

Updates Makefile to compile e2e tests for each platform on build. We opt
to not publish the test binaries that are produced at this time.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Rename composite.composedRendered to composite.composedRenderState

- Add composite.patchTypesToXR & composite.patchTypesFromXR functions
  to define XR-targeting & composed-targeting patch types

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Tweak release issue template based on my first-run experience

I worked through a release issue using this template for the first time earlier
this week. While doing so I noticed a few things that I (possibly subjectively)
felt would make it easier to work through:

1. I think I was wrong about wrapping when I reviewed the original template. In
   practice I found that wrapped markdown comments are much easier to read, but
   wrapped markdown in the lists is actually pretty hard to follow when editing
   the issue. I found myself wanting the markdown list content to not be wrapped
   in the GitHub text box.

2. I found that having inline commentary with example links made it harder for
   my brain to immediately zero in on which link I needed to add next. I hope
   that keeping the examples but moving them into a precursor comment block will
   make it easier to open the issue and immediately identify which link needs
   to be populated next.

3. I found some of the 'front matter' around what version was being relesed and
   whether it was a minor or patch release to be a little repetetive, so I've
   tried to roll that all into the issue title.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Break patches and transforms out of Composition types

We have a lot of logic defined as methods on our API types; this breaks
them out into distinct files to make it a little clearer which is which.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Fix typo in register comments

Signed-off-by: Nic Cope <negz@rk0n.org>

* Fix copy-pasta in Composition documentation

Signed-off-by: Nic Cope <negz@rk0n.org>

* Add revision support to XR and XRC schemas

Signed-off-by: Nic Cope <negz@rk0n.org>

* Add support for "composition revisions"

See the one-pager at crossplane/crossplane#2437 for details.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Put CompositionRevision support behind a feature flag

This commit introduces a simple feature flag library and uses it to gate
CompositionRevision support. Going forward I'd like to keep all newly introduced
features of any significant size and complexity behind a feature flag like this.

The idea here is that the feature flags are a simple map that can be plumbed
down from cmd/ to the various places in the codebase we'd need to use them. This
approach mostly just avoids having to plumb down a lot of boolean flags as
distinct bool types, which would bloat our controller Setup() signatures in
particular.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Use GenerateName, not revision number for CompositionRevision names

This reverts to the original design here. It was suggested that we use the
revision number as a suffix instead during review. I like that approach, but
have since realised we're using GenerateName for package revisions. Given it
does not make a big difference (the revision number appears prominently in the
spec and as a printer column) I prefer to keep symmetry with pacakge revisions.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Flag alpha XR fields as such.

I'm hesitant to actually put these fields behind a feature flag (we typically
couldn't for other less dynamic API types) so instead we'll warn users that they
are alpha.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Use the hash, not revision, to determine the latest Composition

This is necessary for the Automatic update policy to actually track the 'latest'
(i.e. most current) revision. We cannot rely on the revision number, because
it's possible that the latest Composition state may actually be a reversion to
an older state, and thus an older (lower numbered) CompositionRevision. Matching
the hash ensures we always select the revision that matches the current
Composition.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Propagate a claim's composition revision machinery to its XR

Signed-off-by: Nic Cope <negz@rk0n.org>

* Tweak XRC -> XR field propagation naming and commentary

I got hung up on this logic for quite a while trying to figure something out.
Hopefully this updated comment and naming makes it a little clearer what is
happening.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Only select revisions of the selected Composition

In practice we already filter down to revisions owned by our Composition, but
this pushes some of the filtering down into the controller-runtime cache layer
by 'pre-filtering' to CompositionRevisions that are labelled with the desired
Composition's name.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Wrap composition reconciler event errors with more context

Signed-off-by: Nic Cope <negz@rk0n.org>

* Break current CompositionRevision selection out

This caps the complexity of the Composition reconciler and breaks the loop early
when we find the current revision.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Clarify feature test names

Signed-off-by: Nic Cope <negz@rk0n.org>

* 'Future proof' the --enable-composition-revisions flag

This removes the 'alpha' part of the flag so that we can continue to use the
same flag once the feature reaches beta (when we'll have it on be default).
We instead use a kong flag group to highlight that the feature is currently in
alpha - in future we can move it into a beta group without a breaking change.

I believe we can also make the flag on by default by adding default:"true" and
negatable:"" in future.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Link to cloud-providers/* for more config info

Signed-off-by: Matthias Luebken <matthias.luebken@gmail.com>

* Sync Composition v1beta1 with v1

We need to keep these two types identical, and unfortunately that process is
currently manual.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Mark CompositionRevisions as immutable

This isn't enforced, but at least we're providing a hint of our intention. This
commit also adds a missing (but previously implied by the omitempty tag)
optional comment marker on the Combine field.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Indicate which CompositionRevision is 'current'

The current CompositionRevision is the one with a spec that matches the
Composition's spec at any point in time. There should only ever be one
current CompositionRevision, and it won't necessarily be the one with the
highest revision number, e.g. if the Composition has reverted to a state that
matches a prior revision.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Fix Composition and CompositionRevision status subresource

Namely, by enabling it for CompositionRevision (which has a status) and
disabling it for Composition (which doesn't).

Signed-off-by: Nic Cope <negz@rk0n.org>

* Don't specifically mention 'reverting' to an existing revision

This log line can be produced when nothing actually happened to a Composition
(e.g. a resync, a revision changing, etc) so it's a bit misleading to log that
a Composition reverted to a previous state (it could just be staying in the same
state).

Signed-off-by: Nic Cope <negz@rk0n.org>

* Do not requeue on successful revision reconcile

This is a fairly substantial change in the package revision controller
behavior, but should drastically reduce the number of calls we make to
the API Server. We previously reconciled package revisions every minute
after a successful reconcile, but we now opt for only requeing if a
reconcile is not successful. This means that installed resources could
drift from what is specified in the package, but the odds of this
causing negative impact on an environment are somewhat mininal.

We also update to watch owned Deployments for a ProviderRevision as we
need to be notified immediately if a provider Deployment is unhealthy.
This does have the consequence that we will update all installed
resources on a regular cadence in the case that a provider Deployment
remains unhealthy. That being said, an unhealthy provider Deployment
should call for urgent intervention, either by the controller or the
cluster administrator.

A potential negative side-effect of not regularly reconciling
ProviderRevisions is that an updated ControllerConfig will not flow
through to the provider Deployment within a minute, which was the
previous guarantee. That being said, any update to the Provider itself
will trigger a reconcile, which would cause ControllerConfig changes to
also be picked up.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Update package revision tests to not requeue on success

Updates all package revision tests to not requeue in the event that we
successfully reconcile.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Add event handler for controller configs referenced by providerrevisions

Adds an event handler for enqueing requests for providerrevision when an
event is observed on a controllerconfig it references.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Spelling & Grammar

- "platform builer" -> "platform builder
- "an claim" -> "a claim"
Signed-off-by: Harry Fallows <harryfallows@protonmail.com>

* Watch controllerconfigs in providerrevision controller

Updates providerrevision controller to watch for events on
controllerconfigs.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Fix minor typo in providerrevision controllerconfig handler

Fixes a small typo in the providerrevision controllerconfig handler
docstring.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Add a guide to CompositionRevisions

I imagine this will be rolled into the broader Composition documentation at some
point, and probably framed more around the actual use case it solves, i.e.
'updating XRs' or 'evolving Compostions'. However for the time being while the
feature is in alpha I'd like to keep this documentation separate and frame it as
a guide to the specific feature.

Signed-off-by: Nic Cope <negz@rk0n.org>

* Update build submodule with optional docs publishing

Updates the build submodule to include optionally publishing docs. When
a branch is no longer supported, the Makefile should be updated to
DOCS_VERSION_ACTIVE=false and it will be removed when publishing to the
docs repo.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Update releases table for v1.3.1

Signed-off-by: Hasan Turken <turkenh@gmail.com>

* Updating v1.2 release to v1.2.4

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

* Updating v1.1 release to v1.1.4

Signed-off-by: Aaron Eaton <aaron@upbound.io>

* Add pkgrev category to revision types

Adds a pkgrev category to provider revisions and configuration revisions
so that they can be listed more easily in a cluster.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Redirect ROADMAP.md to our GitHub projects

Signed-off-by: Nic Cope <negz@rk0n.org>

* Add v1beta1 Lock API and mark as storage version

Adds a v1beta1 API for the Lock type and marks it as the storage
version. The v1beta1 API is identical to the v1alpha1 API.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Generate Lock CRD with v1beta1 version

Updates the Lock CRD with v1beta1 schema, which is identical to
v1alpha1.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Generate v1beta1 lock clientsets

Adds new Lock clientsets for interacting the the v1beta1 API version.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Mark v1alpha1 Lock as deprecated

The v1alpha1 Lock API has been deprecated in favor of the v1beta1 API
and is scheduled for removal in Crossplane v1.7.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Use v1beta1 Lock types in revision controller

Updates all Lock interactions in the revision controller to use the
v1beta1 API.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* Update resolver controller to use v1beta1 Lock types

Updates the package revision dependency resolver controller to use
v1beta1 Lock types.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>

* go.mod: update crossplane-runtime to latest version

Signed-off-by: Muvaffak Onus <me@muvaf.com>

* Fix vararg in reconciler.go.
Fix API group name in register.go

* Fix IBM resource ref patch

* Fix IBM patches overwritten by merge

* Fix tests failing because of IBM patches

* Clean up github actions.
Update API group name for compositionrevision.
Regenerate CRDs.

* Regenerate CRDs

* Merge change removing cluster-scope secrets permissions

* Clean up merged changes

* Set go version to 1.15

* fix missing imports.
Fix error on conversion of v1.CreateOptions to shim.bedrock.ibm.com.
Remove cluster scope Deployment permissions.

* Fix overwritten clientForSecret change

* Regenerate CRDs

* Fix prow error on 'make reviewable'

* Fix prow error on check-diff

* Update submodule

* Update go version to 1.16

* Update go version to 1.16

* Check go version

* Remove go version check

Co-authored-by: Pratyush Singhal <psinghal20@gmail.com>
Co-authored-by: Daniel Mangum <31777345+hasheddan@users.noreply.github.com>
Co-authored-by: hasheddan <georgedanielmangum@gmail.com>
Co-authored-by: Rahul Grover <rahulgrover99@gmail.com>
Co-authored-by: Nic Cope <negz@rk0n.org>
Co-authored-by: Muvaffak Onus <me@muvaf.com>
Co-authored-by: Ben Agricola <717328+benagricola@users.noreply.github.com>
Co-authored-by: Ben Agricola <bagricola@squiz.co.uk>
Co-authored-by: Matthias Luebken <matthias.luebken@gmail.com>
Co-authored-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
Co-authored-by: Hasan Turken <turkenh@gmail.com>
Co-authored-by: Alec Rajeev <alecinthecloud@gmail.com>
Co-authored-by: Amit Sadaphule <amits2@us.ibm.com>
Co-authored-by: Taylor Thornton <taylor@upbound.io>
Co-authored-by: Carl Henrik Lunde <chlunde@ifi.uio.no>
Co-authored-by: Ying Mo <morningspace@yahoo.com>
Co-authored-by: Ben Lackey <ben.lackey@outlook.com>
Co-authored-by: Vladimir Novoselskiy <vnovoselskiy@gmail.com>
Co-authored-by: Harry Fallows <harryfallows@protonmail.com>
Co-authored-by: Nic Cope <nicc@rk0n.org>
Co-authored-by: Aaron Eaton <aaron@upbound.io>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants