diff --git a/bootstrapper/cmd/bootstrapper/run.go b/bootstrapper/cmd/bootstrapper/run.go index 1cc9b9c90..0ad41e824 100644 --- a/bootstrapper/cmd/bootstrapper/run.go +++ b/bootstrapper/cmd/bootstrapper/run.go @@ -24,6 +24,9 @@ import ( "go.uber.org/zap" ) +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func run(issuerWrapper initserver.IssuerWrapper, tpm vtpm.TPMOpenFunc, fileHandler file.Handler, kube clusterInitJoiner, metadata metadataAPI, bindIP, bindPort string, log *logger.Logger, diff --git a/bootstrapper/internal/helm/client.go b/bootstrapper/internal/helm/client.go index 43ed7a137..656a620c8 100644 --- a/bootstrapper/internal/helm/client.go +++ b/bootstrapper/internal/helm/client.go @@ -146,6 +146,9 @@ func (h *Client) installCiliumGeneric(ctx context.Context, release helm.Release, return nil } +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func (h *Client) installCiliumGCP(ctx context.Context, kubectl k8sapi.Client, release helm.Release, nodeName, nodePodCIDR, subnetworkPodCIDR, kubeAPIEndpoint string) error { out, err := exec.CommandContext(ctx, constants.KubectlPath, "--kubeconfig", constants.ControlPlaneAdminConfFilename, "patch", "node", nodeName, "-p", "{\"spec\":{\"podCIDR\": \""+nodePodCIDR+"\"}}").CombinedOutput() if err != nil { diff --git a/bootstrapper/internal/kubernetes/k8sapi/k8sutil.go b/bootstrapper/internal/kubernetes/k8sapi/k8sutil.go index 2362a1587..5f60778a7 100644 --- a/bootstrapper/internal/kubernetes/k8sapi/k8sutil.go +++ b/bootstrapper/internal/kubernetes/k8sapi/k8sutil.go @@ -109,6 +109,9 @@ func (k *KubernetesUtil) InstallComponents(ctx context.Context, version versions } // InitCluster instruments kubeadm to initialize the K8s cluster. +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func (k *KubernetesUtil) InitCluster( ctx context.Context, initConfig []byte, nodeName string, ips []net.IP, controlPlaneEndpoint string, conformanceMode bool, log *logger.Logger, ) error { diff --git a/bootstrapper/internal/kubernetes/kubernetes.go b/bootstrapper/internal/kubernetes/kubernetes.go index d883b3f04..3c11fcf14 100644 --- a/bootstrapper/internal/kubernetes/kubernetes.go +++ b/bootstrapper/internal/kubernetes/kubernetes.go @@ -66,6 +66,9 @@ type KubeWrapper struct { } // New creates a new KubeWrapper with real values. +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func New(cloudProvider string, clusterUtil clusterUtil, configProvider configurationProvider, client k8sapi.Client, providerMetadata ProviderMetadata, initialMeasurementsJSON []byte, helmClient helmClient, kubeAPIWaiter kubeAPIWaiter, ) *KubeWrapper { @@ -84,6 +87,9 @@ func New(cloudProvider string, clusterUtil clusterUtil, configProvider configura } // InitCluster initializes a new Kubernetes cluster and applies pod network provider. +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func (k *KubeWrapper) InitCluster( ctx context.Context, cloudServiceAccountURI, versionString string, measurementSalt []byte, enforcedPCRs []uint32, enforceIDKeyDigest bool, idKeyDigest []byte, azureCVM bool, diff --git a/bootstrapper/internal/kubernetes/kubernetes_test.go b/bootstrapper/internal/kubernetes/kubernetes_test.go index 31ecae5c2..0a2a93714 100644 --- a/bootstrapper/internal/kubernetes/kubernetes_test.go +++ b/bootstrapper/internal/kubernetes/kubernetes_test.go @@ -438,6 +438,9 @@ func (s *stubClusterUtil) InstallComponents(ctx context.Context, version version return s.installComponentsErr } +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func (s *stubClusterUtil) InitCluster(ctx context.Context, initConfig []byte, nodeName string, ips []net.IP, controlPlaneEndpoint string, conformanceMode bool, log *logger.Logger) error { s.initConfigs = append(s.initConfigs, initConfig) return s.initClusterErr diff --git a/cli/internal/cloudcmd/create.go b/cli/internal/cloudcmd/create.go index ab9f2c17d..e57d3b09e 100644 --- a/cli/internal/cloudcmd/create.go +++ b/cli/internal/cloudcmd/create.go @@ -45,6 +45,9 @@ func NewCreator(out io.Writer) *Creator { } // Create creates the handed amount of instances and all the needed resources. +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func (c *Creator) Create(ctx context.Context, provider cloudprovider.Provider, config *config.Config, name, insType string, controlPlaneCount, workerCount int, ) (clusterid.File, error) { switch provider { @@ -85,6 +88,9 @@ func (c *Creator) Create(ctx context.Context, provider cloudprovider.Provider, c } } +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func (c *Creator) createAWS(ctx context.Context, cl terraformClient, config *config.Config, name, insType string, controlPlaneCount, workerCount int, ) (idFile clusterid.File, retErr error) { @@ -121,6 +127,9 @@ func (c *Creator) createAWS(ctx context.Context, cl terraformClient, config *con }, nil } +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func (c *Creator) createGCP(ctx context.Context, cl terraformClient, config *config.Config, name, insType string, controlPlaneCount, workerCount int, ) (idFile clusterid.File, retErr error) { @@ -157,6 +166,9 @@ func (c *Creator) createGCP(ctx context.Context, cl terraformClient, config *con }, nil } +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func (c *Creator) createAzure(ctx context.Context, cl terraformClient, config *config.Config, name, insType string, controlPlaneCount, workerCount int, ) (idFile clusterid.File, retErr error) { @@ -222,6 +234,9 @@ func normalizeAzureURIs(vars terraform.AzureVariables) terraform.AzureVariables return vars } +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func (c *Creator) createQEMU(ctx context.Context, cl terraformClient, lv libvirtRunner, name string, config *config.Config, controlPlaneCount, workerCount int, ) (idFile clusterid.File, retErr error) { diff --git a/cli/internal/cmd/cloud_test.go b/cli/internal/cmd/cloud_test.go index 9791dffb0..1d9521e6d 100644 --- a/cli/internal/cmd/cloud_test.go +++ b/cli/internal/cmd/cloud_test.go @@ -29,6 +29,9 @@ type stubCloudCreator struct { createErr error } +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func (c *stubCloudCreator) Create( ctx context.Context, provider cloudprovider.Provider, diff --git a/cli/internal/cmd/spinner.go b/cli/internal/cmd/spinner.go index ad321054c..13b2b3df0 100644 --- a/cli/internal/cmd/spinner.go +++ b/cli/internal/cmd/spinner.go @@ -77,6 +77,9 @@ func (s *spinner) Write(p []byte) (n int, err error) { return s.out.Write(p) } +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func spinTTY(out io.Writer, wg *sync.WaitGroup, stop *atomic.Bool, delay time.Duration, text string, showDots bool) { defer wg.Done() @@ -103,6 +106,9 @@ func spinTTY(out io.Writer, wg *sync.WaitGroup, stop *atomic.Bool, delay time.Du fmt.Fprint(out, showCursor) } +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func spinNoTTY(out io.Writer, wg *sync.WaitGroup, _ *atomic.Bool, _ time.Duration, text string, _ bool) { defer wg.Done() fmt.Fprintln(out, text+"...") diff --git a/cli/internal/cmd/upgradeplan.go b/cli/internal/cmd/upgradeplan.go index a59cce489..fb4412ffd 100644 --- a/cli/internal/cmd/upgradeplan.go +++ b/cli/internal/cmd/upgradeplan.go @@ -70,6 +70,9 @@ func runUpgradePlan(cmd *cobra.Command, args []string) error { } // upgradePlan plans an upgrade of a Constellation cluster. +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func upgradePlan(cmd *cobra.Command, planner upgradePlanner, fileHandler file.Handler, client *http.Client, rekor rekorVerifier, flags upgradePlanFlags, ) error { @@ -179,6 +182,9 @@ func getCompatibleImages(csp cloudprovider.Provider, currentVersion string, imag } // getCompatibleImageMeasurements retrieves the expected measurements for each image. +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func getCompatibleImageMeasurements(ctx context.Context, cmd *cobra.Command, client *http.Client, rekor rekorVerifier, pubK []byte, images map[string]config.UpgradeConfig) error { for idx, img := range images { measurementsURL, err := url.Parse(constants.S3PublicBucket + strings.ToLower(img.Image) + "/measurements.yaml") @@ -256,6 +262,9 @@ func parseUpgradePlanFlags(cmd *cobra.Command) (upgradePlanFlags, error) { }, nil } +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func upgradePlanInteractive(out io.WriteCloser, in io.ReadCloser, configPath string, config *config.Config, fileHandler file.Handler, compatibleImages map[string]config.UpgradeConfig, diff --git a/csi/cryptmapper/cryptmapper.go b/csi/cryptmapper/cryptmapper.go index b5c1c6b76..b48a61ec5 100644 --- a/csi/cryptmapper/cryptmapper.go +++ b/csi/cryptmapper/cryptmapper.go @@ -217,6 +217,9 @@ func closeCryptDevice(device DeviceMapper, source, volumeID, deviceType string) } // openCryptDevice maps the volume at source to the crypt device identified by volumeID. +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func openCryptDevice(ctx context.Context, device DeviceMapper, source, volumeID string, integrity bool, getKey func(ctx context.Context, keyID string, keySize int) ([]byte, error), diskInfo func(disk string) (string, error), ) (string, error) { diff --git a/disk-mapper/internal/setup/setup.go b/disk-mapper/internal/setup/setup.go index a48ce75ca..350b0ff25 100644 --- a/disk-mapper/internal/setup/setup.go +++ b/disk-mapper/internal/setup/setup.go @@ -51,6 +51,9 @@ type Manager struct { } // New initializes a SetupManager with the given parameters. +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func New(log *logger.Logger, csp string, diskPath string, fs afero.Afero, mapper DeviceMapper, mounter Mounter, openTPM vtpm.TPMOpenFunc, ) *Manager { diff --git a/internal/attestation/vtpm/attestation.go b/internal/attestation/vtpm/attestation.go index c79a5a7c6..009d7ff6a 100644 --- a/internal/attestation/vtpm/attestation.go +++ b/internal/attestation/vtpm/attestation.go @@ -154,6 +154,9 @@ type Validator struct { } // NewValidator returns a new Validator. +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func NewValidator(expectedPCRs map[uint32][]byte, enforcedPCRs []uint32, getTrustedKey GetTPMTrustedAttestationPublicKey, validateCVM ValidateCVM, verifyUserData VerifyUserData, log AttestationLogger, ) *Validator { diff --git a/joinservice/internal/server/server.go b/joinservice/internal/server/server.go index fef3d07c2..908c1fff3 100644 --- a/joinservice/internal/server/server.go +++ b/joinservice/internal/server/server.go @@ -42,6 +42,9 @@ type Server struct { } // New initializes a new Server. +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func New( measurementSalt []byte, fileHandler file.Handler, ca certificateAuthority, joinTokenGetter joinTokenGetter, dataKeyGetter dataKeyGetter, log *logger.Logger, diff --git a/kms/kms/gcp/gcp.go b/kms/kms/gcp/gcp.go index 8fd213f1a..226e3f194 100644 --- a/kms/kms/gcp/gcp.go +++ b/kms/kms/gcp/gcp.go @@ -54,6 +54,9 @@ type KMSClient struct { } // New initializes a KMS client for Google Cloud Platform. +// TODO: Upon changing this function, please refactor it to reduce the number of arguments to <= 5. +// +//revive:disable-next-line func New(ctx context.Context, projectID, locationID, keyRingID string, store kmsInterface.Storage, protectionLvl kmspb.ProtectionLevel, opts ...gax.CallOption) (*KMSClient, error) { if store == nil { store = storage.NewMemMapStorage()