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

Add new "always" approval policy #806

Merged
merged 8 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
8 changes: 4 additions & 4 deletions controllers/pkg/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
k8s.io/utils v0.0.0-20240310230437-4693a0247e57
sigs.k8s.io/cluster-api v1.4.0-beta.2.0.20230527123250-e111168cdff3
sigs.k8s.io/controller-runtime v0.17.2
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3
sigs.k8s.io/kustomize/kyaml v0.17.2
sigs.k8s.io/yaml v1.4.0
)

Expand All @@ -44,7 +44,7 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/davidmz/go-pageant v1.0.2 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch/v5 v5.8.0 // indirect
Expand All @@ -53,7 +53,7 @@ require (
github.com/go-fed/httpsig v1.1.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.1.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
Expand All @@ -76,7 +76,7 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/openconfig/gnmi v0.9.1 // indirect
github.com/openconfig/goyang v1.4.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
Expand Down
17 changes: 10 additions & 7 deletions controllers/pkg/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davidmz/go-pageant v1.0.2 h1:bPblRCh5jGU+Uptpz6LgMZGD5hJoOt7otgT454WvHn0=
github.com/davidmz/go-pageant v1.0.2/go.mod h1:P2EDDnMqIwG5Rrp05dTRITj9z2zpGcD9efWSkTNKLIE=
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
Expand All @@ -43,8 +44,9 @@ github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
Expand Down Expand Up @@ -150,8 +152,9 @@ github.com/openconfig/ygot v0.28.3/go.mod h1:MB1WlgmH/547+unI5oVy7dQ46Tx+pCA05bJ
github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk=
github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
Expand All @@ -161,8 +164,8 @@ github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lne
github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY=
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
Expand Down Expand Up @@ -324,8 +327,8 @@ sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMm
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 h1:XX3Ajgzov2RKUdc5jW3t5jwY7Bo7dcRm+tFxT+NfgY0=
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3/go.mod h1:9n16EZKMhXBNSiUC5kSdFQJkdH3zbxS/JoO619G1VAY=
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 h1:W6cLQc5pnqM7vh3b7HvGNfXrJ/xL6BDMS0v1V/HHg5U=
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3/go.mod h1:JWP1Fj0VWGHyw3YUPjXSQnRnrwezrZSrApfX5S0nIag=
sigs.k8s.io/kustomize/kyaml v0.17.2 h1:+AzvoJUY0kq4QAhH/ydPHHMRLijtUKiyVyh7fOSshr0=
sigs.k8s.io/kustomize/kyaml v0.17.2/go.mod h1:9V0mCjIEYjlXuCdYsSXvyoy2BTsLESH7TlGV81S282U=
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08=
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
Expand Down
2 changes: 1 addition & 1 deletion controllers/pkg/porch/util/packagevariant.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

func PackageVariantReady(ctx context.Context, pr *porchv1alpha1.PackageRevision, c client.Client) (bool, error) {
func PackageVariantReady(ctx context.Context, pr *porchv1alpha1.PackageRevision, c client.Reader) (bool, error) {
// If the package revision is owned by a PackageVariant, check the Ready condition
// of the package variant.
owned := false
Expand Down
19 changes: 10 additions & 9 deletions controllers/pkg/reconcilers/approval/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
DelayAnnotationName = "approval.nephio.org/delay"
PolicyAnnotationName = "approval.nephio.org/policy"
InitialPolicyAnnotationValue = "initial"
AlwaysPolicyAnnotationValue = "always"
)

func init() {
Expand All @@ -68,7 +69,6 @@ func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c i

r.apiReader = mgr.GetAPIReader()
r.baseClient = mgr.GetClient()
r.porchClient = cfg.PorchClient
r.porchRESTClient = cfg.PorchRESTClient
r.recorder = mgr.GetEventRecorderFor("approval-controller")
r.requeueDuration = time.Duration(cfg.ApprovalRequeueDuration) * time.Second
Expand All @@ -83,7 +83,6 @@ func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c i
type reconciler struct {
apiReader client.Reader
baseClient client.Client
porchClient client.Client
porchRESTClient rest.Interface
recorder record.EventRecorder
requeueDuration time.Duration
Expand Down Expand Up @@ -114,7 +113,7 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
// of the package variant. If it is not Ready, then we should not approve yet. The
// lack of readiness could indicate an error which even impacts whether or not the
// readiness gates have been properly set.
pvReady, err := porchutil.PackageVariantReady(ctx, pr, r.porchClient)
pvReady, err := porchutil.PackageVariantReady(ctx, pr, r.apiReader)
if err != nil {
r.recorder.Event(pr, corev1.EventTypeWarning,
"Error", fmt.Sprintf("could not get owning PackageVariant: %s", err.Error()))
Expand All @@ -123,17 +122,17 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
}

if !pvReady {
r.recorder.Event(pr, corev1.EventTypeNormal,
"NotApproved", "owning PackageVariant not Ready")
r.recorder.Eventf(pr, corev1.EventTypeNormal,
"NotApproved", "owning PackageVariant for %s not Ready", pr.Spec.PackageName)
johnbelamaric marked this conversation as resolved.
Show resolved Hide resolved

return ctrl.Result{RequeueAfter: r.requeueDuration}, nil
}

// All policies require readiness gates to be met, so if they
// are not, we are done for now.
if !porchconds.PackageRevisionIsReady(pr.Spec.ReadinessGates, pr.Status.Conditions) {
r.recorder.Event(pr, corev1.EventTypeNormal,
"NotApproved", "readiness gates not met")
r.recorder.Eventf(pr, corev1.EventTypeNormal,
"NotApproved", "readiness gates not met for %s, in repo %s", pr.Spec.PackageName, pr.Spec.RepositoryName)
johnbelamaric marked this conversation as resolved.
Show resolved Hide resolved

return ctrl.Result{RequeueAfter: r.requeueDuration}, nil
}
Expand All @@ -143,6 +142,8 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
switch policy {
case InitialPolicyAnnotationValue:
approve, err = r.policyInitial(ctx, pr)
case AlwaysPolicyAnnotationValue:
approve, err = true, nil
default:
r.recorder.Eventf(pr, corev1.EventTypeWarning,
"InvalidPolicy", "invalid %q annotation value: %q", PolicyAnnotationName, policy)
Expand All @@ -159,7 +160,7 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu

if !approve {
r.recorder.Eventf(pr, corev1.EventTypeNormal,
"NotApproved", "approval policy %q not met", policy)
"NotApproved", "approval policy %q not met for %s", policy, pr.Spec.PackageName)
johnbelamaric marked this conversation as resolved.
Show resolved Hide resolved

return ctrl.Result{RequeueAfter: r.requeueDuration}, nil
}
Expand Down Expand Up @@ -210,7 +211,7 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
"Error", "error %s: %s", action, err.Error())
} else {
r.recorder.Eventf(pr, corev1.EventTypeNormal,
reason, "all approval policies met")
reason, "all approval policies met for %s: %s", pr.Spec.PackageName, reason)
johnbelamaric marked this conversation as resolved.
Show resolved Hide resolved
}

return ctrl.Result{}, err
Expand Down
13 changes: 12 additions & 1 deletion controllers/pkg/reconcilers/approval/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestShouldProcess(t *testing.T) {
expectedPolicy: "",
expectedShould: false,
},
"draft with policy annotation": {
"draft with initial policy annotation": {
pr: porchapi.PackageRevision{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
Expand All @@ -50,6 +50,17 @@ func TestShouldProcess(t *testing.T) {
expectedPolicy: "initial",
expectedShould: true,
},
"draft with always policy annotation": {
pr: porchapi.PackageRevision{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
"approval.nephio.org/policy": "always",
},
},
},
expectedPolicy: "always",
expectedShould: true,
},
"draft with no policy annotation, but delay annotation": {
pr: porchapi.PackageRevision{
ObjectMeta: metav1.ObjectMeta{
Expand Down
21 changes: 10 additions & 11 deletions controllers/pkg/reconcilers/generic-specializer/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func (r *reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, c i

r.Client = mgr.GetClient()
r.porchClient = cfg.PorchClient
r.apiReader = mgr.GetAPIReader()
r.recorder = mgr.GetEventRecorderFor("generic-specializer")
r.ipamClientProxy = cfg.IpamClientProxy
r.vlanClientProxy = cfg.VlanClientProxy
Expand All @@ -92,6 +93,7 @@ type reconciler struct {
ipamClientProxy clientproxy.Proxy[*ipamv1alpha1.NetworkInstance, *ipamv1alpha1.IPClaim]
vlanClientProxy clientproxy.Proxy[*vlanv1alpha1.VLANIndex, *vlanv1alpha1.VLANClaim]
porchClient client.Client
apiReader client.Reader
recorder record.EventRecorder
}

Expand All @@ -100,7 +102,7 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
log.Info("reconcile genericspecializer")

pr := &porchv1alpha1.PackageRevision{}
if err := r.Get(ctx, req.NamespacedName, pr); err != nil {
if err := r.apiReader.Get(ctx, req.NamespacedName, pr); err != nil {
// There's no need to requeue if we no longer exist. Otherwise we'll be
// requeued implicitly because we return an error.
if resource.IgnoreNotFound(err) != nil {
Expand All @@ -111,7 +113,7 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
}

// check if the PackageVariant has done its work
pvReady, err := porchutil.PackageVariantReady(ctx, pr, r.porchClient)
pvReady, err := porchutil.PackageVariantReady(ctx, pr, r.apiReader)
if err != nil {
r.recorder.Event(pr, corev1.EventTypeWarning,
"Error", fmt.Sprintf("could not get owning PackageVariant: %s", err.Error()))
Expand All @@ -120,8 +122,8 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
}

if !pvReady {
r.recorder.Event(pr, corev1.EventTypeNormal,
"Waiting", "owning PackageVariant not Ready")
r.recorder.Eventf(pr, corev1.EventTypeNormal,
"Waiting", "owning PackageVariant for %s not Ready", pr.Spec.PackageName)
johnbelamaric marked this conversation as resolved.
Show resolved Hide resolved

return ctrl.Result{RequeueAfter: RequeueDuration}, nil
}
Expand All @@ -134,7 +136,7 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
vlankrmfn := fn.ResourceListProcessorFunc(vlanf.Run)
vlanFor := vlanf.GetConfig().For

configInjectf := configinjectfn.New(r.porchClient)
configInjectf := configinjectfn.New(r.apiReader)
configInjectkrmfn := fn.ResourceListProcessorFunc(configInjectf.Run)
configInjectFor := configInjectf.GetConfig().For

Expand All @@ -146,7 +148,7 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu

// get package revision resourceList
prr := &porchv1alpha1.PackageRevisionResources{}
if err := r.porchClient.Get(ctx, req.NamespacedName, prr); err != nil {
if err := r.apiReader.Get(ctx, req.NamespacedName, prr); err != nil {
r.recorder.Event(pr, corev1.EventTypeWarning, "ReconcileError", fmt.Sprintf("cannot get package revision resources: %s", err.Error()))
log.Error(err, "cannot get package revision resources")
return ctrl.Result{}, errors.Wrap(err, "cannot get package revision resources")
Expand Down Expand Up @@ -196,7 +198,7 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
// but if the package is in publish state the updates cannot be done
// so we stop here
if porchv1alpha1.LifecycleIsPublished(pr.Spec.Lifecycle) {
r.recorder.Event(pr, corev1.EventTypeNormal, "CannotRefreshClaims", "package is published, no update possible")
r.recorder.Eventf(pr, corev1.EventTypeNormal, "CannotRefreshClaims", "package is %s, no update possible", pr.Spec.Lifecycle)
log.Info("package is published, no updates possible",
"repo", pr.Spec.RepositoryName,
"package", pr.Spec.PackageName,
Expand Down Expand Up @@ -296,12 +298,9 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu

log.Info("generic specializer root kptfile", "packageName", pr.Spec.PackageName, "repository", pr.Spec.RepositoryName, "kptfile", kptfile)

kptf := kptfilelibv1.KptFile{Kptfile: rl.Items.GetRootKptfile()}
pr.Status.Conditions = porchcondition.GetPorchConditions(kptf.GetConditions())
// TODO do we need to update the status?
if err = r.porchClient.Update(ctx, prr); err != nil {
r.recorder.Event(pr, corev1.EventTypeWarning, "ReconcileError", "cannot update packagerevision resources")
log.Error(err, "cannot update packagerevision resources")
log.Error(err, "cannot update packagerevision resources", "PackageRevision", pr.Name)
return ctrl.Result{}, err
}
}
Expand Down
6 changes: 3 additions & 3 deletions krm-functions/configinject-fn/fn/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ import (
const revisionPrefix = "v"

type FnR struct {
client.Client
client.Reader
workloadCluster *infrav1alpha1.WorkloadCluster
sdkConfig *condkptsdk.Config
}

func New(c client.Client) *FnR {
func New(c client.Reader) *FnR {
f := &FnR{
Client: c,
Reader: c,
}
f.sdkConfig = &condkptsdk.Config{
For: corev1.ObjectReference{
Expand Down
6 changes: 3 additions & 3 deletions krm-functions/configinject-fn/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ require (

require (
github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20230427202446-3255accc518d // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch/v5 v5.8.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
Expand Down Expand Up @@ -64,7 +64,7 @@ require (
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/kustomize/kyaml v0.17.2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading