-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Install Cluster Build Strategies with Operator
Install the build strategy samples from shipwright-io/build, at the v0.12.0 tag. Only cluster build strategies were added - namespace scoped build strategies were dropped. Red Hat-specific strategies were also dropped, in part to avoid potential trademark issues. The build strategies use v1alpha1 APIs because this is the stored version in v0.12.0. Testing revealed that if we reconciled v1beta1 APIs, we would need to wait for (and mock out!) the conversion webhook deployment. Lastly, the operator was granted RBAC permission to administer all ClusterBuildStrategies. Reconciling build strategies required adding logic to wait for the required CRDs to be installed on the cluster first. If a requeue is required, the operator will report the Ready status condition as "Unknown." The manifestival library code also had to enhanced to optionally recurse a directory for manifests to deploy. Finally, development of this feature revealed refactoring opportunities with respect to our use of k8s and controller-runtime client libraries, and the way we are organizing/managing Manifestival-driven reconcilers. Some refactoring of test code was included to simplify future testing efforts.
- Loading branch information
1 parent
0d64e38
commit d423d71
Showing
23 changed files
with
1,574 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package controllers | ||
|
||
import ( | ||
"fmt" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
buildv1alpha1 "github.com/shipwright-io/build/pkg/apis/build/v1alpha1" | ||
"github.com/shipwright-io/operator/api/v1alpha1" | ||
"github.com/shipwright-io/operator/test" | ||
) | ||
|
||
var _ = Describe("Install embedded build strategies", func() { | ||
|
||
var build *v1alpha1.ShipwrightBuild | ||
|
||
BeforeEach(func(ctx SpecContext) { | ||
setupTektonCRDs(ctx) | ||
build = createShipwrightBuild(ctx, "shipwright") | ||
test.CRDEventuallyExists(ctx, k8sClient, "clusterbuildstrategies.shipwright.io") | ||
}) | ||
|
||
When("the install build strategies feature is enabled", func() { | ||
|
||
It("applies the embedded build strategy manifests to the cluster", func(ctx SpecContext) { | ||
expectedBuildStrategies, err := test.ParseBuildStrategyNames() | ||
Expect(err).NotTo(HaveOccurred()) | ||
for _, strategy := range expectedBuildStrategies { | ||
strategyObj := &buildv1alpha1.ClusterBuildStrategy{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: strategy, | ||
}, | ||
} | ||
By(fmt.Sprintf("checking for build strategy %q", strategy)) | ||
test.EventuallyExists(ctx, k8sClient, strategyObj) | ||
} | ||
|
||
}) | ||
}) | ||
|
||
AfterEach(func(ctx SpecContext) { | ||
deleteShipwrightBuild(ctx, build) | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.