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

refactor: create root level HelmConfig struct which applies to all HelmReleases #345

Closed
wants to merge 4 commits into from
Closed
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
20 changes: 10 additions & 10 deletions api/v1alpha1/validatorconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import (

// ValidatorConfigSpec defines the desired state of ValidatorConfig.
type ValidatorConfigSpec struct {
// HelmConfig defines the configuration for the Helm repository.
HelmConfig HelmConfig `json:"helmConfig" yaml:"helmConfig"`

// Plugins defines the configuration for the validator plugins.
Plugins []HelmRelease `json:"plugins,omitempty" yaml:"plugins,omitempty"`

Expand All @@ -42,24 +45,21 @@ type Sink struct {

// HelmRelease defines the configuration for a Helm chart release.
type HelmRelease struct {
// Chart defines the Helm chart to be installed.
Chart HelmChart `json:"chart" yaml:"chart"`
// Name of the Helm chart.
Name string `json:"name" yaml:"name"`

Copy link
Member

Choose a reason for hiding this comment

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

We need to track repository here in addition to the name:

// Repository containing the Helm chart.
Repository string `json:"repository" yaml:"repository"`

Structure of Helm URI: <registry>/<repository>/<chart>

// Version of the Helm chart.
Version string `json:"version" yaml:"version"`

// Values defines the values to be passed to the Helm chart.
Values string `json:"values" yaml:"values"`
}

// HelmChart defines the configuration for a Helm chart.
type HelmChart struct {
// Name of the Helm chart.
Name string `json:"name" yaml:"name"`

// HelmConfig defines the configuration for a Helm repository.
Copy link
Member

Choose a reason for hiding this comment

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

Repository refers to the name of a chart within a registry. So this should say "for a Helm registry".

type HelmConfig struct {
// Repository URL of the Helm chart.
Repository string `json:"repository" yaml:"repository"`
Copy link
Member

Choose a reason for hiding this comment

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

Propose to rename this Registry w/ comment: "Registry is the URL of a Helm registry"

Copy link
Member

Choose a reason for hiding this comment

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

Because repository can't be configured globally - it varies for each chart.


// Version of the Helm chart.
Version string `json:"version" yaml:"version"`

// CAFile is the path to the CA certificate for the Helm repository.
CAFile string `json:"caFile,omitempty" yaml:"caFile,omitempty"`

Expand Down
10 changes: 5 additions & 5 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chart/validator/README.md

Large diffs are not rendered by default.

59 changes: 24 additions & 35 deletions chart/validator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,13 @@ pluginSecrets:
# <your public key content here>
# -----END PUBLIC KEY-----

helmConfig:
repository: "https://validator-labs.github.io"

# Validation plugin charts
plugins:
- chart:
name: validator-plugin-azure
repository: "https://validator-labs.github.io/validator-plugin-azure"
version: v0.0.13
- name: validator-plugin-azure
version: v0.0.14
values: |-
controllerManager:
kubeRbacProxy:
Expand Down Expand Up @@ -225,7 +226,7 @@ plugins:
- ALL
image:
repository: quay.io/validator-labs/validator-plugin-azure
tag: v0.0.13
tag: v0.0.14
resources:
limits:
cpu: 500m
Expand Down Expand Up @@ -262,10 +263,8 @@ plugins:
# Override the service account used by Azure validator (optional, could be used for WorkloadIdentityCredentials on AKS)
# WARNING: the chosen service account must include all RBAC privileges found in templates/manager-rbac.yaml
serviceAccountName: ""
- chart:
name: validator-plugin-oci
repository: "https://validator-labs.github.io/validator-plugin-oci"
version: v0.0.11
- name: validator-plugin-oci
version: v0.0.12
values: |-
controllerManager:
kubeRbacProxy:
Expand Down Expand Up @@ -300,7 +299,7 @@ plugins:
- ALL
image:
repository: quay.io/validator-labs/validator-plugin-oci
tag: v0.0.11
tag: v0.0.12
resources:
limits:
cpu: 500m
Expand All @@ -319,10 +318,8 @@ plugins:
protocol: TCP
targetPort: https
type: ClusterIP
- chart:
name: validator-plugin-kubescape
repository: "https://validator-labs.github.io/validator-plugin-kubescape"
version: v0.0.3
- name: validator-plugin-kubescape
version: v0.0.4
values: |-
controllerManager:
kubeRbacProxy:
Expand Down Expand Up @@ -357,7 +354,7 @@ plugins:
- ALL
image:
repository: quay.io/validator-labs/validator-plugin-kubescape
tag: v0.0.3
tag: v0.0.4
resources:
limits:
cpu: 500m
Expand All @@ -384,10 +381,8 @@ plugins:
protocol: TCP
targetPort: https
type: ClusterIP
- chart:
name: validator-plugin-aws
repository: "https://validator-labs.github.io/validator-plugin-aws"
version: v0.1.1
- name: validator-plugin-aws
version: v0.1.2
values: |-
controllerManager:
kubeRbacProxy:
Expand Down Expand Up @@ -422,7 +417,7 @@ plugins:
- ALL
image:
repository: quay.io/validator-labs/validator-plugin-aws
tag: v0.1.1
tag: v0.1.2
resources:
limits:
cpu: 500m
Expand Down Expand Up @@ -451,10 +446,8 @@ plugins:
# Override the service account used by AWS validator (optional, could be used for IAM roles for Service Accounts)
# WARNING: the chosen service account must have the same RBAC privileges as seen in templates/manager-rbac.yaml
serviceAccountName: ""
- chart:
name: validator-plugin-network
repository: "https://validator-labs.github.io/validator-plugin-network"
version: v0.0.19
- name: validator-plugin-network
version: v0.0.20
values: |-
controllerManager:
kubeRbacProxy:
Expand Down Expand Up @@ -491,7 +484,7 @@ plugins:
- ALL
image:
repository: quay.io/validator-labs/validator-plugin-network
tag: v0.0.19
tag: v0.0.20
resources:
limits:
cpu: 500m
Expand All @@ -510,10 +503,8 @@ plugins:
protocol: TCP
targetPort: https
type: ClusterIP
- chart:
name: validator-plugin-maas
repository: "https://validator-labs.github.io/validator-plugin-maas"
version: v0.0.4
- name: validator-plugin-maas
version: v0.0.5
values: |-
controllerManager:
kubeRbacProxy:
Expand Down Expand Up @@ -548,7 +539,7 @@ plugins:
- ALL
image:
repository: quay.io/validator-labs/validator-plugin-maas
tag: v0.0.4
tag: v0.0.5
resources:
limits:
cpu: 500m
Expand All @@ -567,10 +558,8 @@ plugins:
protocol: TCP
targetPort: https
type: ClusterIP
- chart:
name: validator-plugin-vsphere
repository: "https://validator-labs.github.io/validator-plugin-vsphere"
version: v0.0.27
- name: validator-plugin-vsphere
version: v0.0.28
values: |-
controllerManager:
kubeRbacProxy:
Expand Down Expand Up @@ -606,7 +595,7 @@ plugins:
- ALL
image:
repository: quay.io/validator-labs/validator-plugin-vsphere
tag: v0.0.27
tag: v0.0.28
resources:
limits:
cpu: 500m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,48 +39,47 @@ spec:
spec:
description: ValidatorConfigSpec defines the desired state of ValidatorConfig.
properties:
helmConfig:
description: HelmConfig defines the configuration for the Helm repository.
properties:
authSecretName:
description: AuthSecretName is the name of the K8s secret containing
the authentication details for the Helm repository.
type: string
caFile:
description: CAFile is the path to the CA certificate for the
Helm repository.
type: string
insecureSkipVerify:
description: InsecureSkipTLSVerify skips the verification of the
server's certificate chain and host name.
type: boolean
repository:
description: Repository URL of the Helm chart.
type: string
required:
- repository
type: object
plugins:
description: Plugins defines the configuration for the validator plugins.
items:
description: HelmRelease defines the configuration for a Helm chart
release.
properties:
chart:
description: Chart defines the Helm chart to be installed.
properties:
authSecretName:
description: AuthSecretName is the name of the K8s secret
containing the authentication details for the Helm repository.
type: string
caFile:
description: CAFile is the path to the CA certificate for
the Helm repository.
type: string
insecureSkipVerify:
description: InsecureSkipTLSVerify skips the verification
of the server's certificate chain and host name.
type: boolean
name:
description: Name of the Helm chart.
type: string
repository:
description: Repository URL of the Helm chart.
type: string
version:
description: Version of the Helm chart.
type: string
required:
- name
- repository
- version
type: object
name:
description: Name of the Helm chart.
type: string
values:
description: Values defines the values to be passed to the Helm
chart.
type: string
version:
description: Version of the Helm chart.
type: string
required:
- chart
- name
- values
- version
type: object
type: array
sink:
Expand All @@ -100,6 +99,8 @@ spec:
- secretName
- type
type: object
required:
- helmConfig
type: object
status:
description: ValidatorConfigStatus defines the observed state of ValidatorConfig
Expand Down
3 changes: 3 additions & 0 deletions hack/chart/values-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,8 @@ pluginSecrets:
# <your public key content here>
# -----END PUBLIC KEY-----

helmConfig:
repository: "https://validator-labs.github.io"

# Validation plugin charts
plugins:
8 changes: 3 additions & 5 deletions hack/update-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ function addChartValues {

# Append the plugin's values to chart/validator/values.yaml
cat <<EOF >> chart/validator/values.yaml
- chart:
name: $1
repository: "https://validator-labs.github.io/$1"
version: v$2
- name: $1
version: v$2
values: |-
$indentedValues
EOF
Expand Down Expand Up @@ -65,4 +63,4 @@ versions["oci"]=$OCI_VERSION
versions["vsphere"]=$VSPHERE_VERSION

updateHaulerManifest
updateValues
updateValues
Loading