Skip to content

Commit

Permalink
fix: role for secrets/configmaps
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Jan 19, 2025
1 parent 7a67b16 commit a69903c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
10 changes: 6 additions & 4 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@ rules:
- apiGroups:
- ""
resources:
- namespaces
- configmaps
- persistentvolumeclaims
- secrets
verbs:
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- persistentvolumeclaims
- namespaces
verbs:
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
Expand Down
2 changes: 2 additions & 0 deletions internal/storage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
// +kubebuilder:rbac:groups="",resources=pods/exec,verbs=create
// +kubebuilder:rbac:groups="",resources=pods/log,verbs=list;get
// +kubebuilder:rbac:groups="",resources=persistentvolumeclaims,verbs=list;get;watch
// +kubebuilder:rbac:groups="",resources=secrets,verbs=list;get;watch
// +kubebuilder:rbac:groups="",resources=configmaps,verbs=list;get;watch

// Calculator handles collecting storage calculator information
type Calculator struct {
Expand Down
39 changes: 35 additions & 4 deletions test/e2e/e2e_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,52 @@ var _ = Describe("controller", Ordered, func() {
_, _ = utils.Run(cmd)

// remove the example namespace
cmd = exec.Command("kubectl", "delete", "ns", "example-project-develop")
cmd = exec.Command(utils.Kubectl(), "delete", "ns", "example-project-develop")
_, _ = utils.Run(cmd)
})

// comment to prevent cleaning up controller namespace and local services
AfterAll(func() {
By("dump controller logs")
cmd := exec.Command(utils.Kubectl(), "get",
"pods", "-l", "control-plane=controller-manager",
"-o", "go-template={{ range .items }}"+
"{{ if not .metadata.deletionTimestamp }}"+
"{{ .metadata.name }}"+
"{{ \"\\n\" }}{{ end }}{{ end }}",
"-n", namespace,
)
podOutput, err := utils.Run(cmd)
if err == nil {
podNames := utils.GetNonEmptyLines(string(podOutput))
controllerPodName := podNames[0]
cmd = exec.Command(utils.Kubectl(), "logs",
controllerPodName, "-c", "manager",
"-n", namespace,
)
podlogs, err := utils.Run(cmd)
if err == nil {
fmt.Fprintf(GinkgoWriter, "info: %s\n", podlogs)
}
// cmd = exec.Command(utils.Kubectl(), "logs",
// controllerPodName, "-c", "manager",
// "-n", namespace, "--previous",
// )
// podlogs, err = utils.Run(cmd)
// if err == nil {
// fmt.Fprintf(GinkgoWriter, "info: previous %s\n", podlogs)
// }
}

By("stop metrics consumer")
utils.StopMetricsConsumer()

// remove the example namespace
cmd := exec.Command(utils.Kubectl(), "delete", "ns", "example-project-main")
cmd = exec.Command(utils.Kubectl(), "delete", "ns", "example-project-main")
_, _ = utils.Run(cmd)

// remove the example namespace
cmd = exec.Command("kubectl", "delete", "ns", "example-project-develop")
cmd = exec.Command(utils.Kubectl(), "delete", "ns", "example-project-develop")
_, _ = utils.Run(cmd)

By("removing manager namespace")
Expand Down Expand Up @@ -159,7 +190,7 @@ var _ = Describe("controller", Ordered, func() {

By("creating second basic deployment")
cmd = exec.Command(
"kubectl",
utils.Kubectl(),
"apply",
"-f",
"test/e2e/testdata/example-env-2.yaml",
Expand Down

0 comments on commit a69903c

Please sign in to comment.