mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-19 23:57:57 +00:00
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Failing after 4m35s
Post / images (amd64) (push) Failing after 6m0s
Post / images (arm64) (push) Failing after 5m36s
Post / image manifest (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped
Post / coverage (push) Failing after 27m33s
* Add the awscli volume mount to klusterlet-work, klusterlet-agent, klusterlet-registration deployment manifests if the registration auth type is awsirsa. Update the test util function to check for both .aws and /awscli volume mounts. Signed-off-by: dtclxy64 <70486866+dtclxy64@users.noreply.github.com> * Update the conditions to only check the registration driver auth type because the nil checks are done on the klusterlet CRD. Signed-off-by: dtclxy64 <70486866+dtclxy64@users.noreply.github.com> --------- Signed-off-by: dtclxy64 <70486866+dtclxy64@users.noreply.github.com> Co-authored-by: Amrutha <amrutha.hari12@gmail.com>
47 lines
1.7 KiB
Go
47 lines
1.7 KiB
Go
package util
|
|
|
|
import (
|
|
"strings"
|
|
|
|
v1 "k8s.io/api/apps/v1"
|
|
)
|
|
|
|
const (
|
|
HubClusterArn = "arn:aws:eks:us-west-2:123456789012:cluster/hub-cluster1"
|
|
ManagedClusterArn = "arn:aws:eks:us-west-2:123456789012:cluster/managed-cluster1"
|
|
ManagedClusterRoleSuffix = "7f8141296c75f2871e3d030f85c35692"
|
|
PrerequisiteSpokeRoleArn = "arn:aws:iam::123456789012:role/ocm-managed-cluster-" + ManagedClusterRoleSuffix
|
|
IrsaAnnotationKey = "eks.amazonaws.com/role-arn"
|
|
)
|
|
|
|
func AwsCliSpecificVolumesMounted(deployment v1.Deployment) bool {
|
|
isDotAwsMounted := false
|
|
isAwsCliMounted := false
|
|
for _, volumeMount := range deployment.Spec.Template.Spec.Containers[0].VolumeMounts {
|
|
if volumeMount.Name == "dot-aws" && volumeMount.MountPath == "/.aws" {
|
|
isDotAwsMounted = true
|
|
} else if volumeMount.Name == "awscli" && volumeMount.MountPath == "/awscli" {
|
|
isAwsCliMounted = true
|
|
}
|
|
}
|
|
return isDotAwsMounted && isAwsCliMounted
|
|
}
|
|
|
|
func AllCommandLineOptionsPresent(deployment v1.Deployment) bool {
|
|
isRegistrationAuthPresent := false
|
|
isManagedClusterArnPresent := false
|
|
isManagedClusterRoleSuffixPresent := false
|
|
for _, arg := range deployment.Spec.Template.Spec.Containers[0].Args {
|
|
if strings.Contains(arg, "--registration-auth=awsirsa") {
|
|
isRegistrationAuthPresent = true
|
|
}
|
|
if strings.Contains(arg, "--managed-cluster-arn=arn:aws:eks:us-west-2:123456789012:cluster/managed-cluster1") {
|
|
isManagedClusterArnPresent = true
|
|
}
|
|
if strings.Contains(arg, "--managed-cluster-role-suffix="+ManagedClusterRoleSuffix) {
|
|
isManagedClusterRoleSuffixPresent = true
|
|
}
|
|
}
|
|
return isRegistrationAuthPresent && isManagedClusterArnPresent && isManagedClusterRoleSuffixPresent
|
|
}
|