Skip to content

Commit cf7e992

Browse files
1gtmtamalsaha
authored andcommitted
Prepare for release v0.27.0-rc.0
ProductLine: KubeStash Release: v2026.5.18-rc.0 Release-tracker: kubestash/CHANGELOG#49 Signed-off-by: 1gtm <1gtm@appscode.com>
1 parent e3829bc commit cf7e992

5 files changed

Lines changed: 61 additions & 9 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
kmodules.xyz/offshoot-api v0.34.0
2727
kmodules.xyz/prober v0.34.0
2828
kubedb.dev/apimachinery v0.63.0
29-
kubestash.dev/apimachinery v0.27.0
29+
kubestash.dev/apimachinery v0.28.0-rc.0
3030
sigs.k8s.io/controller-runtime v0.22.4
3131
sigs.k8s.io/yaml v1.6.0
3232
stash.appscode.dev/apimachinery v0.42.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,8 +914,8 @@ kubeops.dev/petset v0.0.15 h1:iwTRFAp0RNw0A87sw2c97UZ6WIA9H/nhJBpDhXLa7fk=
914914
kubeops.dev/petset v0.0.15/go.mod h1:sw96WiXfzhpmKpXj4a5AdmEHs0Bx4QMhf+iW15zY4Gg=
915915
kubeops.dev/sidekick v0.0.12 h1:pmUjQLZDKxgREiM6z0PogLR1aDbgvkE9jRjbxG6dEt0=
916916
kubeops.dev/sidekick v0.0.12/go.mod h1:RU7QH3E8DOLw15rBYlOOJSyczuwAnVVtYyZjJb00UB8=
917-
kubestash.dev/apimachinery v0.27.0 h1:cBPAQRmXFlI/Z0A4IOCQ1r5fQcsV2/iLV8UrGTg7weQ=
918-
kubestash.dev/apimachinery v0.27.0/go.mod h1:f3xtr2V2PWmpktitX4CQgE1g8Y49fyFbO8/FLpk/lJ4=
917+
kubestash.dev/apimachinery v0.28.0-rc.0 h1:/8obzAxKhWzX4ar9Qyobqp7GFfVKKS1HnJD9q0orXZQ=
918+
kubestash.dev/apimachinery v0.28.0-rc.0/go.mod h1:f3xtr2V2PWmpktitX4CQgE1g8Y49fyFbO8/FLpk/lJ4=
919919
open-cluster-management.io/api v1.2.0 h1:+yeQgJiErrur5S4s205UM37EcZ2XbC9pFSm0xgV5/hU=
920920
open-cluster-management.io/api v1.2.0/go.mod h1:YcmA6SpGEekIMxdoeVIIyOaBhMA6ImWRLXP4g8n8T+4=
921921
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=

vendor/kubestash.dev/apimachinery/apis/storage/v1alpha1/backupstorage_helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ func (b *BackupStorage) IsCredentialLessModeEnabled() bool {
9797
switch b.Spec.Storage.Provider {
9898
case ProviderS3:
9999
return b.Spec.Storage.S3.SecretName == ""
100-
// case ProviderGCS:
101-
// case ProviderAzure:
100+
case ProviderAzure:
101+
return b.Spec.Storage.Azure.SecretName == ""
102102
default:
103103
return false
104104
}

vendor/kubestash.dev/apimachinery/pkg/cloud/annotations.go

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
kmapi "kmodules.xyz/client-go/api/v1"
3434
kmc "kmodules.xyz/client-go/client"
3535
"kmodules.xyz/client-go/meta"
36+
sidekickapi "kubeops.dev/sidekick/apis/apps/v1alpha1"
3637
"sigs.k8s.io/controller-runtime/pkg/client"
3738
)
3839

@@ -52,6 +53,9 @@ const (
5253
AzureSubscriptionIDAnnotation = "klusters.dev/azure-subscription-id"
5354
AzureMIClientIDAnnotation = "azure.workload.identity/client-id"
5455
AzureMITenantIDAnnotation = "azure.workload.identity/tenant-id"
56+
57+
AzureWorkloadIdentityUseLabel = "azure.workload.identity/use"
58+
AzureWorkloadIdentityUseAnnotation = "azure.workload.identity/use-identity-binding"
5559
)
5660

5761
func GetCloudAnnotations(ctx context.Context, kc client.Client, storages ...storageapi.BackupStorage) (map[string]string, error) {
@@ -139,12 +143,20 @@ func setBucketAnnotations(annotations map[string]string, storages ...storageapi.
139143
}
140144

141145
func AddCloudAnnotationsToSAIfNeeded(ctx context.Context, kbClient client.Client,
142-
bs *storageapi.BackupStorage, saRef *kmapi.ObjectReference, invTypRef *core.TypedObjectReference,
146+
bs *storageapi.BackupStorage, sidekick *sidekickapi.Sidekick, invTypRef *core.TypedObjectReference,
143147
) (bool, error) {
144-
sa, err := getServiceAccount(ctx, kbClient, saRef)
148+
sa, err := getServiceAccount(ctx, kbClient, &kmapi.ObjectReference{
149+
Name: sidekick.Spec.ServiceAccountName,
150+
Namespace: sidekick.Namespace,
151+
})
145152
if err != nil {
146153
return true, fmt.Errorf("failed to get service account: %v", err)
147154
}
155+
156+
if bs.IsCredentialLessModeEnabled() {
157+
addSidekickAnnotationsIfNeeded(sidekick, bs)
158+
}
159+
148160
if !isCloudAnnotationNeeded(bs, sa) { // Return if not needed
149161
return false, nil
150162
}
@@ -168,11 +180,28 @@ func AddCloudAnnotationsToSAIfNeeded(ctx context.Context, kbClient client.Client
168180
return false, nil
169181
}
170182

183+
func addSidekickAnnotationsIfNeeded(sidekick *sidekickapi.Sidekick, bs *storageapi.BackupStorage) {
184+
if bs.Spec.Storage.Provider == storageapi.ProviderAzure {
185+
if sidekick.Labels == nil {
186+
sidekick.Labels = make(map[string]string)
187+
}
188+
sidekick.Labels[AzureWorkloadIdentityUseLabel] = "true"
189+
if sidekick.Annotations == nil {
190+
sidekick.Annotations = make(map[string]string)
191+
}
192+
sidekick.Annotations[AzureWorkloadIdentityUseAnnotation] = "true"
193+
}
194+
}
195+
171196
func hasCredLessManagerProvidedAnnotation(bs *storageapi.BackupStorage, sa *core.ServiceAccount) bool {
172197
switch bs.Spec.Storage.Provider {
173198
case storageapi.ProviderS3:
174199
_, exists := sa.Annotations[AWSIRSARoleAnnotation]
175200
return exists
201+
case storageapi.ProviderAzure:
202+
_, hasClientId := sa.Annotations[AzureMIClientIDAnnotation]
203+
_, hasTenantId := sa.Annotations[AzureMITenantIDAnnotation]
204+
return hasClientId && hasTenantId
176205
default:
177206
return false
178207
}
@@ -184,7 +213,10 @@ func isCloudAnnotationNeeded(bs *storageapi.BackupStorage, sa *core.ServiceAccou
184213
case storageapi.ProviderS3:
185214
_, ok := sa.Annotations[AWSSeedRoleAnnotationName]
186215
return !ok
187-
// case storageapi.ProviderAzure:
216+
case storageapi.ProviderAzure:
217+
_, hasClientId := sa.Annotations[AzureMIClientIDAnnotation]
218+
_, hasTenantId := sa.Annotations[AzureMITenantIDAnnotation]
219+
return !hasTenantId || !hasClientId
188220
}
189221
}
190222
return false
@@ -260,6 +292,10 @@ func hasRequiredCloudAnnotations(bs *storageapi.BackupStorage, sa *core.ServiceA
260292
if bs.Spec.Storage.Provider == storageapi.ProviderS3 {
261293
return sa.Annotations[AWSSeedRoleAnnotationName] != "" && sa.Annotations[BucketAnnotationKey] != ""
262294
}
295+
if bs.Spec.Storage.Provider == storageapi.ProviderAzure {
296+
return sa.Annotations[AzureSubscriptionIDAnnotation] != "" && sa.Annotations[AzureMINameAnnotation] != "" &&
297+
sa.Annotations[AzureResourceGroupAnnotation] != ""
298+
}
263299
return false
264300
}
265301

@@ -431,12 +467,28 @@ func getAWSAnnotations(source map[string]string) (map[string]string, error) {
431467
return annotations, nil
432468
}
433469

470+
func getAzureAnnotations(source map[string]string) (map[string]string, error) {
471+
required := map[string]string{
472+
AzureSubscriptionIDAnnotation: source[AzureSubscriptionIDAnnotation],
473+
AzureMINameAnnotation: source[AzureMINameAnnotation],
474+
AzureResourceGroupAnnotation: source[AzureResourceGroupAnnotation],
475+
BucketAnnotationKey: source[BucketAnnotationKey],
476+
}
477+
annotations := make(map[string]string)
478+
for key, val := range required {
479+
annotations[key] = val
480+
}
481+
return annotations, nil
482+
}
483+
434484
func getRequiredAnnotations(bs *storageapi.BackupStorage, annotations map[string]string) (map[string]string, error) {
435485
switch bs.Spec.Storage.Provider {
436486
case storageapi.ProviderS3:
437487
return getAWSAnnotations(annotations)
438488
// case storageapi.ProviderGCS:
439489
// return applyGCPAnnotations(sa, annotations)
490+
case storageapi.ProviderAzure:
491+
return getAzureAnnotations(annotations)
440492
default:
441493
return nil, fmt.Errorf("unsupported storage provider: %s", bs.Spec.Storage.Provider)
442494

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ kubeops.dev/petset/crds
18831883
kubeops.dev/sidekick/apis/apps
18841884
kubeops.dev/sidekick/apis/apps/v1alpha1
18851885
kubeops.dev/sidekick/crds
1886-
# kubestash.dev/apimachinery v0.27.0
1886+
# kubestash.dev/apimachinery v0.28.0-rc.0
18871887
## explicit; go 1.25.0
18881888
kubestash.dev/apimachinery/apis
18891889
kubestash.dev/apimachinery/apis/addons/v1alpha1

0 commit comments

Comments
 (0)