Skip to content

Commit

Permalink
Merge branch 'openstack-k8s-operators:main' into remove-extra-newline…
Browse files Browse the repository at this point in the history
…s-from-confs
  • Loading branch information
auniyal61 authored Sep 9, 2024
2 parents 14cb785 + 174296c commit b322894
Show file tree
Hide file tree
Showing 19 changed files with 117 additions and 126 deletions.
12 changes: 6 additions & 6 deletions modules/certmanager/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ require (
github.com/cert-manager/cert-manager v1.11.5
github.com/go-logr/logr v1.4.2
github.com/google/uuid v1.6.0
github.com/onsi/ginkgo/v2 v2.20.0
github.com/onsi/ginkgo/v2 v2.20.1
github.com/onsi/gomega v1.34.1
github.com/openstack-k8s-operators/lib-common/modules/common v0.3.1-0.20240122120141-2eff3281aef1
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
k8s.io/api v0.28.12
k8s.io/apimachinery v0.28.12
k8s.io/client-go v0.28.12
k8s.io/api v0.28.13
k8s.io/apimachinery v0.28.13
k8s.io/client-go v0.28.13
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
sigs.k8s.io/controller-runtime v0.16.6
)
Expand Down Expand Up @@ -67,8 +67,8 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.28.12 // indirect
k8s.io/component-base v0.28.12 // indirect
k8s.io/apiextensions-apiserver v0.28.13 // indirect
k8s.io/component-base v0.28.13 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
sigs.k8s.io/gateway-api v0.6.0 // indirect
Expand Down
24 changes: 12 additions & 12 deletions modules/certmanager/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/onsi/ginkgo/v2 v2.20.0 h1:PE84V2mHqoT1sglvHc8ZdQtPcwmvvt29WLEEO3xmdZw=
github.com/onsi/ginkgo/v2 v2.20.0/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI=
github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo=
github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI=
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7 h1:rncLxJBpFGqBztyxCMwNRnMjhhIDOWHJowi6q8G6koI=
Expand Down Expand Up @@ -197,16 +197,16 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.28.12 h1:C2hpsaso18pqn0Dmkfnbv/YCctozTC3KGGuZ6bF7zhQ=
k8s.io/api v0.28.12/go.mod h1:qjswI+whxvf9LAKD4sEYHfy+WgHGWeH+H5sCRQMwZAQ=
k8s.io/apiextensions-apiserver v0.28.12 h1:6GA64rylk5q0mbXfHHFVgfL1jx/4p6RU+Y+ni2DUuZc=
k8s.io/apiextensions-apiserver v0.28.12/go.mod h1:Len29ySvb/fnrXvioTxg2l6iFi97B53Bm3/jBMBllCE=
k8s.io/apimachinery v0.28.12 h1:VepMEVOi9o7L/4wMAXJq+3BK9tqBIeerTB+HSOTKeo0=
k8s.io/apimachinery v0.28.12/go.mod h1:zUG757HaKs6Dc3iGtKjzIpBfqTM4yiRsEe3/E7NX15o=
k8s.io/client-go v0.28.12 h1:li7iRPRQF3vDki6gTxT/kXWJvw3BkJSdjVPVhDTZQec=
k8s.io/client-go v0.28.12/go.mod h1:yEzH2Z+nEGlrnKyHJWcJsbOr5tGdIj04dj1TVQOg0wE=
k8s.io/component-base v0.28.12 h1:ZNq6QFFGCPjaAzWqYHaQRoAY5seoK3vP0pZOjgxOzNc=
k8s.io/component-base v0.28.12/go.mod h1:8zI5TmGuHX6R5Lay61Ox7wb+dsEENl0NBmVSiHMQu1c=
k8s.io/api v0.28.13 h1:0Sw8MjdkmrJAF/uVv09HXSZ3cQauVyZHQWKt8hiiKo4=
k8s.io/api v0.28.13/go.mod h1:7hlRF5wArzXf0qbRRT2TMtHRa5SHBEVJhA02JpTxj9Q=
k8s.io/apiextensions-apiserver v0.28.13 h1:+Q3jtMXBxvURuW0tzW1UsZMPud3T4OvgVPuI/uQUEQ8=
k8s.io/apiextensions-apiserver v0.28.13/go.mod h1:yThTxyuc0ba1rXKZNK2aQNIbFxmGcU+CPc8YB40IGj0=
k8s.io/apimachinery v0.28.13 h1:0O2mk2i0Yi+xkron0lK//biI21F1eGXb4eXECLU5v7g=
k8s.io/apimachinery v0.28.13/go.mod h1:zUG757HaKs6Dc3iGtKjzIpBfqTM4yiRsEe3/E7NX15o=
k8s.io/client-go v0.28.13 h1:kHgFOxWwAsa8VxL6Oylo10V6euobub9Jo0wyEWrhrWk=
k8s.io/client-go v0.28.13/go.mod h1:IudvInbWfd+6WLreEVnBnZJCGFaSROCFbny9jFTkk7g=
k8s.io/component-base v0.28.13 h1:hNgX2QcMt7Z5vy/9MB2rodbvBJj6H4Jq1JZDqGvVuf8=
k8s.io/component-base v0.28.13/go.mod h1:G37g+bIAcjV2cAMEpFG2SEN7NgRFMizqSksOLpPN2bM=
k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0=
k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo=
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ=
Expand Down
8 changes: 4 additions & 4 deletions modules/common/condition/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func (conditions *Conditions) Mirror(t Type) *Condition {
cg := g[groupOrder(*TrueCondition(ReadyCondition, "foo"))]
if len(cg.conditions) > 0 && cg.conditions.IsTrue(ReadyCondition) {
c := cg.conditions.Get(ReadyCondition)
mirrorCondition := TrueCondition(t, c.Message)
mirrorCondition := TrueCondition(t, "%s", c.Message)
mirrorCondition.LastTransitionTime = c.LastTransitionTime

return mirrorCondition
Expand All @@ -355,19 +355,19 @@ func (conditions *Conditions) Mirror(t Type) *Condition {
c := (*cl)[0]

if c.Status == corev1.ConditionTrue {
mirrorCondition = TrueCondition(t, c.Message)
mirrorCondition = TrueCondition(t, "%s", c.Message)
mirrorCondition.LastTransitionTime = c.LastTransitionTime
break
}

if c.Status == corev1.ConditionFalse {
mirrorCondition = FalseCondition(t, c.Reason, c.Severity, c.Message)
mirrorCondition = FalseCondition(t, c.Reason, c.Severity, "%s", c.Message)
mirrorCondition.LastTransitionTime = c.LastTransitionTime
break
}

if c.Status == corev1.ConditionUnknown {
mirrorCondition = UnknownCondition(t, c.Reason, c.Message)
mirrorCondition = UnknownCondition(t, c.Reason, "%s", c.Message)
mirrorCondition.LastTransitionTime = c.LastTransitionTime
break
}
Expand Down
12 changes: 6 additions & 6 deletions modules/common/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ require (
github.com/go-logr/logr v1.4.2
github.com/google/uuid v1.6.0
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0
github.com/onsi/ginkgo/v2 v2.20.0
github.com/onsi/ginkgo/v2 v2.20.1
github.com/onsi/gomega v1.34.1
github.com/openshift/api v3.9.0+incompatible
github.com/pkg/errors v0.9.1
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.28.12
k8s.io/apimachinery v0.28.12
k8s.io/client-go v0.28.12
k8s.io/api v0.28.13
k8s.io/apimachinery v0.28.13
k8s.io/client-go v0.28.13
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
sigs.k8s.io/controller-runtime v0.16.6
)
Expand Down Expand Up @@ -65,8 +65,8 @@ require (
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/apiextensions-apiserver v0.28.12 // indirect
k8s.io/component-base v0.28.12 // indirect
k8s.io/apiextensions-apiserver v0.28.13 // indirect
k8s.io/component-base v0.28.13 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
Expand Down
24 changes: 12 additions & 12 deletions modules/common/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/onsi/ginkgo/v2 v2.20.0 h1:PE84V2mHqoT1sglvHc8ZdQtPcwmvvt29WLEEO3xmdZw=
github.com/onsi/ginkgo/v2 v2.20.0/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI=
github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo=
github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI=
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7 h1:rncLxJBpFGqBztyxCMwNRnMjhhIDOWHJowi6q8G6koI=
Expand Down Expand Up @@ -195,16 +195,16 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.28.12 h1:C2hpsaso18pqn0Dmkfnbv/YCctozTC3KGGuZ6bF7zhQ=
k8s.io/api v0.28.12/go.mod h1:qjswI+whxvf9LAKD4sEYHfy+WgHGWeH+H5sCRQMwZAQ=
k8s.io/apiextensions-apiserver v0.28.12 h1:6GA64rylk5q0mbXfHHFVgfL1jx/4p6RU+Y+ni2DUuZc=
k8s.io/apiextensions-apiserver v0.28.12/go.mod h1:Len29ySvb/fnrXvioTxg2l6iFi97B53Bm3/jBMBllCE=
k8s.io/apimachinery v0.28.12 h1:VepMEVOi9o7L/4wMAXJq+3BK9tqBIeerTB+HSOTKeo0=
k8s.io/apimachinery v0.28.12/go.mod h1:zUG757HaKs6Dc3iGtKjzIpBfqTM4yiRsEe3/E7NX15o=
k8s.io/client-go v0.28.12 h1:li7iRPRQF3vDki6gTxT/kXWJvw3BkJSdjVPVhDTZQec=
k8s.io/client-go v0.28.12/go.mod h1:yEzH2Z+nEGlrnKyHJWcJsbOr5tGdIj04dj1TVQOg0wE=
k8s.io/component-base v0.28.12 h1:ZNq6QFFGCPjaAzWqYHaQRoAY5seoK3vP0pZOjgxOzNc=
k8s.io/component-base v0.28.12/go.mod h1:8zI5TmGuHX6R5Lay61Ox7wb+dsEENl0NBmVSiHMQu1c=
k8s.io/api v0.28.13 h1:0Sw8MjdkmrJAF/uVv09HXSZ3cQauVyZHQWKt8hiiKo4=
k8s.io/api v0.28.13/go.mod h1:7hlRF5wArzXf0qbRRT2TMtHRa5SHBEVJhA02JpTxj9Q=
k8s.io/apiextensions-apiserver v0.28.13 h1:+Q3jtMXBxvURuW0tzW1UsZMPud3T4OvgVPuI/uQUEQ8=
k8s.io/apiextensions-apiserver v0.28.13/go.mod h1:yThTxyuc0ba1rXKZNK2aQNIbFxmGcU+CPc8YB40IGj0=
k8s.io/apimachinery v0.28.13 h1:0O2mk2i0Yi+xkron0lK//biI21F1eGXb4eXECLU5v7g=
k8s.io/apimachinery v0.28.13/go.mod h1:zUG757HaKs6Dc3iGtKjzIpBfqTM4yiRsEe3/E7NX15o=
k8s.io/client-go v0.28.13 h1:kHgFOxWwAsa8VxL6Oylo10V6euobub9Jo0wyEWrhrWk=
k8s.io/client-go v0.28.13/go.mod h1:IudvInbWfd+6WLreEVnBnZJCGFaSROCFbny9jFTkk7g=
k8s.io/component-base v0.28.13 h1:hNgX2QcMt7Z5vy/9MB2rodbvBJj6H4Jq1JZDqGvVuf8=
k8s.io/component-base v0.28.13/go.mod h1:G37g+bIAcjV2cAMEpFG2SEN7NgRFMizqSksOLpPN2bM=
k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0=
k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo=
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ=
Expand Down
25 changes: 8 additions & 17 deletions modules/common/test/functional/tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
"github.com/openstack-k8s-operators/lib-common/modules/common/tls"
"k8s.io/apimachinery/pkg/types"
ctrl "sigs.k8s.io/controller-runtime"
)

var _ = Describe("tls package", func() {
Expand All @@ -48,15 +47,13 @@ var _ = Describe("tls package", func() {
th.CreateEmptySecret(sname)

// validate bad ca cert secret
_, ctrlResult, err := tls.ValidateCACertSecret(th.Ctx, cClient, sname)
_, err := tls.ValidateCACertSecret(th.Ctx, cClient, sname)
Expect(err).To(HaveOccurred())
Expect(ctrlResult).To(BeIdenticalTo(ctrl.Result{}))

// update ca cert secret with good data
th.UpdateSecret(sname, tls.CABundleKey, []byte("foo"))
hash, ctrlResult, err := tls.ValidateCACertSecret(th.Ctx, cClient, sname)
hash, err := tls.ValidateCACertSecret(th.Ctx, cClient, sname)
Expect(err).ShouldNot(HaveOccurred())
Expect(ctrlResult).To(BeIdenticalTo(ctrl.Result{}))
Expect(hash).To(BeIdenticalTo("n56fh645hfbh687hc9h678h87h64bh598h577hch5d6h5c9h5d4h74h84h5f4hfch6dh678h547h9bhbchb6h89h5c4h68dhc9h664h557h595h5c5q"))
})

Expand All @@ -73,24 +70,21 @@ var _ = Describe("tls package", func() {
s := &tls.Service{
SecretName: sname.Name,
}
_, ctrlResult, err := s.ValidateCertSecret(th.Ctx, h, namespace)
_, err := s.ValidateCertSecret(th.Ctx, h, namespace)
Expect(err).To(HaveOccurred())
Expect(ctrlResult).To(BeIdenticalTo(ctrl.Result{}))

// update cert secret with cert, still key missing
th.UpdateSecret(sname, tls.CertKey, []byte("cert"))
_, ctrlResult, err = s.ValidateCertSecret(th.Ctx, h, namespace)
_, err = s.ValidateCertSecret(th.Ctx, h, namespace)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("field tls.key not found in Secret"))
Expect(ctrlResult).To(BeIdenticalTo(ctrl.Result{}))

// update cert secret with key to be a good cert secret
th.UpdateSecret(sname, tls.PrivateKey, []byte("key"))

// validate good cert secret
hash, ctrlResult, err := s.ValidateCertSecret(th.Ctx, h, namespace)
hash, err := s.ValidateCertSecret(th.Ctx, h, namespace)
Expect(err).ShouldNot(HaveOccurred())
Expect(ctrlResult).To(BeIdenticalTo(ctrl.Result{}))
Expect(hash).To(BeIdenticalTo("n547h97h5cfh587h56ch594h79hd4h96h5cfh565h587h569h688h666h685h67ch7fhfbh664h5f9h694h564h9ch645h675h665h78h7h87h566hb6q"))
})

Expand All @@ -107,9 +101,8 @@ var _ = Describe("tls package", func() {
endpointCfgs := map[service.Endpoint]tls.Service{}

// validate empty service map
_, ctrlResult, err := tls.ValidateEndpointCerts(th.Ctx, h, namespace, endpointCfgs)
_, err := tls.ValidateEndpointCerts(th.Ctx, h, namespace, endpointCfgs)
Expect(err).ToNot(HaveOccurred())
Expect(ctrlResult).To(BeIdenticalTo(ctrl.Result{}))

endpointCfgs[service.EndpointInternal] = tls.Service{
SecretName: sname.Name,
Expand All @@ -119,18 +112,16 @@ var _ = Describe("tls package", func() {
}

// validate service map with bad cert secret
_, ctrlResult, err = tls.ValidateEndpointCerts(th.Ctx, h, namespace, endpointCfgs)
_, err = tls.ValidateEndpointCerts(th.Ctx, h, namespace, endpointCfgs)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("field tls.crt not found in Secret"))
Expect(ctrlResult).To(BeIdenticalTo(ctrl.Result{}))

// update cert secret to have missing private key
th.UpdateSecret(sname, tls.CertKey, []byte("cert"))

// validate service map with good cert secret
hash, ctrlResult, err := tls.ValidateEndpointCerts(th.Ctx, h, namespace, endpointCfgs)
hash, err := tls.ValidateEndpointCerts(th.Ctx, h, namespace, endpointCfgs)
Expect(err).ShouldNot(HaveOccurred())
Expect(ctrlResult).To(BeIdenticalTo(ctrl.Result{}))
Expect(hash).To(BeIdenticalTo("n5d7h65dh5d5h569hffh66ch568h95h686h58fhcfh586h5b8hc6hd7h65bh56bh55bh656hfh5f7h84h54bh65dh5c9h8ch64bh64bhdfh8ch589h54bq"))
})
})
Loading

0 comments on commit b322894

Please sign in to comment.