Skip to content

Commit

Permalink
Update Kubernetes v1.18.3 dependencies (#578)
Browse files Browse the repository at this point in the history
Signed-off-by: 1gtm <1gtm@appscode.com>
  • Loading branch information
1gtm committed Sep 3, 2020
1 parent 24c5e82 commit 152cef5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -21,7 +21,7 @@ require (
k8s.io/apimachinery v0.18.5
k8s.io/client-go v12.0.0+incompatible
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6
kmodules.xyz/client-go v0.0.0-20200901064306-0f1faee534af
kmodules.xyz/client-go v0.0.0-20200903033732-dab39b86c81b
kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95
kmodules.xyz/custom-resources v0.0.0-20200604135349-9e9f5c4fdba9
kmodules.xyz/monitoring-agent-api v0.0.0-20200828051750-42aa8e7852f3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -1255,8 +1255,8 @@ kmodules.xyz/client-go v0.0.0-20200524205059-e986bc44c91b/go.mod h1:sY/eoe4ktxZE
kmodules.xyz/client-go v0.0.0-20200525195850-2fd180961371/go.mod h1:sY/eoe4ktxZEoHpr5NpAQ5s22VSwTE8psJtKVeVgLRY=
kmodules.xyz/client-go v0.0.0-20200818171030-24b2ce405feb h1:0yIIoTfkhR4JAgx8UyXbP7oAveVAOcf66+D+20Uj/Uc=
kmodules.xyz/client-go v0.0.0-20200818171030-24b2ce405feb/go.mod h1:sY/eoe4ktxZEoHpr5NpAQ5s22VSwTE8psJtKVeVgLRY=
kmodules.xyz/client-go v0.0.0-20200901064306-0f1faee534af h1:Ly3rbfwRgQumrPnXVpdQsW2UqZiBpsEe40oik8AFNAY=
kmodules.xyz/client-go v0.0.0-20200901064306-0f1faee534af/go.mod h1:sY/eoe4ktxZEoHpr5NpAQ5s22VSwTE8psJtKVeVgLRY=
kmodules.xyz/client-go v0.0.0-20200903033732-dab39b86c81b h1:Erhqi9TZEqKmiIO2Lc7gX18JMH474wIJsoZ6xf//Lf0=
kmodules.xyz/client-go v0.0.0-20200903033732-dab39b86c81b/go.mod h1:sY/eoe4ktxZEoHpr5NpAQ5s22VSwTE8psJtKVeVgLRY=
kmodules.xyz/constants v0.0.0-20200506032633-a21e58ceec72/go.mod h1:DbiFk1bJ1KEO94t1SlAn7tzc+Zz95rSXgyUKa2nzPmY=
kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95 h1:v0S/+ftzL6Xrs9XevgchAOJyPKlRQXPiZf87xotj3X4=
kmodules.xyz/crd-schema-fuzz v0.0.0-20200521005638-2433a187de95/go.mod h1:jpu8xFsDKd6kAWUAKk8oTu/GQGBWqhrcaDeOJdaCJnk=
Expand Down
21 changes: 21 additions & 0 deletions vendor/kmodules.xyz/client-go/meta/incluster.go
Expand Up @@ -49,6 +49,7 @@ func Namespace() string {
}

// PossiblyInCluster returns true if loading an inside-kubernetes-cluster is possible.
// ref: https://github.com/kubernetes/kubernetes/blob/v1.18.3/staging/src/k8s.io/client-go/tools/clientcmd/client_config.go#L537
func PossiblyInCluster() bool {
fi, err := os.Stat("/var/run/secrets/kubernetes.io/serviceaccount/token")
return os.Getenv("KUBERNETES_SERVICE_HOST") != "" &&
Expand Down Expand Up @@ -93,3 +94,23 @@ func APIServerCertificate(cfg *rest.Config) (*x509.Certificate, error) {
}
return nil, fmt.Errorf("no cert found")
}

func ClusterDomain() string {
defaultDomain := func() string {
if v, ok := os.LookupEnv("KUBE_CLUSTER_DOMAIN"); ok {
return v
}
return "cluster.local"
}

if !PossiblyInCluster() {
return defaultDomain()
}

const k8sService = "kubernetes.default.svc"
domain, err := net.LookupCNAME(k8sService)
if err != nil {
return defaultDomain()
}
return strings.Trim(strings.TrimPrefix(domain, k8sService), ".")
}
2 changes: 1 addition & 1 deletion vendor/modules.txt
Expand Up @@ -851,7 +851,7 @@ k8s.io/utils/net
k8s.io/utils/path
k8s.io/utils/pointer
k8s.io/utils/trace
# kmodules.xyz/client-go v0.0.0-20200901064306-0f1faee534af
# kmodules.xyz/client-go v0.0.0-20200903033732-dab39b86c81b
kmodules.xyz/client-go
kmodules.xyz/client-go/api/v1
kmodules.xyz/client-go/apiextensions
Expand Down

0 comments on commit 152cef5

Please sign in to comment.