-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3626 from camilamacedo86/add-distro-mode
✨ (go/v4): Add method to allow users distribute the project
- Loading branch information
Showing
25 changed files
with
2,430 additions
and
15 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
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
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 |
---|---|---|
|
@@ -85,19 +85,24 @@ var _ = Describe("kubebuilder", func() { | |
" with restricted pods", func() { | ||
kbc.IsRestricted = true | ||
GenerateV4(kbc) | ||
Run(kbc, true) | ||
Run(kbc, true, false) | ||
}) | ||
It("should generate a runnable project without webhooks"+ | ||
" with restricted pods", func() { | ||
kbc.IsRestricted = true | ||
GenerateV4WithoutWebhooks(kbc) | ||
Run(kbc, false) | ||
Run(kbc, false, false) | ||
}) | ||
It("should generate a runnable project"+ | ||
" with the Installer", func() { | ||
GenerateV4(kbc) | ||
Run(kbc, false, true) | ||
}) | ||
}) | ||
}) | ||
|
||
// Run runs a set of e2e tests for a scaffolded project defined by a TestContext. | ||
func Run(kbc *utils.TestContext, hasWebhook bool) { | ||
func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller bool) { | ||
var controllerPodName string | ||
var err error | ||
|
||
|
@@ -129,18 +134,35 @@ func Run(kbc *utils.TestContext, hasWebhook bool) { | |
err = kbc.LoadImageToKindCluster() | ||
ExpectWithOffset(1, err).NotTo(HaveOccurred()) | ||
|
||
// NOTE: If you want to run the test against a GKE cluster, you will need to grant yourself permission. | ||
// Otherwise, you may see "... is forbidden: attempt to grant extra privileges" | ||
// $ kubectl create clusterrolebinding myname-cluster-admin-binding \ | ||
// --clusterrole=cluster-admin [email protected] | ||
// https://cloud.google.com/kubernetes-engine/docs/how-to/role-based-access-control | ||
By("deploying the controller-manager") | ||
var output []byte | ||
if !isToUseInstaller { | ||
// NOTE: If you want to run the test against a GKE cluster, you will need to grant yourself permission. | ||
// Otherwise, you may see "... is forbidden: attempt to grant extra privileges" | ||
// $ kubectl create clusterrolebinding myname-cluster-admin-binding \ | ||
// --clusterrole=cluster-admin [email protected] | ||
// https://cloud.google.com/kubernetes-engine/docs/how-to/role-based-access-control | ||
By("deploying the controller-manager") | ||
|
||
cmd := exec.Command("make", "deploy", "IMG="+kbc.ImageName) | ||
output, err = kbc.Run(cmd) | ||
ExpectWithOffset(1, err).NotTo(HaveOccurred()) | ||
} else { | ||
By("building the installer") | ||
err = kbc.Make("build-installer", "IMG="+kbc.ImageName) | ||
ExpectWithOffset(1, err).NotTo(HaveOccurred()) | ||
|
||
cmd := exec.Command("make", "deploy", "IMG="+kbc.ImageName) | ||
output, err := kbc.Run(cmd) | ||
ExpectWithOffset(1, err).NotTo(HaveOccurred()) | ||
// NOTE: If you want to run the test against a GKE cluster, you will need to grant yourself permission. | ||
// Otherwise, you may see "... is forbidden: attempt to grant extra privileges" | ||
// $ kubectl create clusterrolebinding myname-cluster-admin-binding \ | ||
// --clusterrole=cluster-admin [email protected] | ||
// https://cloud.google.com/kubernetes-engine/docs/how-to/role-based-access-control | ||
By("deploying the controller-manager with the installer") | ||
|
||
_, err = kbc.Kubectl.Apply(true, "-f", "dist/install.yaml") | ||
ExpectWithOffset(1, err).NotTo(HaveOccurred()) | ||
} | ||
|
||
if kbc.IsRestricted { | ||
if kbc.IsRestricted && !isToUseInstaller { | ||
By("validating that manager Pod/container(s) are restricted") | ||
ExpectWithOffset(1, output).NotTo(ContainSubstring("Warning: would violate PodSecurity")) | ||
} | ||
|
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
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
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
6 changes: 6 additions & 0 deletions
6
testdata/project-v4-with-deploy-image/config/manager/kustomization.yaml
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 |
---|---|---|
@@ -1,2 +1,8 @@ | ||
resources: | ||
- manager.yaml | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
images: | ||
- name: controller | ||
newName: controller | ||
newTag: latest |
Oops, something went wrong.