Skip to content

Instantly share code, notes, and snippets.

View Jeffwan's full-sized avatar

Jiaxin Shan Jeffwan

  • Bytedance
  • Seattle, WA
View GitHub Profile
```
WARN[0007] Encountered error applying application application: (kubeflow.error): Code 500 with message: Apply.Run : unable to recognize "/tmp/kout799748204": no matches for kind "Application" in version "app.k8s.io/v1beta1" filename="kustomize/kustomize.go:266"
WARN[0007] Will retry in 3 seconds. filename="kustomize/kustomize.go:267"
```
@Jeffwan
Jeffwan / Dockerfile
Created May 20, 2020 17:11
Dockerfile
ARG BASE_IMAGE=763104351884.dkr.ecr.us-west-2.amazonaws.com/tensorflow-training:1.15.2-cpu-py36-ubuntu18.04
FROM $BASE_IMAGE
ARG NB_USER=jovyan
ARG KUBEFLOW_FAIRING_SDK_VERSION=0.7.1
ARG KUBEFLOW_METADATA_SDK_VERSION=0.3.1
ARG KUBEFLOW_KFP_SDK_VERSION=0.5.0
ARG KUBEFLOW_KFSERVING_SDK_VERSION=0.3.0.1
@Jeffwan
Jeffwan / dependency.sh
Created May 12, 2020 22:58
kubernetes dependency resolver shell scripts
#!/bin/sh
set -euo pipefail
VERSION=${1#"v"}
if [ -z "$VERSION" ]; then
echo "Must specify version!"
exit 1
fi
MODS=($(
curl -sS https://raw.githubusercontent.com/kubernetes/kubernetes/v${VERSION}/go.mod |
@Jeffwan
Jeffwan / override.go
Last active February 20, 2022 17:48
Abstract class and interface in golang
package mxnet
import "fmt"
type ControllerInterface interface {
// Returns the Controller name
Method1() string
// Returns the GroupVersionKind of the API
Method2() string
package mxnet
import "fmt"
type ControllerInterface interface {
// Returns the Controller name
Method1() string
// Returns the GroupVersionKind of the API
Method2() string
@Jeffwan
Jeffwan / elastic_job.yaml
Last active March 31, 2020 05:10
elastic_job.yaml
apiVersion: elastic.pytorch.org/v1alpha1
kind: ElasticJob
metadata:
name: imagenet
namespace: elastic-job
spec:
# Use "etcd-service:2379" if you already apply etcd.yaml
rdzvEndpoint: "etcd-service:2379"
minReplicas: 1
maxReplicas: 5
@Jeffwan
Jeffwan / test.go
Last active March 13, 2020 08:12
buildNodeTemplateTest
// AddCustomResourcesToNode adds Custom Resource to given node. Given resource will override existing resource of node.
func AddCustomResourcesToNode(node *apiv1.Node, resourceList apiv1.ResourceList) {
for resourceName, value := range resourceList {
node.Status.Capacity[apiv1.ResourceName(resourceName)] = value
node.Status.Allocatable[apiv1.ResourceName(resourceName)] = value
}
}
// AddLabelsToNode adds Labels to given node. Given labels will override existing label of node.
@Jeffwan
Jeffwan / kaniko.yaml
Created February 19, 2020 06:48
kaniko.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: docker-config
data:
config.json: |-
{
"credHelpers": {
"xxxxx.dkr.ecr.us-west-2.amazonaws.com": "ecr-login"
}
INFO[0006] Processing application: application-crds filename="kustomize/kustomize.go:408"
INFO[0006] Processing application: application filename="kustomize/kustomize.go:408"
INFO[0006] Processing application: istio-crds filename="kustomize/kustomize.go:408"
INFO[0006] Processing application: istio-install filename="kustomize/kustomize.go:408"
INFO[0006] Processing application: istio filename="kustomize/kustomize.go:408"
INFO[0006] Processing application: cert-manager-crds filename="kustomize/kustomize.go:408"
INFO[0006] Processing application: cert-manager-kube-system-resources filename="kustomize/kustomize.go:408"
INFO[0006] Processing application: cert-manager filename="kustomize/kustomize.go:408"
INFO[0006] Processing application: oidc-authservice filename="kustomize/kustomize.go:408"
INFO[0006] Processing application: dex filename="kustomize/kustomize.go:408"
assumeRolePolicyDocument := []byte(
`{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "$(roleArn)"
},
"Action": "sts:AssumeRoleWithWebIdentity",