@@ -31,13 +31,13 @@ import (
3131 "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
3232 ctrllog "sigs.k8s.io/controller-runtime/pkg/log"
3333
34+ compapiv1alpha1 "github.com/konflux-ci/application-api/api/v1alpha1"
3435 imagerepositoryv1alpha1 "github.com/konflux-ci/image-controller/api/v1alpha1"
3536 l "github.com/konflux-ci/image-controller/pkg/logs"
36- appstudioredhatcomv1alpha1 "github.com/redhat-appstudio/application-api/api/v1alpha1"
3737)
3838
3939const (
40- IntegrationTestsServiceAccountName = "konflux-integration-runner"
40+ IntegrationServiceAccountName = "konflux-integration-runner"
4141 ApplicationSecretLinkToSaFinalizer = "application-secret-link-to-integration-tests-sa.appstudio.openshift.io/finalizer"
4242)
4343
@@ -58,7 +58,7 @@ type ApplicationPullSecretCreator struct {
5858// SetupWithManager sets up the controller with the Manager.
5959func (r * ApplicationPullSecretCreator ) SetupWithManager (mgr ctrl.Manager ) error {
6060 return ctrl .NewControllerManagedBy (mgr ).
61- For (& appstudioredhatcomv1alpha1 .Application {}).
61+ For (& compapiv1alpha1 .Application {}).
6262 Complete (r )
6363}
6464
@@ -73,7 +73,7 @@ func (r *ApplicationPullSecretCreator) Reconcile(ctx context.Context, req ctrl.R
7373 ctx = ctrllog .IntoContext (ctx , log )
7474
7575 // fetch the application instance
76- application := & appstudioredhatcomv1alpha1 .Application {}
76+ application := & compapiv1alpha1 .Application {}
7777 err := r .Client .Get (ctx , req .NamespacedName , application )
7878 if err != nil {
7979 if errors .IsNotFound (err ) {
@@ -132,7 +132,7 @@ func (r *ApplicationPullSecretCreator) Reconcile(ctx context.Context, req ctrl.R
132132 }
133133 }
134134
135- if err := r .updateServiceAccountWithApplicationPullSecret (ctx , applicationPullSecretName , application .Namespace ); err != nil {
135+ if err := r .updateIntegrationServiceAccountWithApplicationPullSecret (ctx , applicationPullSecretName , application .Namespace ); err != nil {
136136 return ctrl.Result {}, err
137137 }
138138
@@ -147,7 +147,7 @@ func getApplicationPullSecretName(applicationName string) string {
147147// getComponentIdsForApplication returns components id for all components owned by the application
148148func (r * ApplicationPullSecretCreator ) getComponentIdsForApplication (ctx context.Context , applicationId types.UID , namespace string ) ([]types.UID , error ) {
149149 log := ctrllog .FromContext (ctx )
150- componentsList := & appstudioredhatcomv1alpha1 .ComponentList {}
150+ componentsList := & compapiv1alpha1 .ComponentList {}
151151 if err := r .Client .List (ctx , componentsList , & client.ListOptions {Namespace : namespace }); err != nil {
152152 log .Error (err , "failed to list components" )
153153 return nil , err
@@ -198,7 +198,7 @@ func (r *ApplicationPullSecretCreator) getImageRepositoryPullSecretNamesForCompo
198198
199199// createApplicationPullSecret creates or updates a single kubernetes.io/dockerconfigjson secret
200200// by combining data from individual pull secrets.
201- func (r * ApplicationPullSecretCreator ) createApplicationPullSecret (ctx context.Context , applicationPullSecretName string , application * appstudioredhatcomv1alpha1 .Application , individualSecretNames []string ) error {
201+ func (r * ApplicationPullSecretCreator ) createApplicationPullSecret (ctx context.Context , applicationPullSecretName string , application * compapiv1alpha1 .Application , individualSecretNames []string ) error {
202202 log := ctrllog .FromContext (ctx )
203203
204204 log .Info ("Creating application pull secret" , "secretName" , applicationPullSecretName )
@@ -282,19 +282,19 @@ func (r *ApplicationPullSecretCreator) createApplicationPullSecret(ctx context.C
282282 return nil
283283}
284284
285- // udateServiceAccountWithApplicationPullSecret updates the ServiceAccount to include
285+ // updateIntegrationServiceAccountWithApplicationPullSecret updates the ServiceAccount to include
286286// the application pull secret as an imagePullSecret and as a Secret
287- func (r * ApplicationPullSecretCreator ) updateServiceAccountWithApplicationPullSecret (ctx context.Context , applicationPullSecretName string , namespace string ) error {
287+ func (r * ApplicationPullSecretCreator ) updateIntegrationServiceAccountWithApplicationPullSecret (ctx context.Context , applicationPullSecretName string , namespace string ) error {
288288 log := ctrllog .FromContext (ctx )
289289
290290 // fetch namespace SA
291291 namespaceServiceAccount := & corev1.ServiceAccount {}
292- if err := r .Client .Get (ctx , types.NamespacedName {Name : IntegrationTestsServiceAccountName , Namespace : namespace }, namespaceServiceAccount ); err != nil {
292+ if err := r .Client .Get (ctx , types.NamespacedName {Name : IntegrationServiceAccountName , Namespace : namespace }, namespaceServiceAccount ); err != nil {
293293 if errors .IsNotFound (err ) {
294- log .Info ("Namespace ServiceAccount not found" , "serviceAccountName" , IntegrationTestsServiceAccountName , "namespace" , namespace )
294+ log .Info ("Integration ServiceAccount not found" , "serviceAccountName" , IntegrationServiceAccountName , "namespace" , namespace )
295295 return nil
296296 }
297- log .Error (err , "failed to read namespace ServiceAccount" , "serviceAccountName" , IntegrationTestsServiceAccountName , "namespace" , namespace , l .Action , l .ActionView )
297+ log .Error (err , "failed to read integration ServiceAccount" , "serviceAccountName" , IntegrationServiceAccountName , "namespace" , namespace , l .Action , l .ActionView )
298298 return err
299299 }
300300
@@ -337,7 +337,7 @@ func (r *ApplicationPullSecretCreator) updateServiceAccountWithApplicationPullSe
337337 return nil
338338}
339339
340- func (r * ApplicationPullSecretCreator ) doesApplicationPullSecretExist (ctx context.Context , applicationPullSecretName string , application * appstudioredhatcomv1alpha1 .Application ) (bool , error ) {
340+ func (r * ApplicationPullSecretCreator ) doesApplicationPullSecretExist (ctx context.Context , applicationPullSecretName string , application * compapiv1alpha1 .Application ) (bool , error ) {
341341 log := ctrllog .FromContext (ctx )
342342
343343 applicationPullSecret := & corev1.Secret {}
@@ -355,15 +355,15 @@ func (r *ApplicationPullSecretCreator) doesApplicationPullSecretExist(ctx contex
355355
356356// unlinkApplicationSecretFromIntegrationTestsSa ensures that the given secret is not linked with the integration tests service account.
357357func (r * ApplicationPullSecretCreator ) unlinkApplicationSecretFromIntegrationTestsSa (ctx context.Context , secretNameToRemove , namespace string ) error {
358- log := ctrllog .FromContext (ctx ).WithValues ("ServiceAccountName" , IntegrationTestsServiceAccountName , "SecretName" , secretNameToRemove )
358+ log := ctrllog .FromContext (ctx ).WithValues ("ServiceAccountName" , IntegrationServiceAccountName , "SecretName" , secretNameToRemove )
359359
360360 serviceAccount := & corev1.ServiceAccount {}
361- err := r .Client .Get (ctx , types.NamespacedName {Name : IntegrationTestsServiceAccountName , Namespace : namespace }, serviceAccount )
361+ err := r .Client .Get (ctx , types.NamespacedName {Name : IntegrationServiceAccountName , Namespace : namespace }, serviceAccount )
362362 if err != nil {
363363 if errors .IsNotFound (err ) {
364364 return nil
365365 }
366- log .Error (err , "failed to read namespace service account" , l .Action , l .ActionView )
366+ log .Error (err , "failed to read integration service account" , l .Action , l .ActionView )
367367 return err
368368 }
369369
0 commit comments