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

istioctl: fix install with pilot volumes/volumeMounts/extraContainerArgs #51818

Closed
wants to merge 3 commits into from

Conversation

zirain
Copy link
Member

@zirain zirain commented Jul 1, 2024

Please provide a description of this PR:

Introduce in #45517, fix following errors:

Error: validation errors (use --force to override): 
bad StructValue: json: cannot unmarshal string into Go value of type map[string]json.RawMessage

Error: validation errors (use --force to override): 
unknown field "secret" in k8s.io.api.core.v1.Volume

@zirain zirain added cherrypick/release-1.21 Set this label on a PR to auto-merge it to the release-1.21 branch cherrypick/release-1.22 Set this label on a PR to auto-merge it to the release-1.22 branch labels Jul 1, 2024
@zirain zirain requested a review from a team as a code owner July 1, 2024 02:44
@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 1, 2024
@zirain
Copy link
Member Author

zirain commented Jul 1, 2024

/retest

env:
ENABLE_CA_SERVER: false
extraContainerArgs:
- --tlsCertFile=/etc/cert-manager/tls/tls.crt
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to not use the build-in defaults ( by mounting the volume in the expected location ) ?

The '/var/run/secret' is preferred for consistency and because (some) tools know to skip it.

- --tlsKeyFile=/etc/cert-manager/tls/tls.key
- --caCertFile=/etc/cert-manager/ca/root-cert.pem
volumeMounts:
- name: cert-manager
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't the base chart already have the volumes for this (with optional mount) ?

I'm confused on what is the purpose for this file - nothing should need to be configured if the defaults are used.

Copy link
Contributor

@costinm costinm left a comment

Choose a reason for hiding this comment

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

Fixing istioctl to allow volumes is ok - but please don't test or use the 'mounted' certs as an example.

For args - the majority of config is via env variables, which are well supported - it would be much better to fix the few remaining flags and stop having 3 ways to configure Istiod ( mesh config is the other). And really we mainly use env variables and CLI options as a way to introduce de-facto APIs but avoid the API design/UX/review ( because changes to MeshConfig and the api/ repo typically are strictly reviewed and require TOC approvals ).

@zirain
Copy link
Member Author

zirain commented Jul 2, 2024

@costinm the main purpose of this PR is make istioctl can work with cert-manager istio-csr, helm will work after #45517.

without this, we need something like:

apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
  name: cert-manager-integration
  namespace: istio-system
spec:
  values:
    global:
      caAddress: cert-manager-istio-csr.cert-manager.svc:443
  components:
    pilot:
      k8s:
        env:
          # Disable istiod CA Sever functionality
          - name: ENABLE_CA_SERVER
            value: "false"
        overlays:
          - apiVersion: apps/v1
            kind: Deployment
            name: istiod
            patches:
              # Mount istiod serving and webhook certificate from Secret mount
              - path: spec.template.spec.containers.[name:discovery].args[7]
                value: "--tlsCertFile=/etc/cert-manager/tls/tls.crt"
              - path: spec.template.spec.containers.[name:discovery].args[8]
                value: "--tlsKeyFile=/etc/cert-manager/tls/tls.key"
              - path: spec.template.spec.containers.[name:discovery].args[9]
                value: "--caCertFile=/etc/cert-manager/ca/root-cert.pem"
              - path: spec.template.spec.containers.[name:discovery].volumeMounts[6]
                value:
                  name: cert-manager
                  mountPath: "/etc/cert-manager/tls"
                  readOnly: true
              - path: spec.template.spec.containers.[name:discovery].volumeMounts[7]
                value:
                  name: ca-root-cert
                  mountPath: "/etc/cert-manager/ca"
                  readOnly: true
              - path: spec.template.spec.volumes[6]
                value:
                  name: cert-manager
                  secret:
                    secretName: istiod-tls
              - path: spec.template.spec.volumes[7]
                value:
                  name: ca-root-cert
                  configMap:
                    defaultMode: 420
                    name: istio-ca-root-cert

cert-manager/istio-csr#113

@costinm
Copy link
Contributor

costinm commented Jul 2, 2024 via email

@costinm
Copy link
Contributor

costinm commented Jul 2, 2024 via email

@zirain
Copy link
Member Author

zirain commented Jul 2, 2024

I don't get it: the template already has - name: istio-csr-dns-cert secret: secretName: istiod-tls optional: true # If this config map is present in istio-system - this will be used for mesh cert # verification and distributed in namespaces. - name: istio-csr-ca-configmap configMap: name: istio-ca-root-cert defaultMode: 420 optional: true and the CLI parameters have default values that correspond to the mounts. Why would you want to mount with different volume mounts and paths - when the out-of-box install just works ?

On Mon, Jul 1, 2024 at 5:11 PM zirain @.> wrote: @costinm https://github.com/costinm the main purpose of this PR is make istioctl can work with cert-manager istio-csr, helm will work after #45517 <#45517>. without this, we need something like: apiVersion: install.istio.io/v1alpha1 kind: IstioOperator metadata: name: cert-manager-integration namespace: istio-system spec: values: global: caAddress: cert-manager-istio-csr.cert-manager.svc:443 components: pilot: k8s: env: # Disable istiod CA Sever functionality - name: ENABLE_CA_SERVER value: "false" overlays: - apiVersion: apps/v1 kind: Deployment name: istiod patches: # Mount istiod serving and webhook certificate from Secret mount - path: spec.template.spec.containers.[name:discovery].args[7] value: "--tlsCertFile=/etc/cert-manager/tls/tls.crt" - path: spec.template.spec.containers.[name:discovery].args[8] value: "--tlsKeyFile=/etc/cert-manager/tls/tls.key" - path: spec.template.spec.containers.[name:discovery].args[9] value: "--caCertFile=/etc/cert-manager/ca/root-cert.pem" - path: spec.template.spec.containers.[name:discovery].volumeMounts[6] value: name: cert-manager mountPath: "/etc/cert-manager/tls" readOnly: true - path: spec.template.spec.containers.[name:discovery].volumeMounts[7] value: name: ca-root-cert mountPath: "/etc/cert-manager/ca" readOnly: true - path: spec.template.spec.volumes[6] value: name: cert-manager secret: secretName: istiod-tls - path: spec.template.spec.volumes[7] value: name: ca-root-cert configMap: defaultMode: 420 name: istio-ca-root-cert cert-manager/istio-csr#113 <cert-manager/istio-csr#113> — Reply to this email directly, view it on GitHub <#51818 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAUR2SQSZKHOZLVWXHGXJLZKHV4BAVCNFSM6AAAAABKEVQOT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBRGUYDEOJZGU . You are receiving this because you were mentioned.Message ID: @.>

Thanks for point out, I didn't notice that, I should be following an out-of-date document.

@zirain
Copy link
Member Author

zirain commented Jul 2, 2024

If anything is broken with the default template - and the file paths - we can fix the actual template, so neither Helm nor Istioctl will need any special options. User only has to create the Secret and ConfigMap with the names that are currently specified in the chart - I don't see anything completely unacceptable on how they are named or the default locations - I understand others may have different naming preferences, but the PR has been reviewed and approved and the author gets to set the names they like...

On Mon, Jul 1, 2024 at 6:50 PM Costin Manolache @.> wrote: I don't get it: the template already has - name: istio-csr-dns-cert secret: secretName: istiod-tls optional: true # If this config map is present in istio-system - this will be used for mesh cert # verification and distributed in namespaces. - name: istio-csr-ca-configmap configMap: name: istio-ca-root-cert defaultMode: 420 optional: true and the CLI parameters have default values that correspond to the mounts. Why would you want to mount with different volume mounts and paths - when the out-of-box install just works ? On Mon, Jul 1, 2024 at 5:11 PM zirain @.> wrote: > @costinm https://github.com/costinm the main purpose of this PR is > make istioctl can work with cert-manager istio-csr, helm will work after > #45517 <#45517>. > > without this, we need something like: > > apiVersion: install.istio.io/v1alpha1 > kind: IstioOperator > metadata: > name: cert-manager-integration > namespace: istio-system > spec: > values: > global: > caAddress: cert-manager-istio-csr.cert-manager.svc:443 > components: > pilot: > k8s: > env: > # Disable istiod CA Sever functionality > - name: ENABLE_CA_SERVER > value: "false" > overlays: > - apiVersion: apps/v1 > kind: Deployment > name: istiod > patches: > # Mount istiod serving and webhook certificate from Secret mount > - path: spec.template.spec.containers.[name:discovery].args[7] > value: "--tlsCertFile=/etc/cert-manager/tls/tls.crt" > - path: spec.template.spec.containers.[name:discovery].args[8] > value: "--tlsKeyFile=/etc/cert-manager/tls/tls.key" > - path: spec.template.spec.containers.[name:discovery].args[9] > value: "--caCertFile=/etc/cert-manager/ca/root-cert.pem" > - path: spec.template.spec.containers.[name:discovery].volumeMounts[6] > value: > name: cert-manager > mountPath: "/etc/cert-manager/tls" > readOnly: true > - path: spec.template.spec.containers.[name:discovery].volumeMounts[7] > value: > name: ca-root-cert > mountPath: "/etc/cert-manager/ca" > readOnly: true > - path: spec.template.spec.volumes[6] > value: > name: cert-manager > secret: > secretName: istiod-tls > - path: spec.template.spec.volumes[7] > value: > name: ca-root-cert > configMap: > defaultMode: 420 > name: istio-ca-root-cert > > cert-manager/istio-csr#113 > <cert-manager/istio-csr#113> > > — > Reply to this email directly, view it on GitHub > <#51818 (comment)>, or > unsubscribe > https://github.com/notifications/unsubscribe-auth/AAAUR2SQSZKHOZLVWXHGXJLZKHV4BAVCNFSM6AAAAABKEVQOT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBRGUYDEOJZGU > . > You are receiving this because you were mentioned.Message ID: > @.***> >

do we need to make istioctl not report the issue like following:

Error: validation errors (use --force to override): 
bad StructValue: json: cannot unmarshal string into Go value of type map[string]json.RawMessage

Error: validation errors (use --force to override): 
unknown field "secret" in k8s.io.api.core.v1.Volume

those are supported by helm, but not working with istioctl, maybe istio-cser isn't an good example.

@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label Jul 10, 2024
@istio-testing
Copy link
Collaborator

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@zirain zirain closed this Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/environments cherrypick/release-1.21 Set this label on a PR to auto-merge it to the release-1.21 branch cherrypick/release-1.22 Set this label on a PR to auto-merge it to the release-1.22 branch needs-rebase Indicates a PR needs to be rebased before being merged size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants