Repository: crc-org/crc (go)

Issue:
The wildcard domain (apps-crc.testing) has stopped working in `network-mode user`
### General information

Start crc with the defaults, and apps deployed on the cluster are unreachable via the wildcard domain. Recreate crc from scratch w/`network-mode system` and apps are reachable via the wildcard domain. In prior versions, NM config scripts (e.g. 99-crc.sh) were installed in `user` mode, but in v2.52 they are only installed in `system` mode.  Also, the `crc` network isn't created in `user` mode in this version (confirmed via Cockpit).

### Operating System

Linux

### Hypervisor

KVM

### Did you run `crc setup` before `crc start`?

yes

### Running on

Laptop

### Steps to reproduce

Create an app (e.g. w/a pod running httpd and Hello World index.html) and try and reach it in `network-mode user` (the default). You won't be able to reach it.  

### CRC version

```shell
$ crc version
CRC version: 2.52.0+47be8d
OpenShift version: 4.19.0
MicroShift version: 4.19.0
```

### CRC status

```shell
$ crc status
CRC VM:          Running
OpenShift:       Running (v4.19.0)
RAM Usage:       8.542GB of 67.42GB
Disk Usage:      27.82GB of 136.8GB (Inside the CRC VM)
Cache Usage:     32.69GB
Cache Directory: /home/hippyod/.crc/cache
```

### CRC config

```shell
$ crc config view
- consent-telemetry                     : yes
- cpus                                  : 10
- disk-size                             : 128
- kubeadmin-password                    : elcicd
- memory                                : 65536
```

### Host Operating System

```shell
Fedora 42 (fully updated last Thursday).
```

### Expected behavior

Apps with an Ingress or Route are reachable from outside the cluster at <some-arbitrary-name>.apps-crc.testing.

### Actual behavior

Apps with an Ingress or Route are **NOT** reachable from outside the cluster at <some-arbitrary-name>.apps-crc.testing.

### CRC Logs

```shell
Stopping the OpenShift Local cluster
INFO Stopping kubelet and all containers...       
INFO Stopping the instance, this may take a few minutes... 
Stopped the instance
Do you want to delete the instance? [y/N]: y
Deleted the instance
Cleaning up the OpenShift Local install
INFO Removing vsock configuration                 
INFO Removing 'crc' network from libvirt          
INFO Removing /etc/NetworkManager/dispatcher.d/99-crc.sh file 
INFO Using root access: Removing NetworkManager configuration file in /etc/NetworkManager/dispatcher.d/99-crc.sh 
[sudo] password for hippyod: 
INFO Using root access: Executing systemctl daemon-reload command 
INFO Using root access: Executing systemctl reload NetworkManager 
INFO Removing crc daemon systemd socket units     
INFO Removing crc daemon systemd service          
INFO Removing crc's virtual machine               
INFO Removing crc libvirt storage pool            
INFO Removing CRC manpages                        
INFO Removing CRC Specific entries from user's known_hosts file 
INFO Removing hosts file records added by CRC     
INFO Removing pull secret from the keyring        
INFO Removing older logs                          
Cleanup finished

Removing old OpenShift Local installation directories
removed '/home/hippyod/elcicd-dev/crc-linux-2.52.0-amd64/LICENSE'
removed '/home/hippyod/elcicd-dev/crc-linux-2.52.0-amd64/crc'
removed directory '/home/hippyod/elcicd-dev/crc-linux-2.52.0-amd64/'
removed '/home/hippyod/.crc/cache/crc_libvirt_4.19.0_amd64.crcbundle'
removed '/home/hippyod/.crc/cache/crc_libvirt_4.19.0_amd64/crc-bundle-info.json'
removed '/home/hippyod/.crc/cache/crc_libvirt_4.19.0_amd64/crc.qcow2'
removed '/home/hippyod/.crc/cache/crc_libvirt_4.19.0_amd64/id_ecdsa_crc'
removed '/home/hippyod/.crc/cache/crc_libvirt_4.19.0_amd64/kubeconfig'
removed '/home/hippyod/.crc/cache/crc_libvirt_4.19.0_amd64/oc'
removed '/home/hippyod/.crc/cache/crc_libvirt_4.19.0_amd64/podman-remote'
removed directory '/home/hippyod/.crc/cache/crc_libvirt_4.19.0_amd64'
removed directory '/home/hippyod/.crc/cache'
removed '/home/hippyod/.crc/bin/crc-admin-helper-linux-amd64'
removed '/home/hippyod/.crc/bin/crc-driver-libvirt-amd64'
removed '/home/hippyod/.crc/bin/oc/oc'
removed directory '/home/hippyod/.crc/bin/oc'
removed '/home/hippyod/.crc/bin/podman/podman-remote'
removed directory '/home/hippyod/.crc/bin/podman'
removed directory '/home/hippyod/.crc/bin'
removed '/home/hippyod/.crc/crc-http.sock'
removed '/home/hippyod/.crc/segmentIdentifyHash'
removed '/home/hippyod/.crc/crc.json'
removed '/home/hippyod/.crc/crc.log'
removed directory '/home/hippyod/.crc'

Extracting OpenShift Local tar.xz to /home/hippyod/elcicd-dev

++ /home/hippyod/elcicd-dev/crc-linux-2.52.0-amd64/crc setup
CRC is constantly improving and we would like to know more about usage (more details at https://developers.redhat.com/article/tool-data-collection)
Your preference can be changed manually if desired using 'crc config set consent-telemetry <yes/no>'
Would you like to contribute anonymous usage statistics? [y/N]: y
Thanks for helping us! You can disable telemetry with the command 'crc config set consent-telemetry no'.
INFO Using bundle path /home/hippyod/.crc/cache/crc_libvirt_4.19.0_amd64.crcbundle 
INFO Checking if running as non-root              
INFO Checking if running inside WSL2              
INFO Checking if crc-admin-helper executable is cached 
INFO Caching crc-admin-helper executable          
INFO Using root access: Changing ownership of /home/hippyod/.crc/bin/crc-admin-helper-linux-amd64 
INFO Using root access: Setting suid for /home/hippyod/.crc/bin/crc-admin-helper-linux-amd64 
INFO Checking if running on a supported CPU architecture 
INFO Checking if crc executable symlink exists    
INFO Creating symlink for crc executable          
INFO Checking minimum RAM requirements            
INFO Check if Podman binary exists in: /home/hippyod/.crc/bin/oc 
INFO Checking if Virtualization is enabled        
INFO Checking if KVM is enabled                   
INFO Checking if libvirt is installed             
INFO Checking if user is part of libvirt group    
INFO Checking if active user/process is currently part of the libvirt group 
INFO Checking if libvirt daemon is running        
INFO Checking if a supported libvirt version is installed 
INFO Checking if crc-driver-libvirt is installed  
INFO Installing crc-driver-libvirt                
INFO Checking crc daemon systemd service          
INFO Setting up crc daemon systemd service        
INFO Checking crc daemon systemd socket units     
INFO Setting up crc daemon systemd socket units   
INFO Checking if vsock is correctly configured    
INFO Setting up vsock support                     
INFO Using root access: Setting CAP_NET_BIND_SERVICE capability for /home/hippyod/elcicd-dev/crc-linux-2.52.0-amd64/crc executable 
INFO Using root access: Creating udev rule for /dev/vsock 
INFO Using root access: Changing permissions for /etc/udev/rules.d/99-crc-vsock.rules to 644  
INFO Using root access: Reloading udev rules database 
INFO Using root access: Loading vhost_vsock kernel module 
INFO Using root access: Creating file /etc/modules-load.d/vhost_vsock.conf 
INFO Using root access: Changing permissions for /etc/modules-load.d/vhost_vsock.conf to 644  
INFO Checking if CRC bundle is extracted in '$HOME/.crc' 
INFO Checking if /home/hippyod/.crc/cache/crc_libvirt_4.19.0_amd64.crcbundle exists 
INFO Getting bundle for the CRC executable        
INFO Downloading bundle: /home/hippyod/.crc/cache/crc_libvirt_4.19.0_amd64.crcbundle... 
7.40 GiB / 7.40 GiB [------------------------------------------------------------------------------------------] 100.00% 40.04 MiB/s
INFO Uncompressing /home/hippyod/.crc/cache/crc_libvirt_4.19.0_amd64.crcbundle 
crc.qcow2:  22.83 GiB / 22.83 GiB [----------------------------------------------------------------------------------------] 100.00%
oc:  177.76 MiB / 177.76 MiB [---------------------------------------------------------------------------------------------] 100.00%
Your system is correctly setup for using CRC. Use 'crc start' to start the instance
```

### Additional context

As I said above, the crc network isn't being created, and it doesn't look like the 99-crc.sh, etc., NM scripts and config are being created anymore in this version when setting up using the default. No crc network is created. I confirmed this is not the same behavior as w/v2.51.  I posted the default `user` mode setup logs above.  It's missing the following (copied when setting up in `system` network-mode, which works properly):

```
INFO Checking if systemd-networkd is running      
INFO Checking if NetworkManager is installed      
INFO Checking if NetworkManager service is running 
INFO Checking if dnsmasq configurations file exist for NetworkManager 
INFO Checking if the systemd-resolved service is running 
INFO Checking if /etc/NetworkManager/dispatcher.d/99-crc.sh exists 
INFO Writing NetworkManager dispatcher file for crc 
INFO Using root access: Writing NetworkManager configuration to /etc/NetworkManager/dispatcher.d/99-crc.sh 
INFO Using root access: Changing permissions for /etc/NetworkManager/dispatcher.d/99-crc.sh to 755  
INFO Using root access: Executing systemctl daemon-reload command 
INFO Using root access: Executing systemctl reload NetworkManager 
INFO Checking if libvirt 'crc' network is available 
INFO Setting up libvirt 'crc' network             
INFO Checking if libvirt 'crc' network is active  
INFO Starting libvirt 'crc' network               
```

Pull request:
systemd: Add state for activating service
In OCP-4.19 bundles ovs-configuration service is by default active which
was not the case for older bundle so when we check the status it throw
the error because systemd activating state is not implemented. Since it
is the error and in `UpdateResolvFileOnInstance` function logic which
implemented as part of https://github.com/praveenkumar/crc/commit/60040cd097db5eabf1f9234292b5e001b207f2ef, update the /etc/resolv.conf setting
using old method which doesn't work on the bundles with ovs as CNI.

This pr add the activating condition for systemd state logic which
make sure the resolv.conf applied right way.

After this change the instance have
```
$ cat /etc/resolv.conf
search crc.testing
nameserver 192.168.127.1
```

and route controller pod have
```
sh-5.1$ cat /etc/resolv.conf
search openshift-ingress.svc.cluster.local svc.cluster.local cluster.local crc.testing
nameserver 10.217.4.10
options ndots:5
```

## Contribution Checklist
- [ ] I Keep It Small and Simple: The smaller the PR is, the easier it is to review and have it merged
- [x] I have performed a self-review of my code
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Which platform have you tested the code changes on? <!-- Only put an `x` in applicable platforms -->
    - [x] Linux
    - [ ] Windows
    - [ ] MacOS

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **New Features**
  * Introduced a new "Activating" state to the system status options, improving visibility of transitional states during startup.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

fixes #4823

Patch:
diff --git a/go.mod b/go.mod
index c990a07d1..7712c8efd 100644
--- a/go.mod
+++ b/go.mod
@@ -55,7 +55,7 @@ require (
 	github.com/yusufpapurcu/wmi v1.2.4
 	github.com/zalando/go-keyring v0.2.6
 	golang.org/x/crypto v0.40.0
-	golang.org/x/net v0.41.0
+	golang.org/x/net v0.42.0
 	golang.org/x/sync v0.16.0
 	golang.org/x/sys v0.34.0
 	golang.org/x/term v0.33.0
diff --git a/go.sum b/go.sum
index e7b1f8f87..53197ff1a 100644
--- a/go.sum
+++ b/go.sum
@@ -491,8 +491,8 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
 golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
 golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
 golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
-golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
-golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
+golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
+golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
 golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70=
 golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
 golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
diff --git a/pkg/crc/systemd/states/state.go b/pkg/crc/systemd/states/state.go
index 4b5609adb..03433ccb6 100644
--- a/pkg/crc/systemd/states/state.go
+++ b/pkg/crc/systemd/states/state.go
@@ -10,6 +10,7 @@ const (
 	Unknown State = iota
 	Running
 	Listening
+	Activating
 	Stopped
 	NotFound
 	Error
@@ -19,6 +20,7 @@ var states = []string{
 	"unknown",
 	"active (running)",
 	"active (listening)",
+	"activating (start)",
 	"inactive (dead)",
 	"could not be found",
 	"error",
@@ -38,6 +40,9 @@ func Compare(input string) State {
 	if strings.Contains(input, states[Listening]) {
 		return Listening
 	}
+	if strings.Contains(input, states[Activating]) {
+		return Activating
+	}
 	if strings.Contains(input, states[Stopped]) {
 		return Stopped
 	}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index ad38e4b7e..3d162a4d5 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -841,7 +841,7 @@ golang.org/x/exp/maps
 # golang.org/x/mod v0.25.0
 ## explicit; go 1.23.0
 golang.org/x/mod/semver
-# golang.org/x/net v0.41.0
+# golang.org/x/net v0.42.0
 ## explicit; go 1.23.0
 golang.org/x/net/bpf
 golang.org/x/net/context


Test patch:
diff --git a/pkg/crc/systemd/systemd_linux_test.go b/pkg/crc/systemd/systemd_linux_test.go
index 8b066e55e..36afaf70e 100644
--- a/pkg/crc/systemd/systemd_linux_test.go
+++ b/pkg/crc/systemd/systemd_linux_test.go
@@ -42,6 +42,10 @@ func TestSystemdStatuses(t *testing.T) {
 	assert.NoError(t, err)
 	assert.Equal(t, states.Running.String(), status.String())
 
+	status, err = systemctl.Status("activating.service")
+	assert.NoError(t, err)
+	assert.Equal(t, states.Activating.String(), status.String())
+
 	status, err = systemctl.Status("listening.socket")
 	assert.NoError(t, err)
 	assert.Equal(t, states.Listening.String(), status.String())
@@ -68,6 +72,8 @@ func (r *mockSystemdRunner) Run(command string, args ...string) (string, string,
 	switch unitName {
 	case "running.service":
 		return r.status(states.Running)
+	case "activating.service":
+		return r.status(states.Activating)
 	case "listening.socket":
 		return r.status(states.Listening)
 	case "stopped.service":
@@ -140,7 +146,20 @@ TriggeredBy: ● listening.socket
    Main PID: 64922 (code=exited, status=0/SUCCESS)
         CPU: 327ms
 `
-	statusNotFound string = "Unit notfound.service could not be found."
+	statusNotFound   string = "Unit notfound.service could not be found."
+	statusActivating string = `● activating.service - activating service
+	 Loaded: loaded (/usr/lib/systemd/system/activating.service; enabled; vendor preset: enabled)
+	 Active: activating (start) since Tue 2020-11-24 14:52:20 CET; 15s ago
+	TriggeredBy: ● activating.socket
+	       Docs: man:activating(8)
+             https://activating.example.com
+	 Main PID: 224516 (activating)
+	    Tasks: 19 (limit: 32768)
+			   Memory: 36.9M
+			      CPU: 414ms
+				  	 CGroup: /system.slice/activating.service
+					 	 ├─ 19588 /usr/sbin/true
+`
 )
 
 func (r *mockSystemdRunner) status(s states.State) (string, string, error) {
@@ -158,6 +177,8 @@ func (r *mockSystemdRunner) status(s states.State) (string, string, error) {
 		stdout = statusRunning
 	case states.Listening:
 		stdout = statusListening
+	case states.Activating:
+		stdout = statusActivating
 	case states.Stopped:
 		stdout = statusStopped
 		err = errors.New("exit code: 3 - see EXIT STATUS in man systemctl")