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

Indent values.yaml using 2 instead of 4 spaces #9656

Merged
merged 2 commits into from
Mar 9, 2023
Merged

Indent values.yaml using 2 instead of 4 spaces #9656

merged 2 commits into from
Mar 9, 2023

Conversation

Joibel
Copy link
Contributor

@Joibel Joibel commented Feb 20, 2023

What this PR does / why we need it:

This is much more conventional, and how it was here until commit 80fd69e which didn't appear to intentionally change this. Fixes #9655

Types of changes

  • [ x ] Bug fix (non-breaking change which fixes an issue)

Mostly just convention and standards

Which issue/s this PR fixes

fixes #9655

How Has This Been Tested?

The yaml is functionally identical.
See commentary for more testing - deployment is successful and resulting values.yaml is identical barring whitespace.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have added unit and/or e2e tests to cover my changes.
  • All new and existing tests passed.
  • Added Release Notes.
    None required

Does my pull request need a release note?

Layout of values.yaml reverted to 2 spaces instead of 4

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 20, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: Joibel / name: Alan Clucas (091609c26ed2709b49a7a263dd40d5c7998930fd)

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 20, 2023
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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/test-infra repository.

@k8s-ci-robot
Copy link
Contributor

Welcome @Joibel!

It looks like this is your first PR to kubernetes/ingress-nginx 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/ingress-nginx has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the area/helm Issues or PRs related to helm charts label Feb 20, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @Joibel. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Feb 20, 2023
@k8s-ci-robot k8s-ci-robot requested a review from cpanato February 20, 2023 11:52
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 20, 2023
@longwuyuan
Copy link
Contributor

@Joibel thanks for the contribution.

Can you kindly check if you have empty lines in your fork/clone or is that a github view problem.

@Joibel
Copy link
Contributor Author

Joibel commented Feb 20, 2023

I believe it is github finding some lines that it can match up (even though they shouldn't in this case) which actually come from a very different part of the file. Try viewing the diff in a different viewer.
git diff HEAD~ -b shows there are no non-whitespace changes.

@longwuyuan
Copy link
Contributor

longwuyuan commented Feb 21, 2023 via email

@tao12345666333
Copy link
Member

/assign
/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 21, 2023
@Joibel
Copy link
Contributor Author

Joibel commented Feb 21, 2023

Install log:

$ helm install ingress-nginx .
NAME: ingress-nginx
LAST DEPLOYED: Tue Feb 21 08:44:14 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The ingress-nginx controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running 'kubectl --namespace default get services -o wide -w ingress-nginx-controller'

An example Ingress that makes use of the controller:
  apiVersion: networking.k8s.io/v1
  kind: Ingress
  metadata:
    name: example
    namespace: foo
  spec:
    ingressClassName: nginx
    rules:
      - host: www.example.com
        http:
          paths:
            - pathType: Prefix
              backend:
                service:
                  name: exampleService
                  port:
                    number: 80
              path: /
    # This section is only required if TLS is to be enabled for the Ingress
    tls:
      - hosts:
        - www.example.com
        secretName: example-tls

If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided:

  apiVersion: v1
  kind: Secret
  metadata:
    name: example-tls
    namespace: foo
  data:
    tls.crt: <base64 encoded cert>
    tls.key: <base64 encoded key>
  type: kubernetes.io/tls

Logs from the controller:

-------------------------------------------------------------------------------                                                                                                                                                        
NGINX Ingress controller                                                                                                                                                                                                               
  Release:       v1.6.4                                                                                                                                                                                                                
  Build:         69e8833858fb6bda12a44990f1d5eaa7b13f4b75                                                                                                                                                                              
  Repository:    https://github.com/kubernetes/ingress-nginx                                                                                                                                                                           
  nginx version: nginx/1.21.6                                                                                                                                                                                                          
                                                                                                                                                                                                                                       
-------------------------------------------------------------------------------                                                                                                                                                        
                                                                                                                                                                                                                                       
W0221 08:44:19.902159       7 client_config.go:618] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.                                                                                 
I0221 08:44:19.902232       7 main.go:209] "Creating API client" host="https://10.96.0.1:443"                                                                                                                                          
I0221 08:44:19.904964       7 main.go:253] "Running in Kubernetes cluster" major="1" minor="25" git="v1.25.3" state="clean" commit="434bfd82814af038ad94d62ebe59b133fcb50506" platform="linux/amd64"                                   
I0221 08:44:20.019883       7 main.go:104] "SSL fake certificate created" file="/etc/ingress-controller/ssl/default-fake-certificate.pem"                                                                                              
I0221 08:44:20.043227       7 ssl.go:533] "loading tls certificate" path="/usr/local/certificates/cert" key="/usr/local/certificates/key"                                                                                              
I0221 08:44:20.049265       7 nginx.go:261] "Starting NGINX Ingress controller"                                                                                                                                                        
I0221 08:44:20.051048       7 event.go:285] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"default", Name:"ingress-nginx-controller", UID:"d0221fa5-bd63-4114-8f40-7e02ce266b70", APIVersion:"v1", ResourceVersion:"891", FieldP
ath:""}): type: 'Normal' reason: 'CREATE' ConfigMap default/ingress-nginx-controller                                                                                                                                                   
I0221 08:44:21.250961       7 nginx.go:304] "Starting NGINX process"                                                                                                                                                                   
I0221 08:44:21.251123       7 leaderelection.go:248] attempting to acquire leader lease default/ingress-nginx-leader...                                                                                                                
I0221 08:44:21.252026       7 nginx.go:324] "Starting validation webhook" address=":8443" certPath="/usr/local/certificates/cert" keyPath="/usr/local/certificates/key"                                                                
I0221 08:44:21.252322       7 controller.go:188] "Configuration changes detected, backend reload required"                                                                                                                             
I0221 08:44:21.254973       7 status.go:84] "New leader elected" identity="ingress-nginx-controller-6b94c75599-x6684"                                                                                                                  
I0221 08:44:21.301226       7 controller.go:205] "Backend successfully reloaded"                                                                                                                                                       
I0221 08:44:21.301271       7 controller.go:216] "Initial sync, sleeping for 1 second"                                                                                                                                                 
I0221 08:44:21.301320       7 event.go:285] Event(v1.ObjectReference{Kind:"Pod", Namespace:"default", Name:"ingress-nginx-controller-6b94c75599-7sjjf", UID:"01b24ded-6efa-479a-8edf-3f7720d1d359", APIVersion:"v1", ResourceVersion:"9
20", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration                                                                                                                           
I0221 08:45:03.409951       7 leaderelection.go:258] successfully acquired lease default/ingress-nginx-leader                                                                                                                          
I0221 08:45:03.409989       7 status.go:84] "New leader elected" identity="ingress-nginx-controller-6b94c75599-7sjjf"                                                                                                                  
172.17.0.1 - - [21/Feb/2023:08:51:04 +0000] "GET / HTTP/1.1" 400 248 "-" "Mozilla/5.0 (Windows NT 10.0; rv:110.0) Gecko/20100101 Firefox/110.0" 338 0.000 [] [] - - - - 8e994b1b2ed5599918dff172c971c487                               
172.17.0.1 - - [21/Feb/2023:08:51:04 +0000] "GET /favicon.ico HTTP/1.1" 400 248 "http://10.111.41.179:443/" "Mozilla/5.0 (Windows NT 10.0; rv:110.0) Gecko/20100101 Firefox/110.0" 295 0.000 [] [] - - - - 975c1704f9947ad2f7c79d1af3bd
cfa9

This was a curl to the ingress port.

$ curl -k https://10.111.41.179/
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

Tests performed on minikube with minikube tunnel

Another test was:

$ helm template ingress-nginx . > new.txt
$ git checkout HEAD~
$ helm template ingress-nginx . > old.txt
$ diff new.txt old.txt

Showing no differences

@tao12345666333
Copy link
Member

Thanks for your contributions.

In fact, this file is currently automatically generated by the program, so directly modifying this file cannot really solve the problem.

func updateChartValue(key, value string) {
Info("HELM Updating Chart %s %s:%s", HelmChartValues, key, value)
//read current values.yaml
data, err := os.ReadFile(HelmChartValues)
CheckIfError(err, "HELM Could not Load Helm Chart Values files %s", HelmChartValues)
//var valuesStruct IngressChartValue
var n yaml.Node
CheckIfError(yaml.Unmarshal(data, &n), "HELM Could not Unmarshal %s", HelmChartValues)
//update value
//keyParse := parsePath(key)
p, err := yamlpath.NewPath(key)
CheckIfError(err, "HELM cannot create path")
q, err := p.Find(&n)
CheckIfError(err, "HELM unexpected error finding path")
for _, i := range q {
Info("HELM Found %s at %s", i.Value, key)
i.Value = value
Info("HELM Updated %s at %s", i.Value, key)
}
//// write to file
newValueFile, err := yaml.Marshal(&n)
CheckIfError(err, "HELM Could not Marshal new Values file")
err = os.WriteFile(HelmChartValues, newValueFile, 0644)
CheckIfError(err, "HELM Could not write new Values file to %s", HelmChartValues)
Info("HELM Ingress Nginx Helm Chart update %s %s", key, value)
}

@Joibel
Copy link
Contributor Author

Joibel commented Feb 21, 2023

In fact, this file is currently automatically generated by the program, so directly modifying this file cannot really solve the problem.

Ok, I've changed the PR to generate values with an indentation of 2. I've left in the modified values.yaml, but can remove it if preferred. It is what will now get generated anyway, so it either happens in this PR or the next release, and the next release seemed more 'surprising', so I left it in.

@strongjz
Copy link
Member

@Joibel Let's remove the values.yaml update, it won't get pushed since were not releasing a new chart; on the next release, with the update to the mage code, it will get updated; thanks for the contribution.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 22, 2023
@Joibel
Copy link
Contributor Author

Joibel commented Feb 22, 2023

@Joibel Let's remove the values.yaml update, it won't get pushed since were not releasing a new chart; on the next release, with the update to the mage code, it will get updated; thanks for the contribution.

Done.

magefiles/helm.go Outdated Show resolved Hide resolved
magefiles/helm.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 27, 2023
@tao12345666333
Copy link
Member

/retest

Copy link
Member

@tao12345666333 tao12345666333 left a comment

Choose a reason for hiding this comment

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

/ok-to-test
/lgtm

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 7, 2023
@tao12345666333
Copy link
Member

/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Mar 7, 2023
@tao12345666333
Copy link
Member

I will re-run all CI jobs.

@Joibel Joibel requested review from tao12345666333 and removed request for cpanato and ChiefAlexander March 7, 2023 09:00
Copy link
Member

@tao12345666333 tao12345666333 left a comment

Choose a reason for hiding this comment

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

all tests passed.

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 9, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Joibel, tao12345666333

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 4f74e03 into kubernetes:main Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/helm Issues or PRs related to helm charts cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

values.yaml controller config double-indented
6 participants