MCPcopy Create free account
hub / github.com/devfile/devworkspace-operator / getClusterServiceAccount

Function getClusterServiceAccount

pkg/webhook/service_account.go:76–90  ·  view source on GitHub ↗
(client crclient.Client, ctx context.Context, namespace string)

Source from the content-addressed store, hash-verified

74}
75
76func getClusterServiceAccount(client crclient.Client, ctx context.Context, namespace string) (*corev1.ServiceAccount, error) {
77 serviceAccount := &corev1.ServiceAccount{}
78 namespacedName := types.NamespacedName{
79 Name: server.WebhookServerSAName,
80 Namespace: namespace,
81 }
82 err := client.Get(ctx, namespacedName, serviceAccount)
83 if err != nil {
84 if apierrors.IsNotFound(err) {
85 return nil, nil
86 }
87 return nil, err
88 }
89 return serviceAccount, nil
90}
91
92func needsUpdate(spec, cluster *corev1.ServiceAccount) bool {
93 return !equality.Semantic.DeepDerivative(spec.Labels, cluster.Labels)

Callers 1

CreateWebhookSAFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected