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

Fix mysql provider config spec.tls kubebuilder validation enum #138

Conversation

alereca
Copy link
Contributor

@alereca alereca commented Mar 15, 2023

Description of your changes

Fixes #137

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Since the current unit tests do not setup a webhook server it kinda hard to add an automatic test for this.
Tested manually with kubectl and a local kind k8s cluster

apiVersion: mysql.sql.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
  name: default
spec:
  credentials:
    source: MySQLConnectionSecret
    connectionSecretRef:
      namespace: default
      name: db-conn
  # tls one of preferred(default), skip-verify, or true
  tls: true
> kubectl apply -f /home/alejandro/Documents/operators/crossplane/provider-sql/examples/mysql/config.yaml
The ProviderConfig "default2" is invalid: 
* spec.tls: Invalid value: "boolean": spec.tls in body must be of type string: "boolean"
* spec.tls: Unsupported value: true: supported values: "true", "skip-verify", "preferred"
apiVersion: mysql.sql.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
  name: default
spec:
  credentials:
    source: MySQLConnectionSecret
    connectionSecretRef:
      namespace: default
      name: db-conn
  # tls one of preferred(default), skip-verify, or true
  tls: "true"
kubectl apply -f /home/alejandro/Documents/operators/crossplane/provider-sql/examples/mysql/config.yaml
providerconfig.mysql.sql.crossplane.io/default2 created

Copy link
Member

@Duologic Duologic left a comment

Choose a reason for hiding this comment

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

❤️ YAML

@Duologic Duologic merged commit bd9cd6f into crossplane-contrib:master Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting Mysql ProviderConfig spec.tls as true is always rejected by enum validation
2 participants