Skip to content
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

feat: add provider attribute #1195

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions chart/infra-server/static/flavors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
name: StackRox Demo
description: Demo running StackRox {{ .Chart.Annotations.acsDemoVersion }}
availability: default
provider: gcp
workflow: configuration/workflow-demo.yaml
parameters:
- name: name
Expand Down Expand Up @@ -63,6 +64,7 @@
name: StackRox Demo for QA testing
description: Demo running a provided StackRox version
availability: stable
provider: gcp
workflow: configuration/workflow-qa-demo.yaml
parameters:
- name: name
Expand Down Expand Up @@ -142,6 +144,7 @@
name: GKE Default
description: GKE cluster running the default version
availability: stable
provider: gcp
workflow: configuration/workflow-gke-default.yaml
aliases:
- gke
Expand Down Expand Up @@ -205,6 +208,7 @@
name: OpenShift 3.11
description: OpenShift 3.11 cluster
availability: stable
provider: gcp
workflow: configuration/workflow-openshift-multi.yaml
aliases:
- openshift-3
Expand Down Expand Up @@ -276,6 +280,7 @@
name: OpenShift 4.x
description: OpenShift 4.x OCP or OKD cluster
availability: stable
provider: gcp
workflow: configuration/workflow-openshift-4.yaml
aliases:
- ocp-4
Expand Down Expand Up @@ -398,6 +403,7 @@
name: OpenShift 4.x Demo
description: OpenShift 4.x Demo
availability: stable
provider: gcp
workflow: configuration/workflow-openshift-4-demo.yaml
aliases:
- ocp-4-demo
Expand Down Expand Up @@ -546,6 +552,7 @@
name: OpenShift 4.x Perf&Scale
description: OpenShift 4.x Perf&Scale
availability: stable
provider: gcp
workflow: configuration/workflow-openshift-4-perf-scale.yaml
aliases:
- ocp-4-perf-scale
Expand Down Expand Up @@ -668,6 +675,7 @@
name: EKS
description: AWS EKS cluster
availability: stable
provider: aws
workflow: configuration/workflow-eks.yaml
parameters:
- name: name
Expand Down Expand Up @@ -705,6 +713,7 @@
name: AKS
description: Azure AKS cluster
availability: stable
provider: azure
workflow: configuration/workflow-aks.yaml
parameters:
- name: name
Expand Down Expand Up @@ -757,6 +766,7 @@
name: ARO
description: Openshift ARO cluster
availability: stable
provider: azure
workflow: configuration/workflow-openshift-aro.yaml
parameters:
- name: name
Expand Down Expand Up @@ -800,6 +810,7 @@
name: ROSA
description: Openshift ROSA cluster
availability: stable
provider: aws
workflow: configuration/workflow-openshift-rosa.yaml
parameters:
- name: name
Expand Down Expand Up @@ -848,6 +859,7 @@
name: Hypershift on ROSA (HCP)
description: Openshift ROSA HCP (Hypershift ManagedCP) cluster
availability: stable
provider: aws
workflow: configuration/workflow-openshift-rosa-hcp.yaml
parameters:
- name: name
Expand Down Expand Up @@ -923,6 +935,7 @@
name: OSD on AWS
description: Openshift dedicated on AWS
availability: stable
provider: aws
workflow: configuration/workflow-osd-aws.yaml
parameters:
- name: name
Expand Down Expand Up @@ -977,6 +990,7 @@
name: OSD on GCP
description: Openshift dedicated on GCP
availability: stable
provider: gcp
workflow: configuration/workflow-osd-gcp.yaml
parameters:
- name: name
Expand Down Expand Up @@ -1031,6 +1045,7 @@
name: IBM ROKS
description: IBM ROKS cluster on VPC infrastructure.
availability: stable
provider: ibm
workflow: configuration/workflow-openshift-ibmroks.yaml
parameters:
- name: name
Expand Down Expand Up @@ -1133,6 +1148,7 @@
name: Test URL Artifact
description: Test URL Artifact
availability: stable
provider: ""
workflow: configuration/test-url-artifact.yaml
parameters:
- name: name
Expand All @@ -1150,6 +1166,7 @@
name: Test Connect Artifact
description: Test Connect Artifact
availability: stable
provider: ""
aliases:
- test-alias-1
- test-alias-2
Expand Down
1 change: 1 addition & 0 deletions cmd/infractl/flavor/list/fancy.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func (p prettyFlavorListResponse) PrettyPrint(cmd *cobra.Command) {
cmd.Printf(" Name: %s\n", flavor.GetName())
cmd.Printf(" Description: %s\n", flavor.GetDescription())
cmd.Printf(" Availability: %s\n", flavor.GetAvailability())
cmd.Printf(" Provider: %s\n", flavor.GetProvider())
}
}

Expand Down
3 changes: 3 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ type FlavorConfig struct {
// Description is a human readable description for the flavor.
Description string `json:"description"`

// (Cloud) Provider
Provider string `json:"provider"`

// Availability is an availability classification level. One of "alpha",
// "beta", "stable", or "default". Exactly 1 default flavor must be
// configured.
Expand Down
1 change: 1 addition & 0 deletions flavor/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ func NewFromConfig(filename string) (*Registry, error) {
ID: flavorCfg.ID,
Name: flavorCfg.Name,
Description: flavorCfg.Description,
Provider: flavorCfg.Provider,
Availability: v1.FlavorAvailability(availability),
Parameters: parameters,
Artifacts: artifacts,
Expand Down
7 changes: 7 additions & 0 deletions flavor/workflow_templates.bats
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ setup_file() {
assert_output --partial '"msg":"ignoring a workflow template with an unknown infra.stackrox.io/availability annotation","template-name":"invalid-availability","template-availability":"woot!"'
}

@test "provider is set" {
flavor="$(infractl flavor get test-gke-lite --json)"
assert_success
provider="$(echo "$flavor" | jq -r '.Provider')"
assert_equal "$provider" "gcp"
}

# Parameters

@test "parameters must have descriptions" {
Expand Down
1 change: 1 addition & 0 deletions flavor/workflow_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func workflowTemplate2Flavor(template *v1alpha1.WorkflowTemplate) *v1.Flavor {
Name: template.ObjectMeta.Name,
Description: template.ObjectMeta.Annotations["infra.stackrox.io/description"],
Availability: availability,
Provider: template.ObjectMeta.Annotations["infra.stackrox.io/provider"],
Parameters: getParametersFromWorkflowTemplate(template),
Artifacts: make(map[string]*v1.FlavorArtifact),
}
Expand Down
Loading
Loading