openshift / osdctl Goto Github PK
View Code? Open in Web Editor NEWCLI for the OSD utilities
License: Apache License 2.0
CLI for the OSD utilities
License: Apache License 2.0
Currently we're looking for IamUserName but really we need to pass in the account CR name: https://github.com/openshift/osd-utils-cli/blob/master/cmd/account/rotate-secret.go#L29
When submitting a serviceLog, only the clusterUUID is provided. This results in the possibility of receiving a 403 from OCM for some users when the cluster with the given clusterUUID has not completed installation successfully. Including the clusterID and subscriptionID in the POST request will ensure that the authz mechanism can find the subscription/cluster record for the matching clusterUUID even if metrics have never been sent by the cluster.
See https://github.com/openshift/osdctl/blob/master/cmd/servicelog/post.go#L333
The service log post operation already lists the cluster record and already has access to both the clusterID and the subscriptionID from the cluster record: https://github.com/openshift/osdctl/blob/master/cmd/servicelog/list.go#L38
Tests in osdctl should be refactored to not require a running kubernetes cluster for unit tests to run, and should instead require a mock of the same.
version
$ osdctl version
{
"commit": "bf7b850211724ee5bee23934bb665819b568bcc3",
"version": "0.14.0",
"latest": "0.14.0"
}
cost get
working as expected
$ osdctl cost get -p rhcontrol --ou ou-jtfp-qqvby1mp -t 3M
OuId: ou-jtfp-qqvby1mp
OuName: 1OXqyqko0vmxpV9dmXe9oFypJIw
Cost: 713015.3138919932
cost list
not working as expected
$ osdctl cost list -p rhcontrol --ou ou-jtfp-qqvby1mp -t 3M
OuId: ou-jtfp-qqvby1mp
OuName: 1OXqyqko0vmxpV9dmXe9oFypJIw
Cost: 0
cc @cattias
Currently I tried to run #189 and found that it was conplex for me to add the ocm client in.
I would like that the
a, err:= aws.NewAwsClient()
if err !=nil {
return err
}
It's important that the func won't require any args as this will make pulling the client much faster
Cobra has a builtin markdown generation feature. Here we are just using doc.GenMarkdownTree
, but the problem is that the generated documents have a date part https://github.com/openshift/osd-utils-cli/blob/master/docs/command/osd-utils-cli_set.md#auto-generated-by-spf13cobra-on-17-jun-2020.
This is not very friendly for CI and new PRs. Maybe we can investigate a way to customize the document output using https://github.com/spf13/cobra/blob/master/doc/md_docs.md#customize-the-output
As the Arm architecture becomes more prevalent there is a need to run the binaries on Linux currently there are only x86_64 builds available.
after running go-get inside a container I get:
$ go install github.com/openshift/osd-utils-cli
/root/go/src/k8s.io/cli-runtime/pkg/kustomize/builder.go:23:2: cannot find package "sigs.k8s.io/kustomize/pkg/commands/build" in any of:
/usr/lib/golang/src/sigs.k8s.io/kustomize/pkg/commands/build (from $GOROOT)
/root/go/src/sigs.k8s.io/kustomize/pkg/commands/build (from $GOPATH)
/root/go/src/k8s.io/cli-runtime/pkg/kustomize/k8sdeps/factory.go:24:2: cannot find package "sigs.k8s.io/kustomize/pkg/factory" in any of:
/usr/lib/golang/src/sigs.k8s.io/kustomize/pkg/factory (from $GOROOT)
/root/go/src/sigs.k8s.io/kustomize/pkg/factory (from $GOPATH)
/root/go/src/k8s.io/cli-runtime/pkg/kustomize/builder.go:24:2: cannot find package "sigs.k8s.io/kustomize/pkg/fs" in any of:
/usr/lib/golang/src/sigs.k8s.io/kustomize/pkg/fs (from $GOROOT)
/root/go/src/sigs.k8s.io/kustomize/pkg/fs (from $GOPATH)
/root/go/src/k8s.io/cli-runtime/pkg/kustomize/k8sdeps/kunstruct/kunstruct.go:27:2: cannot find package "sigs.k8s.io/kustomize/pkg/gvk" in any of:
/usr/lib/golang/src/sigs.k8s.io/kustomize/pkg/gvk (from $GOROOT)
/root/go/src/sigs.k8s.io/kustomize/pkg/gvk (from $GOPATH)
/root/go/src/k8s.io/cli-runtime/pkg/kustomize/k8sdeps/configmapandsecret/configmapfactory.go:29:2: cannot find package "sigs.k8s.io/kustomize/pkg/ifc" in any of:
/usr/lib/golang/src/sigs.k8s.io/kustomize/pkg/ifc (from $GOROOT)
/root/go/src/sigs.k8s.io/kustomize/pkg/ifc (from $GOPATH)
/root/go/src/k8s.io/cli-runtime/pkg/kustomize/k8sdeps/transformer/hash/namehash.go:22:2: cannot find package "sigs.k8s.io/kustomize/pkg/resmap" in any of:
/usr/lib/golang/src/sigs.k8s.io/kustomize/pkg/resmap (from $GOROOT)
/root/go/src/sigs.k8s.io/kustomize/pkg/resmap (from $GOPATH)
/root/go/src/k8s.io/cli-runtime/pkg/kustomize/k8sdeps/transformer/patch/patch.go:30:2: cannot find package "sigs.k8s.io/kustomize/pkg/resource" in any of:
/usr/lib/golang/src/sigs.k8s.io/kustomize/pkg/resource (from $GOROOT)
/root/go/src/sigs.k8s.io/kustomize/pkg/resource (from $GOPATH)
/root/go/src/k8s.io/cli-runtime/pkg/kustomize/k8sdeps/transformer/hash/namehash.go:23:2: cannot find package "sigs.k8s.io/kustomize/pkg/transformers" in any of:
/usr/lib/golang/src/sigs.k8s.io/kustomize/pkg/transformers (from $GOROOT)
/root/go/src/sigs.k8s.io/kustomize/pkg/transformers (from $GOPATH)
/root/go/src/k8s.io/cli-runtime/pkg/kustomize/k8sdeps/configmapandsecret/configmapfactory.go:30:2: cannot find package "sigs.k8s.io/kustomize/pkg/types" in any of:
/usr/lib/golang/src/sigs.k8s.io/kustomize/pkg/types (from $GOROOT)
/root/go/src/sigs.k8s.io/kustomize/pkg/types (from $GOPATH)
can this be addressed to allow installing the util easily?
also inside the same container running this gave another error:
$ cd /root/go/src/github.com/openshift/osd-utils-cli/
$ make build
go mod tidy
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go mod tidy
go: github.com/openshift/[email protected]+incompatible: invalid pseudo-version: preceding tag (v3.9.0) not found
go version
go version go1.14.6 linux/amd64
and
$ find /root/go/src/ -name .git | sed 's|/.git||'
/root/go/src/golang.org/x/sys
/root/go/src/golang.org/x/crypto
/root/go/src/golang.org/x/oauth2
/root/go/src/golang.org/x/net
/root/go/src/golang.org/x/text
/root/go/src/golang.org/x/time
/root/go/src/google.golang.org/protobuf
/root/go/src/gopkg.in/yaml.v2
/root/go/src/gopkg.in/AlecAivazis/survey.v1
/root/go/src/gopkg.in/inf.v0
/root/go/src/gopkg.in/yaml.v3
/root/go/src/k8s.io/apimachinery
/root/go/src/k8s.io/utils
/root/go/src/k8s.io/kubectl
/root/go/src/k8s.io/api
/root/go/src/k8s.io/component-base
/root/go/src/k8s.io/kube-openapi
/root/go/src/k8s.io/client-go
/root/go/src/k8s.io/klog
/root/go/src/k8s.io/cli-runtime
/root/go/src/gitlab.com/c0b/go-ordered-json
/root/go/src/github.com/json-iterator/go
/root/go/src/github.com/openshift-online/ocm-sdk-go
/root/go/src/github.com/openshift-online/ocm-cli
/root/go/src/github.com/modern-go/reflect2
/root/go/src/github.com/modern-go/concurrent
/root/go/src/github.com/beorn7/perks
/root/go/src/github.com/cpuguy83/go-md2man
/root/go/src/github.com/pkg/browser
/root/go/src/github.com/pkg/errors
/root/go/src/github.com/golang/protobuf
/root/go/src/github.com/golang/glog
/root/go/src/github.com/dgrijalva/jwt-go
/root/go/src/github.com/cenkalti/backoff
/root/go/src/github.com/cespare/xxhash
/root/go/src/github.com/zgalor/weberr
/root/go/src/github.com/prometheus/common
/root/go/src/github.com/prometheus/procfs
/root/go/src/github.com/prometheus/client_golang
/root/go/src/github.com/prometheus/client_model
/root/go/src/github.com/jmespath/go-jmespath
/root/go/src/github.com/aws/aws-sdk-go
/root/go/src/github.com/spf13/cobra
/root/go/src/github.com/spf13/pflag
/root/go/src/github.com/openshift/moactl
/root/go/src/github.com/openshift/api
/root/go/src/github.com/openshift/hive
/root/go/src/github.com/openshift/aws-account-operator
/root/go/src/github.com/openshift/osd-utils-cli
/root/go/src/github.com/AlecAivazis/survey
/root/go/src/github.com/grokify/html-strip-tags-go
/root/go/src/github.com/mitchellh/go-homedir
/root/go/src/github.com/mitchellh/go-wordwrap
/root/go/src/github.com/matttproud/golang_protobuf_extensions
/root/go/src/github.com/sirupsen/logrus
/root/go/src/github.com/dustin/go-humanize
/root/go/src/github.com/PuerkitoBio/purell
/root/go/src/github.com/PuerkitoBio/urlesc
/root/go/src/github.com/gogo/protobuf
/root/go/src/github.com/gregjones/httpcache
/root/go/src/github.com/liggitt/tabwriter
/root/go/src/github.com/peterbourgon/diskv
/root/go/src/github.com/go-logr/logr
/root/go/src/github.com/russross/blackfriday
/root/go/src/github.com/imdario/mergo
/root/go/src/github.com/deckarep/golang-set
/root/go/src/github.com/googleapis/gnostic
/root/go/src/github.com/MakeNowJust/heredoc
/root/go/src/github.com/evanphx/json-patch
/root/go/src/github.com/davecgh/go-spew
/root/go/src/github.com/google/btree
/root/go/src/github.com/google/gofuzz
/root/go/src/github.com/exponent-io/jsonpath
/root/go/src/github.com/josharian/intern
/root/go/src/github.com/moby/term
/root/go/src/github.com/mailru/easyjson
/root/go/src/github.com/docker/spdystream
/root/go/src/github.com/go-openapi/jsonpointer
/root/go/src/github.com/go-openapi/jsonreference
/root/go/src/github.com/go-openapi/spec
/root/go/src/github.com/go-openapi/swag
/root/go/src/sigs.k8s.io/kustomize
/root/go/src/sigs.k8s.io/controller-runtime
/root/go/src/sigs.k8s.io/yaml
/root/go/src/sigs.k8s.io/structured-merge-diff
There are changes happening that make it not great if people aren't using the more recent versions.
Not sure how to go about implementing it, though. One idea: if the version release timestamp is older than N months (2? 3?) have it check the github repo for newer releases (every N runs?) and write a warning mentioning it.
I'm using osdctl to access account console using -r option, however it's always defaulting to us-east-1
This is getting set in https://github.com/openshift/osdctl/blob/master/pkg/k8s/clusterresourcefactory.go#L155 it should really be respecting the -r option
master branch is frozen for merges until Friday Jan-06-2023 @ 14:00 UTC
I've always had this problem with osdsh/osdctl:
$ osdctl -s 'test'
test
$ osdctl -s 'sermão'
serm
$ osdctl -s 'fácil'
f
$ osdctl -s 'ótimo'
[empty]
So the output always dies off at the accented character and nothing else after it is printed.
(Obviously, the output is displayed as on screen text, not in terminal output.)
I have a Tcl script sending text to osdctl and I can convert the text to other encodings before sending it to osdctl. But none of the encodings work. The output is exactly the same unless I convert the text to ascii, in which case osdctl displays each accented character as '?' instead of printing incomplete output.
There is no mention of encodings in either manual and a google search didn't help either.
Can you please provide some information on that? Is there any encoding that osdsh/osdctl will understand and comply with?
The output of osdctl account get xxx -o yaml
is not correct. We can use the genericcli library to print out yaml and json files.
Internal servicelog posting would be made easier if all I had to remember was -i
(for --internal
) and the tool would guide me from there.
What I mean is – instead of telling me ${MESSAGE}
is missing, it could ask me to type the message. Or better yet, run $EDITOR
like git commit
does?
When scanning through the list of open cards for a given cluster, card creation and resolution dates would allow me to make better calls on whether it makes sense to click them.
The url generated looks like this:
The AWS Console URL is:
https://signin.aws.amazon.com/federation?Action=login&Destination=https%3A%2F%2Fconsole.aws.amazon.com%2F&Issuer=Red+Hat+SRE&SigninToken=
My quick testing shows that if you modify the Destination
to point to https://$REGION.console.aws.amazon.com
that logs directly into the desired region.
If somebody could confirm that's indeed the case, then this should be a 5 lines patch.
This in turn breaks our internal scripts (chgm and provdelay).
Update:
osdctl
appears to produce a running the command
info line, which breaks outputs. Example:
$ ./osdctl account cli -p rhcontrol -C 1tgqiqb6asdfasdfasdfasdfasdfasdf -o json
running the command: 'ocm list clusters --parameter=search="((id like '1tgqiqb6asdfasdfasdfasdfasdfasdf' or external_id like '1tgqiqb6asdfasdfasdfasdfasdfasdf' or display_name like '1tgqiqb6asdfasdfasdfasdfasdfasdf))"'
{
"AccessKeyId":
I suspect this might be a universal issue for all output formats and all commands.
We have a script (aws-get-creds.sh
) that does this:
osdctl account cli -C $intid -p ${AWS_PROFILE} > $tmpd/creds
akid=$(awk -F'"' '$1 ~ /^ *AccessKeyId: */ {print $2}' $tmpd/creds)
sak=$(awk -F'"' '$1 ~ /^ *SecretAccessKey: */ {print $2}' $tmpd/creds)
st=$(awk -F'"' '$1 ~ /^ *SessionToken: */ {print $2}' $tmpd/creds)
cat <<EOF
export AWS_ACCESS_KEY_ID="$akid"
export AWS_SECRET_ACCESS_KEY="$sak"
export AWS_SESSION_TOKEN="$st"
export AWS_DEFAULT_REGION="$region"
EOF
I should be able to get this type of output by just using an argument in osdctl account cli
. Maybe --shell
, maybe something better.
We've started to make changes to replace non-inclusive terms in other parts of the infrastructure, including "blacklist" and "whitelist". We should make the same change to the terminology of the "master" branches, and since this is a young repo with little hard-coded references to branch names, the time is perfect to make this change here as well.
Please investigate and replace the master
branch with main
as the primary/default branch, and remove master
completely.
As part of this, please document how you complete this, and any issues that arise so we can share this with others in the team.
I'm getting a login error with osdctl version 0.5.0, GitCommit: e5b4ae
[~ {production} ]$ ocm whoami | grep username
"username": "***"
[~ {production} ]$ osdctl servicelog list 3cbf516c-d432-4ad3-9c5c-596365e3d7c3
FATA[0000] Failed to create OCM connection: Authetication error, run the 'ocm login' command first.
The error went away after I've cp ~/.config/ocm/ocm.json ~/.ocm.json
To fix this please bump ocm sdk version for osdctl
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.