Skip to content

Commit

Permalink
Merge pull request #304 from viccuad/bump-1.19
Browse files Browse the repository at this point in the history
Bump to 1.19, refactor for `go.opentelemetry.io/otel/sdk` `0.32.1`
  • Loading branch information
viccuad committed Oct 11, 2022
2 parents c2c9904 + 08ce746 commit 846ced0
Show file tree
Hide file tree
Showing 21 changed files with 137 additions and 107 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.18'
go-version: '1.19'
- run: make unit-tests

integration_tests:
Expand All @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.18'
go-version: '1.19'
- run: make integration-tests

golangci:
Expand All @@ -33,11 +33,11 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.18'
go-version: '1.19'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.47.2
version: v1.49.0

shellcheck:
name: Shellcheck
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/container-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
name: Install Golang
uses: actions/setup-go@v3
with:
go-version: '1.18'
go-version: '1.19'
-
name: Install the bom command
uses: kubewarden/github-actions/kubernetes-bom-installer@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install Golang
uses: actions/setup-go@v3
with:
go-version: '1.18'
go-version: '1.19'

- name: Install the bom command
shell: bash
Expand Down
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ linters:
- lll # long lines
# https://github.com/golangci/golangci-lint/issues/541
- interfacer
- interfacebloat
# TODO: enable once we can set some exceptions
- funlen
- ifshort # deprecated
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 golang:1.18 as builder
FROM golang:1.19 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 @@ -33,7 +33,7 @@ SETUP_ENVTEST_VER := v0.0.0-20211110210527-619e6b92dab9
SETUP_ENVTEST_BIN := setup-envtest
SETUP_ENVTEST := $(abspath $(BIN_DIR)/$(SETUP_ENVTEST_BIN))

GOLANGCI_LINT_VER := v1.47.2
GOLANGCI_LINT_VER := v1.49.0
GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT := $(BIN_DIR)/$(GOLANGCI_LINT_BIN)

Expand Down
18 changes: 9 additions & 9 deletions apis/policies/v1/admissionpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ type AdmissionPolicySpec struct {
}

// AdmissionPolicy is the Schema for the admissionpolicies API
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Namespaced
//+kubebuilder:storageversion
//+kubebuilder:printcolumn:name="Policy Server",type=string,JSONPath=`.spec.policyServer`,description="Bound to Policy Server"
//+kubebuilder:printcolumn:name="Mutating",type=boolean,JSONPath=`.spec.mutating`,description="Whether the policy is mutating"
//+kubebuilder:printcolumn:name="Mode",type=string,JSONPath=`.spec.mode`,description="Policy deployment mode"
//+kubebuilder:printcolumn:name="Observed mode",type=string,JSONPath=`.status.mode`,description="Policy deployment mode observed on the assigned Policy Server"
//+kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.policyStatus`,description="Status of the policy"
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Namespaced
// +kubebuilder:storageversion
// +kubebuilder:printcolumn:name="Policy Server",type=string,JSONPath=`.spec.policyServer`,description="Bound to Policy Server"
// +kubebuilder:printcolumn:name="Mutating",type=boolean,JSONPath=`.spec.mutating`,description="Whether the policy is mutating"
// +kubebuilder:printcolumn:name="Mode",type=string,JSONPath=`.spec.mode`,description="Policy deployment mode"
// +kubebuilder:printcolumn:name="Observed mode",type=string,JSONPath=`.status.mode`,description="Policy deployment mode observed on the assigned Policy Server"
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.policyStatus`,description="Status of the policy"
type AdmissionPolicy struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
20 changes: 10 additions & 10 deletions apis/policies/v1/clusteradmissionpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ type ClusterAdmissionPolicySpec struct {
}

// ClusterAdmissionPolicy is the Schema for the clusteradmissionpolicies API
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
//+kubebuilder:storageversion
//+kubebuilder:printcolumn:name="Policy Server",type=string,JSONPath=`.spec.policyServer`,description="Bound to Policy Server"
//+kubebuilder:printcolumn:name="Mutating",type=boolean,JSONPath=`.spec.mutating`,description="Whether the policy is mutating"
//+kubebuilder:printcolumn:name="Mode",type=string,JSONPath=`.spec.mode`,description="Policy deployment mode"
//+kubebuilder:printcolumn:name="Observed mode",type=string,JSONPath=`.status.mode`,description="Policy deployment mode observed on the assigned Policy Server"
//+kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.policyStatus`,description="Status of the policy"
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster
// +kubebuilder:storageversion
// +kubebuilder:printcolumn:name="Policy Server",type=string,JSONPath=`.spec.policyServer`,description="Bound to Policy Server"
// +kubebuilder:printcolumn:name="Mutating",type=boolean,JSONPath=`.spec.mutating`,description="Whether the policy is mutating"
// +kubebuilder:printcolumn:name="Mode",type=string,JSONPath=`.spec.mode`,description="Policy deployment mode"
// +kubebuilder:printcolumn:name="Observed mode",type=string,JSONPath=`.status.mode`,description="Policy deployment mode observed on the assigned Policy Server"
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.policyStatus`,description="Status of the policy"
type ClusterAdmissionPolicy struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -92,7 +92,7 @@ type ClusterAdmissionPolicy struct {
}

// ClusterAdmissionPolicyList contains a list of ClusterAdmissionPolicy
//+kubebuilder:object:root=true
// +kubebuilder:object:root=true
type ClusterAdmissionPolicyList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions apis/policies/v1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v1 contains API Schema definitions for the policies v1 API group
//+kubebuilder:object:generate=true
//+groupName=policies.kubewarden.io
// +kubebuilder:object:generate=true
// +groupName=policies.kubewarden.io
package v1

import (
Expand Down
2 changes: 1 addition & 1 deletion apis/policies/v1/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type PolicyStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

//+kubebuilder:object:generate:=false
// +kubebuilder:object:generate:=false
type Policy interface {
client.Object
GetPolicyMode() PolicyMode
Expand Down
4 changes: 2 additions & 2 deletions apis/policies/v1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func makeClusterAdmissionPolicyTemplate(name, namespace, policyServerName string
}
}

//nolint: dupl
//nolint:dupl
func deleteClusterAdmissionPolicy(ctx context.Context, name, namespace string) {
nsn := types.NamespacedName{
Name: name,
Expand Down Expand Up @@ -211,7 +211,7 @@ func makePolicyServerTemplate(name, namespace string) *PolicyServer {
}
}

//nolint: dupl
//nolint:dupl
func deletePolicyServer(ctx context.Context, name, namespace string) {
nsn := types.NamespacedName{
Name: name,
Expand Down
16 changes: 8 additions & 8 deletions apis/policies/v1alpha2/admissionpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ type AdmissionPolicySpec struct {
}

// AdmissionPolicy is the Schema for the admissionpolicies API
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Namespaced
//+kubebuilder:printcolumn:name="Policy Server",type=string,JSONPath=`.spec.policyServer`,description="Bound to Policy Server"
//+kubebuilder:printcolumn:name="Mutating",type=boolean,JSONPath=`.spec.mutating`,description="Whether the policy is mutating"
//+kubebuilder:printcolumn:name="Mode",type=string,JSONPath=`.spec.mode`,description="Policy deployment mode"
//+kubebuilder:printcolumn:name="Observed mode",type=string,JSONPath=`.status.mode`,description="Policy deployment mode observed on the assigned Policy Server"
//+kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.policyStatus`,description="Status of the policy"
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Namespaced
// +kubebuilder:printcolumn:name="Policy Server",type=string,JSONPath=`.spec.policyServer`,description="Bound to Policy Server"
// +kubebuilder:printcolumn:name="Mutating",type=boolean,JSONPath=`.spec.mutating`,description="Whether the policy is mutating"
// +kubebuilder:printcolumn:name="Mode",type=string,JSONPath=`.spec.mode`,description="Policy deployment mode"
// +kubebuilder:printcolumn:name="Observed mode",type=string,JSONPath=`.status.mode`,description="Policy deployment mode observed on the assigned Policy Server"
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.policyStatus`,description="Status of the policy"
type AdmissionPolicy struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
18 changes: 9 additions & 9 deletions apis/policies/v1alpha2/clusteradmissionpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ type ClusterAdmissionPolicySpec struct {
}

// ClusterAdmissionPolicy is the Schema for the clusteradmissionpolicies API
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
//+kubebuilder:printcolumn:name="Policy Server",type=string,JSONPath=`.spec.policyServer`,description="Bound to Policy Server"
//+kubebuilder:printcolumn:name="Mutating",type=boolean,JSONPath=`.spec.mutating`,description="Whether the policy is mutating"
//+kubebuilder:printcolumn:name="Mode",type=string,JSONPath=`.spec.mode`,description="Policy deployment mode"
//+kubebuilder:printcolumn:name="Observed mode",type=string,JSONPath=`.status.mode`,description="Policy deployment mode observed on the assigned Policy Server"
//+kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.policyStatus`,description="Status of the policy"
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster
// +kubebuilder:printcolumn:name="Policy Server",type=string,JSONPath=`.spec.policyServer`,description="Bound to Policy Server"
// +kubebuilder:printcolumn:name="Mutating",type=boolean,JSONPath=`.spec.mutating`,description="Whether the policy is mutating"
// +kubebuilder:printcolumn:name="Mode",type=string,JSONPath=`.spec.mode`,description="Policy deployment mode"
// +kubebuilder:printcolumn:name="Observed mode",type=string,JSONPath=`.status.mode`,description="Policy deployment mode observed on the assigned Policy Server"
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.policyStatus`,description="Status of the policy"
type ClusterAdmissionPolicy struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -90,7 +90,7 @@ type ClusterAdmissionPolicy struct {
}

// ClusterAdmissionPolicyList contains a list of ClusterAdmissionPolicy
//+kubebuilder:object:root=true
// +kubebuilder:object:root=true
type ClusterAdmissionPolicyList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions apis/policies/v1alpha2/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v1alpha2 contains API Schema definitions for the policies v1alpha2 API group
//+kubebuilder:object:generate=true
//+groupName=policies.kubewarden.io
// +kubebuilder:object:generate=true
// +groupName=policies.kubewarden.io
package v1alpha2

import (
Expand Down
2 changes: 1 addition & 1 deletion apis/policies/v1alpha2/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type PolicyStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

//+kubebuilder:object:generate:=false
// +kubebuilder:object:generate:=false
type Policy interface {
client.Object
GetPolicyMode() PolicyMode
Expand Down
8 changes: 4 additions & 4 deletions controllers/policyserver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (r *PolicyServerReconciler) SetupWithManager(mgr ctrl.Manager) error {
err := mgr.GetFieldIndexer().IndexField(context.Background(), &policiesv1.ClusterAdmissionPolicy{}, constants.PolicyServerIndexKey, func(object client.Object) []string {
policy, ok := object.(*policiesv1.ClusterAdmissionPolicy)
if !ok {
r.Log.Error(nil, "object is not type of ClusterAdmissionPolicy: %#v", policy)
r.Log.Error(nil, "object is not type of ClusterAdmissionPolicy: %#v", "policy", policy)
return []string{}
}
return []string{policy.Spec.PolicyServer}
Expand All @@ -136,7 +136,7 @@ func (r *PolicyServerReconciler) SetupWithManager(mgr ctrl.Manager) error {
err = mgr.GetFieldIndexer().IndexField(context.Background(), &policiesv1.AdmissionPolicy{}, constants.PolicyServerIndexKey, func(object client.Object) []string {
policy, ok := object.(*policiesv1.AdmissionPolicy)
if !ok {
r.Log.Error(nil, "object is not type of ClusterAdmissionPolicy: %#v", policy)
r.Log.Error(nil, "object is not type of AdmissionPolicy: %#v", "policy", policy)
return []string{}
}
return []string{policy.Spec.PolicyServer}
Expand All @@ -153,7 +153,7 @@ func (r *PolicyServerReconciler) SetupWithManager(mgr ctrl.Manager) error {
// object.
policy, ok := object.(*policiesv1.AdmissionPolicy)
if !ok {
r.Log.Info("object is not type of AdmissionPolicy: %+v", policy)
r.Log.Info("object is not type of AdmissionPolicy: %+v", "policy", policy)
return []ctrl.Request{}
}

Expand All @@ -172,7 +172,7 @@ func (r *PolicyServerReconciler) SetupWithManager(mgr ctrl.Manager) error {
// object.
policy, ok := object.(*policiesv1.ClusterAdmissionPolicy)
if !ok {
r.Log.Info("object is not type of ClusterAdmissionPolicy: %+v", policy)
r.Log.Info("object is not type of ClusterAdmissionPolicy: %+v", "policy", policy)
return []ctrl.Request{}
}

Expand Down
15 changes: 8 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/kubewarden/kubewarden-controller

go 1.18
go 1.19

require (
github.com/ereslibre/kube-webhook-wrapper v0.0.2
Expand All @@ -10,10 +10,10 @@ require (
github.com/onsi/gomega v1.20.1
github.com/pkg/errors v0.9.1
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.31.0
go.opentelemetry.io/otel/metric v0.32.0
go.opentelemetry.io/otel/sdk/metric v0.31.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.1
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.32.1
go.opentelemetry.io/otel/metric v0.32.1
go.opentelemetry.io/otel/sdk/metric v0.32.1
k8s.io/api v0.25.2
k8s.io/apimachinery v0.25.2
k8s.io/client-go v0.25.2
Expand Down Expand Up @@ -52,6 +52,7 @@ require (
github.com/imdario/mergo v0.3.13 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand All @@ -76,7 +77,7 @@ require (
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
golang.org/x/term v0.0.0-20220919170432-7a66f970e087 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220920022843-2ce7c2934d45 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220921223823-23cae91e6737 // indirect
Expand All @@ -90,7 +91,7 @@ require (
k8s.io/component-base v0.25.2 // indirect
k8s.io/klog/v2 v2.80.1 // indirect
k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea // indirect
k8s.io/utils v0.0.0-20220922104903-7796b5f52b7e // indirect
k8s.io/utils v0.0.0-20220922133306-665eaaec4324 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
Expand Down

0 comments on commit 846ced0

Please sign in to comment.