-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
daemon: Bind /run/secrets/ in so we can see SA tokens
Because we `chroot()` we need to ensure that we can still see the service account tokens injected into our pod. Closes: #358
- Loading branch information
Showing
3 changed files
with
60 additions
and
0 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,42 @@ | ||
package e2e_test | ||
|
||
import ( | ||
"testing" | ||
"strings" | ||
|
||
"k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/labels" | ||
|
||
"github.com/openshift/machine-config-operator/cmd/common" | ||
) | ||
|
||
// Test case for https://github.com/openshift/machine-config-operator/issues/358 | ||
func TestMCDToken(t *testing.T) { | ||
cb, err := common.NewClientBuilder("") | ||
if err != nil{ | ||
t.Errorf("%#v", err) | ||
} | ||
k := cb.KubeClientOrDie("sanity-test") | ||
|
||
listOptions := metav1.ListOptions{ | ||
LabelSelector: labels.SelectorFromSet(labels.Set{"k8s-app": "machine-config-daemon"}).String(), | ||
} | ||
|
||
mcdList, err := k.CoreV1().Pods("openshift-machine-config-operator").List(listOptions) | ||
if err != nil { | ||
t.Fatalf("%#v", err) | ||
} | ||
|
||
for _, pod := range mcdList.Items { | ||
res, err := k.CoreV1().Pods(pod.Namespace).GetLogs(pod.Name, &v1.PodLogOptions{}).DoRaw() | ||
if err != nil { | ||
t.Errorf("%s", err) | ||
} | ||
for _, line := range strings.Split(string(res), "\n") { | ||
if strings.Contains(line, "Unable to rotate token") { | ||
t.Fatalf("found token rotation failure message: %s", line) | ||
} | ||
} | ||
} | ||
} |