Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
GOPROXY: ${{ secrets.GOPROXY }}
SOURCE_REPO: ${{ secrets.SOURCE_REPO }}
SOURCE_REPO_SSH_KEY: ${{ secrets.SOURCE_REPO_SSH_KEY }}
BASE_IMAGES_VERSION: "v0.5.79"
BASE_IMAGES_VERSION: "v1.1.8"
on:
#pull_request:
# call from trivy_image_check.yaml, which in turn call from pull_request
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:

- name: Download base images and auth prepare
run: |
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fcontainer-base%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
cat base_images.yml

- uses: deckhouse/modules-actions/setup@v4
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
GOPROXY: ${{ secrets.GOPROXY }}
SOURCE_REPO: ${{ secrets.SOURCE_REPO }}
SOURCE_REPO_SSH_KEY: ${{ secrets.SOURCE_REPO_SSH_KEY }}
BASE_IMAGES_VERSION: "v0.5.79"
BASE_IMAGES_VERSION: "v1.1.8"
on:
push:
tags:
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:

- name: Download base images and auth prepare
run: |
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fcontainer-base%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
cat base_images.yml

- uses: deckhouse/modules-actions/setup@v4
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:

- name: Download base images
run: |
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fcontainer-base%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
cat base_images.yml

- uses: deckhouse/modules-actions/setup@v4
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:

- name: Download base images
run: |
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fcontainer-base%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
cat base_images.yml

- uses: deckhouse/modules-actions/setup@v4
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:

- name: Download base images
run: |
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fcontainer-base%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
cat base_images.yml

- uses: deckhouse/modules-actions/setup@v4
Expand Down Expand Up @@ -211,7 +211,7 @@ jobs:

- name: Download base images
run: |
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fcontainer-base%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml
cat base_images.yml

- uses: deckhouse/modules-actions/setup@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/translate-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Translate Changelog and Create PR

on:
push:
# Запуск для всех веток при любом push
# Run on every push to any branch

jobs:
translate-and-pr:
Expand Down
9 changes: 1 addition & 8 deletions .werf/base-images.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
# Base Images
{{- $baseImages := .Files.Get "base_images.yml" | fromYaml }}
{{- range $k, $v := $baseImages }}
{{ $baseImagePath := (printf "%s@%s" $baseImages.REGISTRY_PATH (trimSuffix "/" $v)) }}
{{- $baseImagePath := (printf "%s@%s" $baseImages.REGISTRY_PATH (trimSuffix "/" $v)) }}
{{- if ne $k "REGISTRY_PATH" }}
{{- $_ := set $baseImages $k $baseImagePath }}
{{- end }}
{{- end }}
{{- $_ := unset $baseImages "REGISTRY_PATH" }}

{{- $_ := set . "Images" $baseImages }}
# base images artifacts
{{- range $k, $v := .Images }}
---
image: {{ $k }}
from: {{ $v }}
final: false
{{- end }}

4 changes: 2 additions & 2 deletions .werf/bundle.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
image: docs-generator
fromImage: builder/alt
from: {{ index $.Images "builder/golang-alt" }}
final: false

git:
Expand All @@ -25,7 +25,7 @@ shell:
# Bundle image, stored in your.registry.io/modules/<module-name>:<semver>
---
image: bundle
fromImage: builder/scratch
from: {{ index $.Images "builder/scratch" }}

import:
# Rendering .werf/images-digests.yaml is required!
Expand Down
2 changes: 1 addition & 1 deletion .werf/choose-edition.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
image: choose-edition
fromImage: builder/alt
from: {{ index $.Images "builder/golang-alt" }}
fromCacheVersion: {{ div .Commit.Date.Unix (mul 60 60 24 30) }}

git:
Expand Down
9 changes: 6 additions & 3 deletions .werf/images-digests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
# Images Digest: a files with all image digests to be able to use them in helm templates of a module
---
image: images-digests
fromImage: builder/alpine
from: {{ index $.Images "builder/alpine" }}
import:
- from: {{ index $.Images "jq" }}
add: /usr/bin/jq
to: /usr/bin/jq
before: setup
dependencies:
{{- range $ImageID := $ImagesIDList }}
{{- $ImageNameCamel := $ImageID | splitList "/" | last | camelcase | untitle }}
Expand All @@ -24,8 +29,6 @@ dependencies:
targetEnv: MODULE_IMAGE_DIGEST_{{ $ImageNameCamel }}
{{- end }}
shell:
beforeInstall:
- apk add --no-cache jq
setup:
- |
env | grep MODULE_IMAGE_DIGEST | jq -Rn '
Expand Down
1 change: 1 addition & 0 deletions .werf/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
{{- range $path, $content := $ImagesBuildFiles }}
{{- $ctx := dict }}
{{- $_ := set $ctx "ImageName" ($path | split "/")._1 }}
{{- $_ := set $ctx "Images" $.Images }}
{{- $_ := set $ctx "SOURCE_REPO" $Root.SOURCE_REPO }}
{{- $_ := set $ctx "MODULE_EDITION" $.MODULE_EDITION }}
{{- $_ := set $ctx "SVACE_ENABLED" (env "SVACE_ENABLED" "false") }}
Expand Down
6 changes: 3 additions & 3 deletions .werf/release.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Release image, stored in your.registry.io/modules/<module-name>/release:<semver>
---
image: release-channel-version-artifact
fromImage: builder/alpine
from: {{ index $.Images "builder/alpine" }}
final: false
git:
- add: /
Expand All @@ -13,7 +13,7 @@ git:
setup:
- '**/*'
import:
- image: tools/yq
- from: {{ index $.Images "yq" }}
add: /usr/bin/yq
to: /usr/bin/yq
before: install
Expand All @@ -24,7 +24,7 @@ shell:
- cp -f CHANGELOG/{{ env "MODULES_MODULE_TAG" "local" }}.yml /changelog.yaml || touch /changelog.yaml
---
image: release-channel-version
fromImage: builder/scratch
from: {{ index $.Images "builder/scratch" }}
import:
- image: release-channel-version-artifact
add: /
Expand Down
1 change: 0 additions & 1 deletion hooks/go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package main

import (
"github.com/deckhouse/module-sdk/pkg/app"

_ "github.com/deckhouse/sds-object/hooks/go/020-webhook-certs"
_ "github.com/deckhouse/sds-object/hooks/go/030-remove-finalizers-on-module-delete"
)
Expand Down
16 changes: 8 additions & 8 deletions images/controller/internal/backend/garage/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import (
v1alpha1 "github.com/deckhouse/sds-object/api/v1alpha1"
)

func cluster(name string, t v1alpha1.ClusterType, r v1alpha1.RedundancyMode) *v1alpha1.ObjectStorageCluster {
func cluster(name string, r v1alpha1.RedundancyMode) *v1alpha1.ObjectStorageCluster {
return &v1alpha1.ObjectStorageCluster{
ObjectMeta: metav1.ObjectMeta{Name: name},
Spec: v1alpha1.ObjectStorageClusterSpec{Type: t, Redundancy: r},
Spec: v1alpha1.ObjectStorageClusterSpec{Type: v1alpha1.ClusterTypeLightweight, Redundancy: r},
}
}

Expand All @@ -41,33 +41,33 @@ func TestReplicationFactor(t *testing.T) {
v1alpha1.RedundancyMode(""): 3, // default
}
for r, want := range cases {
if got := replicationFactor(cluster("c", v1alpha1.ClusterTypeLightweight, r)); got != want {
if got := replicationFactor(cluster("c", r)); got != want {
t.Errorf("replicationFactor(%q)=%d, want %d", r, got, want)
}
}
}

func TestStorageSize(t *testing.T) {
none := cluster("c", v1alpha1.ClusterTypeLightweight, "")
none := cluster("c", "")
if got := storageSize(none); got.Cmp(resource.MustParse("10Gi")) != 0 {
t.Errorf("storageSize(unset)=%s, want 10Gi", got.String())
}

sized := cluster("c", v1alpha1.ClusterTypeLightweight, "")
sized := cluster("c", "")
sized.Spec.Storage = &v1alpha1.ObjectStorageClusterStorageSpec{Size: "20Gi"}
if got := storageSize(sized); got.Cmp(resource.MustParse("20Gi")) != 0 {
t.Errorf("storageSize(20Gi)=%s, want 20Gi", got.String())
}

bad := cluster("c", v1alpha1.ClusterTypeLightweight, "")
bad := cluster("c", "")
bad.Spec.Storage = &v1alpha1.ObjectStorageClusterStorageSpec{Size: "not-a-quantity"}
if got := storageSize(bad); got.Cmp(resource.MustParse("10Gi")) != 0 {
t.Errorf("storageSize(invalid)=%s, want 10Gi fallback", got.String())
}
}

func TestRenderConfig(t *testing.T) {
cfg := renderConfig(cluster("c", v1alpha1.ClusterTypeLightweight, v1alpha1.RedundancyHighRedundancy))
cfg := renderConfig(cluster("c", v1alpha1.RedundancyHighRedundancy))
for _, want := range []string{
"replication_factor = 5",
"[s3_api]",
Expand All @@ -81,7 +81,7 @@ func TestRenderConfig(t *testing.T) {
}

func TestNamesAndEndpoints(t *testing.T) {
c := cluster("shared", v1alpha1.ClusterTypeLightweight, "")
c := cluster("shared", "")
if got := resourceName(c); got != "shared-garage" {
t.Errorf("resourceName=%q", got)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func (r *ObjectBucketReconciler) reconcileNormal(ctx context.Context, bucket *v1
if err != nil {
status.setCondition(v1alpha1.OBConditionBucketReady, metav1.ConditionFalse, "WaitingForCluster",
fmt.Sprintf("ObjectStorageCluster %q is not available: %v", bucket.Spec.ClusterRef, err))
gateAfter(status, obStageOrder, v1alpha1.OBConditionReady, v1alpha1.OBConditionBucketReady)
gateAfter(status, obStageOrder, v1alpha1.OBConditionBucketReady)
return r.finish(ctx, bucket, status, observed, nil)
}
if cluster.Status != nil && cluster.Status.Endpoint != nil {
Expand All @@ -216,26 +216,26 @@ func (r *ObjectBucketReconciler) reconcileNormal(ctx context.Context, bucket *v1
if clusterReadyState(cluster) != string(metav1.ConditionTrue) {
status.setCondition(v1alpha1.OBConditionBucketReady, metav1.ConditionFalse, "WaitingForCluster",
fmt.Sprintf("ObjectStorageCluster %q is not Ready", bucket.Spec.ClusterRef))
gateAfter(status, obStageOrder, v1alpha1.OBConditionReady, v1alpha1.OBConditionBucketReady)
gateAfter(status, obStageOrder, v1alpha1.OBConditionBucketReady)
return r.finish(ctx, bucket, status, observed, nil)
}

driver, err := r.Registry.For(cluster)
if err != nil {
status.setCondition(v1alpha1.OBConditionBucketReady, metav1.ConditionFalse, reasonError, err.Error())
gateAfter(status, obStageOrder, v1alpha1.OBConditionReady, v1alpha1.OBConditionBucketReady)
gateAfter(status, obStageOrder, v1alpha1.OBConditionBucketReady)
return r.finish(ctx, bucket, status, observed, err)
}

state, err := driver.EnsureBucket(ctx, cluster, bucket)
observed.bucketName = state.BucketName
if !advance(status, obStageOrder, v1alpha1.OBConditionReady, v1alpha1.OBConditionBucketReady, state.Ready, state.Message, err) {
if !advance(status, obStageOrder, v1alpha1.OBConditionBucketReady, state.Ready, state.Message, err) {
return r.finish(ctx, bucket, status, observed, err)
}

// Stage 2: CredentialsReady — (re)write the credentials Secret.
secretName, err := r.ensureCredentialsSecret(ctx, cluster, bucket, &state)
if !advance(status, obStageOrder, v1alpha1.OBConditionReady, v1alpha1.OBConditionCredentialsReady, err == nil,
if !advance(status, obStageOrder, v1alpha1.OBConditionCredentialsReady, err == nil,
"credentials Secret written", err) {
return r.finish(ctx, bucket, status, observed, err)
}
Expand Down Expand Up @@ -321,7 +321,7 @@ func (r *ObjectBucketReconciler) finish(
if reconcileErr != nil {
return ctrl.Result{}, reconcileErr
}
if aggregateReady(status, v1alpha1.OBConditionReady) {
if aggregateReady(status) {
return ctrl.Result{}, nil
}
return ctrl.Result{RequeueAfter: r.Cfg.RequeueInterval}, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ func (r *ObjectStorageClusterReconciler) reconcileNormal(ctx context.Context, cl
if err != nil {
// No driver for this profile is a terminal configuration error.
status.setCondition(v1alpha1.OSCConditionBackendReady, metav1.ConditionFalse, reasonError, err.Error())
gateAfter(status, oscStageOrder, v1alpha1.OSCConditionReady, v1alpha1.OSCConditionBackendReady)
gateAfter(status, oscStageOrder, v1alpha1.OSCConditionBackendReady)
return r.finish(ctx, cluster, status, nil, err)
}

state, err := driver.EnsureCluster(ctx, cluster)
if !advance(status, oscStageOrder, v1alpha1.OSCConditionReady, v1alpha1.OSCConditionBackendReady, state.Ready, state.Message, err) {
if !advance(status, oscStageOrder, v1alpha1.OSCConditionBackendReady, state.Ready, state.Message, err) {
return r.finish(ctx, cluster, status, &state, err)
}

Expand All @@ -149,7 +149,7 @@ func (r *ObjectStorageClusterReconciler) reconcileNormal(ctx context.Context, cl
if !endpointReady {
endpointMsg = "waiting for the backend to publish an S3 endpoint"
}
if !advance(status, oscStageOrder, v1alpha1.OSCConditionReady, v1alpha1.OSCConditionEndpointReady, endpointReady, endpointMsg, nil) {
if !advance(status, oscStageOrder, v1alpha1.OSCConditionEndpointReady, endpointReady, endpointMsg, nil) {
return r.finish(ctx, cluster, status, &state, nil)
}

Expand All @@ -175,7 +175,7 @@ func (r *ObjectStorageClusterReconciler) finish(
if reconcileErr != nil {
return ctrl.Result{}, reconcileErr
}
if aggregateReady(status, v1alpha1.OSCConditionReady) {
if aggregateReady(status) {
return ctrl.Result{}, nil
}
return ctrl.Result{RequeueAfter: r.Cfg.RequeueInterval}, nil
Expand Down
Loading
Loading