Skip to content

Commit bd915d2

Browse files
author
Niklas Burchhardt
committed
update to go v1.26.0, changing recommended codeparts for new version
leave out k8s dependencies, because they break it
1 parent 682fb6c commit bd915d2

File tree

6 files changed

+25
-42
lines changed

6 files changed

+25
-42
lines changed

deploy/stackit/README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,37 @@
11
# stackit-cert-manager-webhook
22

3-
![Version: 0.3.0](https://img.shields.io/badge/Version-0.3.0-informational?style=flat-square) ![AppVersion: 1.0](https://img.shields.io/badge/AppVersion-1.0-informational?style=flat-square)
3+
![Version: 0.4.1](https://img.shields.io/badge/Version-0.4.1-informational?style=flat-square) ![AppVersion: v0.4.1](https://img.shields.io/badge/AppVersion-v0.4.1-informational?style=flat-square)
44

5-
A Helm chart for Kubernetes
5+
A Helm chart for stackitcloud/stackit-cert-manager-webhook
66

77
## Values
88

99
| Key | Type | Default | Description |
1010
|-----|------|---------|-------------|
11+
| additionalVolumeMounts | list | `[]` | |
12+
| additionalVolumes | list | `[]` | |
1113
| affinity | object | `{}` | |
1214
| certManager | object | `{"namespace":"cert-manager","serviceAccountName":"cert-manager"}` | Meta information of the cert-manager itself. |
1315
| certManager.namespace | string | `"cert-manager"` | namespace where the webhook should be installed. Cert-Manager and the webhook should be in the same namespace. |
1416
| certManager.serviceAccountName | string | `"cert-manager"` | service account name for the cert-manager. |
17+
| extraEnv | list | `[]` | delete the next line and add your variables as in the commented example below. |
1518
| fullnameOverride | string | `""` | Fullname override of the webhook. |
1619
| groupName | string | `"acme.stackit.de"` | The GroupName here is used to identify your company or business unit that created this webhook. Therefore, it should be acme.stackit.de. |
17-
| image | object | `{"pullPolicy":"IfNotPresent","repository":"ghcr.io/stackitcloud/stackit-cert-manager-webhook","tag":"latest"}` | Image information for the webhook. |
20+
| image | object | `{"pullPolicy":"IfNotPresent","repository":"ghcr.io/stackitcloud/stackit-cert-manager-webhook","tag":""}` | Image information for the webhook. |
1821
| image.pullPolicy | string | `"IfNotPresent"` | pull policy of the image. |
1922
| image.repository | string | `"ghcr.io/stackitcloud/stackit-cert-manager-webhook"` | repository of the image. |
20-
| image.tag | string | `"latest"` | tag of the image. |
23+
| imagePullSecrets | list | `[]` | |
2124
| nameOverride | string | `""` | Webhook configuration. |
2225
| nodeSelector | object | `{}` | Node selector for the webhook. |
2326
| podSecurityContext.runAsGroup | int | `1000` | |
2427
| podSecurityContext.runAsNonRoot | bool | `true` | |
2528
| podSecurityContext.runAsUser | int | `1000` | |
29+
| podSecurityContext.seccompProfile.type | string | `"RuntimeDefault"` | |
2630
| replicaCount | int | `1` | Replicas for the webhook. Since it is a stateless application server that sends requests you can increase the number as you want. Most of the time however, 1 replica is enough. |
2731
| resources | object | `{}` | Kubernetes resources for the webhook. Usually limits.cpu=100m, limits.memory=128Mi, requests.cpu=100m, requests.memory=128Mi is enough for the webhook. |
2832
| securityContext.allowPrivilegeEscalation | bool | `false` | |
2933
| securityContext.capabilities.drop[0] | string | `"ALL"` | |
34+
| securityContext.seccompProfile.type | string | `"RuntimeDefault"` | |
3035
| service | object | `{"port":443,"type":"ClusterIP"}` | Configuration for the webhook service. |
3136
| service.port | int | `443` | port of the service. |
3237
| service.type | string | `"ClusterIP"` | type of the service. |

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/stackitcloud/stackit-cert-manager-webhook
22

3-
go 1.25.0
4-
5-
toolchain go1.26.0
3+
go 1.26.0
64

75
// Do not remove this comment:
86
// please place any replace statements here at the top for visibility and add a

internal/repository/dns_client.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,17 @@ func newStackitDnsClient(
1212
}
1313

1414
func newStackitDnsClientBearerToken(config Config) (*stackitdnsclient.APIClient, error) {
15-
httpClient := *config.HttpClient
16-
1715
return newStackitDnsClient(
1816
stackitconfig.WithToken(config.AuthToken),
19-
stackitconfig.WithHTTPClient(&httpClient),
17+
stackitconfig.WithHTTPClient(new(*config.HttpClient)),
2018
stackitconfig.WithEndpoint(config.ApiBasePath),
2119
)
2220
}
2321

2422
func newStackitDnsClientKeyPath(config Config) (*stackitdnsclient.APIClient, error) {
25-
httpClient := *config.HttpClient
26-
2723
return newStackitDnsClient(
2824
stackitconfig.WithServiceAccountKeyPath(config.SaKeyPath),
29-
stackitconfig.WithHTTPClient(&httpClient),
25+
stackitconfig.WithHTTPClient(new(*config.HttpClient)),
3026
stackitconfig.WithEndpoint(config.ApiBasePath),
3127
stackitconfig.WithTokenEndpoint(config.ServiceAccountBaseUrl),
3228
)

internal/repository/rrset_repository.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ func (r *rrSetRepository) UpdateRRSet(
135135
func (r *rrSetRepository) DeleteRRSet(ctx context.Context, rrSetId string) error {
136136
_, err := r.apiClient.DeleteRecordSet(ctx, r.projectId, r.zoneId, rrSetId).Execute()
137137
if err != nil {
138-
var oapiError *oapierror.GenericOpenAPIError
139-
if errors.As(err, &oapiError) {
138+
if oapiError, ok := errors.AsType[*oapierror.GenericOpenAPIError](err); ok {
140139
if oapiError.StatusCode == 404 || oapiError.StatusCode == 400 {
141140
return ErrRRSetNotFound
142141
}

internal/repository/rrset_repositry_test.go

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -72,45 +72,33 @@ func TestRrSetRepository_UpdateRRSet(t *testing.T) {
7272

7373
t.Run("UpdateRRSet success", func(t *testing.T) {
7474
t.Parallel()
75-
comment := "comment1"
76-
id := "0000"
77-
name := "test.com."
78-
ttl := int64(60)
79-
content := "content1"
80-
8175
rrSetRepository, err := rrSetRepositoryFactory.NewRRSetRepository(config, "2222")
8276
require.NoError(t, err)
8377
err = rrSetRepository.UpdateRRSet(
8478
ctx,
8579
stackitdnsclient.RecordSet{
86-
Comment: &comment,
87-
Id: &id,
88-
Name: &name,
89-
Ttl: &ttl,
90-
Records: &[]stackitdnsclient.Record{{Content: &content}},
80+
Comment: new("comment1"),
81+
Id: new("0000"),
82+
Name: new("test.com."),
83+
Ttl: new(int64(60)),
84+
Records: &[]stackitdnsclient.Record{{Content: new("content1")}},
9185
},
9286
)
9387
require.NoError(t, err)
9488
})
9589

9690
t.Run("UpdateRRSet failure", func(t *testing.T) {
9791
t.Parallel()
98-
comment := "comment2"
99-
id := "2222"
100-
name := "test.com."
101-
ttl := int64(60)
102-
content := "content2"
103-
10492
rrSetRepository, err := rrSetRepositoryFactory.NewRRSetRepository(config, "3333")
10593
require.NoError(t, err)
10694
err = rrSetRepository.UpdateRRSet(
10795
ctx,
10896
stackitdnsclient.RecordSet{
109-
Comment: &comment,
110-
Id: &id,
111-
Name: &name,
112-
Ttl: &ttl,
113-
Records: &[]stackitdnsclient.Record{{Content: &content}},
97+
Comment: new("comment2"),
98+
Id: new("2222"),
99+
Name: new("test.com."),
100+
Ttl: new(int64(60)),
101+
Records: &[]stackitdnsclient.Record{{Content: new("content2")}},
114102
},
115103
)
116104
require.Error(t, err)

internal/resolver/resolver.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,19 +185,16 @@ func (s *stackitDnsProviderResolver) initializeResolverContext(
185185
func (s *stackitDnsProviderResolver) createRRSet(
186186
initResolverRes *initResolverContextResult, key string,
187187
) error {
188-
comment := "This record set is managed by stackit-cert-manager-webhook"
189-
rrSetType := typeTxtRecord
190-
191188
rrSet := stackitdnsclient.RecordSet{
192-
Comment: &comment,
189+
Comment: new("This record set is managed by stackit-cert-manager-webhook"),
193190
Name: &initResolverRes.rrSetName,
194191
Records: &[]stackitdnsclient.Record{
195192
{
196193
Content: &key,
197194
},
198195
},
199196
Ttl: &initResolverRes.acmeTxtDefaultTTL,
200-
Type: stackitdnsclient.RecordSetGetTypeAttributeType(&rrSetType),
197+
Type: stackitdnsclient.RecordSetGetTypeAttributeType(new(typeTxtRecord)),
201198
}
202199

203200
s.logger.Info("Creating RRSet", zap.String("rrSet", fmt.Sprintf("%+v", rrSet)))

0 commit comments

Comments
 (0)