Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update go version #504

Merged
merged 8 commits into from
Feb 5, 2025
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
6 changes: 5 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ run:
# Extend default timeout for running in single-core CI
timeout: 5m
tests: false

issues:
exclude-rules:
- path: pkg/mod
linters:
- '*'
linters:
enable:
# Default linters plus these:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.22.7-alpine as builder
FROM --platform=$BUILDPLATFORM golang:1.23.5-alpine as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ envtest:


lint: lint-deps
golangci-lint run
golangci-lint run --skip-dirs "pkg/mod"

lint-deps:
@if ! which golangci-lint >/dev/null || [[ "$$(golangci-lint --version)" != *${LINT_VERSION}* ]]; then \
Expand Down
4 changes: 2 additions & 2 deletions api/common/utils/secret_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"io"
"text/template"

"github.com/Masterminds/sprig/v3"
sprigv3 "github.com/Masterminds/sprig/v3"

Check warning on line 10 in api/common/utils/secret_template.go

View check run for this annotation

In Solidarity / Inclusive Language

Match Found

Please consider an alternative to `Master`. Possibilities include: `primary`, `main`, `leader`, `active`, `writer`
Raw output
/\b(?!masterdata|masterdata\w+\b)master/gi
"github.com/SAP/sap-btp-service-operator/api/common"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -336,7 +336,7 @@
}

func filteredFuncMap() template.FuncMap {
funcs := sprig.TxtFuncMap()
funcs := sprigv3.TxtFuncMap()

for sprigFunc := range funcs {
if _, ok := allowedSprigFunctions[sprigFunc]; !ok {
Expand Down
4 changes: 2 additions & 2 deletions api/v1/servicebinding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ func (sb *ServiceBinding) SetReady(ready metav1.ConditionStatus) {
}

func (sb *ServiceBinding) GetAnnotations() map[string]string {
return sb.Annotations
return sb.ObjectMeta.Annotations
}

func (sb *ServiceBinding) SetAnnotations(annotations map[string]string) {
sb.Annotations = annotations
sb.ObjectMeta.Annotations = annotations
}

// +kubebuilder:object:root=true
Expand Down
10 changes: 5 additions & 5 deletions api/v1/servicebinding_validating_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var _ webhook.Validator = &ServiceBinding{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (sb *ServiceBinding) ValidateCreate() (admission.Warnings, error) {
servicebindinglog.Info("validate create", "name", sb.Name)
servicebindinglog.Info("validate create", "name", sb.ObjectMeta.Name)
if sb.Spec.CredRotationPolicy != nil {
if err := sb.validateCredRotatingConfig(); err != nil {
return nil, err
Expand All @@ -58,7 +58,7 @@ func (sb *ServiceBinding) ValidateCreate() (admission.Warnings, error) {

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (sb *ServiceBinding) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
servicebindinglog.Info("validate update", "name", sb.Name)
servicebindinglog.Info("validate update", "name", sb.ObjectMeta.Name)
if sb.Spec.CredRotationPolicy != nil {
if err := sb.validateCredRotatingConfig(); err != nil {
return nil, err
Expand Down Expand Up @@ -87,10 +87,10 @@ func (sb *ServiceBinding) ValidateUpdate(old runtime.Object) (admission.Warnings
}

func (sb *ServiceBinding) validateRotationLabels(old *ServiceBinding) bool {
if sb.Labels[common.StaleBindingIDLabel] != old.Labels[common.StaleBindingIDLabel] {
if sb.ObjectMeta.Labels[common.StaleBindingIDLabel] != old.ObjectMeta.Labels[common.StaleBindingIDLabel] {
return false
}
return sb.Labels[common.StaleBindingRotationOfLabel] == old.Labels[common.StaleBindingRotationOfLabel]
return sb.ObjectMeta.Labels[common.StaleBindingRotationOfLabel] == old.ObjectMeta.Labels[common.StaleBindingRotationOfLabel]
}

func (sb *ServiceBinding) specChanged(oldBinding *ServiceBinding) bool {
Expand All @@ -110,7 +110,7 @@ func (sb *ServiceBinding) specChanged(oldBinding *ServiceBinding) bool {

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (sb *ServiceBinding) ValidateDelete() (admission.Warnings, error) {
servicebindinglog.Info("validate delete", "name", sb.Name)
servicebindinglog.Info("validate delete", "name", sb.ObjectMeta.Name)

// TODO(user): fill in your validation logic upon object deletion.
return nil, nil
Expand Down
4 changes: 2 additions & 2 deletions api/v1/serviceinstance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ func (si *ServiceInstance) SetReady(ready metav1.ConditionStatus) {
si.Status.Ready = ready
}
func (si *ServiceInstance) GetAnnotations() map[string]string {
return si.Annotations
return si.ObjectMeta.Annotations
}

func (si *ServiceInstance) SetAnnotations(annotations map[string]string) {
si.Annotations = annotations
si.ObjectMeta.Annotations = annotations
}

// +kubebuilder:object:root=true
Expand Down
10 changes: 5 additions & 5 deletions api/v1/serviceinstance_validating_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (si *ServiceInstance) ValidateCreate() (warnings admission.Warnings, err er
}

func (si *ServiceInstance) ValidateUpdate(old runtime.Object) (warnings admission.Warnings, err error) {
serviceinstancelog.Info("validate update", "name", si.Name)
serviceinstancelog.Info("validate update", "name", si.ObjectMeta.Name)

oldInstance := old.(*ServiceInstance)
if oldInstance.Spec.BTPAccessCredentialsSecret != si.Spec.BTPAccessCredentialsSecret {
Expand All @@ -57,11 +57,11 @@ func (si *ServiceInstance) ValidateUpdate(old runtime.Object) (warnings admissio
}

func (si *ServiceInstance) ValidateDelete() (warnings admission.Warnings, err error) {
serviceinstancelog.Info("validate delete", "name", si.Name)
if si.Annotations != nil {
preventDeletion, ok := si.Annotations[common.PreventDeletion]
serviceinstancelog.Info("validate delete", "name", si.ObjectMeta.Name)
if si.ObjectMeta.Annotations != nil {
preventDeletion, ok := si.ObjectMeta.Annotations[common.PreventDeletion]
if ok && strings.ToLower(preventDeletion) == "true" {
return nil, fmt.Errorf("service instance '%s' is marked with \"prevent deletion\"", si.Name)
return nil, fmt.Errorf("service instance '%s' is marked with \"prevent deletion\"", si.ObjectMeta.Name)
}
}
return nil, nil
Expand Down
42 changes: 7 additions & 35 deletions config/crd/bases/services.cloud.sap.com_servicebindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.16.1
name: servicebindings.services.cloud.sap.com
spec:
group: services.cloud.sap.com
Expand Down Expand Up @@ -82,7 +82,6 @@ spec:
description: |-
Parameters for the binding.


The Parameters field is NOT secret or secured in any way and should
NEVER be used to hold sensitive information. To set parameters that
contain secret information, you should ALWAYS store that information
Expand Down Expand Up @@ -199,16 +198,8 @@ spec:
conditions:
description: Service binding conditions
items:
description: "Condition contains details for one aspect of the current
state of this API Resource.\n---\nThis struct is intended for
direct use as an array at the field path .status.conditions. For
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
observations of a foo's current state.\n\t // Known .status.conditions.type
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
\ // other fields\n\t}"
description: Condition contains details for one aspect of the current
state of this API Resource.
properties:
lastTransitionTime:
description: |-
Expand Down Expand Up @@ -249,12 +240,7 @@ spec:
- Unknown
type: string
type:
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
Expand Down Expand Up @@ -362,7 +348,6 @@ spec:
description: |-
Parameters for the binding.


The Parameters field is NOT secret or secured in any way and should
NEVER be used to hold sensitive information. To set parameters that
contain secret information, you should ALWAYS store that information
Expand Down Expand Up @@ -464,16 +449,8 @@ spec:
conditions:
description: Service binding conditions
items:
description: "Condition contains details for one aspect of the current
state of this API Resource.\n---\nThis struct is intended for
direct use as an array at the field path .status.conditions. For
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
observations of a foo's current state.\n\t // Known .status.conditions.type
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
\ // other fields\n\t}"
description: Condition contains details for one aspect of the current
state of this API Resource.
properties:
lastTransitionTime:
description: |-
Expand Down Expand Up @@ -514,12 +491,7 @@ spec:
- Unknown
type: string
type:
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
Expand Down
50 changes: 11 additions & 39 deletions config/crd/bases/services.cloud.sap.com_serviceinstances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.16.1
name: serviceinstances.services.cloud.sap.com
spec:
group: services.cloud.sap.com
Expand Down Expand Up @@ -89,7 +89,6 @@ spec:
description: |-
Provisioning parameters for the instance.


The Parameters field is NOT secret or secured in any way and should
NEVER be used to hold sensitive information. To set parameters that
contain secret information, you should ALWAYS store that information
Expand Down Expand Up @@ -140,10 +139,6 @@ spec:
shared:
description: Indicates the desired shared state
type: boolean
watchParametersFromChanges:
description: indicate instance will update on secrets from parametersFrom
change
type: boolean
userInfo:
description: |-
UserInfo contains information about the user that last modified this
Expand Down Expand Up @@ -175,6 +170,10 @@ spec:
all active users.
type: string
type: object
watchParametersFromChanges:
description: indicate instance will update on secrets from parametersFrom
change
type: boolean
required:
- serviceOfferingName
- servicePlanName
Expand All @@ -185,16 +184,8 @@ spec:
conditions:
description: Service instance conditions
items:
description: "Condition contains details for one aspect of the current
state of this API Resource.\n---\nThis struct is intended for
direct use as an array at the field path .status.conditions. For
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
observations of a foo's current state.\n\t // Known .status.conditions.type
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
\ // other fields\n\t}"
description: Condition contains details for one aspect of the current
state of this API Resource.
properties:
lastTransitionTime:
description: |-
Expand Down Expand Up @@ -235,12 +226,7 @@ spec:
- Unknown
type: string
type:
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
Expand Down Expand Up @@ -352,7 +338,6 @@ spec:
description: |-
Provisioning parameters for the instance.


The Parameters field is NOT secret or secured in any way and should
NEVER be used to hold sensitive information. To set parameters that
contain secret information, you should ALWAYS store that information
Expand Down Expand Up @@ -444,16 +429,8 @@ spec:
conditions:
description: Service instance conditions
items:
description: "Condition contains details for one aspect of the current
state of this API Resource.\n---\nThis struct is intended for
direct use as an array at the field path .status.conditions. For
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
observations of a foo's current state.\n\t // Known .status.conditions.type
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
\ // other fields\n\t}"
description: Condition contains details for one aspect of the current
state of this API Resource.
properties:
lastTransitionTime:
description: |-
Expand Down Expand Up @@ -494,12 +471,7 @@ spec:
- Unknown
type: string
type:
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
Expand Down
2 changes: 1 addition & 1 deletion controllers/secret_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (r *SecretReconciler) Reconcile(ctx context.Context, req reconcile.Request)
log.Info(fmt.Sprintf("reconciling params secret %s", req.NamespacedName))
// Fetch the Secret
secret := &corev1.Secret{}
if err := r.Get(ctx, req.NamespacedName, secret); err != nil {
if err := r.Client.Get(ctx, req.NamespacedName, secret); err != nil {
if !apierrors.IsNotFound(err) {
log.Error(err, "unable to fetch Secret")
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/SAP/sap-btp-service-operator

go 1.22.7
go 1.23.5

require (
github.com/Masterminds/sprig/v3 v3.2.3
Expand Down
Loading