Skip to content

Installer Experience v2 - Milestone 1 #2187

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

Merged

Conversation

sgalsaleh
Copy link
Member

What this PR does / why we need it:

Which issue(s) this PR fixes:

Does this PR require a test?

Does this PR require a release note?


Does this PR require documentation?

NONE

Copy link

github-actions bot commented May 23, 2025

This PR has been released (on staging) and is available for download with a embedded-cluster-smoke-test-staging-app license ID.

Online Installer:

curl "https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci/appver-dev-50ef28e" -H "Authorization: $EC_SMOKE_TEST_LICENSE_ID" -o embedded-cluster-smoke-test-staging-app-ci.tgz

Airgap Installer (may take a few minutes before the airgap bundle is built):

curl "https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci-airgap/appver-dev-50ef28e?airgap=true" -H "Authorization: $EC_SMOKE_TEST_LICENSE_ID" -o embedded-cluster-smoke-test-staging-app-ci.tgz

Happy debugging!

@sgalsaleh sgalsaleh force-pushed the salah/sc-123874/steelthread-configure-data-dir-in-the-new branch from fcd2925 to 2753604 Compare May 23, 2025 20:09
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing tests for getInstallStatus and setInstallStatus.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done via #2214

Comment on lines +30 to +35

func NewDiscardLogger() *logrus.Logger {
logger := logrus.New()
logger.SetOutput(io.Discard)
return logger
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on having a "debug" logger or something along those lines that writes to stdout with a well known format that allows us to distinguish between the cli logs and the API logs? This could be setup whenever the --debug flag is passed to the cli (or an env var is setup in our local dev envs for easier local dev).

Comment on lines +18 to +22
type MemoryStore struct {
mu sync.RWMutex
config *types.InstallationConfig
status *types.InstallationStatus
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add tests to this store.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done via - #2226

Comment on lines +10 to +32
func ValidateCIDR(cidr string) error {
if err := netutils.ValidateCIDR(cidr, 16, true); err != nil {
return fmt.Errorf("unable to validate cidr flag: %w", err)
}
return nil
}

type CIDRConfig struct {
PodCIDR string
ServiceCIDR string
GlobalCIDR *string
}

// SplitCIDR takes a CIDR string and splits it into pod and service CIDRs
// to be used for the cluster. It returns a CIDRConfig containing the split CIDRs
// and the original global CIDR.
func SplitCIDR(cidr string) (string, string, error) {
podCIDR, serviceCIDR, err := netutils.SplitNetworkCIDR(cidr)
if err != nil {
return "", "", fmt.Errorf("unable to split cidr flag: %w", err)
}
return podCIDR, serviceCIDR, nil
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add tests to these functions?

Comment on lines +33 to +65
// GetCertificate returns a TLS certificate based on the provided configuration.
// If cert and key files are provided, it uses those. Otherwise, it generates a self-signed certificate.
func GetCertificate(cfg Config) (tls.Certificate, error) {
if cfg.CertFile != "" && cfg.KeyFile != "" {
logrus.Debugf("Using TLS configuration with cert file: %s and key file: %s", cfg.CertFile, cfg.KeyFile)
return tls.LoadX509KeyPair(cfg.CertFile, cfg.KeyFile)
}

hostname, altNames := generateCertHostnames(cfg.Hostname)

// Generate a new self-signed cert
certData, keyData, err := certutil.GenerateSelfSignedCertKey(hostname, cfg.IPAddresses, altNames)
if err != nil {
return tls.Certificate{}, fmt.Errorf("generate self-signed cert: %w", err)
}

cert, err := tls.X509KeyPair(certData, keyData)
if err != nil {
return tls.Certificate{}, fmt.Errorf("create TLS certificate: %w", err)
}

logrus.Debugf("Using self-signed TLS certificate for hostname: %s", hostname)
return cert, nil
}

// GetTLSConfig returns a TLS configuration with the provided certificate
func GetTLSConfig(cert tls.Certificate) *tls.Config {
return &tls.Config{
MinVersion: tls.VersionTLS12,
CipherSuites: TLSCipherSuites,
Certificates: []tls.Certificate{cert},
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add tests to these functions?

Comment on lines +46 to +48
// ListValidNetworkInterfaces returns a list of valid network interfaces that are up and not
// loopback.
func ListValidNetworkInterfaces() ([]net.Interface, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should test this function.

@@ -93,3 +116,32 @@ func firstValidIPNet(i net.Interface) (*net.IPNet, error) {
}
return nil, fmt.Errorf("could not find any non-local, non podnetwork ipv4 addresses")
}

func ListAllValidIPAddresses() ([]net.IP, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should test this function.

@sgalsaleh sgalsaleh force-pushed the salah/sc-123874/steelthread-configure-data-dir-in-the-new branch from c83276b to ec30def Compare May 27, 2025 14:49
@sgalsaleh sgalsaleh force-pushed the salah/sc-123874/steelthread-configure-data-dir-in-the-new branch from ec30def to 50ef28e Compare May 27, 2025 14:49
@sgalsaleh sgalsaleh marked this pull request as ready for review May 27, 2025 15:12
@sgalsaleh sgalsaleh merged commit 6a0394f into main May 27, 2025
187 of 193 checks passed
@sgalsaleh sgalsaleh deleted the salah/sc-123874/steelthread-configure-data-dir-in-the-new branch May 27, 2025 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants