Skip to content

Commit f153f72

Browse files
committed
feat(snc): add --profile flag with virtualization addon support
Add a profile system to the OpenShift SNC command that allows installing addons on the cluster after deployment. The first supported profile is 'virtualization' which installs the OCP Virtualization (CNV) operator and enables nested virtualization on the compute instance. Signed-off-by: Jose Angel Morena <jmorenas@redhat.com>
1 parent d874d63 commit f153f72

493 files changed

Lines changed: 111012 additions & 7 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/mapt/cmd/aws/services/snc.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ const (
2222
pullSecretFileDesc = "file path of image pull secret (download from https://console.redhat.com/openshift/create/local)"
2323
disableClusterReadiness = "disable-cluster-readiness"
2424
disableClusterReadinessDesc = "If this flag is set it will skip the checks for the cluster readiness. In this case the kubeconfig can not be generated"
25+
26+
sncProfile = "profile"
27+
sncProfileDesc = "comma separated list of profiles to apply on the SNC cluster. Profiles available: virtualization"
2528
)
2629

2730
func GetOpenshiftSNCCmd() *cobra.Command {
@@ -51,6 +54,14 @@ func createSNC() *cobra.Command {
5154
if err := viper.BindPFlags(cmd.Flags()); err != nil {
5255
return err
5356
}
57+
if err := viper.BindPFlags(cmd.InheritedFlags()); err != nil {
58+
return err
59+
}
60+
profiles := viper.GetStringSlice(sncProfile)
61+
computeReq := params.ComputeRequestArgs()
62+
if sncApi.ProfilesRequireNestedVirt(profiles) {
63+
computeReq.NestedVirt = true
64+
}
5465
if _, err := openshiftsnc.Create(
5566
&maptContext.ContextArgs{
5667
Context: cmd.Context(),
@@ -62,13 +73,14 @@ func createSNC() *cobra.Command {
6273
Tags: viper.GetStringMapString(params.Tags),
6374
},
6475
&sncApi.SNCArgs{
65-
ComputeRequest: params.ComputeRequestArgs(),
76+
ComputeRequest: computeReq,
6677
Spot: params.SpotArgs(),
6778
Version: viper.GetString(ocpVersion),
6879
DisableClusterReadiness: viper.IsSet(disableClusterReadiness),
6980
Arch: viper.GetString(params.LinuxArch),
7081
PullSecretFile: viper.GetString(pullSecretFile),
71-
Timeout: viper.GetString(params.Timeout)}); err != nil {
82+
Timeout: viper.GetString(params.Timeout),
83+
Profiles: profiles}); err != nil {
7284
return err
7385
}
7486
return nil
@@ -82,6 +94,7 @@ func createSNC() *cobra.Command {
8294
flagSet.StringP(pullSecretFile, "", "", pullSecretFileDesc)
8395
flagSet.StringP(params.Timeout, "", "", params.TimeoutDesc)
8496
flagSet.StringToStringP(params.Tags, "", nil, params.TagsDesc)
97+
flagSet.StringSliceP(sncProfile, "", []string{}, sncProfileDesc)
8598
params.AddComputeRequestFlags(flagSet)
8699
params.AddSpotFlags(flagSet)
87100
c.PersistentFlags().AddFlagSet(flagSet)

docs/aws/openshift-snc.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,41 @@ After the AMI is published and accessible by the account, we can use the followi
4040
--spot \
4141
--version 4.19.0 \
4242
--project-name mapt-snc \
43-
--backed-url file:///Users/tester/workspace \
43+
--backed-url file:///home/tester/workspace \
4444
--conn-details-output /tmp/snc \
45-
--pull-secret-file /Users/tester/Downloads/pull-secret
45+
--pull-secret-file /home/tester/Downloads/pull-secret
4646
```
4747

4848
After the above command succeeds the `kubeconfig` to access the deployed cluster will be available in `/tmp/snc/kubeconfig`
4949

50+
## Profiles
51+
52+
Profiles are optional addons that are installed on the SNC cluster after it is ready. Use the `--profile` flag to enable one or more profiles:
53+
54+
```
55+
mapt aws openshift-snc create \
56+
--spot \
57+
--version 4.21.0 \
58+
--project-name mapt-snc \
59+
--backed-url file:///home/tester/workspace \
60+
--conn-details-output /tmp/snc \
61+
--pull-secret-file /home/tester/Downloads/pull-secret \
62+
--profile virtualization
63+
```
64+
65+
Multiple profiles can be specified as a comma-separated list (e.g., `--profile virtualization,serverless`).
66+
67+
### Available profiles
68+
69+
| Profile | Description |
70+
|---------|-------------|
71+
| `virtualization` | Installs [OpenShift Virtualization](https://docs.openshift.com/container-platform/latest/virt/about_virt/about-virt.html) (CNV) on the cluster, enabling virtual machines to run on the single-node cluster. When this profile is selected, nested virtualization is automatically enabled on the cloud instance. Because standard Nitro-based instances do not expose `/dev/kvm`, a bare metal instance is required.|
72+
73+
74+
### Adding new profiles
75+
76+
To add a new profile:
77+
78+
1. Create `profile_<name>.go` under `pkg/target/service/snc/` — Go file with a `deploy<Name>()` function that uses the Pulumi Kubernetes provider to create the required resources (Namespace, OperatorGroup, Subscription, CRs, etc.)
79+
2. Register the profile name in `profiles.go` by adding it to `validProfiles` and the `DeployProfile()` switch
80+

go.mod

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ require (
3636
github.com/pulumi/pulumi-gitlab/sdk/v8 v8.11.0
3737
github.com/pulumi/pulumi-tls/sdk/v5 v5.3.0
3838
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa
39+
k8s.io/apimachinery v0.35.2
40+
k8s.io/client-go v0.35.2
3941
)
4042

4143
require (
@@ -101,7 +103,9 @@ require (
101103
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
102104
github.com/cloudflare/circl v1.6.3 // indirect
103105
github.com/cyphar/filepath-securejoin v0.6.1 // indirect
106+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
104107
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
108+
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
105109
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
106110
github.com/go-logr/logr v1.4.3 // indirect
107111
github.com/go-logr/stdr v1.2.2 // indirect
@@ -125,6 +129,7 @@ require (
125129
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
126130
github.com/muesli/cancelreader v0.2.2 // indirect
127131
github.com/muesli/termenv v0.16.0 // indirect
132+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
128133
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
129134
github.com/pgavlin/fx v0.1.6 // indirect
130135
github.com/pjbgf/sha1cd v0.5.0 // indirect
@@ -138,6 +143,7 @@ require (
138143
github.com/spf13/afero v1.15.0 // indirect
139144
github.com/spf13/cast v1.10.0 // indirect
140145
github.com/subosito/gotenv v1.6.0 // indirect
146+
github.com/x448/float16 v0.8.4 // indirect
141147
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
142148
github.com/zclconf/go-cty v1.18.0 // indirect
143149
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
@@ -151,11 +157,22 @@ require (
151157
go.opentelemetry.io/otel/trace v1.40.0 // indirect
152158
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
153159
go.uber.org/multierr v1.11.0 // indirect
160+
go.yaml.in/yaml/v2 v2.4.3 // indirect
154161
go.yaml.in/yaml/v3 v3.0.4 // indirect
162+
golang.org/x/oauth2 v0.34.0 // indirect
155163
golang.org/x/sync v0.19.0 // indirect
164+
golang.org/x/time v0.9.0 // indirect
156165
google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect
157166
google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 // indirect
167+
gopkg.in/inf.v0 v0.9.1 // indirect
158168
gopkg.in/yaml.v3 v3.0.1 // indirect
169+
k8s.io/klog/v2 v2.130.1 // indirect
170+
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
171+
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect
172+
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
173+
sigs.k8s.io/randfill v1.0.0 // indirect
174+
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
175+
sigs.k8s.io/yaml v1.6.0 // indirect
159176
)
160177

161178
require (

0 commit comments

Comments
 (0)