Giter VIP home page Giter VIP logo

paasta-tools-go's Introduction

paasta-tools-go

Go library for interacting with PaaSTA

Troubleshooting

How to clone

The project must be clonned via https as it is required to perform SSO, this means no push via ssh would work.

Private libraries

You may need to export the following env variable

export GOPRIVATE=*github.yelpcorp.com

otherwise doing go mod tidy will have problems finding the monk library.

paasta-tools-go's People

Contributors

bronek avatar rob-johnson avatar vkhromov avatar mattmb avatar jvperrin avatar waziqi89 avatar wilmer05 avatar kawaiwanyelp avatar kovrus avatar qui avatar baisang avatar nemacysts avatar nleigh avatar evankrall avatar rohangulati avatar tzhu-yelp avatar ashishkhatkar avatar chlgit avatar ronin13 avatar

Stargazers

Giovanni Delgado avatar GAURAV avatar Cqshinn avatar Kyle Cascade avatar Marius Karnauskas avatar

Watchers

Tomas Doran avatar James Cloos avatar  avatar Brian Trump avatar  avatar

paasta-tools-go's Issues

SetKubernetesObjectHash doesn't update hash if already set

(making a github issue since I'm too lazy to get my work laptop and make a normal ticket for now)

If we update the test to SetKubernetesObjectHash to try and set the hash again of an object (maybe after it is mutated, or something) like so:

index 1e1b4a8..c5c2908 100644
--- a/pkg/hashing/hashing_test.go
+++ b/pkg/hashing/hashing_test.go
@@ -154,6 +154,15 @@ func TestSetKubernetesObjectHash(t *testing.T) {
        assert.NotEqual(t, someStatefulSet.Spec.Template.ObjectMeta.Labels["yelp.com/operator_config_hash"], "abc1234")
        // but the existing labels are
        assert.Equal(t, someStatefulSet.Spec.Selector.MatchLabels["yelp.com/rick"], "andmortyadventures")
+
+       // Now let's try updating the object with a new hash
+       err = SetKubernetesObjectHash("def5678", someStatefulSet)
+       if err != nil {
+               t.Errorf("Failed to add label")
+       }
+       // the new label and existing label are present in ObjectMeta
+       assert.Equal(t, someStatefulSet.ObjectMeta.Labels["yelp.com/operator_config_hash"], "def5678")
+       assert.Equal(t, someStatefulSet.ObjectMeta.Labels["yelp.com/rick"], "andmortyadventures")
 }

We get the following error:

--- FAIL: TestSetKubernetesObjectHash (0.00s)
    hashing_test.go:164: 
        	Error Trace:	hashing_test.go:164
        	Error:      	Not equal: 
        	            	expected: "abc1234"
        	            	actual  : "def5678"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1 +1 @@
        	            	-abc1234
        	            	+def5678
        	Test:       	TestSetKubernetesObjectHash

I think it's because the hash label already exists on the old object, so we are overwriting the new hash label in labelsToAdd within this loop

                        for _, k := range labels.MapKeys() {
				v := labels.MapIndex(k)
				labelsToAdd[k.Interface().(string)] = v.Interface().(string)
			}
			labels.Set(reflect.ValueOf(labelsToAdd))

https://github.com/Yelp/paasta-tools-go/blob/master/pkg/hashing/hashing.go#L70

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.