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

Update dependencies and fix typos #299

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ Static ip addresses must freed before their project can be deleted.

## Billing

The usage is calculated always withing a time window. The beginning of the time window can be specified by `--from` and if required `--to` specifies the end of the time window to look at. The end defaults to `now`.
The usage is calculated always within a time window. The beginning of the time window can be specified by `--from` and if required `--to` specifies the end of the time window to look at. The end defaults to `now`.

Example calculation:

Expand Down
40 changes: 20 additions & 20 deletions cmd/cluster_audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,43 +188,43 @@ func (c *auditCmd) disable() error {
}

func (c *auditCmd) splunk() error {
auditConfigration := &models.V1Audit{}
auditConfiguration := &models.V1Audit{}

if auditConfigration.Backends == nil {
auditConfigration.Backends = &models.V1AuditBackends{}
if auditConfiguration.Backends == nil {
auditConfiguration.Backends = &models.V1AuditBackends{}
}
if auditConfigration.Backends.Splunk == nil {
auditConfigration.Backends.Splunk = &models.V1AuditBackendSplunk{}
if auditConfiguration.Backends.Splunk == nil {
auditConfiguration.Backends.Splunk = &models.V1AuditBackendSplunk{}
}

if viper.IsSet("enabled") {
auditConfigration.Backends.Splunk.Enabled = pointer.Pointer(viper.GetBool("enabled"))
auditConfiguration.Backends.Splunk.Enabled = pointer.Pointer(viper.GetBool("enabled"))
}
if viper.IsSet("host") {
auditConfigration.Backends.Splunk.Host = pointer.Pointer(viper.GetString("host"))
auditConfiguration.Backends.Splunk.Host = pointer.Pointer(viper.GetString("host"))
}
if viper.IsSet("index") {
auditConfigration.Backends.Splunk.Index = pointer.Pointer(viper.GetString("index"))
auditConfiguration.Backends.Splunk.Index = pointer.Pointer(viper.GetString("index"))
}
if viper.IsSet("port") {
auditConfigration.Backends.Splunk.Port = pointer.Pointer(viper.GetString("port"))
auditConfiguration.Backends.Splunk.Port = pointer.Pointer(viper.GetString("port"))
}
if viper.IsSet("token") {
auditConfigration.Backends.Splunk.Token = pointer.Pointer(viper.GetString("token"))
auditConfiguration.Backends.Splunk.Token = pointer.Pointer(viper.GetString("token"))
}
if viper.IsSet("ca") {
ca, err := os.ReadFile(viper.GetString("ca"))
if err != nil {
return err
}

auditConfigration.Backends.Splunk.TLS = pointer.Pointer(true)
auditConfigration.Backends.Splunk.Ca = pointer.Pointer(string(ca))
auditConfiguration.Backends.Splunk.TLS = pointer.Pointer(true)
auditConfiguration.Backends.Splunk.Ca = pointer.Pointer(string(ca))
}

_, err := c.c.cloud.Cluster.UpdateCluster(cluster.NewUpdateClusterParams().WithBody(&models.V1ClusterUpdateRequest{
ID: pointer.Pointer(viper.GetString("cluster-id")),
Audit: auditConfigration,
Audit: auditConfiguration,
}), nil)
if err != nil {
return err
Expand All @@ -234,22 +234,22 @@ func (c *auditCmd) splunk() error {
}

func (c *auditCmd) clusterForwarding() error {
auditConfigration := &models.V1Audit{}
auditConfiguration := &models.V1Audit{}

if auditConfigration.Backends == nil {
auditConfigration.Backends = &models.V1AuditBackends{}
if auditConfiguration.Backends == nil {
auditConfiguration.Backends = &models.V1AuditBackends{}
}
if auditConfigration.Backends.ClusterForwarding == nil {
auditConfigration.Backends.ClusterForwarding = &models.V1AuditBackendClusterForwarding{}
if auditConfiguration.Backends.ClusterForwarding == nil {
auditConfiguration.Backends.ClusterForwarding = &models.V1AuditBackendClusterForwarding{}
}

if viper.IsSet("enabled") {
auditConfigration.Backends.ClusterForwarding.Enabled = pointer.Pointer(viper.GetBool("enabled"))
auditConfiguration.Backends.ClusterForwarding.Enabled = pointer.Pointer(viper.GetBool("enabled"))
}

_, err := c.c.cloud.Cluster.UpdateCluster(cluster.NewUpdateClusterParams().WithBody(&models.V1ClusterUpdateRequest{
ID: pointer.Pointer(viper.GetString("cluster-id")),
Audit: auditConfigration,
Audit: auditConfiguration,
}), nil)
if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions cmd/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ func Prompt(msg, compare string) error {
return nil
}

// Truncate will trim a string in the middle and replace it with elipsis
// Truncate will trim a string in the middle and replace it with ellipsis
// FIXME write a test
func Truncate(input, elipsis string, maxlength int) string {
func Truncate(input, ellipsis string, maxlength int) string {
il := len(input)
el := len(elipsis)
el := len(ellipsis)
if il <= maxlength {
return input
}
Expand All @@ -97,7 +97,7 @@ func Truncate(input, elipsis string, maxlength int) string {
}
startlength := ((maxlength - el) / 2) - el/2

output := input[:startlength] + elipsis
output := input[:startlength] + ellipsis
missing := maxlength - len(output)
output = output + input[il-missing:]
return output
Expand Down
2 changes: 1 addition & 1 deletion cmd/output/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (p PostgresBackupsTablePrinter) Print(data []*models.V1PostgresBackupConfig
if p.order == "" {
p.order = "date"
}
// FIXME oder is no implemented
// FIXME order is no implemented
for _, b := range data {
createdBy := ""
if b.CreatedBy != nil {
Expand Down
15 changes: 7 additions & 8 deletions cmd/output/shootprinter.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ type (
)

const (
ImageExpirationDaysDefault = 14
KuberentesExpirationDaysDefault = 14
imageExpirationDaysDefault = 14
)

type shootStats struct {
Expand Down Expand Up @@ -197,13 +196,13 @@ func shootData(shoot *models.V1ClusterResponse, withIssues bool) ([]string, []st
if shoot.CreationTimestamp != nil {
age = helper.HumanizeDuration(time.Since(time.Time(*shoot.CreationTimestamp)))
}
lastReconcilation := ""
lastReconciliation := ""
if shoot.Status != nil && shoot.Status.LastOperation != nil && shoot.Status.LastOperation.LastUpdateTime != nil {
lastUpdate, err := time.Parse(time.RFC3339, *shoot.Status.LastOperation.LastUpdateTime)
if err != nil {
lastReconcilation = "unknown"
lastReconciliation = "unknown"
} else {
lastReconcilation = helper.HumanizeDuration(time.Since(lastUpdate))
lastReconciliation = helper.HumanizeDuration(time.Since(lastUpdate))
}
}

Expand Down Expand Up @@ -329,7 +328,7 @@ func shootData(shoot *models.V1ClusterResponse, withIssues bool) ([]string, []st
shootStats.apiServer, shootStats.controlPlane, shootStats.nodes, shootStats.system,
size,
age,
lastReconcilation,
lastReconciliation,
purpose,
privileged,
audit,
Expand Down Expand Up @@ -399,7 +398,7 @@ func imageExpires(m *models.ModelsV1MachineResponse) error {
return nil
}

viper.SetDefault("image-expiration-warning-days", ImageExpirationDaysDefault)
viper.SetDefault("image-expiration-warning-days", imageExpirationDaysDefault)
expirationWarningDays := viper.GetInt("image-expiration-warning-days")
expiresInHours := int(time.Until(t).Hours())

Expand All @@ -417,7 +416,7 @@ func kubernetesExpires(shoot *models.V1ClusterResponse) error {
return nil
}

viper.SetDefault("kubernetes-expiration-warning-days", ImageExpirationDaysDefault)
viper.SetDefault("kubernetes-expiration-warning-days", imageExpirationDaysDefault)
expirationWarningDays := viper.GetInt("kubernetes-expiration-warning-days")
expiresInHours := int(time.Until(time.Time(*shoot.Kubernetes.ExpirationDate)).Hours())

Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func newRootCmd(cfg *config) *cobra.Command {
rootCmd.PersistentFlags().String("apitoken", "", "api token to authenticate. Can be specified with CLOUDCTL_APITOKEN environment variable.")
rootCmd.PersistentFlags().String("kubeconfig", "", "Path to the kube-config to use for authentication and authorization. Is updated by login. Uses default path if not specified.")
rootCmd.PersistentFlags().StringP("order", "", "", "order by (comma separated) column(s)")
rootCmd.PersistentFlags().BoolP("no-headers", "", false, "ommit headers in tables")
rootCmd.PersistentFlags().BoolP("no-headers", "", false, "omit headers in tables")
rootCmd.PersistentFlags().BoolP("debug", "", false, "enable debug")
rootCmd.PersistentFlags().Bool("force-color", false, "force colored output even without tty")
rootCmd.PersistentFlags().StringP("output-format", "o", "table", "output format (table|wide|markdown|json|yaml|template), wide is a table with more columns.")
Expand Down
2 changes: 1 addition & 1 deletion cmd/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func newS3Cmd(c *config) *cobra.Command {
s3Cmd := &cobra.Command{
Use: "s3",
Short: "manage s3",
Long: "manges access to s3 storage located in different partitions",
Long: "manages access to s3 storage located in different partitions",
}
s3DescribeCmd := &cobra.Command{
Use: "describe",
Expand Down
2 changes: 1 addition & 1 deletion cmd/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func newVolumeCmd(c *config) *cobra.Command {
volumeManifestCmd := &cobra.Command{
Use: "manifest <volume>",
Short: "print a manifest for a volume",
Long: "this is only useful for volumes which are not used in any k8s cluster. With the PersistenVolumeClaim given you can reuse it in a new cluster.",
Long: "this is only useful for volumes which are not used in any k8s cluster. With the PersistentVolumeClaim given you can reuse it in a new cluster.",
RunE: func(cmd *cobra.Command, args []string) error {
return c.volumeManifest(args)
},
Expand Down
Loading
Loading